Removed context, process name and logger from Action API. Context specific tasks could be invoked via ActionManager.
This commit is contained in:
parent
2f30be2e6b
commit
96c01df95a
@ -23,7 +23,7 @@ task debug(dependsOn: classes, type: JavaExec) {
|
||||
|
||||
task testRun(dependsOn: classes, type: JavaExec) {
|
||||
main mainClass
|
||||
args(["--cfgFile=D:/temp/test/numass-devices.xml", "--device=thermo-1"])
|
||||
args(["--config=D:/temp/test/numass-devices.xml", "--device=thermo-1"])
|
||||
classpath = sourceSets.main.runtimeClasspath
|
||||
description "Start application using real device"
|
||||
group "debug"
|
||||
|
@ -70,7 +70,7 @@ public class PKT8App extends Application {
|
||||
if (Boolean.parseBoolean(getParameters().getNamed().getOrDefault("debug", "false"))) {
|
||||
config = loadTestConfig();
|
||||
} else {
|
||||
config = MetaFileReader.read(new File(getParameters().getNamed().getOrDefault("cfgFile", DEFAULT_CONFIG_LOCATION)));
|
||||
config = MetaFileReader.read(new File(getParameters().getNamed().getOrDefault("config", DEFAULT_CONFIG_LOCATION)));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,10 +0,0 @@
|
||||
apply plugin: 'application'
|
||||
|
||||
description = "Joint measurement for vacuum, msp and temperature measurements"
|
||||
|
||||
dependencies{
|
||||
compile project(':numass-control:cryotemp')
|
||||
compile project(':numass-control:msp')
|
||||
compile project(':numass-control:vac')
|
||||
compile project(':numass-storage:numass-server')
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
package inr.numass.control.miranda;/**
|
||||
* Created by darksnake on 13-Oct-16.
|
||||
*/
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class MirandaApp extends Application {
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage primaryStage) {
|
||||
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ import hep.dataforge.grind.Grind
|
||||
import inr.numass.storage.NMPoint
|
||||
import inr.numass.storage.NumassData
|
||||
import inr.numass.storage.NumassDataLoader
|
||||
import inr.numass.utils.NMEventGeneratorWithPulser
|
||||
import inr.numass.utils.NMEventGenerator
|
||||
import inr.numass.utils.PileUpSimulator
|
||||
import inr.numass.utils.TritiumUtils
|
||||
import org.apache.commons.math3.random.JDKRandomGenerator
|
||||
@ -18,7 +18,7 @@ import org.apache.commons.math3.random.JDKRandomGenerator
|
||||
rnd = new JDKRandomGenerator();
|
||||
|
||||
//Loading data
|
||||
File dataDir = new File("D:\\Work\\Numass\\data\\2016_10\\Fill_1\\set_28")
|
||||
File dataDir = new File("D:\\Work\\Numass\\data\\2016_10\\Fill_1\\set_24")
|
||||
if (!dataDir.exists()) {
|
||||
println "dataDir directory does not exist"
|
||||
}
|
||||
@ -40,7 +40,8 @@ PileUpSimulator buildSimulator(NMPoint point, double cr, NMPoint reference = nul
|
||||
def cfg = Grind.buildMeta(cr: cr) {
|
||||
pulser(mean: 3450, sigma: 86.45, freq: 66.43)
|
||||
}
|
||||
NMEventGeneratorWithPulser generator = new NMEventGeneratorWithPulser(rnd, cfg)
|
||||
// NMEventGenerator generator = new NMEventGeneratorWithPulser(rnd, cfg)
|
||||
NMEventGenerator generator = new NMEventGenerator(rnd, cfg)
|
||||
generator.loadSpectrum(point, reference, lowerChannel, upperChannel);
|
||||
return new PileUpSimulator(point.length * scale, rnd, generator).withUset(point.uset).generate();
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public class Numass {
|
||||
));
|
||||
writer.println("***Allowed actions***");
|
||||
|
||||
for (ActionDescriptor descriptor : ActionManager.buildFrom(context).listActions()) {
|
||||
for (ActionDescriptor descriptor : ActionManager.buildFrom(context).list()) {
|
||||
writer.print(" ");
|
||||
formatter.showDescription(descriptor);
|
||||
}
|
||||
|
@ -79,19 +79,19 @@ public class NumassPlugin extends BasicPlugin {
|
||||
loadMath(MathPlugin.buildFrom(context));
|
||||
|
||||
ActionManager actions = ActionManager.buildFrom(context);
|
||||
actions.registerAction(SlicingAction.class);
|
||||
actions.registerAction(PrepareDataAction.class);
|
||||
actions.registerAction(ReadNumassDataAction.class);
|
||||
actions.registerAction(MergeDataAction.class);
|
||||
actions.registerAction(FindBorderAction.class);
|
||||
actions.registerAction(MonitorCorrectAction.class);
|
||||
actions.registerAction(SummaryAction.class);
|
||||
actions.registerAction(PlotDataAction.class);
|
||||
actions.registerAction(PlotFitResultAction.class);
|
||||
actions.registerAction(ShowLossSpectrumAction.class);
|
||||
actions.registerAction(AdjustErrorsAction.class);
|
||||
actions.registerAction(ShowEnergySpectrumAction.class);
|
||||
actions.registerAction(SubstractSpectrumAction.class);
|
||||
actions.register(SlicingAction.class);
|
||||
actions.register(PrepareDataAction.class);
|
||||
actions.register(ReadNumassDataAction.class);
|
||||
actions.register(MergeDataAction.class);
|
||||
actions.register(FindBorderAction.class);
|
||||
actions.register(MonitorCorrectAction.class);
|
||||
actions.register(SummaryAction.class);
|
||||
actions.register(PlotDataAction.class);
|
||||
actions.register(PlotFitResultAction.class);
|
||||
actions.register(ShowLossSpectrumAction.class);
|
||||
actions.register(AdjustErrorsAction.class);
|
||||
actions.register(ShowEnergySpectrumAction.class);
|
||||
actions.register(SubstractSpectrumAction.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -38,7 +38,7 @@ public class ShowEnergySpectrumAction extends OneToOneAction<NumassData, Table>
|
||||
List<NMPoint> points = input.getNMPoints();
|
||||
|
||||
if (points.isEmpty()) {
|
||||
logger().error("Empty data");
|
||||
getLogger(inputMeta).error("Empty data");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -198,7 +198,7 @@ public class NumassWorkbenchController implements Initializable, StagePaneHolder
|
||||
}
|
||||
|
||||
private List<ActionDescriptor> listActions() {
|
||||
return ActionManager.buildFrom(getContext()).listActions();
|
||||
return ActionManager.buildFrom(getContext()).list();
|
||||
}
|
||||
|
||||
private ActionDescriptor getDescriptorForAction(String actionType) {
|
||||
|
@ -41,7 +41,7 @@ public class NumassFitScanTask extends AbstractTask<FitState> {
|
||||
} else {
|
||||
scanValues = config.getValue("scan.values", Value.of("[2.5e5, 1e6, 2.25e6, 4e6, 6.25e6, 9e6]"));
|
||||
}
|
||||
Action<Table, FitState> action = new FitAction().withContext(model.getContext()).withParentProcess(callback.workName());
|
||||
Action<Table, FitState> action = new FitAction().withContext(model.getContext());
|
||||
DataTree.Builder<FitState> resultBuilder = DataTree.builder(FitState.class);
|
||||
DataNode<Table> sourceNode = data.getCheckedNode("prepare", Table.class);
|
||||
|
||||
|
@ -17,9 +17,11 @@
|
||||
package inr.numass.workspace;
|
||||
|
||||
import hep.dataforge.actions.Action;
|
||||
import hep.dataforge.actions.ActionUtils;
|
||||
import hep.dataforge.data.DataNode;
|
||||
import hep.dataforge.meta.Meta;
|
||||
import hep.dataforge.meta.MetaBuilder;
|
||||
import hep.dataforge.plotfit.PlotFitResultAction;
|
||||
import hep.dataforge.stat.fit.FitAction;
|
||||
import hep.dataforge.stat.fit.FitState;
|
||||
import hep.dataforge.tables.Table;
|
||||
@ -50,7 +52,12 @@ public class NumassFitTask extends SingleActionTask<Table, FitState> {
|
||||
|
||||
@Override
|
||||
protected Action getAction(TaskModel model) {
|
||||
return new FitAction().withContext(model.getContext());
|
||||
Action action = new FitAction().withContext(model.getContext());
|
||||
if (model.meta().getBoolean("fit.plot", false)) {
|
||||
return ActionUtils.compose(action, new PlotFitResultAction());
|
||||
} else {
|
||||
return action;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package inr.numass.workspace;
|
||||
|
||||
import hep.dataforge.actions.Action;
|
||||
import hep.dataforge.actions.GenericAction;
|
||||
import hep.dataforge.computation.ProgressCallback;
|
||||
import hep.dataforge.context.Context;
|
||||
import hep.dataforge.data.*;
|
||||
@ -125,8 +125,8 @@ public class NumassPrepareTask extends AbstractTask<Table> {
|
||||
return builder;
|
||||
}
|
||||
|
||||
private <T, R> DataNode<R> runAction(Action<T, R> action, ProgressCallback callback, Context context, DataNode<T> data, Meta meta) {
|
||||
return action.withContext(context).withParentProcess(callback.workName()).run(data, meta);
|
||||
private <T, R> DataNode<R> runAction(GenericAction<T, R> action, ProgressCallback callback, Context context, DataNode<T> data, Meta meta) {
|
||||
return action.withContext(context).run(data, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -48,7 +48,7 @@ public class NumassTableFilterTask extends SingleActionTask<Table, Table> {
|
||||
protected Table execute(String name, Laminate inputMeta, Table input) {
|
||||
double uLo = inputMeta.getDouble("filter.from", 0);
|
||||
double uHi = inputMeta.getDouble("filter.to", Double.POSITIVE_INFINITY);
|
||||
getLogger().debug("Filtering finished");
|
||||
getLogger(inputMeta).debug("Filtering finished");
|
||||
return TableTransform.filter(input, "Uset", uLo, uHi);
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ if (!hasProperty('mainClass')) {
|
||||
}
|
||||
mainClassName = mainClass
|
||||
|
||||
version = "0.3.5"
|
||||
version = "0.3.6"
|
||||
|
||||
description = "The viewer for numass data"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user