A lot of changes
This commit is contained in:
parent
6bdb3583a1
commit
6b988f2849
@ -3,7 +3,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
repositories{
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
maven("https://repo.kotlin.link")
|
maven("https://repo.kotlin.link")
|
||||||
}
|
}
|
||||||
@ -12,8 +12,9 @@ allprojects {
|
|||||||
version = "0.1.0-dev-1"
|
version = "0.1.0-dev-1"
|
||||||
}
|
}
|
||||||
|
|
||||||
val dataforgeVersion by extra("0.5.2-dev-2")
|
val dataforgeVersion by extra("0.5.2-dev-4")
|
||||||
val kmathVersion by extra("0.3.0-dev-15")
|
val kmathVersion by extra("0.3.0-dev-17")
|
||||||
|
val plotlyVersion: String by extra("0.5.0")
|
||||||
|
|
||||||
ksciencePublish{
|
ksciencePublish{
|
||||||
git("https://mipt-npm.jetbrains.space/p/numass/code/numass/")
|
git("https://mipt-npm.jetbrains.space/p/numass/code/numass/")
|
||||||
|
15
buildSrc/build.gradle.kts
Normal file
15
buildSrc/build.gradle.kts
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
plugins {
|
||||||
|
`kotlin-dsl`
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
maven("https://repo.kotlin.link")
|
||||||
|
mavenCentral()
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
api("com.squareup.wire:wire-gradle-plugin:3.7.1")
|
||||||
|
api("ru.mipt.npm:gradle-tools:0.10.8-kotlin-1.6.0")
|
||||||
|
}
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
@ -1,19 +1,21 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id("ru.mipt.npm.gradle.mpp")
|
kotlin("multiplatform")
|
||||||
|
id("ru.mipt.npm.gradle.common")
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
val dataforgeVersion: String by rootProject.extra
|
val dataforgeVersion: String by rootProject.extra
|
||||||
|
val kmathVersion: String by rootProject.extra
|
||||||
|
|
||||||
kotlin.sourceSets {
|
kotlin.sourceSets {
|
||||||
commonMain {
|
commonMain {
|
||||||
dependencies {
|
dependencies {
|
||||||
api(project(":numass-data-model"))
|
api(project(":numass-data-model"))
|
||||||
api("space.kscience:tables-kt:0.1.1-dev-2")
|
api("space.kscience:tables-kt:0.1.1-dev-2")
|
||||||
api("space.kscience:kmath-complex:0.3.0-dev-17")
|
api("space.kscience:kmath-complex:$kmathVersion")
|
||||||
api("space.kscience:kmath-stat:0.3.0-dev-17")
|
api("space.kscience:kmath-stat:$kmathVersion")
|
||||||
api("space.kscience:kmath-histograms:0.3.0-dev-17")
|
api("space.kscience:kmath-histograms:$kmathVersion")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id("ru.mipt.npm.gradle.mpp")
|
kotlin("multiplatform")
|
||||||
|
id("ru.mipt.npm.gradle.common")
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -11,7 +12,7 @@ kotlin.sourceSets {
|
|||||||
dependencies {
|
dependencies {
|
||||||
api("space.kscience:dataforge-context:$dataforgeVersion")
|
api("space.kscience:dataforge-context:$dataforgeVersion")
|
||||||
api("space.kscience:dataforge-data:$dataforgeVersion")
|
api("space.kscience:dataforge-data:$dataforgeVersion")
|
||||||
api("org.jetbrains.kotlinx:kotlinx-datetime:0.1.1")
|
api("org.jetbrains.kotlinx:kotlinx-datetime:${ru.mipt.npm.gradle.KScienceVersions.dateTimeVersion}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
jvmMain{
|
jvmMain{
|
||||||
@ -21,4 +22,8 @@ kotlin.sourceSets {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kscience{
|
||||||
|
useSerialization()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
package ru.inr.mass.data.proto
|
||||||
|
|
||||||
|
import kotlinx.datetime.Instant
|
||||||
|
import kotlinx.datetime.toInstant
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
import kotlin.jvm.JvmInline
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
public data class HVEntry(val timestamp: Instant, val value: Double, val channel: Int = 1) {
|
||||||
|
public companion object {
|
||||||
|
public fun readString(line: String): HVEntry {
|
||||||
|
val (timeStr, channelStr, valueStr) = line.split(' ')
|
||||||
|
return HVEntry((timeStr + "Z").toInstant(), valueStr.toDouble(), channelStr.toInt())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
@JvmInline
|
||||||
|
public value class HVData(public val list: List<HVEntry>) : Iterable<HVEntry> {
|
||||||
|
override fun iterator(): Iterator<HVEntry> = list.iterator()
|
||||||
|
|
||||||
|
public companion object
|
||||||
|
}
|
||||||
|
|
@ -10,6 +10,8 @@ import space.kscience.dataforge.meta.Meta
|
|||||||
import space.kscience.dataforge.meta.get
|
import space.kscience.dataforge.meta.get
|
||||||
import space.kscience.dataforge.meta.long
|
import space.kscience.dataforge.meta.long
|
||||||
import space.kscience.dataforge.names.Name
|
import space.kscience.dataforge.names.Name
|
||||||
|
import space.kscience.dataforge.names.NameToken
|
||||||
|
import space.kscience.dataforge.names.asName
|
||||||
import space.kscience.dataforge.provider.Provider
|
import space.kscience.dataforge.provider.Provider
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -39,14 +41,15 @@ public interface NumassSet : Iterable<NumassPoint>, Provider {
|
|||||||
override val defaultTarget: String get() = NUMASS_POINT_TARGET
|
override val defaultTarget: String get() = NUMASS_POINT_TARGET
|
||||||
|
|
||||||
override fun content(target: String): Map<Name, Any> = if (target == NUMASS_POINT_TARGET) {
|
override fun content(target: String): Map<Name, Any> = if (target == NUMASS_POINT_TARGET) {
|
||||||
points.associateBy { Name.parse("point[${it.voltage}]") }
|
points.associateBy { NameToken("point", it.voltage.toString()).asName() }
|
||||||
} else {
|
} else {
|
||||||
super.content(target)
|
super.content(target)
|
||||||
}
|
}
|
||||||
|
|
||||||
public companion object {
|
public companion object {
|
||||||
//public const val DESCRIPTION_KEY = "info"
|
//public const val DESCRIPTION_KEY = "info"
|
||||||
public const val NUMASS_POINT_TARGET: String = "point"
|
public const val NUMASS_POINT_TARGET: String = "numass.point"
|
||||||
|
public const val NUMASS_HV_TARGET: String = "numass.hv"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm")
|
kotlin("jvm")
|
||||||
id("ru.mipt.npm.gradle.common")
|
id("ru.mipt.npm.gradle.common")
|
||||||
id("com.squareup.wire") version "3.5.0"
|
id("com.squareup.wire")
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,29 +0,0 @@
|
|||||||
package ru.inr.mass.data.proto
|
|
||||||
|
|
||||||
import kotlinx.datetime.Instant
|
|
||||||
import kotlinx.datetime.toInstant
|
|
||||||
import space.kscience.dataforge.io.Envelope
|
|
||||||
import space.kscience.dataforge.meta.get
|
|
||||||
import space.kscience.dataforge.meta.string
|
|
||||||
|
|
||||||
public data class HVEntry(val timestamp: Instant, val value: Double, val channel: Int = 1) {
|
|
||||||
public companion object {
|
|
||||||
public fun readString(line: String): HVEntry {
|
|
||||||
val (timeStr, channelStr, valueStr) = line.split(' ')
|
|
||||||
return HVEntry((timeStr + "Z").toInstant(), valueStr.toDouble(), channelStr.toInt())
|
|
||||||
}
|
|
||||||
|
|
||||||
public fun readEnvelope(envelope: Envelope): List<HVEntry> {
|
|
||||||
check(envelope.meta["type"].string == "voltage") { "Expecting voltage type envelope" }
|
|
||||||
return buildList {
|
|
||||||
envelope.data?.read {
|
|
||||||
//Some problems with readLines
|
|
||||||
lines().forEach { str ->
|
|
||||||
add(readString(str))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -2,6 +2,8 @@ package ru.inr.mass.data.proto
|
|||||||
|
|
||||||
import ru.inr.mass.data.api.NumassPoint
|
import ru.inr.mass.data.api.NumassPoint
|
||||||
import ru.inr.mass.data.api.NumassSet
|
import ru.inr.mass.data.api.NumassSet
|
||||||
|
import ru.inr.mass.data.api.NumassSet.Companion.NUMASS_HV_TARGET
|
||||||
|
import ru.inr.mass.data.api.readEnvelope
|
||||||
import space.kscience.dataforge.context.Context
|
import space.kscience.dataforge.context.Context
|
||||||
import space.kscience.dataforge.context.error
|
import space.kscience.dataforge.context.error
|
||||||
import space.kscience.dataforge.context.logger
|
import space.kscience.dataforge.context.logger
|
||||||
@ -10,6 +12,8 @@ import space.kscience.dataforge.io.io
|
|||||||
import space.kscience.dataforge.io.readEnvelopeFile
|
import space.kscience.dataforge.io.readEnvelopeFile
|
||||||
import space.kscience.dataforge.meta.Meta
|
import space.kscience.dataforge.meta.Meta
|
||||||
import space.kscience.dataforge.misc.DFExperimental
|
import space.kscience.dataforge.misc.DFExperimental
|
||||||
|
import space.kscience.dataforge.names.Name
|
||||||
|
import space.kscience.dataforge.names.asName
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
import kotlin.io.path.*
|
import kotlin.io.path.*
|
||||||
@ -22,19 +26,20 @@ public class NumassDirectorySet internal constructor(
|
|||||||
) : NumassSet {
|
) : NumassSet {
|
||||||
|
|
||||||
@OptIn(DFExperimental::class)
|
@OptIn(DFExperimental::class)
|
||||||
override val meta: Meta by lazy {
|
override val meta: Meta
|
||||||
val metaFilePath = path / "meta"
|
get() {
|
||||||
if (metaFilePath.exists()) {
|
val metaFilePath = path / "meta"
|
||||||
val envelope = context.io.readEnvelopeFile(metaFilePath)
|
return if (metaFilePath.exists()) {
|
||||||
envelope.meta
|
val envelope = context.io.readEnvelopeFile(metaFilePath)
|
||||||
} else {
|
envelope.meta
|
||||||
context.logger.warn { "Meta file does not exist for Numass set $metaFilePath" }
|
} else {
|
||||||
Meta.EMPTY
|
context.logger.warn { "Meta file does not exist for Numass set $metaFilePath" }
|
||||||
|
Meta.EMPTY
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
override val points: List<NumassPoint> by lazy {
|
override val points: List<NumassPoint>
|
||||||
Files.list(path).filter {
|
get() = Files.list(path).filter {
|
||||||
it.fileName.name.startsWith("p")
|
it.fileName.name.startsWith("p")
|
||||||
}.map { pointPath ->
|
}.map { pointPath ->
|
||||||
try {
|
try {
|
||||||
@ -44,18 +49,29 @@ public class NumassDirectorySet internal constructor(
|
|||||||
null
|
null
|
||||||
}
|
}
|
||||||
}.toList().filterNotNull()
|
}.toList().filterNotNull()
|
||||||
}
|
|
||||||
|
|
||||||
@OptIn(DFExperimental::class)
|
@OptIn(DFExperimental::class)
|
||||||
public fun getHvData(): List<HVEntry>? {
|
public fun getHvData(): HVData? {
|
||||||
val hvFile = path / "voltage"
|
val hvFile = path / "voltage"
|
||||||
return if (hvFile.exists()) {
|
return if (hvFile.exists()) {
|
||||||
val envelope = context.io.readEnvelopeFile(hvFile)
|
val envelope = context.io.readEnvelopeFile(hvFile)
|
||||||
HVEntry.readEnvelope(envelope)
|
HVData.readEnvelope(envelope)
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun content(target: String): Map<Name, Any> = if (target == NUMASS_HV_TARGET) {
|
||||||
|
val hvData = getHvData()
|
||||||
|
if (hvData != null) {
|
||||||
|
mapOf("hv".asName() to hvData)
|
||||||
|
} else {
|
||||||
|
emptyMap()
|
||||||
|
}
|
||||||
|
} else super.content(target)
|
||||||
|
|
||||||
|
public companion object
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(DFExperimental::class)
|
@OptIn(DFExperimental::class)
|
||||||
@ -68,8 +84,8 @@ public fun Context.readNumassPointFile(path: String): NumassPoint? = readNumassP
|
|||||||
|
|
||||||
@OptIn(ExperimentalPathApi::class)
|
@OptIn(ExperimentalPathApi::class)
|
||||||
public fun Context.readNumassDirectory(path: Path): NumassDirectorySet {
|
public fun Context.readNumassDirectory(path: Path): NumassDirectorySet {
|
||||||
if(!path.exists()) error("Path $path does not exist")
|
if (!path.exists()) error("Path $path does not exist")
|
||||||
if(!path.isDirectory()) error("The path $path is not a directory")
|
if (!path.isDirectory()) error("The path $path is not a directory")
|
||||||
return NumassDirectorySet(this, path)
|
return NumassDirectorySet(this, path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,12 +14,10 @@ public class NumassProtoPlugin : AbstractPlugin() {
|
|||||||
public val io: IOPlugin by require(IOPlugin)
|
public val io: IOPlugin by require(IOPlugin)
|
||||||
override val tag: PluginTag get() = Companion.tag
|
override val tag: PluginTag get() = Companion.tag
|
||||||
|
|
||||||
override fun content(target: String): Map<Name, Any> {
|
override fun content(target: String): Map<Name, Any> = if(target == EnvelopeFormatFactory.ENVELOPE_FORMAT_TYPE){
|
||||||
return if(target== EnvelopeFormatFactory.ENVELOPE_FORMAT_TYPE){
|
mapOf(TaggedNumassEnvelopeFormat.name to TaggedNumassEnvelopeFormat)
|
||||||
mapOf(TaggedNumassEnvelopeFormat.name to TaggedNumassEnvelopeFormat)
|
} else{
|
||||||
} else{
|
super.content(target)
|
||||||
super.content(target)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public companion object : PluginFactory<NumassProtoPlugin> {
|
public companion object : PluginFactory<NumassProtoPlugin> {
|
||||||
|
@ -41,7 +41,7 @@ import kotlin.time.Duration.Companion.nanoseconds
|
|||||||
*/
|
*/
|
||||||
internal class ProtoNumassPoint(
|
internal class ProtoNumassPoint(
|
||||||
override val meta: Meta,
|
override val meta: Meta,
|
||||||
private val protoBuilder: () -> Point,
|
protoBuilder: () -> Point,
|
||||||
) : NumassPoint {
|
) : NumassPoint {
|
||||||
|
|
||||||
val point: Point by lazy(protoBuilder)
|
val point: Point by lazy(protoBuilder)
|
||||||
@ -80,7 +80,7 @@ internal class ProtoNumassPoint(
|
|||||||
override val framesCount: Long
|
override val framesCount: Long
|
||||||
get() = point.channels.sumOf { channel ->
|
get() = point.channels.sumOf { channel ->
|
||||||
channel.blocks.sumOf { block ->
|
channel.blocks.sumOf { block ->
|
||||||
block.frames.size ?: 0
|
block.frames.size
|
||||||
}.toLong()
|
}.toLong()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ internal class TaggedNumassEnvelopeFormat(private val io: IOPlugin) : EnvelopeFo
|
|||||||
override fun invoke(meta: Meta, context: Context): EnvelopeFormat {
|
override fun invoke(meta: Meta, context: Context): EnvelopeFormat {
|
||||||
val io = context.io
|
val io = context.io
|
||||||
|
|
||||||
val metaFormatName = meta["name"].string?.let(Name::parse) ?: JsonMetaFormat.name
|
val metaFormatName = meta["name"].string?.let { Name.parse(it) } ?: JsonMetaFormat.name
|
||||||
//Check if appropriate factory exists
|
//Check if appropriate factory exists
|
||||||
io.metaFormatFactories.find { it.name == metaFormatName } ?: error("Meta format could not be resolved")
|
io.metaFormatFactories.find { it.name == metaFormatName } ?: error("Meta format could not be resolved")
|
||||||
|
|
||||||
@ -133,19 +133,17 @@ internal class TaggedNumassEnvelopeFormat(private val io: IOPlugin) : EnvelopeFo
|
|||||||
return Tag(metaFormatKey, metaLength, dataLength)
|
return Tag(metaFormatKey, metaLength, dataLength)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun peekFormat(io: IOPlugin, binary: Binary): EnvelopeFormat? {
|
override fun peekFormat(io: IOPlugin, binary: Binary): EnvelopeFormat? = try {
|
||||||
return try {
|
binary.read {
|
||||||
binary.read {
|
val header = readRawString(30)
|
||||||
val header = readRawString(30)
|
if (header.startsWith(START_SEQUENCE) && header.endsWith(END_SEQUENCE)) {
|
||||||
if (header.startsWith(START_SEQUENCE) && header.endsWith(END_SEQUENCE)) {
|
TaggedNumassEnvelopeFormat(io)
|
||||||
TaggedNumassEnvelopeFormat(io)
|
} else {
|
||||||
} else {
|
null
|
||||||
null
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (ex: Exception) {
|
|
||||||
null
|
|
||||||
}
|
}
|
||||||
|
} catch (ex: Exception) {
|
||||||
|
null
|
||||||
}
|
}
|
||||||
|
|
||||||
private val default by lazy { invoke() }
|
private val default by lazy { invoke() }
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
package ru.inr.mass.data.api
|
||||||
|
|
||||||
|
import ru.inr.mass.data.proto.HVData
|
||||||
|
import ru.inr.mass.data.proto.HVEntry
|
||||||
|
import ru.inr.mass.data.proto.lines
|
||||||
|
import space.kscience.dataforge.io.Envelope
|
||||||
|
import space.kscience.dataforge.meta.get
|
||||||
|
import space.kscience.dataforge.meta.string
|
||||||
|
|
||||||
|
public fun HVData.Companion.readEnvelope(envelope: Envelope): HVData {
|
||||||
|
check(envelope.meta["type"].string == "voltage") { "Expecting voltage type envelope" }
|
||||||
|
return HVData(buildList {
|
||||||
|
envelope.data?.read {
|
||||||
|
//Some problems with readLines
|
||||||
|
lines().forEach { str ->
|
||||||
|
add(HVEntry.readString(str))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
@ -1,6 +1,10 @@
|
|||||||
package ru.inr.mass.data.proto
|
package ru.inr.mass.data.proto
|
||||||
|
|
||||||
|
import kotlinx.coroutines.flow.toList
|
||||||
|
import kotlinx.coroutines.runBlocking
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
import ru.inr.mass.data.api.NumassPoint
|
||||||
|
import ru.inr.mass.data.api.ParentBlock
|
||||||
import space.kscience.dataforge.context.Context
|
import space.kscience.dataforge.context.Context
|
||||||
import space.kscience.dataforge.meta.get
|
import space.kscience.dataforge.meta.get
|
||||||
import space.kscience.dataforge.meta.string
|
import space.kscience.dataforge.meta.string
|
||||||
@ -14,8 +18,8 @@ class TestNumassDirectory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testDirectoryRead() {
|
fun testDanteRead() {
|
||||||
val dataPath = Path.of("src/test/resources", "testData/set_4")
|
val dataPath = Path.of("src/test/resources", "testData/dante")
|
||||||
val testSet = context.readNumassDirectory(dataPath)
|
val testSet = context.readNumassDirectory(dataPath)
|
||||||
assertEquals("2018-04-13T22:01:46", testSet.meta["end_time"].string)
|
assertEquals("2018-04-13T22:01:46", testSet.meta["end_time"].string)
|
||||||
assertEquals(ListValue.EMPTY, testSet.meta["comments"]?.value)
|
assertEquals(ListValue.EMPTY, testSet.meta["comments"]?.value)
|
||||||
@ -24,4 +28,18 @@ class TestNumassDirectory {
|
|||||||
point22.flowBlocks()
|
point22.flowBlocks()
|
||||||
assertEquals("2018-04-13T21:56:09", point22.meta["end_time"].string)
|
assertEquals("2018-04-13T21:56:09", point22.meta["end_time"].string)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testTQDCRead() = runBlocking {
|
||||||
|
val pointPath = Path.of("C:\\Users\\altavir\\Desktop\\p20211122173034(20s).dat")
|
||||||
|
val point: NumassPoint = context.readNumassPointFile(pointPath)!!
|
||||||
|
point.getChannels().forEach { (channel, block) ->
|
||||||
|
println("$channel: $block")
|
||||||
|
if(block is ParentBlock){
|
||||||
|
block.flowBlocks().toList().forEach{
|
||||||
|
println("\t${it.channel}:${it.eventsCount}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
BIN
numass-data-proto/src/test/resources/testData/tqdc/p0.df
Normal file
BIN
numass-data-proto/src/test/resources/testData/tqdc/p0.df
Normal file
Binary file not shown.
BIN
numass-data-proto/src/test/resources/testData/tqdc/p1.df
Normal file
BIN
numass-data-proto/src/test/resources/testData/tqdc/p1.df
Normal file
Binary file not shown.
BIN
numass-data-proto/src/test/resources/testData/tqdc/p2.df
Normal file
BIN
numass-data-proto/src/test/resources/testData/tqdc/p2.df
Normal file
Binary file not shown.
BIN
numass-data-proto/src/test/resources/testData/tqdc/p3.df
Normal file
BIN
numass-data-proto/src/test/resources/testData/tqdc/p3.df
Normal file
Binary file not shown.
BIN
numass-data-proto/src/test/resources/testData/tqdc/p4.df
Normal file
BIN
numass-data-proto/src/test/resources/testData/tqdc/p4.df
Normal file
Binary file not shown.
BIN
numass-data-proto/src/test/resources/testData/tqdc/p5.df
Normal file
BIN
numass-data-proto/src/test/resources/testData/tqdc/p5.df
Normal file
Binary file not shown.
BIN
numass-data-proto/src/test/resources/testData/tqdc/p6.df
Normal file
BIN
numass-data-proto/src/test/resources/testData/tqdc/p6.df
Normal file
Binary file not shown.
BIN
numass-data-proto/src/test/resources/testData/tqdc/p7.df
Normal file
BIN
numass-data-proto/src/test/resources/testData/tqdc/p7.df
Normal file
Binary file not shown.
BIN
numass-data-proto/src/test/resources/testData/tqdc/p8.df
Normal file
BIN
numass-data-proto/src/test/resources/testData/tqdc/p8.df
Normal file
Binary file not shown.
BIN
numass-data-proto/src/test/resources/testData/tqdc/p9.df
Normal file
BIN
numass-data-proto/src/test/resources/testData/tqdc/p9.df
Normal file
Binary file not shown.
51
numass-data-server/build.gradle.kts
Normal file
51
numass-data-server/build.gradle.kts
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
plugins {
|
||||||
|
kotlin("multiplatform")
|
||||||
|
id("ru.mipt.npm.gradle.common")
|
||||||
|
`maven-publish`
|
||||||
|
}
|
||||||
|
|
||||||
|
val visionForgeVersion = "0.2.0-dev-24"
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
js{
|
||||||
|
browser {
|
||||||
|
webpackTask {
|
||||||
|
this.outputFileName = "js/numass-web.js"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
binaries.executable()
|
||||||
|
}
|
||||||
|
|
||||||
|
afterEvaluate {
|
||||||
|
val jsBrowserDistribution by tasks.getting
|
||||||
|
|
||||||
|
tasks.getByName<ProcessResources>("jvmProcessResources") {
|
||||||
|
dependsOn(jsBrowserDistribution)
|
||||||
|
afterEvaluate {
|
||||||
|
from(jsBrowserDistribution)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
commonMain {
|
||||||
|
dependencies {
|
||||||
|
implementation(project(":numass-data-model"))
|
||||||
|
implementation("space.kscience:visionforge-plotly:$visionForgeVersion")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
jvmMain {
|
||||||
|
dependencies {
|
||||||
|
implementation(project(":numass-data-proto"))
|
||||||
|
implementation("space.kscience:visionforge-server:$visionForgeVersion")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
kscience{
|
||||||
|
useSerialization {
|
||||||
|
json()
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
package ru.inr.mass.data.server
|
||||||
|
|
||||||
|
import kotlinx.serialization.modules.SerializersModule
|
||||||
|
import kotlinx.serialization.modules.polymorphic
|
||||||
|
import kotlinx.serialization.modules.subclass
|
||||||
|
import space.kscience.dataforge.context.Context
|
||||||
|
import space.kscience.dataforge.context.PluginFactory
|
||||||
|
import space.kscience.dataforge.context.PluginTag
|
||||||
|
import space.kscience.dataforge.meta.Meta
|
||||||
|
import space.kscience.visionforge.Vision
|
||||||
|
import space.kscience.visionforge.VisionBase
|
||||||
|
import space.kscience.visionforge.VisionGroupBase
|
||||||
|
import space.kscience.visionforge.VisionPlugin
|
||||||
|
import space.kscience.visionforge.plotly.PlotlyPlugin
|
||||||
|
import kotlin.reflect.KClass
|
||||||
|
|
||||||
|
public class NumassCommonPlugin(meta: Meta) : VisionPlugin(meta) {
|
||||||
|
override val tag: PluginTag get() = Companion.tag
|
||||||
|
|
||||||
|
public val plotlyPlugin: PlotlyPlugin by require(PlotlyPlugin)
|
||||||
|
|
||||||
|
override val visionSerializersModule: SerializersModule get() = numassSerializersModule
|
||||||
|
|
||||||
|
public companion object : PluginFactory<NumassCommonPlugin> {
|
||||||
|
override val tag: PluginTag = PluginTag("numass.common", "ru.inr.mass")
|
||||||
|
override val type: KClass<NumassCommonPlugin> = NumassCommonPlugin::class
|
||||||
|
override fun invoke(meta: Meta, context: Context): NumassCommonPlugin = NumassCommonPlugin()
|
||||||
|
|
||||||
|
private val numassSerializersModule = SerializersModule {
|
||||||
|
polymorphic(Vision::class) {
|
||||||
|
subclass(VisionBase.serializer())
|
||||||
|
subclass(VisionGroupBase.serializer())
|
||||||
|
subclass(VisionOfNumassHv.serializer())
|
||||||
|
subclass(VisionOfNumassPoint.serializer())
|
||||||
|
subclass(VisionOfNumassHv.serializer())
|
||||||
|
subclass(VisionOfNumassSet.serializer())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,66 @@
|
|||||||
|
package ru.inr.mass.data.server
|
||||||
|
|
||||||
|
import kotlinx.coroutines.flow.collect
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
import ru.inr.mass.data.api.NumassBlock
|
||||||
|
import ru.inr.mass.data.api.NumassPoint
|
||||||
|
import ru.inr.mass.data.api.NumassSet
|
||||||
|
import ru.inr.mass.data.api.NumassSet.Companion.NUMASS_HV_TARGET
|
||||||
|
import ru.inr.mass.data.proto.HVData
|
||||||
|
import ru.inr.mass.data.proto.HVEntry
|
||||||
|
import space.kscience.dataforge.meta.Meta
|
||||||
|
import space.kscience.dataforge.names.NameToken
|
||||||
|
import space.kscience.dataforge.provider.top
|
||||||
|
import space.kscience.visionforge.VisionBase
|
||||||
|
import space.kscience.visionforge.VisionGroupBase
|
||||||
|
|
||||||
|
|
||||||
|
public typealias SimpleAmplitudeSpectrum = Map<UShort, UInt>
|
||||||
|
|
||||||
|
private suspend fun NumassBlock.simpleAmplitudeSpectrum(): SimpleAmplitudeSpectrum {
|
||||||
|
val res = mutableMapOf<UShort, UInt>()
|
||||||
|
events.collect {
|
||||||
|
res[it.amplitude] = (res[it.amplitude] ?: 0U) + 1U
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
public class VisionOfNumassPoint(
|
||||||
|
public val pointMeta: Meta,
|
||||||
|
public val index: Int,
|
||||||
|
public val voltage: Double,
|
||||||
|
public val spectra: Map<String, SimpleAmplitudeSpectrum>,
|
||||||
|
) : VisionBase()
|
||||||
|
|
||||||
|
public suspend fun NumassPoint.toVision(): VisionOfNumassPoint = VisionOfNumassPoint(
|
||||||
|
meta,
|
||||||
|
index,
|
||||||
|
voltage,
|
||||||
|
getChannels().entries.associate { (k, v) ->
|
||||||
|
k.toString() to v.simpleAmplitudeSpectrum()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
public class VisionOfNumassHv(public val hv: HVData) : VisionBase(), Iterable<HVEntry> {
|
||||||
|
override fun iterator(): Iterator<HVEntry> = hv.iterator()
|
||||||
|
}
|
||||||
|
|
||||||
|
private val VisionOfNumassPoint.token: NameToken get() = NameToken("point", index.toString())
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
public class VisionOfNumassSet(public val points: List<VisionOfNumassPoint>) : VisionBase() {
|
||||||
|
// init {
|
||||||
|
// points.forEach {
|
||||||
|
// //childrenInternal[it.token] = it
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
public suspend fun NumassSet.toVision(): VisionOfNumassSet = VisionOfNumassSet(points.map { it.toVision() }).apply {
|
||||||
|
this@toVision.top<HVData>(NUMASS_HV_TARGET).forEach { (key, hv) ->
|
||||||
|
// set(key, VisionOfNumassHv(hv))
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,76 @@
|
|||||||
|
package ru.inr.mass.data.server
|
||||||
|
|
||||||
|
import kotlinx.html.dom.append
|
||||||
|
import kotlinx.html.js.*
|
||||||
|
import org.w3c.dom.Element
|
||||||
|
import space.kscience.dataforge.context.AbstractPlugin
|
||||||
|
import space.kscience.dataforge.context.Context
|
||||||
|
import space.kscience.dataforge.context.PluginFactory
|
||||||
|
import space.kscience.dataforge.context.PluginTag
|
||||||
|
import space.kscience.dataforge.meta.Meta
|
||||||
|
import space.kscience.plotly.models.LineShape
|
||||||
|
import space.kscience.plotly.models.ScatterMode
|
||||||
|
import space.kscience.plotly.plot
|
||||||
|
import space.kscience.plotly.scatter
|
||||||
|
import space.kscience.visionforge.ElementVisionRenderer
|
||||||
|
import space.kscience.visionforge.Vision
|
||||||
|
import kotlin.reflect.KClass
|
||||||
|
|
||||||
|
public class NumassJsPlugin : AbstractPlugin(), ElementVisionRenderer {
|
||||||
|
public val numassCommon: NumassCommonPlugin by require(NumassCommonPlugin)
|
||||||
|
private val plotly = numassCommon.plotlyPlugin
|
||||||
|
|
||||||
|
override val tag: PluginTag get() = Companion.tag
|
||||||
|
|
||||||
|
override fun rateVision(vision: Vision): Int = when (vision) {
|
||||||
|
is VisionOfNumassHv, is VisionOfNumassPoint, is VisionOfNumassSet -> ElementVisionRenderer.DEFAULT_RATING
|
||||||
|
else -> ElementVisionRenderer.ZERO_RATING
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun render(element: Element, vision: Vision, meta: Meta) {
|
||||||
|
when (vision) {
|
||||||
|
is VisionOfNumassHv -> element.append {
|
||||||
|
h1 { +"HV" }
|
||||||
|
//TODO add title
|
||||||
|
table {
|
||||||
|
th {
|
||||||
|
td { +"Time" }
|
||||||
|
td { +"Value" }
|
||||||
|
td { +"channel" }
|
||||||
|
}
|
||||||
|
vision.forEach { entry ->
|
||||||
|
tr {
|
||||||
|
td { +entry.timestamp.toString() }
|
||||||
|
td { +entry.value.toString() }
|
||||||
|
td { +entry.channel.toString() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
is VisionOfNumassPoint -> element.append {
|
||||||
|
h1{ +"Point"}
|
||||||
|
plot {
|
||||||
|
vision.spectra.forEach { (channel, spectrum) ->
|
||||||
|
scatter {
|
||||||
|
name = channel
|
||||||
|
mode = ScatterMode.lines
|
||||||
|
line {
|
||||||
|
shape = LineShape.hv
|
||||||
|
}
|
||||||
|
x.numbers = spectrum.keys.map { it.toInt() }
|
||||||
|
y.numbers = spectrum.values.map { it.toInt() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
is VisionOfNumassSet -> {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public companion object : PluginFactory<NumassJsPlugin> {
|
||||||
|
override val tag: PluginTag = PluginTag("numass.js", "ru.inr.mass")
|
||||||
|
override val type: KClass<NumassJsPlugin> = NumassJsPlugin::class
|
||||||
|
override fun invoke(meta: Meta, context: Context): NumassJsPlugin = NumassJsPlugin()
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package ru.inr.mass.data.server
|
||||||
|
|
||||||
|
import space.kscience.dataforge.misc.DFExperimental
|
||||||
|
import space.kscience.visionforge.runVisionClient
|
||||||
|
|
||||||
|
|
||||||
|
@DFExperimental
|
||||||
|
public fun main(): Unit = runVisionClient {
|
||||||
|
plugin(NumassJsPlugin)
|
||||||
|
}
|
@ -0,0 +1,53 @@
|
|||||||
|
package ru.inr.mass.data.server
|
||||||
|
|
||||||
|
import kotlinx.coroutines.runBlocking
|
||||||
|
import kotlinx.html.div
|
||||||
|
import kotlinx.html.h1
|
||||||
|
import ru.inr.mass.data.api.NumassPoint
|
||||||
|
import ru.inr.mass.data.proto.NumassProtoPlugin
|
||||||
|
import ru.inr.mass.data.proto.readNumassPointFile
|
||||||
|
import space.kscience.dataforge.context.Context
|
||||||
|
import space.kscience.visionforge.three.server.close
|
||||||
|
import space.kscience.visionforge.three.server.serve
|
||||||
|
import space.kscience.visionforge.three.server.show
|
||||||
|
import space.kscience.visionforge.visionManager
|
||||||
|
import java.nio.file.Path
|
||||||
|
|
||||||
|
|
||||||
|
public fun main() {
|
||||||
|
val context = Context("Numass") {
|
||||||
|
plugin(NumassProtoPlugin)
|
||||||
|
plugin(NumassCommonPlugin)
|
||||||
|
}
|
||||||
|
|
||||||
|
val pointPath = Path.of("C:\\Users\\altavir\\Desktop\\p20211122173034(20s).dat")
|
||||||
|
val point: NumassPoint = context.readNumassPointFile(pointPath)!!
|
||||||
|
|
||||||
|
val visionOfNumass = runBlocking {
|
||||||
|
point.toVision()
|
||||||
|
}
|
||||||
|
|
||||||
|
val server = context.visionManager.serve {
|
||||||
|
//use client library
|
||||||
|
useNumassWeb()
|
||||||
|
//use css
|
||||||
|
//useCss("css/styles.css")
|
||||||
|
page {
|
||||||
|
div("flex-column") {
|
||||||
|
h1 { +"Satellite detector demo" }
|
||||||
|
//vision(visionOfNumass)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
server.show()
|
||||||
|
|
||||||
|
|
||||||
|
println("Enter 'exit' to close server")
|
||||||
|
while (readLine() != "exit") {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
server.close()
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package ru.inr.mass.data.server
|
||||||
|
|
||||||
|
import space.kscience.dataforge.context.Context
|
||||||
|
import space.kscience.dataforge.misc.DFExperimental
|
||||||
|
import space.kscience.visionforge.html.HtmlVisionFragment
|
||||||
|
import space.kscience.visionforge.html.ResourceLocation
|
||||||
|
import space.kscience.visionforge.html.page
|
||||||
|
import space.kscience.visionforge.html.scriptHeader
|
||||||
|
import space.kscience.visionforge.makeFile
|
||||||
|
import space.kscience.visionforge.three.server.VisionServer
|
||||||
|
import space.kscience.visionforge.three.server.useScript
|
||||||
|
import java.awt.Desktop
|
||||||
|
import java.nio.file.Path
|
||||||
|
|
||||||
|
|
||||||
|
public fun VisionServer.useNumassWeb(): Unit {
|
||||||
|
useScript("js/numass-web.js")
|
||||||
|
}
|
||||||
|
|
||||||
|
@DFExperimental
|
||||||
|
public fun Context.makeNumassWebFile(
|
||||||
|
content: HtmlVisionFragment,
|
||||||
|
path: Path? = null,
|
||||||
|
title: String = "VisionForge Numass page",
|
||||||
|
resourceLocation: ResourceLocation = ResourceLocation.SYSTEM,
|
||||||
|
show: Boolean = true,
|
||||||
|
): Unit {
|
||||||
|
val actualPath = page(title, content = content).makeFile(path) { actualPath ->
|
||||||
|
mapOf("numassWeb" to scriptHeader("js/numass-web.js", resourceLocation, actualPath))
|
||||||
|
}
|
||||||
|
if (show) Desktop.getDesktop().browse(actualPath.toFile().toURI())
|
||||||
|
}
|
@ -1,7 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm")
|
kotlin("jvm")
|
||||||
id("ru.mipt.npm.gradle.common")
|
id("ru.mipt.npm.gradle.common")
|
||||||
id("com.github.johnrengelman.shadow") version "6.1.0"
|
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10,7 +9,7 @@ kotlin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val dataforgeVersion: String by rootProject.extra
|
val dataforgeVersion: String by rootProject.extra
|
||||||
val plotlyVersion: String by rootProject.extra("0.4.0")
|
val plotlyVersion: String by rootProject.extra
|
||||||
val kmathVersion: String by rootProject.extra
|
val kmathVersion: String by rootProject.extra
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
@ -14,7 +14,7 @@ suspend fun main() {
|
|||||||
operator?.startsWith("Vas") ?: false
|
operator?.startsWith("Vas") ?: false
|
||||||
}
|
}
|
||||||
|
|
||||||
filtered.flow().collect {
|
filtered.flowData().collect {
|
||||||
println(it)
|
println(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,25 +1,11 @@
|
|||||||
package ru.inr.mass.workspace
|
package ru.inr.mass.workspace
|
||||||
|
|
||||||
import ru.inr.mass.data.analysis.SmartAnalyzer
|
|
||||||
import ru.inr.mass.data.api.NumassSet
|
|
||||||
import ru.inr.mass.data.proto.NumassProtoPlugin
|
import ru.inr.mass.data.proto.NumassProtoPlugin
|
||||||
import space.kscience.dataforge.context.Context
|
import space.kscience.dataforge.context.Context
|
||||||
import space.kscience.dataforge.context.PluginFactory
|
import space.kscience.dataforge.context.PluginFactory
|
||||||
import space.kscience.dataforge.context.PluginTag
|
import space.kscience.dataforge.context.PluginTag
|
||||||
import space.kscience.dataforge.data.select
|
|
||||||
import space.kscience.dataforge.meta.Meta
|
import space.kscience.dataforge.meta.Meta
|
||||||
import space.kscience.dataforge.meta.boolean
|
|
||||||
import space.kscience.dataforge.meta.descriptors.MetaDescriptor
|
|
||||||
import space.kscience.dataforge.meta.descriptors.value
|
|
||||||
import space.kscience.dataforge.meta.get
|
|
||||||
import space.kscience.dataforge.meta.toMutableMeta
|
|
||||||
import space.kscience.dataforge.names.Name
|
|
||||||
import space.kscience.dataforge.tables.Table
|
|
||||||
import space.kscience.dataforge.values.Value
|
|
||||||
import space.kscience.dataforge.values.ValueType
|
|
||||||
import space.kscience.dataforge.workspace.WorkspacePlugin
|
import space.kscience.dataforge.workspace.WorkspacePlugin
|
||||||
import space.kscience.dataforge.workspace.pipeFrom
|
|
||||||
import space.kscience.dataforge.workspace.task
|
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
|
|
||||||
class NumassPlugin : WorkspacePlugin() {
|
class NumassPlugin : WorkspacePlugin() {
|
||||||
@ -27,40 +13,40 @@ class NumassPlugin : WorkspacePlugin() {
|
|||||||
|
|
||||||
val numassProtoPlugin by require(NumassProtoPlugin)
|
val numassProtoPlugin by require(NumassProtoPlugin)
|
||||||
|
|
||||||
val select by task<NumassSet>(
|
// val select by task<NumassSet>(
|
||||||
descriptor = MetaDescriptor {
|
// descriptor = MetaDescriptor {
|
||||||
info = "Select data from workspace data pool"
|
// info = "Select data from workspace data pool"
|
||||||
value("forward", ValueType.BOOLEAN) {
|
// value("forward", ValueType.BOOLEAN) {
|
||||||
info = "Select only forward or only backward sets"
|
// info = "Select only forward or only backward sets"
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
) {
|
// ) {
|
||||||
val forward = meta["forward"]?.boolean
|
// val forward = meta["forward"]?.boolean
|
||||||
val filtered = workspace.data.select<NumassSet> { _, meta ->
|
// val filtered = workspace.data.select<NumassSet> { _, meta ->
|
||||||
when (forward) {
|
// when (forward) {
|
||||||
true -> meta["iteration_info.reverse"]?.boolean?.not() ?: false
|
// true -> meta["iteration_info.reverse"]?.boolean?.not() ?: false
|
||||||
false -> meta["iteration_info.reverse"]?.boolean ?: false
|
// false -> meta["iteration_info.reverse"]?.boolean ?: false
|
||||||
else -> true
|
// else -> true
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
emit(Name.EMPTY, filtered)
|
// emit(Name.EMPTY, filtered)
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
val analyze by task<Table<Value>>(
|
// val analyze by task<Table<Value>>(
|
||||||
MetaDescriptor {
|
// MetaDescriptor {
|
||||||
info = "Count the number of events for each voltage and produce a table with the results"
|
// info = "Count the number of events for each voltage and produce a table with the results"
|
||||||
}
|
// }
|
||||||
) {
|
// ) {
|
||||||
pipeFrom(select) { set, name, meta ->
|
// pipeFrom(select) { set, name, meta ->
|
||||||
val res = SmartAnalyzer.analyzeSet(set, meta["analyzer"] ?: Meta.EMPTY)
|
// val res = SmartAnalyzer.analyzeSet(set, meta["analyzer"] ?: Meta.EMPTY)
|
||||||
val outputMeta = meta.toMutableMeta().apply {
|
// val outputMeta = meta.toMutableMeta().apply {
|
||||||
"data" put set.meta
|
// "data" put set.meta
|
||||||
}
|
// }
|
||||||
// context.output.render(res, stage = "numass.analyze", name = name, meta = outputMeta)
|
// // context.output.render(res, stage = "numass.analyze", name = name, meta = outputMeta)
|
||||||
res
|
// res
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
companion object : PluginFactory<NumassPlugin> {
|
companion object : PluginFactory<NumassPlugin> {
|
||||||
override val tag: PluginTag = PluginTag("numass", "ru.mipt.npm")
|
override val tag: PluginTag = PluginTag("numass", "ru.mipt.npm")
|
||||||
|
@ -3,7 +3,7 @@ package ru.inr.mass.workspace
|
|||||||
import kotlinx.html.h1
|
import kotlinx.html.h1
|
||||||
import kotlinx.html.h2
|
import kotlinx.html.h2
|
||||||
import ru.inr.mass.data.api.NumassPoint
|
import ru.inr.mass.data.api.NumassPoint
|
||||||
import ru.inr.mass.data.proto.HVEntry
|
import ru.inr.mass.data.proto.HVData
|
||||||
import ru.inr.mass.data.proto.NumassDirectorySet
|
import ru.inr.mass.data.proto.NumassDirectorySet
|
||||||
import space.kscience.dataforge.values.asValue
|
import space.kscience.dataforge.values.asValue
|
||||||
import space.kscience.dataforge.values.double
|
import space.kscience.dataforge.values.double
|
||||||
@ -42,7 +42,7 @@ fun Plot.amplitudeSpectrum(
|
|||||||
/**
|
/**
|
||||||
* Generate a plot from hv data
|
* Generate a plot from hv data
|
||||||
*/
|
*/
|
||||||
fun Plot.hvData(data: List<HVEntry>): Trace = scatter {
|
fun Plot.hvData(data: HVData): Trace = scatter {
|
||||||
x.strings = data.map { it.timestamp.toString() }
|
x.strings = data.map { it.timestamp.toString() }
|
||||||
y.numbers = data.map { it.value }
|
y.numbers = data.map { it.value }
|
||||||
}
|
}
|
||||||
|
@ -1,30 +1,16 @@
|
|||||||
pluginManagement {
|
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
|
||||||
|
enableFeaturePreview("VERSION_CATALOGS")
|
||||||
|
|
||||||
|
dependencyResolutionManagement {
|
||||||
repositories {
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
maven("https://repo.kotlin.link")
|
maven("https://repo.kotlin.link")
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
gradlePluginPortal()
|
|
||||||
mavenLocal()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val toolsVersion = "0.10.7"
|
versionCatalogs {
|
||||||
val kotlinVersion = "1.6.0"
|
create("npm") {
|
||||||
|
from("ru.mipt.npm:version-catalog:0.10.8-kotlin-1.6.0")
|
||||||
plugins {
|
|
||||||
id("ru.mipt.npm.gradle.project") version toolsVersion
|
|
||||||
id("ru.mipt.npm.gradle.mpp") version toolsVersion
|
|
||||||
id("ru.mipt.npm.gradle.jvm") version toolsVersion
|
|
||||||
id("ru.mipt.npm.gradle.js") version toolsVersion
|
|
||||||
kotlin("jvm") version kotlinVersion
|
|
||||||
kotlin("js") version kotlinVersion
|
|
||||||
}
|
|
||||||
|
|
||||||
resolutionStrategy {
|
|
||||||
eachPlugin {
|
|
||||||
if (requested.id.id == "com.squareup.wire") {
|
|
||||||
// For some reason, Gradle does a lookup on the wrong coordinates:
|
|
||||||
// 'com.squareup.wire:com.squareup.wire.gradle.plugin' instead of the one below.
|
|
||||||
useModule("com.squareup.wire:wire-gradle-plugin:${requested.version}")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -33,6 +19,7 @@ include(
|
|||||||
":numass-data-model",
|
":numass-data-model",
|
||||||
":numass-analysis",
|
":numass-analysis",
|
||||||
":numass-data-proto",
|
":numass-data-proto",
|
||||||
|
//":numass-data-server",
|
||||||
":numass-workspace",
|
":numass-workspace",
|
||||||
":numass-model"
|
":numass-model"
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user