[no commit message]

This commit is contained in:
darksnake 2015-12-24 12:20:42 +03:00
parent 829d48b625
commit c8ad2a51bc
3 changed files with 20 additions and 8 deletions

View File

@ -37,6 +37,7 @@ import java.time.Instant;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -169,7 +170,7 @@ public class NumassDataLoader extends AbstractLoader implements BinaryLoader<Env
throw new RuntimeException(ex); throw new RuntimeException(ex);
} }
} }
// LocalDateTime startTime = envelope.meta().get // LocalDateTime startTime = envelope.meta().get
RawNMPoint raw = new RawNMPoint(envelope.meta().getDouble("external_meta.HV1_value", 0), RawNMPoint raw = new RawNMPoint(envelope.meta().getDouble("external_meta.HV1_value", 0),
events, events,
@ -240,7 +241,7 @@ public class NumassDataLoader extends AbstractLoader implements BinaryLoader<Env
@Override @Override
public List<NMPoint> getNMPoints() { public List<NMPoint> getNMPoints() {
List<NMPoint> res = new ArrayList<>(); List<NMPoint> res = new ArrayList<>();
this.getPoints().stream().forEach((point) -> { this.getPoints().stream().forEachOrdered((point) -> {
res.add(readPoint(point)); res.add(readPoint(point));
}); });
// res.sort((NMPoint o1, NMPoint o2) -> o1.getAbsouteTime().compareTo(o2.getAbsouteTime())); // res.sort((NMPoint o1, NMPoint o2) -> o1.getAbsouteTime().compareTo(o2.getAbsouteTime()));
@ -256,6 +257,10 @@ public class NumassDataLoader extends AbstractLoader implements BinaryLoader<Env
} }
} }
}); });
res.sort((Envelope t, Envelope t1) -> t.meta().getInt("external_meta.point_index", -1)
.compareTo(t1.meta().getInt("external_meta.point_index", -1)));
return res; return res;
} }

View File

@ -213,7 +213,7 @@ public class MspViewController implements Initializable {
p.putValue("timestamp", last.getValue("timestamp").timeValue().plusMillis(10)); p.putValue("timestamp", last.getValue("timestamp").timeValue().plusMillis(10));
for (String name : last.namesAsArray()) { for (String name : last.namesAsArray()) {
if (!name.equals("timestamp")) { if (!name.equals("timestamp")) {
p.putValue(name, Value.getNull()); p.putValue(name, Value.NULL);
} }
} }
return p; return p;

View File

@ -147,14 +147,14 @@ public class NumassLoaderViewComponent extends AnchorPane implements Initializab
detectorDataExportButton.setOnAction(this::onExportButtonClick); detectorDataExportButton.setOnAction(this::onExportButtonClick);
lowChannelField.textProperty().bindBidirectional(channelSlider.lowValueProperty(), new NumberStringConverter()); lowChannelField.textProperty().bindBidirectional(channelSlider.lowValueProperty(), new NumberStringConverter());
upChannelField.textProperty().bindBidirectional(channelSlider.highValueProperty(), new NumberStringConverter()); upChannelField.textProperty().bindBidirectional(channelSlider.highValueProperty(), new NumberStringConverter());
channelSlider.setLowValue(300); channelSlider.setLowValue(300);
channelSlider.setHighValue(1900); channelSlider.setHighValue(1900);
ChangeListener<? super Number> rangeChangeListener = (ObservableValue<? extends Number> observable, Number oldValue, Number newValue) -> { ChangeListener<? super Number> rangeChangeListener = (ObservableValue<? extends Number> observable, Number oldValue, Number newValue) -> {
updateSpectrumPane(); updateSpectrumPane();
}; };
channelSlider.lowValueProperty().addListener(rangeChangeListener); channelSlider.lowValueProperty().addListener(rangeChangeListener);
channelSlider.highValueProperty().addListener(rangeChangeListener); channelSlider.highValueProperty().addListener(rangeChangeListener);
} }
@ -209,11 +209,18 @@ public class NumassLoaderViewComponent extends AnchorPane implements Initializab
private void updateSpectrumPane() { private void updateSpectrumPane() {
if (spectrumPlotFrame == null) { if (spectrumPlotFrame == null) {
spectrumPlotFrame = new JFreeChartFrame("spectrum", null, spectrumPlotPane); Meta plotMeta = new MetaBuilder("plot")
.setValue("xAxis.axisTitle", "U")
.setValue("xAxis.axisUnits", "V")
.setValue("yAxis.axisTitle", "count rate")
.setValue("yAxis.axisUnits", "Hz")
.setValue("legend.show", false);
spectrumPlotFrame = new JFreeChartFrame("spectrum", plotMeta, spectrumPlotPane);
} }
if (spectrumData == null) { if (spectrumData == null) {
spectrumData = new ChangeablePlottableData("", null); spectrumData = new ChangeablePlottableData("spectrum", null);
spectrumPlotFrame.add(spectrumData); spectrumPlotFrame.add(spectrumData);
} }