Introduced Type annotation to manage io tools

This commit is contained in:
Alexander Nozik 2018-07-16 18:35:03 +03:00
parent 555e0dfc3d
commit 5e3351b2ba
41 changed files with 63 additions and 55 deletions

View File

@ -5,13 +5,13 @@ import hep.dataforge.context.Global
import hep.dataforge.control.DeviceManager import hep.dataforge.control.DeviceManager
import hep.dataforge.control.connections.Roles import hep.dataforge.control.connections.Roles
import hep.dataforge.control.devices.Device import hep.dataforge.control.devices.Device
import hep.dataforge.kodex.useMeta
import hep.dataforge.kodex.useMetaList
import hep.dataforge.meta.Meta import hep.dataforge.meta.Meta
import hep.dataforge.server.ServerManager import hep.dataforge.server.ServerManager
import hep.dataforge.storage.api.Storage import hep.dataforge.storage.api.Storage
import hep.dataforge.storage.commons.StorageConnection import hep.dataforge.storage.commons.StorageConnection
import hep.dataforge.storage.commons.StorageManager import hep.dataforge.storage.commons.StorageManager
import hep.dataforge.useMeta
import hep.dataforge.useMetaList
import inr.numass.client.ClientUtils import inr.numass.client.ClientUtils
import javafx.beans.property.SimpleObjectProperty import javafx.beans.property.SimpleObjectProperty
import javafx.collections.FXCollections import javafx.collections.FXCollections

View File

@ -16,9 +16,9 @@
package inr.numass.control.dante package inr.numass.control.dante
import hep.dataforge.kodex.orElse
import hep.dataforge.meta.Meta import hep.dataforge.meta.Meta
import hep.dataforge.meta.buildMeta import hep.dataforge.meta.buildMeta
import hep.dataforge.orElse
import inr.numass.control.dante.DanteClient.Companion.CommandType.* import inr.numass.control.dante.DanteClient.Companion.CommandType.*
import inr.numass.control.dante.DanteClient.Companion.Register.* import inr.numass.control.dante.DanteClient.Companion.Register.*
import inr.numass.data.NumassProto import inr.numass.data.NumassProto

View File

@ -16,13 +16,13 @@
package inr.numass.control.dante package inr.numass.control.dante
import hep.dataforge.configure
import hep.dataforge.context.Context import hep.dataforge.context.Context
import hep.dataforge.context.Global import hep.dataforge.context.Global
import hep.dataforge.fx.plots.displayPlot import hep.dataforge.fx.plots.displayPlot
import hep.dataforge.kodex.configure
import hep.dataforge.kodex.nullable
import hep.dataforge.meta.KMetaBuilder import hep.dataforge.meta.KMetaBuilder
import hep.dataforge.meta.buildMeta import hep.dataforge.meta.buildMeta
import hep.dataforge.nullable
import hep.dataforge.plots.data.DataPlot import hep.dataforge.plots.data.DataPlot
import hep.dataforge.plots.jfreechart.chart import hep.dataforge.plots.jfreechart.chart
import hep.dataforge.tables.Adapters import hep.dataforge.tables.Adapters

View File

@ -7,10 +7,10 @@ import hep.dataforge.control.devices.DeviceHub
import hep.dataforge.control.ports.Port import hep.dataforge.control.ports.Port
import hep.dataforge.control.ports.PortFactory import hep.dataforge.control.ports.PortFactory
import hep.dataforge.description.ValueDef import hep.dataforge.description.ValueDef
import hep.dataforge.kodex.useEachMeta
import hep.dataforge.meta.Meta import hep.dataforge.meta.Meta
import hep.dataforge.names.Name import hep.dataforge.names.Name
import hep.dataforge.states.StateDef import hep.dataforge.states.StateDef
import hep.dataforge.useEachMeta
import hep.dataforge.values.ValueType import hep.dataforge.values.ValueType
import inr.numass.control.DeviceDisplayFX import inr.numass.control.DeviceDisplayFX
import inr.numass.control.DeviceView import inr.numass.control.DeviceView

View File

@ -16,8 +16,8 @@
package inr.numass.control.magnet package inr.numass.control.magnet
import hep.dataforge.control.ports.VirtualPort import hep.dataforge.control.ports.VirtualPort
import hep.dataforge.kodex.useEachMeta
import hep.dataforge.meta.Meta import hep.dataforge.meta.Meta
import hep.dataforge.useEachMeta
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import java.time.Duration import java.time.Duration
import java.util.* import java.util.*

View File

@ -29,7 +29,6 @@ import hep.dataforge.description.ValueDef
import hep.dataforge.exceptions.ControlException import hep.dataforge.exceptions.ControlException
import hep.dataforge.exceptions.MeasurementException import hep.dataforge.exceptions.MeasurementException
import hep.dataforge.exceptions.PortException import hep.dataforge.exceptions.PortException
import hep.dataforge.kodex.useMeta
import hep.dataforge.meta.Meta import hep.dataforge.meta.Meta
import hep.dataforge.states.StateDef import hep.dataforge.states.StateDef
import hep.dataforge.states.StateDefs import hep.dataforge.states.StateDefs
@ -37,6 +36,7 @@ import hep.dataforge.states.valueState
import hep.dataforge.storage.commons.StorageConnection import hep.dataforge.storage.commons.StorageConnection
import hep.dataforge.tables.TableFormatBuilder import hep.dataforge.tables.TableFormatBuilder
import hep.dataforge.tables.ValuesListener import hep.dataforge.tables.ValuesListener
import hep.dataforge.useMeta
import hep.dataforge.values.ValueType import hep.dataforge.values.ValueType
import inr.numass.control.DeviceView import inr.numass.control.DeviceView
import inr.numass.control.NumassStorageConnection import inr.numass.control.NumassStorageConnection

View File

@ -4,8 +4,8 @@ import ch.qos.logback.classic.Level
import hep.dataforge.control.devices.Device import hep.dataforge.control.devices.Device
import hep.dataforge.control.devices.DeviceFactory import hep.dataforge.control.devices.DeviceFactory
import hep.dataforge.exceptions.ControlException import hep.dataforge.exceptions.ControlException
import hep.dataforge.kodex.optional
import hep.dataforge.meta.Meta import hep.dataforge.meta.Meta
import hep.dataforge.optional
import javafx.scene.Scene import javafx.scene.Scene
import javafx.stage.Stage import javafx.stage.Stage
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory

View File

@ -8,8 +8,8 @@ import hep.dataforge.exceptions.StorageException
import hep.dataforge.fx.dfIcon import hep.dataforge.fx.dfIcon
import hep.dataforge.io.MetaFileReader import hep.dataforge.io.MetaFileReader
import hep.dataforge.io.XMLMetaReader import hep.dataforge.io.XMLMetaReader
import hep.dataforge.kodex.nullable
import hep.dataforge.meta.Meta import hep.dataforge.meta.Meta
import hep.dataforge.nullable
import hep.dataforge.storage.commons.StorageConnection import hep.dataforge.storage.commons.StorageConnection
import hep.dataforge.storage.commons.StorageManager import hep.dataforge.storage.commons.StorageManager
import inr.numass.client.ClientUtils import inr.numass.client.ClientUtils

View File

@ -3,7 +3,7 @@ package inr.numass.control
import hep.dataforge.control.connections.DeviceConnection import hep.dataforge.control.connections.DeviceConnection
import hep.dataforge.control.connections.Roles import hep.dataforge.control.connections.Roles
import hep.dataforge.control.devices.Device import hep.dataforge.control.devices.Device
import hep.dataforge.kodex.nullable import hep.dataforge.nullable
import hep.dataforge.storage.api.Storage import hep.dataforge.storage.api.Storage
import hep.dataforge.storage.api.TableLoader import hep.dataforge.storage.api.TableLoader
import hep.dataforge.storage.commons.LoaderFactory import hep.dataforge.storage.commons.LoaderFactory

View File

@ -1,7 +1,7 @@
package inr.numass.control package inr.numass.control
import hep.dataforge.control.devices.AbstractDevice import hep.dataforge.control.devices.AbstractDevice
import hep.dataforge.kodex.nullable import hep.dataforge.nullable
import hep.dataforge.storage.api.TableLoader import hep.dataforge.storage.api.TableLoader
import hep.dataforge.storage.commons.StorageConnection import hep.dataforge.storage.commons.StorageConnection
import hep.dataforge.values.Values import hep.dataforge.values.Values

View File

@ -6,8 +6,8 @@
package inr.numass.data.api package inr.numass.data.api
import hep.dataforge.Named import hep.dataforge.Named
import hep.dataforge.kodex.optional
import hep.dataforge.meta.Metoid import hep.dataforge.meta.Metoid
import hep.dataforge.optional
import hep.dataforge.providers.Provider import hep.dataforge.providers.Provider
import hep.dataforge.providers.Provides import hep.dataforge.providers.Provides
import hep.dataforge.providers.ProvidesNames import hep.dataforge.providers.ProvidesNames

View File

@ -19,7 +19,6 @@ import hep.dataforge.context.Context
import hep.dataforge.exceptions.StorageException import hep.dataforge.exceptions.StorageException
import hep.dataforge.io.ColumnedDataReader import hep.dataforge.io.ColumnedDataReader
import hep.dataforge.io.envelopes.Envelope import hep.dataforge.io.envelopes.Envelope
import hep.dataforge.kodex.toList
import hep.dataforge.meta.Meta import hep.dataforge.meta.Meta
import hep.dataforge.meta.MetaBuilder import hep.dataforge.meta.MetaBuilder
import hep.dataforge.providers.Provider import hep.dataforge.providers.Provider
@ -29,6 +28,7 @@ import hep.dataforge.storage.commons.DummyStorage
import hep.dataforge.storage.filestorage.FileStorage import hep.dataforge.storage.filestorage.FileStorage
import hep.dataforge.storage.loaders.AbstractLoader import hep.dataforge.storage.loaders.AbstractLoader
import hep.dataforge.tables.Table import hep.dataforge.tables.Table
import hep.dataforge.toList
import inr.numass.data.api.NumassPoint import inr.numass.data.api.NumassPoint
import inr.numass.data.api.NumassSet import inr.numass.data.api.NumassSet
import inr.numass.data.legacy.NumassFileEnvelope import inr.numass.data.legacy.NumassFileEnvelope

View File

@ -3,8 +3,8 @@ package inr.numass.data.storage
import hep.dataforge.context.Context import hep.dataforge.context.Context
import hep.dataforge.context.Global import hep.dataforge.context.Global
import hep.dataforge.io.envelopes.Envelope import hep.dataforge.io.envelopes.Envelope
import hep.dataforge.kodex.toList
import hep.dataforge.meta.Meta import hep.dataforge.meta.Meta
import hep.dataforge.toList
import inr.numass.data.NumassProto import inr.numass.data.NumassProto
import inr.numass.data.api.* import inr.numass.data.api.*
import inr.numass.data.dataStream import inr.numass.data.dataStream

View File

@ -18,7 +18,6 @@ import hep.dataforge.plots.PlotGroup
import hep.dataforge.plots.data.DataPlot import hep.dataforge.plots.data.DataPlot
import hep.dataforge.tables.Adapters import hep.dataforge.tables.Adapters
import hep.dataforge.tables.Table import hep.dataforge.tables.Table
import hep.dataforge.tables.TableTransform
import inr.numass.NumassPlugin import inr.numass.NumassPlugin
import inr.numass.data.analyzers.NumassAnalyzerKt import inr.numass.data.analyzers.NumassAnalyzerKt
import inr.numass.subthreshold.Threshold import inr.numass.subthreshold.Threshold

View File

@ -40,7 +40,7 @@ import java.util.Map.Entry;
import java.util.TreeMap; import java.util.TreeMap;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
import static hep.dataforge.io.output.Output.TEXT_MODE; import static hep.dataforge.io.output.Output.TEXT_TYPE;
/** /**
* @author Darksnake * @author Darksnake
@ -131,7 +131,7 @@ public class MonitorCorrectAction extends OneToOneAction<Table, Table> {
// } // }
Table res = ListTable.infer(dataList); Table res = ListTable.infer(dataList);
context.getOutput().get(getName(), name, TEXT_MODE).render(NumassUtils.INSTANCE.wrap(res, meta), Meta.empty()); context.getOutput().get(getName(), name, TEXT_TYPE).render(NumassUtils.INSTANCE.wrap(res, meta), Meta.empty());
return res; return res;
} }
@ -196,7 +196,7 @@ public class MonitorCorrectAction extends OneToOneAction<Table, Table> {
String monitorFileName = meta.getString("monitorFile", "monitor"); String monitorFileName = meta.getString("monitorFile", "monitor");
ListTable data = ListTable.infer(monitorPoints); ListTable data = ListTable.infer(monitorPoints);
context.getOutput().get(getName(), monitorFileName, TEXT_MODE).render(NumassUtils.INSTANCE.wrap(data, meta), Meta.empty()); context.getOutput().get(getName(), monitorFileName, TEXT_TYPE).render(NumassUtils.INSTANCE.wrap(data, meta), Meta.empty());
// ColumnedDataWriter.writeTable(stream, TableTransform.sort(data, "Timestamp", true), "Monitor points", monitorNames); // ColumnedDataWriter.writeTable(stream, TableTransform.sort(data, "Timestamp", true), "Monitor points", monitorNames);
} }
} }

View File

@ -21,7 +21,7 @@ import java.io.IOException;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.Optional; import java.util.Optional;
import static hep.dataforge.io.output.Output.TEXT_MODE; import static hep.dataforge.io.output.Output.TEXT_TYPE;
/** /**
* @author <a href="mailto:altavir@gmail.com">Alexander Nozik</a> * @author <a href="mailto:altavir@gmail.com">Alexander Nozik</a>
@ -51,7 +51,7 @@ public class SubstractSpectrumAction extends OneToOneAction<Table, Table> {
Table res = builder.build(); Table res = builder.build();
context.getOutput().get(getName(), name, TEXT_MODE).render(NumassUtils.INSTANCE.wrap(res, inputMeta), Meta.empty()); context.getOutput().get(getName(), name, TEXT_TYPE).render(NumassUtils.INSTANCE.wrap(res, inputMeta), Meta.empty());
return res; return res;
} catch (IOException ex) { } catch (IOException ex) {
throw new RuntimeException("Could not read reference file", ex); throw new RuntimeException("Could not read reference file", ex);

View File

@ -8,7 +8,7 @@ package inr.numass.utils;
import hep.dataforge.meta.Meta; import hep.dataforge.meta.Meta;
import hep.dataforge.tables.ListTable; import hep.dataforge.tables.ListTable;
import hep.dataforge.tables.Table; import hep.dataforge.tables.Table;
import hep.dataforge.tables.TableTransform; import hep.dataforge.tables.Tables;
import hep.dataforge.values.ValueMap; import hep.dataforge.values.ValueMap;
import hep.dataforge.values.Values; import hep.dataforge.values.Values;
import inr.numass.data.analyzers.NumassAnalyzer; import inr.numass.data.analyzers.NumassAnalyzer;
@ -109,7 +109,7 @@ public class UnderflowCorrection {
if (xHigh <= xLow) { if (xHigh <= xLow) {
throw new IllegalArgumentException("Wrong borders for underflow calculation"); throw new IllegalArgumentException("Wrong borders for underflow calculation");
} }
Table binned = TableTransform.filter( Table binned = Tables.filter(
NumassAnalyzerKt.withBinning(spectrum, binning), NumassAnalyzerKt.withBinning(spectrum, binning),
CHANNEL_KEY, CHANNEL_KEY,
xLow, xLow,

View File

@ -26,7 +26,7 @@ import hep.dataforge.meta.Meta
import hep.dataforge.tables.ListTable import hep.dataforge.tables.ListTable
import hep.dataforge.tables.MetaTableFormat import hep.dataforge.tables.MetaTableFormat
import hep.dataforge.tables.Table import hep.dataforge.tables.Table
import hep.dataforge.tables.TableTransform import hep.dataforge.tables.Tables
import hep.dataforge.values.ValueMap import hep.dataforge.values.ValueMap
import hep.dataforge.values.Values import hep.dataforge.values.Values
import inr.numass.NumassUtils import inr.numass.NumassUtils
@ -56,7 +56,7 @@ object MergeDataAction : ManyToOneAction<Table, Table>() {
override fun execute(context: Context, nodeName: String, data: Map<String, Table>, meta: Laminate): Table { override fun execute(context: Context, nodeName: String, data: Map<String, Table>, meta: Laminate): Table {
val res = mergeDataSets(data.values) val res = mergeDataSets(data.values)
return ListTable(res.format, TableTransform.sort(res, NumassPoint.HV_KEY, true)) return ListTable(res.format, Tables.sort(res, NumassPoint.HV_KEY, true).toList())
} }
override fun afterGroup(context: Context, groupName: String, outputMeta: Meta, output: Table) { override fun afterGroup(context: Context, groupName: String, outputMeta: Meta, output: Table) {

View File

@ -1,9 +1,9 @@
package inr.numass.actions package inr.numass.actions
import hep.dataforge.actions.OneToOneAction import hep.dataforge.actions.OneToOneAction
import hep.dataforge.configure
import hep.dataforge.context.Context import hep.dataforge.context.Context
import hep.dataforge.description.* import hep.dataforge.description.*
import hep.dataforge.kodex.configure
import hep.dataforge.maths.histogram.UnivariateHistogram import hep.dataforge.maths.histogram.UnivariateHistogram
import hep.dataforge.meta.Laminate import hep.dataforge.meta.Laminate
import hep.dataforge.plots.XYFunctionPlot import hep.dataforge.plots.XYFunctionPlot

View File

@ -1,9 +1,9 @@
package inr.numass.actions package inr.numass.actions
import hep.dataforge.actions.OneToOneAction import hep.dataforge.actions.OneToOneAction
import hep.dataforge.configure
import hep.dataforge.context.Context import hep.dataforge.context.Context
import hep.dataforge.description.* import hep.dataforge.description.*
import hep.dataforge.kodex.configure
import hep.dataforge.maths.histogram.UnivariateHistogram import hep.dataforge.maths.histogram.UnivariateHistogram
import hep.dataforge.meta.Laminate import hep.dataforge.meta.Laminate
import hep.dataforge.meta.buildMeta import hep.dataforge.meta.buildMeta

View File

@ -16,13 +16,13 @@
package inr.numass.data package inr.numass.data
import hep.dataforge.configure
import hep.dataforge.context.Context import hep.dataforge.context.Context
import hep.dataforge.context.Global import hep.dataforge.context.Global
import hep.dataforge.fx.plots.displayPlot import hep.dataforge.fx.plots.displayPlot
import hep.dataforge.kodex.configure
import hep.dataforge.kodex.nullable
import hep.dataforge.meta.KMetaBuilder import hep.dataforge.meta.KMetaBuilder
import hep.dataforge.meta.buildMeta import hep.dataforge.meta.buildMeta
import hep.dataforge.nullable
import hep.dataforge.plots.data.DataPlot import hep.dataforge.plots.data.DataPlot
import hep.dataforge.plots.jfreechart.chart import hep.dataforge.plots.jfreechart.chart
import hep.dataforge.tables.Adapters import hep.dataforge.tables.Adapters

View File

@ -16,7 +16,7 @@
package inr.numass.scripts package inr.numass.scripts
import hep.dataforge.kodex.buildContext import hep.dataforge.buildContext
import hep.dataforge.meta.buildMeta import hep.dataforge.meta.buildMeta
import inr.numass.NumassPlugin import inr.numass.NumassPlugin
import inr.numass.data.NumassDataUtils import inr.numass.data.NumassDataUtils

View File

@ -16,8 +16,8 @@
package inr.numass.scripts package inr.numass.scripts
import hep.dataforge.buildContext
import hep.dataforge.description.Descriptors import hep.dataforge.description.Descriptors
import hep.dataforge.kodex.buildContext
import hep.dataforge.meta.buildMeta import hep.dataforge.meta.buildMeta
import hep.dataforge.plots.data.DataPlot import hep.dataforge.plots.data.DataPlot
import inr.numass.NumassPlugin import inr.numass.NumassPlugin

View File

@ -16,8 +16,8 @@
package inr.numass.scripts package inr.numass.scripts
import hep.dataforge.buildContext
import hep.dataforge.description.Descriptors import hep.dataforge.description.Descriptors
import hep.dataforge.kodex.buildContext
import hep.dataforge.meta.buildMeta import hep.dataforge.meta.buildMeta
import hep.dataforge.plots.data.DataPlot import hep.dataforge.plots.data.DataPlot
import inr.numass.NumassPlugin import inr.numass.NumassPlugin

View File

@ -16,8 +16,8 @@
package inr.numass.scripts.models package inr.numass.scripts.models
import hep.dataforge.buildContext
import hep.dataforge.description.Descriptors import hep.dataforge.description.Descriptors
import hep.dataforge.kodex.buildContext
import hep.dataforge.meta.buildMeta import hep.dataforge.meta.buildMeta
import hep.dataforge.plots.data.DataPlot import hep.dataforge.plots.data.DataPlot
import hep.dataforge.tables.replaceColumn import hep.dataforge.tables.replaceColumn

View File

@ -16,11 +16,10 @@
package inr.numass.scripts.models package inr.numass.scripts.models
import hep.dataforge.buildContext
import hep.dataforge.configure
import hep.dataforge.fx.output.FXOutputManager import hep.dataforge.fx.output.FXOutputManager
import hep.dataforge.io.output.stream import hep.dataforge.io.output.stream
import hep.dataforge.kodex.buildContext
import hep.dataforge.kodex.configure
import hep.dataforge.kodex.step
import hep.dataforge.meta.Meta import hep.dataforge.meta.Meta
import hep.dataforge.plots.Plot import hep.dataforge.plots.Plot
import hep.dataforge.plots.data.DataPlot import hep.dataforge.plots.data.DataPlot
@ -31,6 +30,7 @@ import hep.dataforge.stat.fit.FitStage
import hep.dataforge.stat.fit.FitState import hep.dataforge.stat.fit.FitState
import hep.dataforge.stat.fit.ParamSet import hep.dataforge.stat.fit.ParamSet
import hep.dataforge.stat.models.XYModel import hep.dataforge.stat.models.XYModel
import hep.dataforge.step
import hep.dataforge.tables.Adapters.X_AXIS import hep.dataforge.tables.Adapters.X_AXIS
import hep.dataforge.values.ValueMap import hep.dataforge.values.ValueMap
import inr.numass.NumassPlugin import inr.numass.NumassPlugin

View File

@ -1,8 +1,8 @@
package inr.numass.scripts.timeanalysis package inr.numass.scripts.timeanalysis
import hep.dataforge.buildContext
import hep.dataforge.data.DataSet import hep.dataforge.data.DataSet
import hep.dataforge.fx.output.FXOutputManager import hep.dataforge.fx.output.FXOutputManager
import hep.dataforge.kodex.buildContext
import hep.dataforge.meta.buildMeta import hep.dataforge.meta.buildMeta
import hep.dataforge.plots.jfreechart.JFreeChartPlugin import hep.dataforge.plots.jfreechart.JFreeChartPlugin
import inr.numass.NumassPlugin import inr.numass.NumassPlugin

View File

@ -16,7 +16,7 @@
package inr.numass.scripts.timeanalysis package inr.numass.scripts.timeanalysis
import hep.dataforge.kodex.buildContext import hep.dataforge.buildContext
import hep.dataforge.maths.histogram.SimpleHistogram import hep.dataforge.maths.histogram.SimpleHistogram
import hep.dataforge.meta.buildMeta import hep.dataforge.meta.buildMeta
import inr.numass.NumassPlugin import inr.numass.NumassPlugin

View File

@ -1,10 +1,10 @@
package inr.numass.scripts.timeanalysis package inr.numass.scripts.timeanalysis
import hep.dataforge.context.Global import hep.dataforge.context.Global
import hep.dataforge.coroutineContext
import hep.dataforge.fx.output.FXOutputManager import hep.dataforge.fx.output.FXOutputManager
import hep.dataforge.goals.generate import hep.dataforge.goals.generate
import hep.dataforge.goals.join import hep.dataforge.goals.join
import hep.dataforge.kodex.coroutineContext
import hep.dataforge.meta.buildMeta import hep.dataforge.meta.buildMeta
import hep.dataforge.plots.jfreechart.JFreeChartPlugin import hep.dataforge.plots.jfreechart.JFreeChartPlugin
import inr.numass.NumassPlugin import inr.numass.NumassPlugin

View File

@ -17,10 +17,10 @@
package inr.numass.scripts.timeanalysis package inr.numass.scripts.timeanalysis
import hep.dataforge.context.Global import hep.dataforge.context.Global
import hep.dataforge.coroutineContext
import hep.dataforge.fx.output.FXOutputManager import hep.dataforge.fx.output.FXOutputManager
import hep.dataforge.goals.generate import hep.dataforge.goals.generate
import hep.dataforge.goals.join import hep.dataforge.goals.join
import hep.dataforge.kodex.coroutineContext
import hep.dataforge.meta.buildMeta import hep.dataforge.meta.buildMeta
import hep.dataforge.plots.jfreechart.JFreeChartPlugin import hep.dataforge.plots.jfreechart.JFreeChartPlugin
import inr.numass.NumassPlugin import inr.numass.NumassPlugin

View File

@ -17,7 +17,7 @@
package inr.numass.scripts.tristan package inr.numass.scripts.tristan
import hep.dataforge.context.Global import hep.dataforge.context.Global
import hep.dataforge.kodex.toList import hep.dataforge.toList
import inr.numass.data.api.NumassPoint import inr.numass.data.api.NumassPoint
import inr.numass.data.channel import inr.numass.data.channel
import inr.numass.data.storage.NumassDataLoader import inr.numass.data.storage.NumassDataLoader

View File

@ -2,12 +2,12 @@ package inr.numass.scripts.utils
import hep.dataforge.context.Global import hep.dataforge.context.Global
import hep.dataforge.io.XMLMetaWriter import hep.dataforge.io.XMLMetaWriter
import hep.dataforge.kodex.useValue
import hep.dataforge.meta.Meta import hep.dataforge.meta.Meta
import hep.dataforge.meta.MetaBuilder import hep.dataforge.meta.MetaBuilder
import hep.dataforge.meta.MetaUtils import hep.dataforge.meta.MetaUtils
import hep.dataforge.meta.buildMeta import hep.dataforge.meta.buildMeta
import hep.dataforge.storage.api.Storage import hep.dataforge.storage.api.Storage
import hep.dataforge.useValue
import inr.numass.data.storage.NumassDataLoader import inr.numass.data.storage.NumassDataLoader
import inr.numass.data.storage.NumassStorageFactory import inr.numass.data.storage.NumassStorageFactory
import java.io.File import java.io.File

View File

@ -1,9 +1,9 @@
package inr.numass.subthreshold package inr.numass.subthreshold
import hep.dataforge.actions.pipe
import hep.dataforge.context.Context import hep.dataforge.context.Context
import hep.dataforge.data.DataNode import hep.dataforge.data.DataNode
import hep.dataforge.data.DataSet import hep.dataforge.data.DataSet
import hep.dataforge.kodex.pipe
import hep.dataforge.meta.Meta import hep.dataforge.meta.Meta
import hep.dataforge.meta.buildMeta import hep.dataforge.meta.buildMeta
import hep.dataforge.storage.commons.StorageUtils import hep.dataforge.storage.commons.StorageUtils

View File

@ -16,7 +16,7 @@ import hep.dataforge.stat.fit.FitResult
import hep.dataforge.stat.fit.UpperLimitGenerator import hep.dataforge.stat.fit.UpperLimitGenerator
import hep.dataforge.tables.ListTable import hep.dataforge.tables.ListTable
import hep.dataforge.tables.Table import hep.dataforge.tables.Table
import hep.dataforge.tables.TableTransform import hep.dataforge.tables.Tables
import hep.dataforge.workspace.tasks.AbstractTask import hep.dataforge.workspace.tasks.AbstractTask
import hep.dataforge.workspace.tasks.TaskModel import hep.dataforge.workspace.tasks.TaskModel
import inr.numass.NumassUtils import inr.numass.NumassUtils
@ -66,7 +66,7 @@ object NumassFitScanSummaryTask : AbstractTask<Table>(Table::class.java) {
pars.getValue("E0"), pars.getValue("E0"),
pars.getValue("trap")) pars.getValue("trap"))
} }
val res = TableTransform.sort(builder.build(), "m", true) val res = Tables.sort(builder.build(), "m", true)
context.output[name, nodeName].render(NumassUtils.wrap(res, meta)) context.output[name, nodeName].render(NumassUtils.wrap(res, meta))
return res return res
} }

View File

@ -7,12 +7,12 @@ package inr.numass.tasks
import hep.dataforge.data.DataNode import hep.dataforge.data.DataNode
import hep.dataforge.data.DataTree import hep.dataforge.data.DataTree
import hep.dataforge.kodex.useMeta
import hep.dataforge.meta.Meta import hep.dataforge.meta.Meta
import hep.dataforge.meta.MetaBuilder import hep.dataforge.meta.MetaBuilder
import hep.dataforge.stat.fit.FitAction import hep.dataforge.stat.fit.FitAction
import hep.dataforge.stat.fit.FitResult import hep.dataforge.stat.fit.FitResult
import hep.dataforge.tables.Table import hep.dataforge.tables.Table
import hep.dataforge.useMeta
import hep.dataforge.values.ListValue import hep.dataforge.values.ListValue
import hep.dataforge.values.Value import hep.dataforge.values.Value
import hep.dataforge.values.asValue import hep.dataforge.values.asValue

View File

@ -1,16 +1,16 @@
package inr.numass.tasks package inr.numass.tasks
import hep.dataforge.configure
import hep.dataforge.data.CustomDataFilter import hep.dataforge.data.CustomDataFilter
import hep.dataforge.data.DataSet import hep.dataforge.data.DataSet
import hep.dataforge.data.DataTree import hep.dataforge.data.DataTree
import hep.dataforge.data.DataUtils import hep.dataforge.data.DataUtils
import hep.dataforge.io.output.stream import hep.dataforge.io.output.stream
import hep.dataforge.io.render import hep.dataforge.io.render
import hep.dataforge.kodex.nullable
import hep.dataforge.kodex.useMeta
import hep.dataforge.meta.Meta import hep.dataforge.meta.Meta
import hep.dataforge.meta.MetaUtils import hep.dataforge.meta.MetaUtils
import hep.dataforge.meta.buildMeta import hep.dataforge.meta.buildMeta
import hep.dataforge.nullable
import hep.dataforge.plots.XYFunctionPlot import hep.dataforge.plots.XYFunctionPlot
import hep.dataforge.plots.data.DataPlot import hep.dataforge.plots.data.DataPlot
import hep.dataforge.plots.jfreechart.JFreeChartFrame import hep.dataforge.plots.jfreechart.JFreeChartFrame
@ -20,6 +20,7 @@ import hep.dataforge.stat.fit.FitHelper
import hep.dataforge.stat.fit.FitResult import hep.dataforge.stat.fit.FitResult
import hep.dataforge.stat.models.XYModel import hep.dataforge.stat.models.XYModel
import hep.dataforge.tables.* import hep.dataforge.tables.*
import hep.dataforge.useMeta
import hep.dataforge.values.ValueType import hep.dataforge.values.ValueType
import hep.dataforge.values.Values import hep.dataforge.values.Values
import hep.dataforge.workspace.tasks.task import hep.dataforge.workspace.tasks.task
@ -40,6 +41,7 @@ import inr.numass.utils.ExpressionUtils
import java.io.PrintWriter import java.io.PrintWriter
import java.util.* import java.util.*
import java.util.concurrent.atomic.AtomicLong import java.util.concurrent.atomic.AtomicLong
import java.util.function.Predicate
import java.util.stream.StreamSupport import java.util.stream.StreamSupport
import kotlin.collections.set import kotlin.collections.set
@ -205,9 +207,9 @@ val filterTask = task("filter") {
val uLo = meta.getDouble("from", 0.0) val uLo = meta.getDouble("from", 0.0)
val uHi = meta.getDouble("to", java.lang.Double.POSITIVE_INFINITY) val uHi = meta.getDouble("to", java.lang.Double.POSITIVE_INFINITY)
this.log.report("Filtering finished") this.log.report("Filtering finished")
TableTransform.filter(data, NumassPoint.HV_KEY, uLo, uHi) Tables.filter(data, NumassPoint.HV_KEY, uLo, uHi)
} else if (meta.hasValue("condition")) { } else if (meta.hasValue("condition")) {
TableTransform.filter(data) { ExpressionUtils.condition(meta.getString("condition"), it.unbox()) } Tables.filter(data, Predicate{ ExpressionUtils.condition(meta.getString("condition"), it.unbox()) })
} else { } else {
throw RuntimeException("No filtering condition specified") throw RuntimeException("No filtering condition specified")
} }
@ -273,6 +275,7 @@ val plotFitTask = task("plotFit") {
val histogramTask = task("histogram") { val histogramTask = task("histogram") {
descriptor { descriptor {
value("plot", types = listOf(ValueType.BOOLEAN), defaultValue = false, info = "Show plot of the spectra") value("plot", types = listOf(ValueType.BOOLEAN), defaultValue = false, info = "Show plot of the spectra")
value("points", multiple = true, types = listOf(ValueType.NUMBER), info = " The list of point voltages to build histogram")
info = "Combine amplitude spectra from multiple sets, but with the same U" info = "Combine amplitude spectra from multiple sets, but with the same U"
} }
model { meta -> model { meta ->
@ -331,6 +334,12 @@ val histogramTask = task("histogram") {
if (meta.getBoolean("plot", false)) { if (meta.getBoolean("plot", false)) {
context.plot("$name.plot", stage = "numass.histogram") { context.plot("$name.plot", stage = "numass.histogram") {
plots.setType<DataPlot>() plots.setType<DataPlot>()
plots.configure {
"showSymbol" to false
"showErrors" to false
"showLine" to true
"connectionType" to "step"
}
table.format.names.filter { it != "channel" }.forEach { table.format.names.filter { it != "channel" }.forEach {
+DataPlot.plot(it, table, adapter = Adapters.buildXYAdapter("channel", it)) +DataPlot.plot(it, table, adapter = Adapters.buildXYAdapter("channel", it))
} }

View File

@ -6,12 +6,12 @@
package inr.numass.models package inr.numass.models
import hep.dataforge.context.Context import hep.dataforge.context.Context
import hep.dataforge.kodex.step
import hep.dataforge.maths.functions.FunctionLibrary import hep.dataforge.maths.functions.FunctionLibrary
import hep.dataforge.meta.Meta import hep.dataforge.meta.Meta
import hep.dataforge.meta.MetaBuilder import hep.dataforge.meta.MetaBuilder
import hep.dataforge.stat.fit.ParamSet import hep.dataforge.stat.fit.ParamSet
import hep.dataforge.stat.parametric.ParametricFunction import hep.dataforge.stat.parametric.ParametricFunction
import hep.dataforge.step
import inr.numass.Numass import inr.numass.Numass
import inr.numass.models.sterile.SterileNeutrinoSpectrum import inr.numass.models.sterile.SterileNeutrinoSpectrum
import org.apache.commons.math3.analysis.BivariateFunction import org.apache.commons.math3.analysis.BivariateFunction

View File

@ -1,12 +1,12 @@
package inr.numass.viewer package inr.numass.viewer
import hep.dataforge.configure
import hep.dataforge.fx.dfIcon import hep.dataforge.fx.dfIcon
import hep.dataforge.fx.except import hep.dataforge.fx.except
import hep.dataforge.fx.plots.PlotContainer import hep.dataforge.fx.plots.PlotContainer
import hep.dataforge.fx.runGoal import hep.dataforge.fx.runGoal
import hep.dataforge.fx.ui import hep.dataforge.fx.ui
import hep.dataforge.goals.Goal import hep.dataforge.goals.Goal
import hep.dataforge.kodex.configure
import hep.dataforge.plots.PlotFrame import hep.dataforge.plots.PlotFrame
import hep.dataforge.plots.PlotGroup import hep.dataforge.plots.PlotGroup
import hep.dataforge.plots.Plottable import hep.dataforge.plots.Plottable

View File

@ -1,10 +1,10 @@
package inr.numass.viewer package inr.numass.viewer
import hep.dataforge.configure
import hep.dataforge.fx.dfIcon import hep.dataforge.fx.dfIcon
import hep.dataforge.fx.plots.PlotContainer import hep.dataforge.fx.plots.PlotContainer
import hep.dataforge.fx.runGoal import hep.dataforge.fx.runGoal
import hep.dataforge.fx.ui import hep.dataforge.fx.ui
import hep.dataforge.kodex.configure
import hep.dataforge.plots.PlotFrame import hep.dataforge.plots.PlotFrame
import hep.dataforge.plots.data.DataPlot import hep.dataforge.plots.data.DataPlot
import hep.dataforge.plots.data.TimePlot import hep.dataforge.plots.data.TimePlot

View File

@ -1,10 +1,10 @@
package inr.numass.viewer package inr.numass.viewer
import hep.dataforge.configure
import hep.dataforge.fx.dfIcon import hep.dataforge.fx.dfIcon
import hep.dataforge.fx.plots.PlotContainer import hep.dataforge.fx.plots.PlotContainer
import hep.dataforge.fx.runGoal import hep.dataforge.fx.runGoal
import hep.dataforge.fx.ui import hep.dataforge.fx.ui
import hep.dataforge.kodex.configure
import hep.dataforge.meta.Meta import hep.dataforge.meta.Meta
import hep.dataforge.plots.PlotGroup import hep.dataforge.plots.PlotGroup
import hep.dataforge.plots.data.DataPlot import hep.dataforge.plots.data.DataPlot

View File

@ -1,10 +1,10 @@
package inr.numass.viewer package inr.numass.viewer
import hep.dataforge.configure
import hep.dataforge.fx.dfIcon import hep.dataforge.fx.dfIcon
import hep.dataforge.fx.plots.PlotContainer import hep.dataforge.fx.plots.PlotContainer
import hep.dataforge.fx.runGoal import hep.dataforge.fx.runGoal
import hep.dataforge.fx.ui import hep.dataforge.fx.ui
import hep.dataforge.kodex.configure
import hep.dataforge.plots.PlotFrame import hep.dataforge.plots.PlotFrame
import hep.dataforge.plots.data.DataPlot import hep.dataforge.plots.data.DataPlot
import hep.dataforge.plots.jfreechart.JFreeChartFrame import hep.dataforge.plots.jfreechart.JFreeChartFrame