Code fixes.
This commit is contained in:
parent
c8da91b39f
commit
d444f2b12b
@ -9,13 +9,14 @@ import hep.dataforge.storage.Storage
|
|||||||
import hep.dataforge.storage.StorageElement
|
import hep.dataforge.storage.StorageElement
|
||||||
import hep.dataforge.storage.StorageManager
|
import hep.dataforge.storage.StorageManager
|
||||||
import inr.numass.data.api.NumassSet
|
import inr.numass.data.api.NumassSet
|
||||||
|
import inr.numass.data.storage.NumassDirectory.Companion.NUMASS_DIRECTORY_TYPE
|
||||||
import kotlinx.coroutines.experimental.runBlocking
|
import kotlinx.coroutines.experimental.runBlocking
|
||||||
import kotlin.coroutines.experimental.buildSequence
|
import kotlin.coroutines.experimental.buildSequence
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by darksnake on 03-Feb-17.
|
* Created by darksnake on 03-Feb-17.
|
||||||
*/
|
*/
|
||||||
object NumassDataFactory : DataFactory<NumassSet>(NumassSet::class.java) {
|
class NumassDataFactory : DataFactory<NumassSet>(NumassSet::class.java) {
|
||||||
|
|
||||||
override val name = "numass"
|
override val name = "numass"
|
||||||
|
|
||||||
@ -36,7 +37,7 @@ object NumassDataFactory : DataFactory<NumassSet>(NumassSet::class.java) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun fill(builder: DataNodeEditor<NumassSet>, context: Context, meta: Meta) {
|
override fun fill(builder: DataNodeEditor<NumassSet>, context: Context, meta: Meta) {
|
||||||
val newMeta = meta.builder.setValue("type", "numass")
|
val newMeta = meta.builder.setValue("type", NUMASS_DIRECTORY_TYPE)
|
||||||
runBlocking {
|
runBlocking {
|
||||||
val storage = context.load(StorageManager::class.java, Meta.empty()).create(newMeta) as Storage
|
val storage = context.load(StorageManager::class.java, Meta.empty()).create(newMeta) as Storage
|
||||||
storage.sequence().forEach { pair ->
|
storage.sequence().forEach { pair ->
|
||||||
|
@ -26,6 +26,10 @@ import java.util.List;
|
|||||||
@TypedActionDef(name = "adjustErrors", inputType = Table.class, outputType = Table.class)
|
@TypedActionDef(name = "adjustErrors", inputType = Table.class, outputType = Table.class)
|
||||||
public class AdjustErrorsAction extends OneToOneAction<Table, Table> {
|
public class AdjustErrorsAction extends OneToOneAction<Table, Table> {
|
||||||
|
|
||||||
|
public AdjustErrorsAction() {
|
||||||
|
super("adjustErrors", Table.class, Table.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Table execute(Context context, String name, Table input, Laminate meta) {
|
protected Table execute(Context context, String name, Table input, Laminate meta) {
|
||||||
List<Values> points = new ArrayList<>();
|
List<Values> points = new ArrayList<>();
|
||||||
|
@ -48,6 +48,9 @@ import static hep.dataforge.io.output.Output.TEXT_TYPE;
|
|||||||
*/
|
*/
|
||||||
@TypedActionDef(name = "monitor", inputType = Table.class, outputType = Table.class)
|
@TypedActionDef(name = "monitor", inputType = Table.class, outputType = Table.class)
|
||||||
public class MonitorCorrectAction extends OneToOneAction<Table, Table> {
|
public class MonitorCorrectAction extends OneToOneAction<Table, Table> {
|
||||||
|
public MonitorCorrectAction() {
|
||||||
|
super("monitor", Table.class, Table.class);
|
||||||
|
}
|
||||||
|
|
||||||
//private static final String[] monitorNames = {"timestamp", NumassAnalyzer.COUNT_KEY, NumassAnalyzer.COUNT_RATE_KEY, NumassAnalyzer.COUNT_RATE_KEY};
|
//private static final String[] monitorNames = {"timestamp", NumassAnalyzer.COUNT_KEY, NumassAnalyzer.COUNT_RATE_KEY, NumassAnalyzer.COUNT_RATE_KEY};
|
||||||
|
|
||||||
|
@ -29,6 +29,10 @@ import static hep.dataforge.io.output.Output.TEXT_TYPE;
|
|||||||
@TypedActionDef(name = "substractSpectrum", inputType = Table.class, outputType = Table.class, info = "Substract reference spectrum (background)")
|
@TypedActionDef(name = "substractSpectrum", inputType = Table.class, outputType = Table.class, info = "Substract reference spectrum (background)")
|
||||||
public class SubstractSpectrumAction extends OneToOneAction<Table, Table> {
|
public class SubstractSpectrumAction extends OneToOneAction<Table, Table> {
|
||||||
|
|
||||||
|
public SubstractSpectrumAction() {
|
||||||
|
super("substractSpectrum", Table.class, Table.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Table execute(Context context, String name, Table input, Laminate inputMeta) {
|
protected Table execute(Context context, String name, Table input, Laminate inputMeta) {
|
||||||
try {
|
try {
|
||||||
|
@ -25,7 +25,7 @@ object WorkspaceTest {
|
|||||||
|
|
||||||
val workspace = BasicWorkspace.builder().apply {
|
val workspace = BasicWorkspace.builder().apply {
|
||||||
this.context = Numass.buildContext()
|
this.context = Numass.buildContext()
|
||||||
data("", NumassDataFactory, MetaBuilder("storage").putValue("path", storagepath))
|
data("", NumassDataFactory(), MetaBuilder("storage").putValue("path", storagepath))
|
||||||
}.build()
|
}.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ import inr.numass.data.api.NumassSet
|
|||||||
ValueDef(key = "window.lo", type = arrayOf(NUMBER, STRING), def = "0", info = "Lower bound for window"),
|
ValueDef(key = "window.lo", type = arrayOf(NUMBER, STRING), def = "0", info = "Lower bound for window"),
|
||||||
ValueDef(key = "window.up", type = arrayOf(NUMBER, STRING), def = "10000", info = "Upper bound for window")
|
ValueDef(key = "window.up", type = arrayOf(NUMBER, STRING), def = "10000", info = "Upper bound for window")
|
||||||
)
|
)
|
||||||
object AnalyzeDataAction : OneToOneAction<NumassSet, Table>() {
|
object AnalyzeDataAction : OneToOneAction<NumassSet, Table>("numass.analyze", NumassSet::class.java, Table::class.java) {
|
||||||
override fun execute(context: Context, name: String, input: NumassSet, inputMeta: Laminate): Table {
|
override fun execute(context: Context, name: String, input: NumassSet, inputMeta: Laminate): Table {
|
||||||
//TODO add processor here
|
//TODO add processor here
|
||||||
val analyzer = NumassAnalyzer.DEFAULT_ANALYZER
|
val analyzer = NumassAnalyzer.DEFAULT_ANALYZER
|
||||||
|
@ -39,7 +39,7 @@ import java.util.*
|
|||||||
*/
|
*/
|
||||||
@TypedActionDef(name = "numass.merge", inputType = Table::class, outputType = Table::class, info = "Merge different numass data files into one.")
|
@TypedActionDef(name = "numass.merge", inputType = Table::class, outputType = Table::class, info = "Merge different numass data files into one.")
|
||||||
@NodeDef(key = "grouping", info = "The definition of grouping rule for this merge", descriptor = "method::hep.dataforge.actions.GroupBuilder.byMeta")
|
@NodeDef(key = "grouping", info = "The definition of grouping rule for this merge", descriptor = "method::hep.dataforge.actions.GroupBuilder.byMeta")
|
||||||
object MergeDataAction : ManyToOneAction<Table, Table>() {
|
object MergeDataAction : ManyToOneAction<Table, Table>("numass.merge", Table::class.java,Table::class.java) {
|
||||||
|
|
||||||
private val parnames = arrayOf(NumassPoint.HV_KEY, NumassPoint.LENGTH_KEY, NumassAnalyzer.COUNT_KEY, NumassAnalyzer.COUNT_RATE_KEY, NumassAnalyzer.COUNT_RATE_ERROR_KEY)
|
private val parnames = arrayOf(NumassPoint.HV_KEY, NumassPoint.LENGTH_KEY, NumassAnalyzer.COUNT_KEY, NumassAnalyzer.COUNT_RATE_KEY, NumassAnalyzer.COUNT_RATE_ERROR_KEY)
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@ import hep.dataforge.plots.data.DataPlot
|
|||||||
import hep.dataforge.plots.data.XYFunctionPlot
|
import hep.dataforge.plots.data.XYFunctionPlot
|
||||||
import hep.dataforge.plots.output.plot
|
import hep.dataforge.plots.output.plot
|
||||||
import hep.dataforge.stat.fit.FitResult
|
import hep.dataforge.stat.fit.FitResult
|
||||||
import hep.dataforge.stat.fit.FitState
|
|
||||||
import hep.dataforge.stat.models.XYModel
|
import hep.dataforge.stat.models.XYModel
|
||||||
import hep.dataforge.tables.Adapters
|
import hep.dataforge.tables.Adapters
|
||||||
import hep.dataforge.tables.ValuesAdapter
|
import hep.dataforge.tables.ValuesAdapter
|
||||||
@ -34,9 +33,9 @@ import java.util.stream.StreamSupport
|
|||||||
/**
|
/**
|
||||||
* @author darksnake
|
* @author darksnake
|
||||||
*/
|
*/
|
||||||
@TypedActionDef(name = "plotFit", info = "Plot fit result", inputType = FitState::class, outputType = FitState::class)
|
@TypedActionDef(name = "plotFit", info = "Plot fit result", inputType = FitResult::class, outputType = FitResult::class)
|
||||||
@NodeDef(key = "adapter", info = "adapter for DataSet being fitted. By default is taken from model.")
|
@NodeDef(key = "adapter", info = "adapter for DataSet being fitted. By default is taken from model.")
|
||||||
object PlotFitResultAction : OneToOneAction<FitResult, FitResult>() {
|
object PlotFitResultAction : OneToOneAction<FitResult, FitResult>("plotFit", FitResult::class.java, FitResult::class.java) {
|
||||||
|
|
||||||
override fun execute(context: Context, name: String, input: FitResult, metaData: Laminate): FitResult {
|
override fun execute(context: Context, name: String, input: FitResult, metaData: Laminate): FitResult {
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ import kotlin.collections.ArrayList
|
|||||||
*/
|
*/
|
||||||
@TypedActionDef(name = "summary", inputType = FitState::class, outputType = Table::class, info = "Generate summary for fit results of different datasets.")
|
@TypedActionDef(name = "summary", inputType = FitState::class, outputType = Table::class, info = "Generate summary for fit results of different datasets.")
|
||||||
@ValueDef(key = "parnames", multiple = true, required = true, info = "List of names of parameters for which summary should be done")
|
@ValueDef(key = "parnames", multiple = true, required = true, info = "List of names of parameters for which summary should be done")
|
||||||
object SummaryAction : ManyToOneAction<FitState, Table>() {
|
object SummaryAction : ManyToOneAction<FitState, Table>("summary", FitState::class.java,Table::class.java) {
|
||||||
|
|
||||||
const val SUMMARY_NAME = "sumName"
|
const val SUMMARY_NAME = "sumName"
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ import kotlin.streams.asStream
|
|||||||
NodeDef(key = "plot", info = "Configuration for stat plots")
|
NodeDef(key = "plot", info = "Configuration for stat plots")
|
||||||
)
|
)
|
||||||
@TypedActionDef(name = "timeSpectrum", inputType = NumassPoint::class, outputType = Table::class)
|
@TypedActionDef(name = "timeSpectrum", inputType = NumassPoint::class, outputType = Table::class)
|
||||||
object TimeAnalyzerAction : OneToOneAction<NumassPoint, Table>() {
|
object TimeAnalyzerAction : OneToOneAction<NumassPoint, Table>("timeSpectrum",NumassPoint::class.java,Table::class.java) {
|
||||||
private val analyzer = TimeAnalyzer();
|
private val analyzer = TimeAnalyzer();
|
||||||
|
|
||||||
override fun execute(context: Context, name: String, input: NumassPoint, inputMeta: Laminate): Table {
|
override fun execute(context: Context, name: String, input: NumassPoint, inputMeta: Laminate): Table {
|
||||||
|
@ -33,7 +33,7 @@ import kotlin.streams.asStream
|
|||||||
NodeDef(key = "plot", info = "Configuration for stat plots")
|
NodeDef(key = "plot", info = "Configuration for stat plots")
|
||||||
)
|
)
|
||||||
@TypedActionDef(name = "numass.timeSpectrum", inputType = NumassPoint::class, outputType = Table::class)
|
@TypedActionDef(name = "numass.timeSpectrum", inputType = NumassPoint::class, outputType = Table::class)
|
||||||
object TimeSpectrumAction : OneToOneAction<NumassPoint, Table>() {
|
object TimeSpectrumAction : OneToOneAction<NumassPoint, Table>( "numass.timeSpectrum", NumassPoint::class.java, Table::class.java) {
|
||||||
private val analyzer = TimeAnalyzer();
|
private val analyzer = TimeAnalyzer();
|
||||||
|
|
||||||
override fun execute(context: Context, name: String, input: NumassPoint, inputMeta: Laminate): Table {
|
override fun execute(context: Context, name: String, input: NumassPoint, inputMeta: Laminate): Table {
|
||||||
|
@ -35,7 +35,7 @@ import java.util.*
|
|||||||
ValueDef(key = "utransform", info = "Expression for voltage transformation. Uses U as input")
|
ValueDef(key = "utransform", info = "Expression for voltage transformation. Uses U as input")
|
||||||
)
|
)
|
||||||
@NodeDef(key = "correction", multiple = true, descriptor = "method::inr.numass.actions.TransformDataAction.makeCorrection")
|
@NodeDef(key = "correction", multiple = true, descriptor = "method::inr.numass.actions.TransformDataAction.makeCorrection")
|
||||||
object TransformDataAction : OneToOneAction<Table, Table>() {
|
object TransformDataAction : OneToOneAction<Table, Table>("numass.transform", Table::class.java, Table::class.java) {
|
||||||
|
|
||||||
override fun execute(context: Context, name: String, input: Table, meta: Laminate): Table {
|
override fun execute(context: Context, name: String, input: Table, meta: Laminate): Table {
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ object NumassFitScanSummaryTask : AbstractTask<Table>(Table::class.java) {
|
|||||||
override val name = "scansum"
|
override val name = "scansum"
|
||||||
|
|
||||||
@TypedActionDef(name = "sterileSummary", inputType = FitResult::class, outputType = Table::class)
|
@TypedActionDef(name = "sterileSummary", inputType = FitResult::class, outputType = Table::class)
|
||||||
private class FitSummaryAction : ManyToOneAction<FitResult, Table>() {
|
private class FitSummaryAction : ManyToOneAction<FitResult, Table>("sterileSummary",FitResult::class.java,Table::class.java) {
|
||||||
|
|
||||||
override fun execute(context: Context, nodeName: String, input: Map<String, FitResult>, meta: Laminate): Table {
|
override fun execute(context: Context, nodeName: String, input: Map<String, FitResult>, meta: Laminate): Table {
|
||||||
val builder = ListTable.Builder("m", "U2", "U2err", "U2limit", "E0", "trap")
|
val builder = ListTable.Builder("m", "U2", "U2err", "U2limit", "E0", "trap")
|
||||||
|
@ -12,7 +12,7 @@ if (!hasProperty('mainClass')) {
|
|||||||
|
|
||||||
mainClassName = mainClass
|
mainClassName = mainClass
|
||||||
|
|
||||||
version = "0.5.5"
|
version = "0.5.6"
|
||||||
|
|
||||||
description = "The viewer for numass data"
|
description = "The viewer for numass data"
|
||||||
|
|
||||||
|
@ -2,9 +2,10 @@ package inr.numass.viewer
|
|||||||
|
|
||||||
import hep.dataforge.context.Context
|
import hep.dataforge.context.Context
|
||||||
import hep.dataforge.context.Global
|
import hep.dataforge.context.Global
|
||||||
import hep.dataforge.fx.*
|
import hep.dataforge.fx.dfIconView
|
||||||
import hep.dataforge.fx.fragments.LogFragment
|
import hep.dataforge.fx.except
|
||||||
import hep.dataforge.fx.meta.MetaViewer
|
import hep.dataforge.fx.runGoal
|
||||||
|
import hep.dataforge.fx.ui
|
||||||
import hep.dataforge.storage.Storage
|
import hep.dataforge.storage.Storage
|
||||||
import inr.numass.NumassProperties
|
import inr.numass.NumassProperties
|
||||||
import inr.numass.data.api.NumassPoint
|
import inr.numass.data.api.NumassPoint
|
||||||
@ -27,9 +28,9 @@ import java.nio.file.Path
|
|||||||
class MainView(val context: Context = Global.getContext("viewer")) : View(title = "Numass viewer", icon = dfIconView) {
|
class MainView(val context: Context = Global.getContext("viewer")) : View(title = "Numass viewer", icon = dfIconView) {
|
||||||
|
|
||||||
private val statusBar = StatusBar();
|
private val statusBar = StatusBar();
|
||||||
private val logFragment = LogFragment().apply {
|
// private val logFragment = LogFragment().apply {
|
||||||
addLogHandler(context.logger)
|
// addLogHandler(context.logger)
|
||||||
}
|
// }
|
||||||
|
|
||||||
private val pathProperty = SimpleObjectProperty<Path>()
|
private val pathProperty = SimpleObjectProperty<Path>()
|
||||||
private var path: Path by pathProperty
|
private var path: Path by pathProperty
|
||||||
@ -37,9 +38,6 @@ class MainView(val context: Context = Global.getContext("viewer")) : View(title
|
|||||||
private val contentViewProperty = SimpleObjectProperty<UIComponent>()
|
private val contentViewProperty = SimpleObjectProperty<UIComponent>()
|
||||||
var contentView: UIComponent? by contentViewProperty
|
var contentView: UIComponent? by contentViewProperty
|
||||||
|
|
||||||
private val infoViewProperty = SimpleObjectProperty<UIComponent>()
|
|
||||||
var infoView: UIComponent? by infoViewProperty
|
|
||||||
|
|
||||||
override val root = borderpane {
|
override val root = borderpane {
|
||||||
prefHeight = 600.0
|
prefHeight = 600.0
|
||||||
prefWidth = 800.0
|
prefWidth = 800.0
|
||||||
@ -110,22 +108,17 @@ class MainView(val context: Context = Global.getContext("viewer")) : View(title
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
label(pathProperty.asString()) {
|
label(pathProperty.stringBinding{it?.toString() ?: "NOT LOADED"}) {
|
||||||
padding = Insets(0.0, 0.0, 0.0, 10.0);
|
padding = Insets(0.0, 0.0, 0.0, 10.0);
|
||||||
font = Font.font("System Bold", 13.0);
|
font = Font.font("System Bold", 13.0);
|
||||||
}
|
}
|
||||||
pane {
|
pane {
|
||||||
hgrow = Priority.ALWAYS
|
hgrow = Priority.ALWAYS
|
||||||
}
|
}
|
||||||
button("Info") {
|
// togglebutton("Console") {
|
||||||
action {
|
// isSelected = false
|
||||||
infoView?.openModal(escapeClosesWindow = true)
|
// logFragment.bindWindow(this@togglebutton)
|
||||||
}
|
// }
|
||||||
}
|
|
||||||
togglebutton("Console") {
|
|
||||||
isSelected = false
|
|
||||||
logFragment.bindWindow(this@togglebutton)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bottom = statusBar
|
bottom = statusBar
|
||||||
@ -140,7 +133,6 @@ class MainView(val context: Context = Global.getContext("viewer")) : View(title
|
|||||||
private suspend fun load(path: Path) {
|
private suspend fun load(path: Path) {
|
||||||
runLater {
|
runLater {
|
||||||
contentView = null
|
contentView = null
|
||||||
infoView = null
|
|
||||||
}
|
}
|
||||||
if (Files.isDirectory(path)) {
|
if (Files.isDirectory(path)) {
|
||||||
if (Files.exists(path.resolve(NumassDataLoader.META_FRAGMENT_NAME))) {
|
if (Files.exists(path.resolve(NumassDataLoader.META_FRAGMENT_NAME))) {
|
||||||
@ -154,7 +146,6 @@ class MainView(val context: Context = Global.getContext("viewer")) : View(title
|
|||||||
clear()
|
clear()
|
||||||
set(it.name, CachedSet(it))
|
set(it.name, CachedSet(it))
|
||||||
}
|
}
|
||||||
infoView = MetaViewer(it.meta)
|
|
||||||
} except {
|
} except {
|
||||||
alert(
|
alert(
|
||||||
type = Alert.AlertType.ERROR,
|
type = Alert.AlertType.ERROR,
|
||||||
@ -170,7 +161,6 @@ class MainView(val context: Context = Global.getContext("viewer")) : View(title
|
|||||||
NumassDirectory.INSTANCE.read(context, path)
|
NumassDirectory.INSTANCE.read(context, path)
|
||||||
} ui {
|
} ui {
|
||||||
contentView = StorageView(it as Storage)
|
contentView = StorageView(it as Storage)
|
||||||
infoView = MetaViewer(it.meta)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -196,7 +186,6 @@ class MainView(val context: Context = Global.getContext("viewer")) : View(title
|
|||||||
contentView = AmplitudeView().apply {
|
contentView = AmplitudeView().apply {
|
||||||
set(path.fileName.toString(), CachedPoint(point))
|
set(path.fileName.toString(), CachedPoint(point))
|
||||||
}
|
}
|
||||||
infoView = PointInfoView(CachedPoint(point))
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
alert(
|
alert(
|
||||||
|
Loading…
Reference in New Issue
Block a user