Added logger error for goal failure
This commit is contained in:
parent
2a6c7b75a5
commit
1b3e48c94f
@ -28,7 +28,6 @@ import inr.numass.data.api.NumassPoint.Companion.HV_KEY
|
|||||||
import inr.numass.data.api.NumassSet
|
import inr.numass.data.api.NumassSet
|
||||||
import inr.numass.data.api.SignalProcessor
|
import inr.numass.data.api.SignalProcessor
|
||||||
import java.lang.IllegalArgumentException
|
import java.lang.IllegalArgumentException
|
||||||
import java.util.*
|
|
||||||
import java.util.stream.Stream
|
import java.util.stream.Stream
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -51,7 +50,7 @@ abstract class AbstractAnalyzer @JvmOverloads constructor(private val processor:
|
|||||||
event.amplitude.toInt() in loChannel..(upChannel - 1)
|
event.amplitude.toInt() in loChannel..(upChannel - 1)
|
||||||
}
|
}
|
||||||
if (meta.getBoolean("sort", false)) {
|
if (meta.getBoolean("sort", false)) {
|
||||||
res = res.sorted(Comparator.comparing<NumassEvent, Long> { it.timeOffset })
|
res = res.sorted(compareBy { it.timeOffset })
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
@ -60,9 +60,10 @@ class TimeAnalyzer(processor: SignalProcessor? = null) : AbstractAnalyzer(proces
|
|||||||
|
|
||||||
val chunkSize = config.getInt("chunkSize", 1000)
|
val chunkSize = config.getInt("chunkSize", 1000)
|
||||||
|
|
||||||
val res = getEventsWithDelay(block, config).asSequence().chunked(chunkSize) {
|
val res = getEventsWithDelay(block, config)
|
||||||
analyzeSequence(it.asSequence(), t0)
|
.chunked(chunkSize) { analyzeSequence(it.asSequence(), t0) }
|
||||||
}.toList().mean(config.getEnum("mean", WEIGHTED))
|
.toList()
|
||||||
|
.mean(config.getEnum("mean", WEIGHTED))
|
||||||
|
|
||||||
return ValueMap.Builder(res)
|
return ValueMap.Builder(res)
|
||||||
.putValue(NumassAnalyzer.WINDOW_KEY, arrayOf(loChannel, upChannel))
|
.putValue(NumassAnalyzer.WINDOW_KEY, arrayOf(loChannel, upChannel))
|
||||||
@ -98,11 +99,9 @@ class TimeAnalyzer(processor: SignalProcessor? = null) : AbstractAnalyzer(proces
|
|||||||
|
|
||||||
override fun analyzeParent(point: ParentBlock, config: Meta): Values {
|
override fun analyzeParent(point: ParentBlock, config: Meta): Values {
|
||||||
//Average count rates, do not sum events
|
//Average count rates, do not sum events
|
||||||
val res = point.blocks
|
val res = point.blocks.map { it -> analyze(it, config) }
|
||||||
.map { it -> analyze(it, config) }
|
|
||||||
.mean(config.getEnum("mean", WEIGHTED))
|
|
||||||
|
|
||||||
val map = HashMap(res.asMap())
|
val map = HashMap(res.mean(config.getEnum("mean", WEIGHTED)).asMap())
|
||||||
if (point is NumassPoint) {
|
if (point is NumassPoint) {
|
||||||
map[HV_KEY] = Value.of(point.voltage)
|
map[HV_KEY] = Value.of(point.voltage)
|
||||||
}
|
}
|
||||||
@ -122,6 +121,15 @@ class TimeAnalyzer(processor: SignalProcessor? = null) : AbstractAnalyzer(proces
|
|||||||
*/
|
*/
|
||||||
private fun List<Values>.mean(method: AveragingMethod): Values {
|
private fun List<Values>.mean(method: AveragingMethod): Values {
|
||||||
|
|
||||||
|
if(this.isEmpty()){
|
||||||
|
return ValueMap.Builder()
|
||||||
|
.putValue(LENGTH_KEY, 0)
|
||||||
|
.putValue(COUNT_KEY, 0)
|
||||||
|
.putValue(COUNT_RATE_KEY, 0)
|
||||||
|
.putValue(COUNT_RATE_ERROR_KEY, 0)
|
||||||
|
.build()
|
||||||
|
}
|
||||||
|
|
||||||
val totalTime = sumByDouble { it.getDouble(LENGTH_KEY) }
|
val totalTime = sumByDouble { it.getDouble(LENGTH_KEY) }
|
||||||
|
|
||||||
val (countRate, countRateDispersion) = when (method) {
|
val (countRate, countRateDispersion) = when (method) {
|
||||||
|
@ -12,6 +12,7 @@ import inr.numass.data.analyzers.TimeAnalyzer
|
|||||||
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.api.SimpleNumassPoint
|
import inr.numass.data.api.SimpleNumassPoint
|
||||||
|
import inr.numass.data.channel
|
||||||
import inr.numass.data.storage.NumassStorageFactory
|
import inr.numass.data.storage.NumassStorageFactory
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
@ -22,7 +23,7 @@ fun main(args: Array<String>) {
|
|||||||
dataDir = "D:\\Work\\Numass\\data\\2018_04"
|
dataDir = "D:\\Work\\Numass\\data\\2018_04"
|
||||||
}
|
}
|
||||||
|
|
||||||
val storage = NumassStorageFactory.buildLocal(context, "Fill_4/Scattering_1", true, false);
|
val storage = NumassStorageFactory.buildLocal(context, "Fill_4", true, false);
|
||||||
|
|
||||||
val meta = buildMeta {
|
val meta = buildMeta {
|
||||||
"t0" to 3000
|
"t0" to 3000
|
||||||
@ -30,7 +31,7 @@ fun main(args: Array<String>) {
|
|||||||
"t0Step" to 100
|
"t0Step" to 100
|
||||||
"chunkSize" to 3000
|
"chunkSize" to 3000
|
||||||
"mean" to TimeAnalyzer.AveragingMethod.ARITHMETIC
|
"mean" to TimeAnalyzer.AveragingMethod.ARITHMETIC
|
||||||
"separateParallelBlocks" to true
|
//"separateParallelBlocks" to true
|
||||||
"window" to {
|
"window" to {
|
||||||
"lo" to 0
|
"lo" to 0
|
||||||
"up" to 4000
|
"up" to 4000
|
||||||
@ -49,12 +50,13 @@ fun main(args: Array<String>) {
|
|||||||
|
|
||||||
val all = NumassDataUtils.join("sum", loaders)
|
val all = NumassDataUtils.join("sum", loaders)
|
||||||
|
|
||||||
val hvs = listOf(18500.0, 18600.0, 18995.0, 19000.0)//listOf(12000.0, 14000.0, 16000.0)//, 15000d, 15200d, 15400d, 15600d, 15800d]
|
val hvs = listOf(12000.0, 14000.0, 16000.0)//, 15000d, 15200d, 15400d, 15600d, 15800d]
|
||||||
|
//listOf(18500.0, 18600.0, 18995.0, 19000.0)
|
||||||
|
|
||||||
val data = DataSet.edit(NumassPoint::class).apply {
|
val data = DataSet.edit(NumassPoint::class).apply {
|
||||||
hvs.forEach { hv ->
|
hvs.forEach { hv ->
|
||||||
val points = all.points.filter {
|
val points = all.points.filter {
|
||||||
it.voltage == hv
|
it.voltage == hv && it.channel == 0
|
||||||
}.toList()
|
}.toList()
|
||||||
if (!points.isEmpty()) {
|
if (!points.isEmpty()) {
|
||||||
putStatic(
|
putStatic(
|
||||||
|
Loading…
Reference in New Issue
Block a user