Add gun extraction

This commit is contained in:
Alexander Nozik 2022-02-20 19:52:15 +03:00
parent 025abf1d58
commit 6853964d24
5 changed files with 58 additions and 1 deletions

View File

@ -103,7 +103,7 @@ public class TaggedNumassEnvelopeFormat(private val io: IOPlugin) : EnvelopeForm
IOFormat.NAME_KEY put name.toString() IOFormat.NAME_KEY put name.toString()
} }
companion object : EnvelopeFormatFactory { public companion object : EnvelopeFormatFactory {
private const val START_SEQUENCE = "#!" private const val START_SEQUENCE = "#!"
private const val END_SEQUENCE = "!#\r\n" private const val END_SEQUENCE = "!#\r\n"

View File

@ -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<NumassDirectorySet> = 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()
}

View File

@ -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()
}

View File

@ -1,5 +1,9 @@
package ru.inr.mass.scripts 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.h2
import kotlinx.html.p import kotlinx.html.p
import kotlinx.serialization.json.Json import kotlinx.serialization.json.Json
@ -25,6 +29,10 @@ fun NumassFrame.tqdcAmplitude(): Short {
return (max - min).toShort() return (max - min).toShort()
} }
fun Flow<NumassFrame>.tqdcAmplitudes(): List<Short> = runBlocking {
map { it.tqdcAmplitude() }.toList()
}
suspend fun main() { suspend fun main() {
//val repo: DataTree<NumassDirectorySet> = readNumassRepository("D:\\Work\\numass-data\\") //val repo: DataTree<NumassDirectorySet> = readNumassRepository("D:\\Work\\numass-data\\")
val directory = readDirectory("D:\\Work\\Numass\\data\\test\\set_7") val directory = readDirectory("D:\\Work\\Numass\\data\\test\\set_7")

View File

@ -1,3 +1,5 @@
rootProject.name = "numass"
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
enableFeaturePreview("VERSION_CATALOGS") enableFeaturePreview("VERSION_CATALOGS")