Fixes for numass-viewer
This commit is contained in:
parent
e62716a80f
commit
1177bdfa6c
@ -12,14 +12,16 @@ import hep.dataforge.storage.api.StateLoader;
|
||||
import hep.dataforge.storage.api.Storage;
|
||||
import hep.dataforge.storage.commons.JSONMetaWriter;
|
||||
import hep.dataforge.storage.servlet.Utils;
|
||||
import static inr.numass.server.HandlerUtils.renderStates;
|
||||
import java.io.StringWriter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import ratpack.handling.Context;
|
||||
import ratpack.handling.Handler;
|
||||
|
||||
import java.io.StringWriter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static inr.numass.server.HandlerUtils.renderStates;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexander Nozik
|
||||
@ -98,7 +100,7 @@ public class NumassRootHandler implements Handler {
|
||||
}
|
||||
|
||||
private void renderLoader(Context ctx, StringBuilder b, Loader loader) {
|
||||
String href = "/storage?path=" + loader.getFullPath();
|
||||
String href = "/storage?path=" + loader.getPath();
|
||||
b.append(String.format("<p><a href=\"%s\">%s</a> (%s)</p>", href, loader.getName(), loader.getType()));
|
||||
}
|
||||
}
|
||||
|
@ -311,7 +311,7 @@ public class NumassDataLoader extends AbstractLoader implements ObjectLoader<Env
|
||||
|
||||
public boolean isReversed() {
|
||||
//TODO replace by meta tag in later revisions
|
||||
return SetDirectionUtility.isReversed(getFullPath(), n -> {
|
||||
return SetDirectionUtility.isReversed(getPath(), n -> {
|
||||
List<Envelope> points = getPoints();
|
||||
if (getPoints().size() >= 2) {
|
||||
return readTime(points.get(0).meta()).isAfter(readTime(points.get(1).meta()));
|
||||
|
@ -20,8 +20,10 @@ import hep.dataforge.events.EventBuilder;
|
||||
import hep.dataforge.exceptions.StorageException;
|
||||
import hep.dataforge.meta.Meta;
|
||||
import hep.dataforge.meta.MetaBuilder;
|
||||
import hep.dataforge.storage.filestorage.FilePointLoader;
|
||||
import hep.dataforge.storage.filestorage.FileStorage;
|
||||
import hep.dataforge.storage.filestorage.VFSUtils;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.vfs2.FileObject;
|
||||
import org.apache.commons.vfs2.FileSystemException;
|
||||
import org.apache.commons.vfs2.FileType;
|
||||
@ -146,6 +148,13 @@ public class NumassStorage extends FileStorage {
|
||||
}
|
||||
} else if (file.getName().toString().endsWith(NUMASS_ZIP_EXTENSION)) {
|
||||
this.loaders.put(file.getName().getBaseName(), NumassDataLoader.fromZip(this, file));
|
||||
} else if (file.getName().toString().endsWith(".points")) {
|
||||
try {
|
||||
loaders.put(FilenameUtils.getBaseName(file.getName().getBaseName()),
|
||||
FilePointLoader.fromFile(this, file, true));
|
||||
} catch (Exception ex) {
|
||||
getContext().getLogger().error("Failed to build numass point loader from file {}", file.getName());
|
||||
}
|
||||
} else {
|
||||
//updating non-numass loader files
|
||||
updateFile(file);
|
||||
|
@ -5,7 +5,7 @@ if (!hasProperty('mainClass')) {
|
||||
}
|
||||
mainClassName = mainClass
|
||||
|
||||
version = "0.3.4"
|
||||
version = "0.3.5"
|
||||
|
||||
description = "The viewer for numass data"
|
||||
|
||||
|
@ -23,7 +23,7 @@ package inr.numass.viewer;
|
||||
|
||||
import hep.dataforge.computation.ProgressCallback;
|
||||
import hep.dataforge.context.Context;
|
||||
import hep.dataforge.exceptions.StorageException;
|
||||
import hep.dataforge.names.Name;
|
||||
import hep.dataforge.plots.PlotUtils;
|
||||
import hep.dataforge.plots.data.DynamicPlottable;
|
||||
import hep.dataforge.plots.data.DynamicPlottableSet;
|
||||
@ -31,6 +31,7 @@ import hep.dataforge.plots.fx.PlotContainer;
|
||||
import hep.dataforge.plots.jfreechart.JFreeChartFrame;
|
||||
import hep.dataforge.storage.api.PointLoader;
|
||||
import hep.dataforge.storage.api.Storage;
|
||||
import hep.dataforge.storage.commons.StorageUtils;
|
||||
import hep.dataforge.tables.DataPoint;
|
||||
import hep.dataforge.tables.MapPoint;
|
||||
import hep.dataforge.values.Value;
|
||||
@ -88,17 +89,23 @@ public class MspViewController {
|
||||
public void fillMspData(Storage rootStorage) {
|
||||
if (rootStorage != null) {
|
||||
context.taskManager().submit("viewer.msp.fill", (ProgressCallback callback) -> {
|
||||
try {
|
||||
// callback.updateTitle("Fill msp data (" + rootStorage.getName() + ")");
|
||||
// callback.updateTitle("Fill msp data (" + rootStorage.getName() + ")");
|
||||
|
||||
callback.updateTitle("Load msp data (" + rootStorage.getName() + ")");
|
||||
|
||||
List<DataPoint> mspData = new ArrayList<>();
|
||||
DataPoint last = null;
|
||||
for (String loaderName : rootStorage.loaders().keySet()) {
|
||||
if (loaderName.startsWith("msp")) {
|
||||
try (final PointLoader mspLoader = (PointLoader) rootStorage.getLoader(loaderName)) {
|
||||
|
||||
StorageUtils.loaderStream(rootStorage)
|
||||
.filter(pair -> pair.getValue() instanceof PointLoader)
|
||||
.filter(pair -> Name.of(pair.getKey()).getLast().toString().startsWith("msp"))
|
||||
.map(pair -> pair.getValue())
|
||||
.filter(loader -> PointLoader.POINT_LOADER_TYPE.equals(loader.getType()))
|
||||
.forEach(loader -> {
|
||||
try {
|
||||
PointLoader mspLoader = (PointLoader) loader;
|
||||
mspLoader.open();
|
||||
callback.updateMessage("Loading mass spectrometer data from " + mspLoader.getName());
|
||||
DataPoint last = null;
|
||||
for (DataPoint dp : mspLoader) {
|
||||
mspData.add(dp);
|
||||
last = dp;
|
||||
@ -109,8 +116,7 @@ public class MspViewController {
|
||||
} catch (Exception ex) {
|
||||
LoggerFactory.getLogger(getClass()).error("Can't read msp loader data", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
callback.updateMessage("Loading msp data finished");
|
||||
// return mspData;
|
||||
// List<DataPoint> mspData = (List<DataPoint>) loadProcess.getTask().get();
|
||||
@ -131,9 +137,6 @@ public class MspViewController {
|
||||
|
||||
updateMspPane(plottables);
|
||||
}
|
||||
} catch (StorageException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -16,29 +16,13 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<?import java.lang.*?>
|
||||
<?import javafx.geometry.*?>
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.text.*?>
|
||||
<?import org.controlsfx.control.*?>
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.SplitPane?>
|
||||
<?import javafx.scene.control.Tab?>
|
||||
<?import javafx.scene.control.TabPane?>
|
||||
<?import javafx.scene.control.ToggleButton?>
|
||||
<?import javafx.scene.control.ToolBar?>
|
||||
<?import javafx.scene.control.TreeTableView?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.BorderPane?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.Pane?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
<?import org.controlsfx.control.StatusBar?>
|
||||
|
||||
<AnchorPane id="AnchorPane" prefHeight="768.0" prefWidth="1024.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="inr.numass.viewer.MainViewerController">
|
||||
<AnchorPane xmlns:fx="http://javafx.com/fxml/1" id="AnchorPane" prefHeight="768.0" prefWidth="1024.0"
|
||||
xmlns="http://javafx.com/javafx/8.0.60" fx:controller="inr.numass.viewer.MainViewerController">
|
||||
<children>
|
||||
<BorderPane prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<top>
|
||||
|
Loading…
Reference in New Issue
Block a user