KTask join fix
This commit is contained in:
parent
cce0372cf8
commit
4ccecbe4ed
@ -272,7 +272,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")
|
||||||
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 ->
|
||||||
@ -280,6 +280,7 @@ val histogramTask = task("histogram") {
|
|||||||
configure(meta.getMetaOrEmpty("histogram"))
|
configure(meta.getMetaOrEmpty("histogram"))
|
||||||
configure {
|
configure {
|
||||||
meta.useMeta("analyzer") { putNode(it) }
|
meta.useMeta("analyzer") { putNode(it) }
|
||||||
|
setValue("@target", meta.getString("@target",meta.name))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
join<NumassSet, Table> { data ->
|
join<NumassSet, Table> { data ->
|
||||||
@ -299,6 +300,7 @@ val histogramTask = task("histogram") {
|
|||||||
analyzer.getAmplitudeSpectrum(MetaBlock(it.value))
|
analyzer.getAmplitudeSpectrum(MetaBlock(it.value))
|
||||||
}
|
}
|
||||||
.forEach { u, spectrum ->
|
.forEach { u, spectrum ->
|
||||||
|
log.report("Aggregating data from U = $u")
|
||||||
spectrum.forEach {
|
spectrum.forEach {
|
||||||
val channel = it[CHANNEL_KEY].int
|
val channel = it[CHANNEL_KEY].int
|
||||||
val count = it[COUNT_KEY].long
|
val count = it[COUNT_KEY].long
|
||||||
@ -309,12 +311,16 @@ val histogramTask = task("histogram") {
|
|||||||
names.add("U$u")
|
names.add("U$u")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.report("Combining spectra")
|
||||||
val format = MetaTableFormat.forNames(names)
|
val format = MetaTableFormat.forNames(names)
|
||||||
val table = buildTable(format) {
|
val table = buildTable(format) {
|
||||||
aggregator.forEach { channel, counters ->
|
aggregator.forEach { channel, counters ->
|
||||||
val values: MutableMap<String, Any> = HashMap()
|
val values: MutableMap<String, Any> = HashMap()
|
||||||
values["channel"] = channel
|
values["channel"] = channel
|
||||||
counters.forEach { u, counter -> values["U$u"] = counter.get() }
|
counters.forEach { u, counter -> values["U$u"] = counter.get() }
|
||||||
|
format.names.forEach {
|
||||||
|
values.putIfAbsent(it, 0)
|
||||||
|
}
|
||||||
row(values)
|
row(values)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user