Values + Binary to kotlin
This commit is contained in:
parent
42a69d1334
commit
42594e119e
@ -122,8 +122,8 @@ class PKT8Device(context: Context, meta: Meta) : PortSensor(context, meta) {
|
|||||||
|
|
||||||
//update parameters from meta
|
//update parameters from meta
|
||||||
meta.optValue("pga").ifPresent {
|
meta.optValue("pga").ifPresent {
|
||||||
logger.info("Setting dynamic range to " + it.getInt())
|
logger.info("Setting dynamic range to " + it.int)
|
||||||
val response = sendAndWait("g" + it.getInt()).trim { it <= ' ' }
|
val response = sendAndWait("g" + it.int).trim { it <= ' ' }
|
||||||
if (response.contains("=")) {
|
if (response.contains("=")) {
|
||||||
updateState(PGA, Integer.parseInt(response.substring(4)))
|
updateState(PGA, Integer.parseInt(response.substring(4)))
|
||||||
} else {
|
} else {
|
||||||
|
@ -84,26 +84,26 @@ class LambdaMagnet(private val controller: LambdaPortController, meta: Meta) : A
|
|||||||
|
|
||||||
//output values of current and voltage
|
//output values of current and voltage
|
||||||
private var outCurrent by valueState("outCurrent", getter = { s2d(controller.getParameter(address, "PC")) }) { _, value ->
|
private var outCurrent by valueState("outCurrent", getter = { s2d(controller.getParameter(address, "PC")) }) { _, value ->
|
||||||
setCurrent(value.getDouble())
|
setCurrent(value.double)
|
||||||
return@valueState value
|
return@valueState value
|
||||||
}.doubleDelegate
|
}.doubleDelegate
|
||||||
|
|
||||||
private var outVoltage = valueState("outVoltage", getter = { s2d(controller.getParameter(address, "PV")) }) { _, value ->
|
private var outVoltage = valueState("outVoltage", getter = { s2d(controller.getParameter(address, "PV")) }) { _, value ->
|
||||||
if (!controller.setParameter(address, "PV", value.getDouble())) {
|
if (!controller.setParameter(address, "PV", value.double)) {
|
||||||
notifyError("Can't set the target voltage")
|
notifyError("Can't set the target voltage")
|
||||||
}
|
}
|
||||||
return@valueState value
|
return@valueState value
|
||||||
}.doubleDelegate
|
}.doubleDelegate
|
||||||
|
|
||||||
val output = valueState("output", getter = { controller.talk(address, "OUT?") == "OK" }) { _, value ->
|
val output = valueState("output", getter = { controller.talk(address, "OUT?") == "OK" }) { _, value ->
|
||||||
setOutputMode(value.getBoolean())
|
setOutputMode(value.boolean)
|
||||||
if (!value.getBoolean()) {
|
if (!value.boolean) {
|
||||||
status = MagnetStatus.OFF
|
status = MagnetStatus.OFF
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val monitoring = valueState("monitoring", getter = { monitorTask != null }) { _, value ->
|
val monitoring = valueState("monitoring", getter = { monitorTask != null }) { _, value ->
|
||||||
if (value.getBoolean()) {
|
if (value.boolean) {
|
||||||
startMonitorTask()
|
startMonitorTask()
|
||||||
} else {
|
} else {
|
||||||
stopMonitorTask()
|
stopMonitorTask()
|
||||||
@ -115,7 +115,7 @@ class LambdaMagnet(private val controller: LambdaPortController, meta: Meta) : A
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
val updating = valueState("updating", getter = { updateTask != null }) { _, value ->
|
val updating = valueState("updating", getter = { updateTask != null }) { _, value ->
|
||||||
if (value.getBoolean()) {
|
if (value.boolean) {
|
||||||
startUpdateTask()
|
startUpdateTask()
|
||||||
} else {
|
} else {
|
||||||
stopUpdateTask()
|
stopUpdateTask()
|
||||||
@ -235,7 +235,7 @@ class LambdaMagnet(private val controller: LambdaPortController, meta: Meta) : A
|
|||||||
stopUpdateTask()
|
stopUpdateTask()
|
||||||
updateTask = repeatOnDeviceThread(Duration.ofMillis(delay)) {
|
updateTask = repeatOnDeviceThread(Duration.ofMillis(delay)) {
|
||||||
try {
|
try {
|
||||||
val measuredI = current.readBlocking().getDouble()
|
val measuredI = current.readBlocking().double
|
||||||
val targetI = target.doubleValue
|
val targetI = target.doubleValue
|
||||||
if (Math.abs(measuredI - targetI) > CURRENT_PRECISION) {
|
if (Math.abs(measuredI - targetI) > CURRENT_PRECISION) {
|
||||||
val nextI = nextI(measuredI, targetI)
|
val nextI = nextI(measuredI, targetI)
|
||||||
|
@ -90,13 +90,13 @@ class MagnetDisplay : DeviceDisplayFX<LambdaMagnet>() {
|
|||||||
|
|
||||||
device.states.getState<ValueState>("status")?.onChange{
|
device.states.getState<ValueState>("status")?.onChange{
|
||||||
runLater {
|
runLater {
|
||||||
this.statusLabel.text = it.getString()
|
this.statusLabel.text = it.string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
device.output.onChange {
|
device.output.onChange {
|
||||||
Platform.runLater {
|
Platform.runLater {
|
||||||
if (it.getBoolean()) {
|
if (it.boolean) {
|
||||||
this.statusLabel.textFill = Color.BLUE
|
this.statusLabel.textFill = Color.BLUE
|
||||||
} else {
|
} else {
|
||||||
this.statusLabel.textFill = Color.BLACK
|
this.statusLabel.textFill = Color.BLACK
|
||||||
@ -105,7 +105,7 @@ class MagnetDisplay : DeviceDisplayFX<LambdaMagnet>() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
device.updating.onChange {
|
device.updating.onChange {
|
||||||
val updateTaskRunning = it.getBoolean()
|
val updateTaskRunning = it.boolean
|
||||||
runLater {
|
runLater {
|
||||||
this.setButton.isSelected = updateTaskRunning
|
this.setButton.isSelected = updateTaskRunning
|
||||||
targetIField.isDisable = updateTaskRunning
|
targetIField.isDisable = updateTaskRunning
|
||||||
@ -114,7 +114,7 @@ class MagnetDisplay : DeviceDisplayFX<LambdaMagnet>() {
|
|||||||
|
|
||||||
device.monitoring.onChange {
|
device.monitoring.onChange {
|
||||||
runLater {
|
runLater {
|
||||||
monitorButton.isScaleShape = it.getBoolean()
|
monitorButton.isScaleShape = it.boolean
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,17 +69,17 @@ class MspDevice(context: Context, meta: Meta) : PortSensor(context, meta) {
|
|||||||
|
|
||||||
val controlled = valueState(CONTROLLED_STATE) { value ->
|
val controlled = valueState(CONTROLLED_STATE) { value ->
|
||||||
runOnDeviceThread {
|
runOnDeviceThread {
|
||||||
val res = control(value.getBoolean())
|
val res = control(value.boolean)
|
||||||
updateState(CONTROLLED_STATE, res)
|
updateState(CONTROLLED_STATE, res)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val filament = valueState("filament") { value ->
|
val filament = valueState("filament") { value ->
|
||||||
selectFilament(value.getInt())
|
selectFilament(value.int)
|
||||||
}
|
}
|
||||||
|
|
||||||
val filamentOn = valueState("filamentOn") { value ->
|
val filamentOn = valueState("filamentOn") { value ->
|
||||||
setFilamentOn(value.getBoolean())
|
setFilamentOn(value.boolean)
|
||||||
}
|
}
|
||||||
|
|
||||||
var peakJumpZero: Double by valueState("peakJump.zero").doubleDelegate
|
var peakJumpZero: Double by valueState("peakJump.zero").doubleDelegate
|
||||||
|
@ -141,7 +141,7 @@ class MspDisplay() : DeviceDisplayFX<MspDevice>(), NamedValueListener {
|
|||||||
device.filamentOn.asBooleanProperty().bindBidirectional(selectedProperty())
|
device.filamentOn.asBooleanProperty().bindBidirectional(selectedProperty())
|
||||||
}
|
}
|
||||||
deviceStateIndicator(this@MspDisplay, "filamentStatus", false) {
|
deviceStateIndicator(this@MspDisplay, "filamentStatus", false) {
|
||||||
when (it.getString()) {
|
when (it.string) {
|
||||||
"ON" -> Paint.valueOf("red")
|
"ON" -> Paint.valueOf("red")
|
||||||
"OFF" -> Paint.valueOf("blue")
|
"OFF" -> Paint.valueOf("blue")
|
||||||
"WARM-UP", "COOL-DOWN" -> Paint.valueOf("yellow")
|
"WARM-UP", "COOL-DOWN" -> Paint.valueOf("yellow")
|
||||||
@ -185,13 +185,13 @@ class MspDisplay() : DeviceDisplayFX<MspDevice>(), NamedValueListener {
|
|||||||
val pl = plottables[change.key] as TimePlot?
|
val pl = plottables[change.key] as TimePlot?
|
||||||
val value = change.valueAdded
|
val value = change.valueAdded
|
||||||
if (pl != null) {
|
if (pl != null) {
|
||||||
if (value.getDouble() > 0) {
|
if (value.double > 0) {
|
||||||
pl.put(value)
|
pl.put(value)
|
||||||
} else {
|
} else {
|
||||||
pl.put(Value.NULL)
|
pl.put(Value.NULL)
|
||||||
}
|
}
|
||||||
val titleBase = pl.config.getString("titleBase")
|
val titleBase = pl.config.getString("titleBase")
|
||||||
val title = String.format("%s (%.4g)", titleBase, value.getDouble())
|
val title = String.format("%s (%.4g)", titleBase, value.double)
|
||||||
pl.configureValue("title", title)
|
pl.configureValue("title", title)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ fun Indicator.bind(connection: DeviceDisplayFX<*>, state: String, transform: ((V
|
|||||||
bind(connection.valueStateProperty(state)) {
|
bind(connection.valueStateProperty(state)) {
|
||||||
when {
|
when {
|
||||||
it.isNull -> Color.GRAY
|
it.isNull -> Color.GRAY
|
||||||
it.getBoolean() -> Color.GREEN
|
it.boolean -> Color.GREEN
|
||||||
else -> Color.RED
|
else -> Color.RED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -119,7 +119,7 @@ fun Node.deviceStateToggle(connection: DeviceDisplayFX<*>, state: String, title:
|
|||||||
}
|
}
|
||||||
connection.valueStateProperty(state).onChange {
|
connection.valueStateProperty(state).onChange {
|
||||||
runLater {
|
runLater {
|
||||||
isSelected = it?.getBoolean() ?: false
|
isSelected = it?.boolean ?: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ class MKSVacDevice(context: Context, meta: Meta) : PortSensor(context, meta) {
|
|||||||
|
|
||||||
var power by valueState("power", getter = { talk("FP?") == "ON" }) { old, value ->
|
var power by valueState("power", getter = { talk("FP?") == "ON" }) { old, value ->
|
||||||
if (old != value) {
|
if (old != value) {
|
||||||
setPowerOn(value.getBoolean())
|
setPowerOn(value.boolean)
|
||||||
}
|
}
|
||||||
}.booleanDelegate
|
}.booleanDelegate
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ open class VacDisplay : DeviceDisplayFX<Sensor>() {
|
|||||||
prefHeight = 60.0
|
prefHeight = 60.0
|
||||||
alignment = Pos.CENTER_RIGHT
|
alignment = Pos.CENTER_RIGHT
|
||||||
textProperty().bind(valueProperty)
|
textProperty().bind(valueProperty)
|
||||||
device.meta.optValue("color").ifPresent { colorValue -> textFill = Color.valueOf(colorValue.getString()) }
|
device.meta.optValue("color").ifPresent { colorValue -> textFill = Color.valueOf(colorValue.string) }
|
||||||
style {
|
style {
|
||||||
fontSize = 24.pt
|
fontSize = 24.pt
|
||||||
fontWeight = FontWeight.BOLD
|
fontWeight = FontWeight.BOLD
|
||||||
|
@ -85,7 +85,7 @@ interface NumassAnalyzer {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
fun getCount(block: NumassBlock, config: Meta): Long {
|
fun getCount(block: NumassBlock, config: Meta): Long {
|
||||||
return analyze(block, config).getValue(COUNT_KEY).getNumber().toLong()
|
return analyze(block, config).getValue(COUNT_KEY).number.toLong()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -96,7 +96,7 @@ interface NumassAnalyzer {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
fun getLength(block: NumassBlock, config: Meta = Meta.empty()): Long {
|
fun getLength(block: NumassBlock, config: Meta = Meta.empty()): Long {
|
||||||
return analyze(block, config).getValue(LENGTH_KEY).getNumber().toLong()
|
return analyze(block, config).getValue(LENGTH_KEY).number.toLong()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getAmplitudeSpectrum(block: NumassBlock, config: Meta = Meta.empty()): Table {
|
fun getAmplitudeSpectrum(block: NumassBlock, config: Meta = Meta.empty()): Table {
|
||||||
@ -133,7 +133,7 @@ interface NumassAnalyzer {
|
|||||||
fun Table.countInWindow(loChannel: Short, upChannel: Short): Long {
|
fun Table.countInWindow(loChannel: Short, upChannel: Short): Long {
|
||||||
return this.rows.filter { row ->
|
return this.rows.filter { row ->
|
||||||
row.getInt(NumassAnalyzer.CHANNEL_KEY) in loChannel..(upChannel - 1)
|
row.getInt(NumassAnalyzer.CHANNEL_KEY) in loChannel..(upChannel - 1)
|
||||||
}.mapToLong { it -> it.getValue(NumassAnalyzer.COUNT_KEY).getNumber().toLong() }.sum()
|
}.mapToLong { it -> it.getValue(NumassAnalyzer.COUNT_KEY).number.toLong() }.sum()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -200,10 +200,10 @@ fun Table.withBinning(binSize: Int, loChannel: Int? = null, upChannel: Int? = nu
|
|||||||
val builder = ListTable.Builder(format)
|
val builder = ListTable.Builder(format)
|
||||||
|
|
||||||
var chan = loChannel
|
var chan = loChannel
|
||||||
?: this.getColumn(NumassAnalyzer.CHANNEL_KEY).stream().mapToInt { it.getInt() }.min().orElse(0)
|
?: this.getColumn(NumassAnalyzer.CHANNEL_KEY).stream().mapToInt { it.int }.min().orElse(0)
|
||||||
|
|
||||||
val top = upChannel
|
val top = upChannel
|
||||||
?: this.getColumn(NumassAnalyzer.CHANNEL_KEY).stream().mapToInt { it.getInt() }.max().orElse(1)
|
?: this.getColumn(NumassAnalyzer.CHANNEL_KEY).stream().mapToInt { it.int }.max().orElse(1)
|
||||||
|
|
||||||
while (chan < top - binSize) {
|
while (chan < top - binSize) {
|
||||||
val count = AtomicLong(0)
|
val count = AtomicLong(0)
|
||||||
@ -216,7 +216,7 @@ fun Table.withBinning(binSize: Int, loChannel: Int? = null, upChannel: Int? = nu
|
|||||||
this.rows.filter { row ->
|
this.rows.filter { row ->
|
||||||
row.getInt(NumassAnalyzer.CHANNEL_KEY) in binLo..(binUp - 1)
|
row.getInt(NumassAnalyzer.CHANNEL_KEY) in binLo..(binUp - 1)
|
||||||
}.forEach { row ->
|
}.forEach { row ->
|
||||||
count.addAndGet(row.getValue(NumassAnalyzer.COUNT_KEY, 0).getLong())
|
count.addAndGet(row.getValue(NumassAnalyzer.COUNT_KEY, 0).long)
|
||||||
countRate.accumulateAndGet(row.getDouble(NumassAnalyzer.COUNT_RATE_KEY, 0.0)) { d1, d2 -> d1 + d2 }
|
countRate.accumulateAndGet(row.getDouble(NumassAnalyzer.COUNT_RATE_KEY, 0.0)) { d1, d2 -> d1 + d2 }
|
||||||
countRateDispersion.accumulateAndGet(Math.pow(row.getDouble(NumassAnalyzer.COUNT_RATE_ERROR_KEY, 0.0), 2.0)) { d1, d2 -> d1 + d2 }
|
countRateDispersion.accumulateAndGet(Math.pow(row.getDouble(NumassAnalyzer.COUNT_RATE_ERROR_KEY, 0.0), 2.0)) { d1, d2 -> d1 + d2 }
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package inr.numass.scripts.workspace
|
|||||||
|
|
||||||
import hep.dataforge.actions.ActionUtils
|
import hep.dataforge.actions.ActionUtils
|
||||||
import hep.dataforge.context.Context
|
import hep.dataforge.context.Context
|
||||||
import hep.dataforge.context.IOManager
|
import hep.dataforge.io.IOManager
|
||||||
import inr.numass.NumassPlugin
|
import inr.numass.NumassPlugin
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,7 +18,7 @@ package inr.numass;
|
|||||||
import hep.dataforge.actions.ActionUtils;
|
import hep.dataforge.actions.ActionUtils;
|
||||||
import hep.dataforge.context.Context;
|
import hep.dataforge.context.Context;
|
||||||
import hep.dataforge.context.Global;
|
import hep.dataforge.context.Global;
|
||||||
import hep.dataforge.context.IOManager;
|
import hep.dataforge.io.IOManager;
|
||||||
import hep.dataforge.io.MetaFileReader;
|
import hep.dataforge.io.MetaFileReader;
|
||||||
import hep.dataforge.meta.Meta;
|
import hep.dataforge.meta.Meta;
|
||||||
import org.apache.commons.cli.*;
|
import org.apache.commons.cli.*;
|
||||||
|
@ -194,7 +194,7 @@ fun getFSS(context: Context, meta: Meta): FSS? {
|
|||||||
fun pointExpression(expression: String, point: Values): Double {
|
fun pointExpression(expression: String, point: Values): Double {
|
||||||
val exprParams = HashMap<String, Any>()
|
val exprParams = HashMap<String, Any>()
|
||||||
//Adding all point values to expression parameters
|
//Adding all point values to expression parameters
|
||||||
point.names.forEach { name -> exprParams.put(name, point.getValue(name).value()) }
|
point.names.forEach { name -> exprParams.put(name, point.getValue(name).value) }
|
||||||
//Adding aliases for commonly used parameters
|
//Adding aliases for commonly used parameters
|
||||||
exprParams.put("T", point.getDouble("length"))
|
exprParams.put("T", point.getDouble("length"))
|
||||||
exprParams.put("U", point.getDouble("voltage"))
|
exprParams.put("U", point.getDouble("voltage"))
|
||||||
@ -210,7 +210,7 @@ fun addSetMarkers(frame: JFreeChartFrame, sets: Collection<NumassSet>) {
|
|||||||
val paint = Color(0.0f, 0.0f, 1.0f, 0.1f)
|
val paint = Color(0.0f, 0.0f, 1.0f, 0.1f)
|
||||||
sets.stream().forEach {
|
sets.stream().forEach {
|
||||||
val start = it.startTime;
|
val start = it.startTime;
|
||||||
val stop = it.meta.optValue("end_time").map { it.getTime() }
|
val stop = it.meta.optValue("end_time").map { it.time }
|
||||||
.orElse(start.plusSeconds(300))
|
.orElse(start.plusSeconds(300))
|
||||||
.minusSeconds(60)
|
.minusSeconds(60)
|
||||||
val marker = IntervalMarker(start.toEpochMilli().toDouble(), stop.toEpochMilli().toDouble(), paint)
|
val marker = IntervalMarker(start.toEpochMilli().toDouble(), stop.toEpochMilli().toDouble(), paint)
|
||||||
@ -252,10 +252,10 @@ fun Values.unbox(): Map<String, Any?> {
|
|||||||
for (field in this.names) {
|
for (field in this.names) {
|
||||||
val value = this.getValue(field)
|
val value = this.getValue(field)
|
||||||
val obj: Any? = when (value.type) {
|
val obj: Any? = when (value.type) {
|
||||||
ValueType.BOOLEAN -> value.getBoolean()
|
ValueType.BOOLEAN -> value.boolean
|
||||||
ValueType.NUMBER -> value.getDouble()
|
ValueType.NUMBER -> value.double
|
||||||
ValueType.STRING -> value.getString()
|
ValueType.STRING -> value.string
|
||||||
ValueType.TIME -> value.getTime()
|
ValueType.TIME -> value.time
|
||||||
ValueType.NULL -> null
|
ValueType.NULL -> null
|
||||||
}
|
}
|
||||||
res.put(field, obj)
|
res.put(field, obj)
|
||||||
|
@ -68,15 +68,15 @@ class MergeDataAction : ManyToOneAction<Table, Table>() {
|
|||||||
return dp1
|
return dp1
|
||||||
}
|
}
|
||||||
|
|
||||||
val voltage = dp1.getValue(NumassPoint.HV_KEY).getDouble()
|
val voltage = dp1.getValue(NumassPoint.HV_KEY).double
|
||||||
val t1 = dp1.getValue(NumassPoint.LENGTH_KEY).getDouble()
|
val t1 = dp1.getValue(NumassPoint.LENGTH_KEY).double
|
||||||
val t2 = dp2.getValue(NumassPoint.LENGTH_KEY).getDouble()
|
val t2 = dp2.getValue(NumassPoint.LENGTH_KEY).double
|
||||||
val time = t1 + t2
|
val time = t1 + t2
|
||||||
|
|
||||||
val total = (dp1.getValue(NumassAnalyzer.COUNT_KEY).getInt() + dp2.getValue(NumassAnalyzer.COUNT_KEY).getInt()).toLong()
|
val total = (dp1.getValue(NumassAnalyzer.COUNT_KEY).int + dp2.getValue(NumassAnalyzer.COUNT_KEY).int).toLong()
|
||||||
|
|
||||||
val cr1 = dp1.getValue(NumassAnalyzer.COUNT_RATE_KEY).getDouble()
|
val cr1 = dp1.getValue(NumassAnalyzer.COUNT_RATE_KEY).double
|
||||||
val cr2 = dp2.getValue(NumassAnalyzer.COUNT_RATE_KEY).getDouble()
|
val cr2 = dp2.getValue(NumassAnalyzer.COUNT_RATE_KEY).double
|
||||||
|
|
||||||
val cr = (cr1 * t1 + cr2 * t2) / (t1 + t2)
|
val cr = (cr1 * t1 + cr2 * t2) / (t1 + t2)
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ class MergeDataAction : ManyToOneAction<Table, Table>() {
|
|||||||
throw IllegalArgumentException()
|
throw IllegalArgumentException()
|
||||||
}
|
}
|
||||||
for (dp in d) {
|
for (dp in d) {
|
||||||
val uset = dp.getValue(NumassPoint.HV_KEY).getDouble()
|
val uset = dp.getValue(NumassPoint.HV_KEY).double
|
||||||
if (!points.containsKey(uset)) {
|
if (!points.containsKey(uset)) {
|
||||||
points.put(uset, ArrayList())
|
points.put(uset, ArrayList())
|
||||||
}
|
}
|
||||||
|
@ -42,11 +42,11 @@ private fun createSummaryNode(storage: Storage): MetaBuilder {
|
|||||||
// .setNode("meta", point.meta)
|
// .setNode("meta", point.meta)
|
||||||
|
|
||||||
point.meta.useValue("acquisition_time") {
|
point.meta.useValue("acquisition_time") {
|
||||||
pointBuilder.setValue("length", it.getDouble())
|
pointBuilder.setValue("length", it.double)
|
||||||
}
|
}
|
||||||
|
|
||||||
point.meta.useValue("events") {
|
point.meta.useValue("events") {
|
||||||
pointBuilder.setValue("count", it.getList().stream().mapToInt { it.getInt() }.sum())
|
pointBuilder.setValue("count", it.list.stream().mapToInt { it.int }.sum())
|
||||||
}
|
}
|
||||||
|
|
||||||
setBuilder.putNode(pointBuilder)
|
setBuilder.putNode(pointBuilder)
|
||||||
|
@ -30,8 +30,8 @@ object NumassFitScanTask : AbstractTask<FitResult>() {
|
|||||||
|
|
||||||
val scanValues: Value = if (config.hasValue("masses")) {
|
val scanValues: Value = if (config.hasValue("masses")) {
|
||||||
ListValue(config.getValue("masses")
|
ListValue(config.getValue("masses")
|
||||||
.getList().stream()
|
.list.stream()
|
||||||
.map { it -> Math.pow(it.getDouble() * 1000, 2.0) }
|
.map { it -> Math.pow(it.double * 1000, 2.0) }
|
||||||
.collect(Collectors.toList<Any>())
|
.collect(Collectors.toList<Any>())
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
@ -46,11 +46,11 @@ object NumassFitScanTask : AbstractTask<FitResult>() {
|
|||||||
|
|
||||||
val fitConfig = config.getMeta("fit")
|
val fitConfig = config.getMeta("fit")
|
||||||
sourceNode.dataStream().forEach { table ->
|
sourceNode.dataStream().forEach { table ->
|
||||||
for (i in 0 until scanValues.getList().size) {
|
for (i in 0 until scanValues.list.size) {
|
||||||
val `val` = scanValues.getList()[i]
|
val `val` = scanValues.list[i]
|
||||||
val overrideMeta = MetaBuilder(fitConfig)
|
val overrideMeta = MetaBuilder(fitConfig)
|
||||||
|
|
||||||
val resultName = String.format("%s[%s=%s]", table.name, scanParameter, `val`.getString())
|
val resultName = String.format("%s[%s=%s]", table.name, scanParameter, `val`.string)
|
||||||
// overrideMeta.setValue("@resultName", String.format("%s[%s=%s]", table.getName(), scanParameter, val.getString()));
|
// overrideMeta.setValue("@resultName", String.format("%s[%s=%s]", table.getName(), scanParameter, val.getString()));
|
||||||
|
|
||||||
if (overrideMeta.hasMeta("params.$scanParameter")) {
|
if (overrideMeta.hasMeta("params.$scanParameter")) {
|
||||||
|
Loading…
Reference in New Issue
Block a user