forked from NPM/numass-framework
Add trigger for tqdc reader
This commit is contained in:
parent
35a29e983e
commit
78ff8d4f6e
@ -81,13 +81,12 @@ object NumassDataUtils {
|
|||||||
return SpectrumAdapter("Uset", "CR", "CRerr", "Time")
|
return SpectrumAdapter("Uset", "CR", "CRerr", "Time")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun read(envelope: Envelope): NumassPoint {
|
fun read(envelope: Envelope): NumassPoint =
|
||||||
return if (envelope.dataType?.startsWith("numass.point.classic") ?: envelope.meta.hasValue("split")) {
|
if (envelope.meta.hasMeta("dpp_params") || envelope.meta.hasMeta("tqdc")) {
|
||||||
ClassicNumassPoint(envelope)
|
|
||||||
} else {
|
|
||||||
ProtoNumassPoint.fromEnvelope(envelope)
|
ProtoNumassPoint.fromEnvelope(envelope)
|
||||||
|
} else {
|
||||||
|
ClassicNumassPoint(envelope)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun NumassBlock.transformChain(transform: (NumassEvent, NumassEvent) -> OrphanNumassEvent?): NumassBlock {
|
suspend fun NumassBlock.transformChain(transform: (NumassEvent, NumassEvent) -> OrphanNumassEvent?): NumassBlock {
|
||||||
|
@ -35,7 +35,6 @@ import java.nio.file.Files
|
|||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
import kotlin.streams.toList
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -47,7 +46,7 @@ class NumassDataLoader(
|
|||||||
override val context: Context,
|
override val context: Context,
|
||||||
override val parent: StorageElement?,
|
override val parent: StorageElement?,
|
||||||
override val name: String,
|
override val name: String,
|
||||||
override val path: Path
|
override val path: Path,
|
||||||
) : Loader<NumassPoint>, NumassSet, Provider, FileStorageElement {
|
) : Loader<NumassPoint>, NumassSet, Provider, FileStorageElement {
|
||||||
|
|
||||||
override val type: KClass<NumassPoint> = NumassPoint::class
|
override val type: KClass<NumassPoint> = NumassPoint::class
|
||||||
@ -97,7 +96,7 @@ class NumassDataLoader(
|
|||||||
|
|
||||||
|
|
||||||
override val startTime: Instant
|
override val startTime: Instant
|
||||||
get() = meta.optValue("start_time").map<Instant> { it.time }.orElseGet { super.startTime }
|
get() = meta.optValue("start_time").map { it.time }.orElseGet { super.startTime }
|
||||||
|
|
||||||
override fun close() {
|
override fun close() {
|
||||||
//do nothing
|
//do nothing
|
||||||
@ -187,8 +186,8 @@ class NumassDataLoader(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun Context.readNumassSet(path:Path):NumassDataLoader{
|
fun Context.readNumassSet(path: Path): NumassDataLoader {
|
||||||
return NumassDataLoader(this,null,path.fileName.toString(),path)
|
return NumassDataLoader(this, null, path.fileName.toString(), path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ class MainView : View(title = "Numass viewer", icon = dfIconView) {
|
|||||||
//build storage
|
//build storage
|
||||||
app.context.launch {
|
app.context.launch {
|
||||||
val storageElement = NumassDirectory.INSTANCE.read(app.context, path) as Storage
|
val storageElement = NumassDirectory.INSTANCE.read(app.context, path) as Storage
|
||||||
withContext(Dispatchers.JavaFx){
|
withContext(Dispatchers.JavaFx) {
|
||||||
contentView = storageView
|
contentView = storageView
|
||||||
storageView.storageProperty.set(storageElement)
|
storageView.storageProperty.set(storageElement)
|
||||||
}
|
}
|
||||||
@ -187,19 +187,12 @@ class MainView : View(title = "Numass viewer", icon = dfIconView) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
envelope?.let {
|
envelope?.let {
|
||||||
if (it.meta.hasMeta("external_meta")) {
|
//try to read as point
|
||||||
//try to read as point
|
val point = NumassDataUtils.read(it)
|
||||||
val point = NumassDataUtils.read(it)
|
runLater {
|
||||||
runLater {
|
contentView = AmplitudeView().apply {
|
||||||
contentView = AmplitudeView().apply {
|
set(path.fileName.toString(), point)
|
||||||
set(path.fileName.toString(), point)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
alert(
|
|
||||||
type = Alert.AlertType.ERROR,
|
|
||||||
header = "Unknown envelope content: $path"
|
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user