diff --git a/numass-data-proto/src/main/kotlin/ru/inr/mass/data/proto/TaggedNumassEnvelopeFormat.kt b/numass-data-proto/src/main/kotlin/ru/inr/mass/data/proto/TaggedNumassEnvelopeFormat.kt index 7be3302..5266e8d 100644 --- a/numass-data-proto/src/main/kotlin/ru/inr/mass/data/proto/TaggedNumassEnvelopeFormat.kt +++ b/numass-data-proto/src/main/kotlin/ru/inr/mass/data/proto/TaggedNumassEnvelopeFormat.kt @@ -103,7 +103,7 @@ public class TaggedNumassEnvelopeFormat(private val io: IOPlugin) : EnvelopeForm IOFormat.NAME_KEY put name.toString() } - companion object : EnvelopeFormatFactory { + public companion object : EnvelopeFormatFactory { private const val START_SEQUENCE = "#!" private const val END_SEQUENCE = "!#\r\n" diff --git a/numass-workspace/src/main/kotlin/ru/inr/mass/scripts/gun_2021_11.kt b/numass-workspace/src/main/kotlin/ru/inr/mass/scripts/gun_2021_11.kt new file mode 100644 index 0000000..01e1064 --- /dev/null +++ b/numass-workspace/src/main/kotlin/ru/inr/mass/scripts/gun_2021_11.kt @@ -0,0 +1,38 @@ +package ru.inr.mass.scripts + +import ru.inr.mass.data.api.channels +import ru.inr.mass.data.proto.NumassDirectorySet +import ru.inr.mass.workspace.Numass.readRepository +import space.kscience.dataforge.data.DataTree +import space.kscience.dataforge.data.await +import space.kscience.dataforge.data.data +import space.kscience.plotly.Plotly +import space.kscience.plotly.histogram +import space.kscience.plotly.makeFile + +suspend fun main() { + val repo: DataTree = readRepository("D:\\Work\\Numass\\data\\2021_11\\Adiabacity_17\\") + + //select point number 2 (U = 16900 V) from each directory + val points = repo.items().mapValues { + val directory = it.value.data?.await() + val point = directory?.points?.find { it.voltage == 16900.0 } + point + } + + Plotly.plot { + points.forEach { name, point -> + if (point != null) { + histogram { + this.name = name.toString() + xbins { + size = 4.0 + } + x.numbers = point.frames.tqdcAmplitudes() + } + } + } + }.makeFile() + + +} \ No newline at end of file diff --git a/numass-workspace/src/main/kotlin/ru/inr/mass/scripts/run_2019_11.kt b/numass-workspace/src/main/kotlin/ru/inr/mass/scripts/run_2019_11.kt new file mode 100644 index 0000000..9c673e1 --- /dev/null +++ b/numass-workspace/src/main/kotlin/ru/inr/mass/scripts/run_2019_11.kt @@ -0,0 +1,9 @@ +package ru.inr.mass.scripts + +import kotlinx.coroutines.flow.toList +import ru.inr.mass.workspace.Numass.readPoint + +suspend fun main() { + val point = readPoint("D:\\Work\\Numass\\data\\2019_11\\Fill_3\\set_2\\p2(30s)(HV1=14000)") + val events = point.events.toList() +} \ No newline at end of file diff --git a/numass-workspace/src/main/kotlin/ru/inr/mass/scripts/run_2021_11.kt b/numass-workspace/src/main/kotlin/ru/inr/mass/scripts/run_2021_11.kt index e653fde..abf3ce1 100644 --- a/numass-workspace/src/main/kotlin/ru/inr/mass/scripts/run_2021_11.kt +++ b/numass-workspace/src/main/kotlin/ru/inr/mass/scripts/run_2021_11.kt @@ -1,5 +1,9 @@ package ru.inr.mass.scripts +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.map +import kotlinx.coroutines.flow.toList +import kotlinx.coroutines.runBlocking import kotlinx.html.h2 import kotlinx.html.p import kotlinx.serialization.json.Json @@ -25,6 +29,10 @@ fun NumassFrame.tqdcAmplitude(): Short { return (max - min).toShort() } +fun Flow.tqdcAmplitudes(): List = runBlocking { + map { it.tqdcAmplitude() }.toList() +} + suspend fun main() { //val repo: DataTree = readNumassRepository("D:\\Work\\numass-data\\") val directory = readDirectory("D:\\Work\\Numass\\data\\test\\set_7") diff --git a/settings.gradle.kts b/settings.gradle.kts index 75583be..b3ec7c0 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,3 +1,5 @@ +rootProject.name = "numass" + enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") enableFeaturePreview("VERSION_CATALOGS")