New numass data structures

This commit is contained in:
Alexander Nozik 2017-07-07 21:04:15 +03:00
parent c63514999c
commit d6cfdc25c1
53 changed files with 334 additions and 267 deletions

View File

@ -1,67 +0,0 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package inr.numass.data;
import hep.dataforge.data.Data;
import hep.dataforge.meta.Meta;
import hep.dataforge.meta.Metoid;
import hep.dataforge.names.Named;
import hep.dataforge.tables.Table;
import org.jetbrains.annotations.NotNull;
import java.time.Instant;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @author <a href="mailto:altavir@gmail.com">Alexander Nozik</a>
*/
public interface NumassData extends Named, Metoid, Iterable<NumassPoint> {
String getDescription();
@Override
Meta meta();
Stream<NumassPoint> stream();
@NotNull
@Override
default Iterator<NumassPoint> iterator() {
return stream().iterator();
}
default List<NumassPoint> getNMPoints() {
return stream().collect(Collectors.toList());
}
boolean isEmpty();
Instant startTime();
default Data<Table> getHVData() {
return Data.buildStatic(null);
}
/**
* Find first point with given Uset
*
* @param U
* @return
*/
default NumassPoint getByVoltage(double U) {
for (NumassPoint point : this) {
if (point.getVoltage() == U) {
return point;
}
}
return null;
}
}

View File

@ -1,68 +0,0 @@
package inr.numass.data;
import hep.dataforge.tables.ValueMap;
import hep.dataforge.values.Values;
import java.time.Instant;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* A general representation of single voltage measurement.
* Created by darksnake on 13-Apr-17.
*/
public interface NumassPoint {
String[] dataNames = {"chanel", "count"};
Instant getStartTime();
int getCount(int chanel);
int getCountInWindow(int from, int to);
List<Values> getData();
long getTotalCount();
default Map<Double, Double> getMap(int binning, boolean normalize) {
Map<Double, Double> res = new LinkedHashMap<>();
double norm;
if (normalize) {
norm = getLength();
} else {
norm = 1d;
}
int i = 0;
while (i < getMaxChannel() - binning) {
int start = i;
double sum = 0;
while (i < start + binning) {
sum += getCount(i);
i++;
}
res.put(start + Math.floor(binning / 2d), sum / norm);
}
return res;
}
default List<Values> getData(int binning, boolean normalize) {
return getMap(binning, normalize).entrySet().stream()
.map(entry -> new ValueMap(dataNames, entry.getKey(), entry.getValue()))
.collect(Collectors.toList());
}
double getLength();
double getVoltage();
int[] getSpectrum();
default int getMaxChannel(){
return getSpectrum().length - 1;
}
}

View File

@ -17,6 +17,7 @@ package inr.numass.data;
import hep.dataforge.tables.ValueMap;
import hep.dataforge.values.Values;
import inr.numass.data.legacy.RawNMPoint;
import java.time.Instant;
import java.util.ArrayList;

View File

@ -1,5 +1,6 @@
package inr.numass.data;
import inr.numass.data.legacy.RawNMPoint;
import org.jetbrains.annotations.NotNull;
import java.io.IOException;

View File

@ -0,0 +1,64 @@
package inr.numass.data.analyzers;
import hep.dataforge.meta.Meta;
import hep.dataforge.tables.ValueMap;
import hep.dataforge.values.Values;
import inr.numass.data.api.NumassAnalyzer;
import inr.numass.data.api.NumassBlock;
import inr.numass.data.api.NumassEvent;
import inr.numass.data.api.SignalProcessor;
import org.jetbrains.annotations.Nullable;
import java.util.stream.Stream;
/**
* A simple event counter
* Created by darksnake on 07.07.2017.
*/
public class SimpleAnalyzer implements NumassAnalyzer {
public static String[] NAME_LIST = {"length", "count", COUNT_RATE_KEY, COUNT_RATE_ERROR_KEY, "window", "timestamp"};
@Nullable
private final SignalProcessor processor;
public SimpleAnalyzer(@Nullable SignalProcessor processor) {
this.processor = processor;
}
/**
* Return unsorted stream of events including events from frames
*
* @param block
* @return
*/
private Stream<NumassEvent> getEventStream(NumassBlock block) {
if (processor == null && block.getFrames().count() > 0) {
throw new IllegalArgumentException("Signal processor needed to analyze frames");
} else {
return Stream.concat(block.getEvents(), block.getFrames().flatMap(processor::analyze));
}
}
@Override
public Values analyze(NumassBlock block, Meta config) {
int loChannel = config.getInt("energy.lo", 0);
int upChannel = config.getInt("energy.up", Integer.MAX_VALUE);
long count = getEventStream(block)
.filter(it -> it.getChanel() >= loChannel && it.getChanel() <= upChannel)
.count();
double countRate = (double) count / block.getLength().toMillis() * 1000;
double countRateError = Math.sqrt((double) count) / block.getLength().toMillis() * 1000;
return new ValueMap(NAME_LIST,
new Object[]{
block.getLength().toNanos(),
count,
countRate,
countRateError,
new int[]{loChannel, upChannel},
block.getStartTime()
}
);
}
}

View File

@ -0,0 +1,24 @@
package inr.numass.data.api;
import hep.dataforge.meta.Meta;
import hep.dataforge.values.Values;
/**
* A general raw data analysis utility. Could have different implementations
* Created by darksnake on 06-Jul-17.
*/
public interface NumassAnalyzer {
String COUNT_RATE_KEY = "cr";
String COUNT_RATE_ERROR_KEY = "crErr";
/**
* Perform analysis on block. The values for count rate, its error and point length in nanos must
* exist, but occasionally additional values could also be presented.
*
* @param block
* @return
*/
Values analyze(NumassBlock block, Meta config);
}

View File

@ -1,4 +1,4 @@
package inr.numass.data.events;
package inr.numass.data.api;
import java.time.Duration;
import java.time.Instant;

View File

@ -13,13 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package inr.numass.data.events;
package inr.numass.data.api;
import org.jetbrains.annotations.NotNull;
/**
* A single numass event with given amplitude ant time.
*
* @author Darksnake
*/
public class NumassEvent {
public class NumassEvent implements Comparable<NumassEvent> {
protected final short chanel;
protected final double time;
@ -38,7 +41,12 @@ public class NumassEvent {
/**
* @return the time
*/
public double getTime(){
public double getTime() {
return time;
}
@Override
public int compareTo(@NotNull NumassEvent o) {
return Double.compare(this.getTime(), o.getTime());
}
}

View File

@ -1,4 +1,4 @@
package inr.numass.data.events;
package inr.numass.data.api;
import java.nio.ShortBuffer;
import java.time.Duration;

View File

@ -0,0 +1,82 @@
package inr.numass.data.api;
import hep.dataforge.meta.Metoid;
import hep.dataforge.values.Value;
import java.time.Duration;
import java.time.Instant;
import java.util.stream.Stream;
/**
* Created by darksnake on 06-Jul-17.
*/
public interface NumassPoint extends Metoid, NumassBlock {
String START_TIME_KEY = "start";
String LENGTH_KEY = "length";
String HV_KEY = "voltage";
Stream<NumassBlock> getBlocks();
/**
* Get the voltage setting for the point
* @return
*/
default double getVoltage() {
return meta().getDouble(HV_KEY, 0);
}
/**
* Get the first block if it exists. Throw runtime exception otherwise.
* @return
*/
default NumassBlock getFirstBlock() {
return getBlocks().findFirst().orElseThrow(() -> new RuntimeException("The point is empty"));
}
/**
* Get the starting time from meta or from first block
* @return
*/
@Override
default Instant getStartTime() {
return meta().optValue(START_TIME_KEY).map(Value::timeValue).orElseGet(() -> getFirstBlock().getStartTime());
}
/**
* Get the length key of meta or calculate length as a sum of block lengths. The latter could be a bit slow
*
* @return
*/
@Override
default Duration getLength() {
return Duration.ofNanos(
meta().optValue(LENGTH_KEY).map(Value::longValue)
.orElseGet(() -> getBlocks().mapToLong(it -> it.getLength().toNanos()).sum())
);
}
/**
* Get all events it all blocks as a single sequence
* <p>
* Some performance analysis of different stream concatenation approaches is given here: https://www.techempower.com/blog/2016/10/19/efficient-multiple-stream-concatenation-in-java/
* </p>
*
* @return
*/
@Override
default Stream<NumassEvent> getEvents() {
return getBlocks().flatMap(NumassBlock::getEvents);
}
/**
* Get all frames in all blocks as a single sequence
*
* @return
*/
@Override
default Stream<NumassFrame> getFrames() {
return getBlocks().flatMap(NumassBlock::getFrames);
}
}

View File

@ -0,0 +1,90 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package inr.numass.data.api;
import hep.dataforge.data.Data;
import hep.dataforge.meta.Metoid;
import hep.dataforge.names.Named;
import hep.dataforge.providers.Provider;
import hep.dataforge.providers.Provides;
import hep.dataforge.providers.ProvidesNames;
import hep.dataforge.tables.Table;
import hep.dataforge.values.Value;
import org.jetbrains.annotations.NotNull;
import java.time.Instant;
import java.util.Iterator;
import java.util.Optional;
import java.util.stream.Stream;
/**
* A single set of numass points previously called file.
*
* @author <a href="mailto:altavir@gmail.com">Alexander Nozik</a>
*/
public interface NumassSet extends Named, Metoid, Iterable<NumassPoint>, Provider {
String DESCRIPTION_KEY = "info";
String NUMASS_POINT_PROVIDER_KEY = "point";
Stream<NumassPoint> getPoints();
default String getDescription() {
return meta().getString(DESCRIPTION_KEY, "");
}
@NotNull
@Override
default Iterator<NumassPoint> iterator() {
return getPoints().iterator();
}
/**
* Get the first point if it exists. Throw runtime exception otherwise.
*
* @return
*/
default NumassPoint getFirstPoint() {
return getPoints().findFirst().orElseThrow(() -> new RuntimeException("The set is empty"));
}
/**
* Get the starting time from meta or from first point
*
* @return
*/
default Instant getStartTime() {
return meta().optValue(NumassPoint.START_TIME_KEY).map(Value::timeValue).orElseGet(() -> getFirstPoint().getStartTime());
}
/**
* Find first point with given voltage
*
* @param voltage
* @return
*/
default Optional<NumassPoint> optPoint(double voltage) {
return getPoints().filter(it -> it.getVoltage() == voltage).findFirst();
}
@Provides(NUMASS_POINT_PROVIDER_KEY)
default Optional<NumassPoint> optPoint(String voltage) {
return optPoint(Double.parseDouble(voltage));
}
@Override
default String defaultTarget() {
return NUMASS_POINT_PROVIDER_KEY;
}
@ProvidesNames(NUMASS_POINT_PROVIDER_KEY)
default Stream<String> listPoints() {
return getPoints().map(it -> Double.toString(it.getVoltage()));
}
default Data<Table> getHvData() {
return Data.buildStatic(null);
}
}

View File

@ -0,0 +1,11 @@
package inr.numass.data.api;
import java.util.stream.Stream;
/**
* An ancestor to numass frame analyzers
* Created by darksnake on 07.07.2017.
*/
public interface SignalProcessor {
Stream<NumassEvent> analyze(NumassFrame frame);
}

View File

@ -1,30 +0,0 @@
package inr.numass.data.events;
import hep.dataforge.meta.Meta;
import hep.dataforge.tables.Table;
/**
* A general raw data analysis utility. Could have different implementations
* Created by darksnake on 06-Jul-17.
*/
public interface NumassAnalyzer {
/**
* Caclulate the number of events in given window
*
* @param block
* @param from
* @param to
* @return
*/
int getCountInWindow(NumassBlock block, int from, int to);
default int getMaxChannel() {
return 4096;
}
default int getCountTotal(NumassBlock block) {
return getCountInWindow(block, 0, getMaxChannel());
}
public Table getSpectrum(Meta config);
}

View File

@ -1,15 +0,0 @@
package inr.numass.data.events;
import hep.dataforge.meta.Metoid;
import java.util.stream.Stream;
/**
* Created by darksnake on 06-Jul-17.
*/
public interface NumassPoint extends Metoid {
Stream<NumassBlock> getBlocks();
}

View File

@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package inr.numass.data;
package inr.numass.data.legacy;
import hep.dataforge.data.FileDataFactory;
import hep.dataforge.data.binary.Binary;
import hep.dataforge.meta.Meta;
import inr.numass.data.events.NumassEvent;
import inr.numass.data.api.NumassEvent;
import java.io.*;
import java.time.LocalDateTime;

View File

@ -13,16 +13,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package inr.numass.data;
package inr.numass.data.legacy;
import hep.dataforge.description.ValueDef;
import hep.dataforge.meta.Meta;
import hep.dataforge.names.NamedMetaHolder;
import inr.numass.data.PointBuilders;
import inr.numass.data.api.NumassPoint;
import inr.numass.data.api.NumassSet;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;
@ -34,7 +36,7 @@ import java.util.stream.Stream;
*/
@ValueDef(name = "numass.path", info = "Path to this data file in numass repository.")
@ValueDef(name = "numass.name", info = "The name of this data file.")
public class NMFile extends NamedMetaHolder implements NumassData {
public class NMFile extends NamedMetaHolder implements NumassSet {
private final List<NumassPoint> points;
@ -55,23 +57,12 @@ public class NMFile extends NamedMetaHolder implements NumassData {
}
@Override
public String getDescription() {
return "";
}
@Override
public Stream<NumassPoint> stream() {
public Stream<NumassPoint> getPoints() {
return points.stream();
}
@Override
public boolean isEmpty() {
return false;
public String getDescription() {
return "";
}
@Override
public Instant startTime() {
return null;
}
}

View File

@ -13,13 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package inr.numass.data;
package inr.numass.data.legacy;
import hep.dataforge.description.ValueDef;
import hep.dataforge.meta.Meta;
import hep.dataforge.meta.MetaBuilder;
import hep.dataforge.names.NamedMetaHolder;
import inr.numass.data.events.NumassEvent;
import inr.numass.data.api.NumassEvent;
import java.io.BufferedOutputStream;
import java.io.OutputStream;

View File

@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package inr.numass.data;
package inr.numass.data.legacy;
import inr.numass.data.events.NumassEvent;
import inr.numass.data.api.NumassEvent;
import java.time.Instant;
import java.util.ArrayList;

View File

@ -6,7 +6,6 @@ import hep.dataforge.data.DataFilter;
import hep.dataforge.data.DataTree;
import hep.dataforge.meta.Meta;
import hep.dataforge.storage.commons.StorageUtils;
import inr.numass.data.NumassData;
/**
* Created by darksnake on 03-Feb-17.

View File

@ -30,11 +30,9 @@ import hep.dataforge.storage.filestorage.FileEnvelope;
import hep.dataforge.storage.filestorage.FileStorage;
import hep.dataforge.storage.loaders.AbstractLoader;
import hep.dataforge.tables.Table;
import inr.numass.data.NumassData;
import inr.numass.data.NumassPoint;
import inr.numass.data.PointBuilders;
import inr.numass.data.RawNMPoint;
import inr.numass.data.events.NumassEvent;
import inr.numass.data.api.NumassEvent;
import inr.numass.data.legacy.RawNMPoint;
import org.slf4j.LoggerFactory;
import java.io.IOException;

View File

@ -21,8 +21,7 @@ import hep.dataforge.events.EventBuilder;
import hep.dataforge.exceptions.StorageException;
import hep.dataforge.meta.Meta;
import hep.dataforge.storage.filestorage.FileStorage;
import inr.numass.data.NMFile;
import inr.numass.data.NumassData;
import inr.numass.data.legacy.NMFile;
import org.slf4j.LoggerFactory;
import java.io.IOException;

View File

@ -3,7 +3,8 @@ package inr.numass.data
import groovy.transform.CompileStatic
import hep.dataforge.maths.histogram.Histogram
import hep.dataforge.maths.histogram.UnivariateHistogram
import inr.numass.data.events.NumassEvent
import inr.numass.data.api.NumassEvent
import inr.numass.data.legacy.RawNMPoint
import java.util.stream.DoubleStream

View File

@ -10,7 +10,6 @@ import hep.dataforge.io.ColumnedDataWriter
import hep.dataforge.tables.ListTable
import hep.dataforge.tables.TableFormatBuilder
import hep.dataforge.tables.ValueMap
import inr.numass.data.NumassData
NumassData.metaClass.findPoint{double u ->
delegate.getNMPoints().getWork { it.getVoltage() == u }.getMap(20, true)

View File

@ -9,7 +9,6 @@ package inr.numass.scripts
import hep.dataforge.grind.GrindMetaBuilder
import hep.dataforge.meta.Meta
import inr.numass.actions.FindBorderAction
import inr.numass.data.NumassData
import inr.numass.storage.NumassDataLoader
File dataDir = new File("D:\\Work\\Numass\\data\\2016_04\\T2_data\\Fill_2_2\\set_6_e26d123e54010000")

View File

@ -8,9 +8,8 @@ package inr.numass.scripts
import hep.dataforge.grind.Grind
import hep.dataforge.values.Values
import inr.numass.data.NumassPoint
import inr.numass.data.NumassPointImpl
import inr.numass.data.RawNMPoint
import inr.numass.data.legacy.RawNMPoint
import inr.numass.storage.NumassDataLoader
import inr.numass.utils.NMEventGeneratorWithPulser
import inr.numass.utils.PileUpSimulator

View File

@ -9,7 +9,6 @@ package inr.numass.scripts
import hep.dataforge.io.ColumnedDataWriter
import hep.dataforge.storage.commons.StorageUtils
import hep.dataforge.tables.Table
import inr.numass.data.NumassData
import inr.numass.data.NumassDataUtils
import inr.numass.data.NumassPointImpl
import inr.numass.storage.NumassStorage

View File

@ -7,7 +7,7 @@ import hep.dataforge.grind.helpers.PlotHelper
import hep.dataforge.plots.fx.FXPlotManager
import inr.numass.NumassPlugin
import inr.numass.data.PointAnalyzer
import inr.numass.data.RawNMPoint
import inr.numass.data.legacy.RawNMPoint
import inr.numass.storage.NumassDataLoader
import inr.numass.storage.NumassStorage
import inr.numass.storage.NumassStorageFactory

View File

@ -8,7 +8,7 @@ import hep.dataforge.plots.fx.FXPlotManager
import hep.dataforge.tables.ValueMap
import inr.numass.NumassPlugin
import inr.numass.data.PointAnalyzer
import inr.numass.data.RawNMPoint
import inr.numass.data.legacy.RawNMPoint
import inr.numass.storage.NumassStorage
import inr.numass.storage.NumassStorageFactory

View File

@ -20,8 +20,8 @@ import hep.dataforge.data.binary.Binary;
import hep.dataforge.io.BasicIOManager;
import hep.dataforge.meta.Meta;
import hep.dataforge.names.Name;
import inr.numass.data.LegacyDataReader;
import inr.numass.data.RawNMFile;
import inr.numass.data.legacy.LegacyDataReader;
import inr.numass.data.legacy.RawNMFile;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.output.TeeOutputStream;

View File

@ -21,8 +21,8 @@ import hep.dataforge.description.TypedActionDef;
import hep.dataforge.description.ValueDef;
import hep.dataforge.exceptions.ContentException;
import hep.dataforge.meta.Laminate;
import inr.numass.data.RawNMFile;
import inr.numass.data.RawNMPoint;
import inr.numass.data.legacy.RawNMFile;
import inr.numass.data.legacy.RawNMPoint;
import inr.numass.debunch.DebunchReport;
import inr.numass.debunch.FrameAnalizer;

View File

@ -25,9 +25,7 @@ import hep.dataforge.tables.ListTable;
import hep.dataforge.tables.Table;
import hep.dataforge.tables.ValueMap;
import hep.dataforge.values.Value;
import inr.numass.data.NMFile;
import inr.numass.data.NumassData;
import inr.numass.data.NumassPoint;
import inr.numass.data.legacy.NMFile;
import org.apache.commons.math3.analysis.UnivariateFunction;
import java.io.OutputStream;

View File

@ -4,8 +4,6 @@ import hep.dataforge.actions.ManyToOneAction;
import hep.dataforge.context.Context;
import hep.dataforge.description.TypedActionDef;
import hep.dataforge.meta.Laminate;
import inr.numass.data.NumassData;
import inr.numass.data.NumassPoint;
import inr.numass.data.NumassPointImpl;
import java.util.Collection;

View File

@ -30,10 +30,9 @@ import hep.dataforge.tables.Table;
import hep.dataforge.tables.TableFormat;
import hep.dataforge.tables.ValueMap;
import hep.dataforge.values.Values;
import inr.numass.data.NumassData;
import inr.numass.data.NumassPoint;
import inr.numass.data.PointBuilders;
import inr.numass.data.RawNMPoint;
import inr.numass.data.legacy.RawNMPoint;
import inr.numass.debunch.DebunchReport;
import inr.numass.debunch.FrameAnalizer;
import inr.numass.storage.NumassDataLoader;

View File

@ -23,8 +23,8 @@ import hep.dataforge.description.TypedActionDef;
import hep.dataforge.description.ValueDef;
import hep.dataforge.exceptions.ContentException;
import hep.dataforge.meta.Laminate;
import inr.numass.data.NMFile;
import inr.numass.data.RawNMFile;
import inr.numass.data.legacy.NMFile;
import inr.numass.data.legacy.RawNMFile;
import static hep.dataforge.values.ValueType.NUMBER;
import static inr.numass.NumassIO.getNumassData;

View File

@ -19,8 +19,6 @@ import hep.dataforge.plots.data.XYPlottable;
import hep.dataforge.tables.*;
import hep.dataforge.values.ValueType;
import hep.dataforge.values.Values;
import inr.numass.data.NumassData;
import inr.numass.data.NumassPoint;
import java.io.OutputStream;
import java.util.*;

View File

@ -15,8 +15,8 @@
*/
package inr.numass.debunch;
import inr.numass.data.RawNMPoint;
import inr.numass.data.events.NumassEvent;
import inr.numass.data.api.NumassEvent;
import inr.numass.data.legacy.RawNMPoint;
import java.util.ArrayList;
import java.util.Collections;

View File

@ -15,7 +15,7 @@
*/
package inr.numass.debunch;
import inr.numass.data.events.NumassEvent;
import inr.numass.data.api.NumassEvent;
/**
*

View File

@ -15,8 +15,8 @@
*/
package inr.numass.debunch;
import inr.numass.data.RawNMPoint;
import inr.numass.data.events.NumassEvent;
import inr.numass.data.api.NumassEvent;
import inr.numass.data.legacy.RawNMPoint;
import java.util.List;

View File

@ -15,8 +15,8 @@
*/
package inr.numass.debunch;
import inr.numass.data.RawNMPoint;
import inr.numass.data.events.NumassEvent;
import inr.numass.data.api.NumassEvent;
import inr.numass.data.legacy.RawNMPoint;
import java.util.ArrayList;
import java.util.List;

View File

@ -15,7 +15,7 @@
*/
package inr.numass.debunch;
import inr.numass.data.RawNMPoint;
import inr.numass.data.legacy.RawNMPoint;
/**
*

View File

@ -15,7 +15,7 @@
*/
package inr.numass.debunch;
import inr.numass.data.events.NumassEvent;
import inr.numass.data.api.NumassEvent;
import org.apache.commons.math3.distribution.PoissonDistribution;
import java.util.ArrayList;

View File

@ -15,7 +15,7 @@
*/
package inr.numass.debunch;
import inr.numass.data.RawNMPoint;
import inr.numass.data.legacy.RawNMPoint;
import org.apache.commons.math3.analysis.UnivariateFunction;
import org.apache.commons.math3.analysis.interpolation.LinearInterpolator;
import org.apache.commons.math3.util.FastMath;

View File

@ -19,7 +19,6 @@ import hep.dataforge.workspace.TaskModel;
import inr.numass.actions.MergeDataAction;
import inr.numass.actions.MonitorCorrectAction;
import inr.numass.actions.PrepareDataAction;
import inr.numass.data.NumassData;
/**
* Prepare data task

View File

@ -15,8 +15,8 @@
*/
package inr.numass.utils;
import inr.numass.data.RawNMPoint;
import inr.numass.data.events.NumassEvent;
import inr.numass.data.api.NumassEvent;
import inr.numass.data.legacy.RawNMPoint;
import org.apache.commons.math3.random.MersenneTwister;
import org.apache.commons.math3.random.RandomGenerator;
import org.apache.commons.math3.random.SynchronizedRandomGenerator;

View File

@ -16,9 +16,8 @@
package inr.numass.utils;
import hep.dataforge.meta.Meta;
import inr.numass.data.NumassPoint;
import inr.numass.data.RawNMPoint;
import inr.numass.data.events.NumassEvent;
import inr.numass.data.api.NumassEvent;
import inr.numass.data.legacy.RawNMPoint;
import org.apache.commons.math3.distribution.EnumeratedRealDistribution;
import org.apache.commons.math3.distribution.RealDistribution;
import org.apache.commons.math3.random.EmpiricalDistribution;

View File

@ -1,7 +1,7 @@
package inr.numass.utils;
import hep.dataforge.meta.Meta;
import inr.numass.data.events.NumassEvent;
import inr.numass.data.api.NumassEvent;
import org.apache.commons.math3.distribution.NormalDistribution;
import org.apache.commons.math3.distribution.RealDistribution;
import org.apache.commons.math3.random.RandomGenerator;

View File

@ -5,10 +5,9 @@
*/
package inr.numass.utils;
import inr.numass.data.NumassPoint;
import inr.numass.data.PointBuilders;
import inr.numass.data.RawNMPoint;
import inr.numass.data.events.NumassEvent;
import inr.numass.data.api.NumassEvent;
import inr.numass.data.legacy.RawNMPoint;
import org.apache.commons.math3.random.RandomGenerator;
import java.util.ArrayList;

View File

@ -15,7 +15,6 @@
*/
package inr.numass.utils;
import inr.numass.data.NumassPoint;
import org.apache.commons.math3.analysis.UnivariateFunction;
import java.util.HashMap;

View File

@ -9,7 +9,6 @@ import hep.dataforge.tables.ListTable;
import hep.dataforge.tables.Table;
import hep.dataforge.tables.ValueMap;
import hep.dataforge.values.Values;
import inr.numass.data.NumassPoint;
import org.apache.commons.math3.analysis.ParametricUnivariateFunction;
import org.apache.commons.math3.exception.DimensionMismatchException;
import org.apache.commons.math3.fitting.SimpleCurveFitter;

View File

@ -13,7 +13,6 @@ import hep.dataforge.server.storage.StorageRatpackHandler;
import hep.dataforge.storage.api.ObjectLoader;
import hep.dataforge.storage.api.PointLoader;
import hep.dataforge.storage.api.Storage;
import inr.numass.data.NumassData;
import org.slf4j.LoggerFactory;
import ratpack.handling.Context;

View File

@ -15,7 +15,6 @@ import hep.dataforge.storage.api.PointLoader
import hep.dataforge.storage.api.Storage
import hep.dataforge.storage.filestorage.FileStorageFactory
import inr.numass.NumassProperties
import inr.numass.data.NumassData
import inr.numass.storage.NumassStorage
import javafx.application.Platform
import javafx.beans.property.SimpleObjectProperty

View File

@ -3,8 +3,6 @@ package inr.numass.viewer
import hep.dataforge.data.Data
import hep.dataforge.meta.Meta
import hep.dataforge.tables.Table
import inr.numass.data.NumassData
import inr.numass.data.NumassPoint
import java.time.Instant
import java.util.stream.Collectors
import java.util.stream.Stream
@ -13,7 +11,7 @@ import java.util.stream.Stream
* Cached numass data
* Created by darksnake on 23-Jun-17.
*/
class NumassDataCache(val data: NumassData) : NumassData {
class NumassDataCache(val data: NumassData) {
private val cachedDescription: String by lazy { data.description }
private val cachedMeta: Meta by lazy { data.meta }
private val cachedPoints: List<NumassPoint> by lazy { data.stream().collect(Collectors.toList()) }

View File

@ -17,9 +17,7 @@ import hep.dataforge.tables.ListTable
import hep.dataforge.tables.ValueMap
import hep.dataforge.tables.XYAdapter
import hep.dataforge.values.Values
import inr.numass.data.NumassData
import inr.numass.data.NumassDataUtils
import inr.numass.data.NumassPoint
import javafx.beans.property.SimpleObjectProperty
import javafx.beans.value.ObservableValue
import javafx.collections.FXCollections