Control update
This commit is contained in:
parent
65d24017d8
commit
cf3268244e
@ -3,9 +3,11 @@ package inr.numass.data
|
|||||||
import hep.dataforge.io.envelopes.Envelope
|
import hep.dataforge.io.envelopes.Envelope
|
||||||
import hep.dataforge.meta.Meta
|
import hep.dataforge.meta.Meta
|
||||||
import hep.dataforge.meta.MetaBuilder
|
import hep.dataforge.meta.MetaBuilder
|
||||||
|
import inr.numass.data.api.NumassBlock
|
||||||
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.storage.ProtoBlock
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
import java.util.stream.Collectors
|
import java.util.stream.Collectors
|
||||||
import java.util.stream.Stream
|
import java.util.stream.Stream
|
||||||
@ -49,3 +51,10 @@ val Envelope.dataStream : InputStream
|
|||||||
} else {
|
} else {
|
||||||
this.data.stream
|
this.data.stream
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val NumassBlock.channel: Int
|
||||||
|
get() = if (this is ProtoBlock) {
|
||||||
|
this.channel
|
||||||
|
} else {
|
||||||
|
0
|
||||||
|
}
|
||||||
|
@ -43,10 +43,23 @@ class ProtoNumassPoint(private val envelope: Envelope) : NumassPoint {
|
|||||||
return envelope.meta
|
return envelope.meta
|
||||||
}
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun readFile(path: Path): ProtoNumassPoint {
|
||||||
|
return ProtoNumassPoint(NumassFileEnvelope.open(path, true))
|
||||||
|
}
|
||||||
|
|
||||||
|
fun ofEpochNanos(nanos: Long): Instant {
|
||||||
|
val seconds = Math.floorDiv(nanos, 1e9.toInt().toLong())
|
||||||
|
val reminder = (nanos % 1e9).toInt()
|
||||||
|
return Instant.ofEpochSecond(seconds, reminder.toLong())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class ProtoBlock(val channel: Int, private val block: NumassProto.Point.Channel.Block, private val meta: Meta) : NumassBlock {
|
class ProtoBlock(val channel: Int, private val block: NumassProto.Point.Channel.Block, private val meta: Meta) : NumassBlock {
|
||||||
|
|
||||||
override fun getStartTime(): Instant {
|
override fun getStartTime(): Instant {
|
||||||
return ofEpochNanos(block.time)
|
return ProtoNumassPoint.ofEpochNanos(block.time)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getLength(): Duration {
|
override fun getLength(): Duration {
|
||||||
@ -72,16 +85,3 @@ class ProtoNumassPoint(private val envelope: Envelope) : NumassPoint {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
|
||||||
fun readFile(path: Path): ProtoNumassPoint {
|
|
||||||
return ProtoNumassPoint(NumassFileEnvelope.open(path, true))
|
|
||||||
}
|
|
||||||
|
|
||||||
fun ofEpochNanos(nanos: Long): Instant {
|
|
||||||
val seconds = Math.floorDiv(nanos, 1e9.toInt().toLong())
|
|
||||||
val reminder = (nanos % 1e9).toInt()
|
|
||||||
return Instant.ofEpochSecond(seconds, reminder.toLong())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -55,7 +55,7 @@ class AmplitudeView(
|
|||||||
|
|
||||||
|
|
||||||
private val container = PlotContainer(frame).apply {
|
private val container = PlotContainer(frame).apply {
|
||||||
val binnintSelector: ChoiceBox<Int> = ChoiceBox(FXCollections.observableArrayList(1, 2, 5, 10, 20, 50)).apply {
|
val binningSelector: ChoiceBox<Int> = ChoiceBox(FXCollections.observableArrayList(1, 2, 5, 10, 20, 50)).apply {
|
||||||
minWidth = 0.0
|
minWidth = 0.0
|
||||||
selectionModel.selectLast()
|
selectionModel.selectLast()
|
||||||
binningProperty.bind(this.selectionModel.selectedItemProperty())
|
binningProperty.bind(this.selectionModel.selectedItemProperty())
|
||||||
@ -64,7 +64,7 @@ class AmplitudeView(
|
|||||||
minWidth = 0.0
|
minWidth = 0.0
|
||||||
this.selectedProperty().bindBidirectional(normalizeProperty)
|
this.selectedProperty().bindBidirectional(normalizeProperty)
|
||||||
}
|
}
|
||||||
addToSideBar(0, binnintSelector, normalizeSwitch)
|
addToSideBar(0, binningSelector, normalizeSwitch)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val data: ObservableMap<String, NumassPoint> = FXCollections.observableHashMap()
|
private val data: ObservableMap<String, NumassPoint> = FXCollections.observableHashMap()
|
||||||
|
Loading…
Reference in New Issue
Block a user