Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
232669af80 | |||
b7618cc08f | |||
bbfa0483b6 | |||
047551fef7 | |||
43d79db6bb | |||
26f5e7461c | |||
64bae18644 | |||
cf02b2d8ba | |||
d9b4707da1 | |||
17d681bd42 | |||
e95f73d94d | |||
4c67d8b0a0 |
@ -1,3 +1,6 @@
|
|||||||
|
import space.kscience.gradle.useApache2Licence
|
||||||
|
import space.kscience.gradle.useSPCTeam
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("space.kscience.gradle.project")
|
id("space.kscience.gradle.project")
|
||||||
}
|
}
|
||||||
@ -10,17 +13,22 @@ allprojects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "ru.inr.mass"
|
group = "ru.inr.mass"
|
||||||
version = "0.1.3"
|
version = "0.1.4-dev-3"
|
||||||
}
|
}
|
||||||
|
|
||||||
val dataforgeVersion by extra("0.6.0-dev-15")
|
val dataforgeVersion by extra("0.6.2")
|
||||||
val tablesVersion: String by extra("0.2.0-dev-3")
|
val tablesVersion: String by extra("0.2.1")
|
||||||
val kmathVersion by extra("0.3.1-dev-6")
|
val kmathVersion by extra("0.3.1")
|
||||||
val visionForgeVersion: String by rootProject.extra("0.3.0-dev-4")
|
val visionForgeVersion: String by rootProject.extra("0.3.0-dev-14")
|
||||||
|
|
||||||
|
|
||||||
ksciencePublish {
|
ksciencePublish {
|
||||||
space("https://maven.pkg.jetbrains.space/mipt-npm/p/numass/maven")
|
pom("https://spc.jetbrains.space/p/numass/repositories/numass/") {
|
||||||
|
useApache2Licence()
|
||||||
|
useSPCTeam()
|
||||||
|
}
|
||||||
|
space("https://maven.pkg.jetbrains.space/spc/p/numass/maven")
|
||||||
|
//repository("spc","https://maven.sciprog.center/spc")
|
||||||
}
|
}
|
||||||
|
|
||||||
apiValidation {
|
apiValidation {
|
||||||
|
@ -5,11 +5,11 @@
|
|||||||
|
|
||||||
kotlin.code.style=official
|
kotlin.code.style=official
|
||||||
kotlin.mpp.stability.nowarn=true
|
kotlin.mpp.stability.nowarn=true
|
||||||
|
kotlin.js.compiler=ir
|
||||||
kotlin.jupyter.add.scanner=false
|
|
||||||
|
|
||||||
org.gradle.configureondemand=true
|
org.gradle.configureondemand=true
|
||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
org.gradle.jvmargs=-XX:MaxMetaspaceSize=1G
|
org.gradle.jvmargs=-XX:MaxMetaspaceSize=1G
|
||||||
|
|
||||||
toolsVersion=0.13.3-kotlin-1.7.20
|
toolsVersion=0.14.10-kotlin-1.9.0
|
||||||
|
compose.version=1.5.3
|
||||||
|
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.5.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
@ -8,7 +8,9 @@ val dataforgeVersion: String by rootProject.extra
|
|||||||
val kmathVersion: String by rootProject.extra
|
val kmathVersion: String by rootProject.extra
|
||||||
val tablesVersion: String by rootProject.extra
|
val tablesVersion: String by rootProject.extra
|
||||||
|
|
||||||
kotlin.sourceSets {
|
kscience {
|
||||||
|
jvm()
|
||||||
|
js()
|
||||||
commonMain {
|
commonMain {
|
||||||
dependencies {
|
dependencies {
|
||||||
api(projects.numass.numassDataModel)
|
api(projects.numass.numassDataModel)
|
||||||
@ -20,7 +22,7 @@ kotlin.sourceSets {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//
|
||||||
//kscience{
|
//kscience{
|
||||||
// useAtomic()
|
// useAtomic()
|
||||||
//}
|
//}
|
||||||
|
@ -6,7 +6,11 @@ plugins {
|
|||||||
|
|
||||||
val dataforgeVersion: String by rootProject.extra
|
val dataforgeVersion: String by rootProject.extra
|
||||||
|
|
||||||
kotlin.sourceSets {
|
kscience{
|
||||||
|
jvm()
|
||||||
|
js()
|
||||||
|
useSerialization()
|
||||||
|
|
||||||
commonMain {
|
commonMain {
|
||||||
dependencies {
|
dependencies {
|
||||||
api("space.kscience:dataforge-context:$dataforgeVersion")
|
api("space.kscience:dataforge-context:$dataforgeVersion")
|
||||||
@ -14,15 +18,14 @@ kotlin.sourceSets {
|
|||||||
api("org.jetbrains.kotlinx:kotlinx-datetime:${space.kscience.gradle.KScienceVersions.dateTimeVersion}")
|
api("org.jetbrains.kotlinx:kotlinx-datetime:${space.kscience.gradle.KScienceVersions.dateTimeVersion}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
jvmMain{
|
}
|
||||||
|
|
||||||
|
kotlin.sourceSets{
|
||||||
|
getByName("jvmMain"){
|
||||||
dependencies{
|
dependencies{
|
||||||
api("ch.qos.logback:logback-classic:1.2.3")
|
api("ch.qos.logback:logback-classic:1.2.3")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
kscience{
|
|
||||||
useSerialization()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id("space.kscience.gradle.jvm")
|
id("space.kscience.gradle.jvm")
|
||||||
id("com.squareup.wire") version "4.4.1"
|
id("com.squareup.wire") version "4.9.1"
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ package ru.inr.mass.`data`.proto
|
|||||||
|
|
||||||
import com.squareup.wire.*
|
import com.squareup.wire.*
|
||||||
import com.squareup.wire.Syntax.PROTO_3
|
import com.squareup.wire.Syntax.PROTO_3
|
||||||
|
import com.squareup.wire.internal.JvmField
|
||||||
import com.squareup.wire.internal.immutableCopyOf
|
import com.squareup.wire.internal.immutableCopyOf
|
||||||
import com.squareup.wire.internal.redactElements
|
import com.squareup.wire.internal.redactElements
|
||||||
import okio.ByteString
|
import okio.ByteString
|
||||||
@ -19,6 +20,7 @@ public class Point(
|
|||||||
tag = 1,
|
tag = 1,
|
||||||
adapter = "ru.inr.mass.data.proto.Point${'$'}Channel#ADAPTER",
|
adapter = "ru.inr.mass.data.proto.Point${'$'}Channel#ADAPTER",
|
||||||
label = WireField.Label.REPEATED,
|
label = WireField.Label.REPEATED,
|
||||||
|
schemaIndex = 0,
|
||||||
)
|
)
|
||||||
public val channels: List<Channel> = immutableCopyOf("channels", channels)
|
public val channels: List<Channel> = immutableCopyOf("channels", channels)
|
||||||
|
|
||||||
@ -26,10 +28,10 @@ public class Point(
|
|||||||
message = "Shouldn't be used in Kotlin",
|
message = "Shouldn't be used in Kotlin",
|
||||||
level = DeprecationLevel.HIDDEN,
|
level = DeprecationLevel.HIDDEN,
|
||||||
)
|
)
|
||||||
public override fun newBuilder(): Nothing = throw
|
override fun newBuilder(): Nothing = throw
|
||||||
AssertionError("Builders are deprecated and only available in a javaInterop build; see https://square.github.io/wire/wire_compiler/#kotlin")
|
AssertionError("Builders are deprecated and only available in a javaInterop build; see https://square.github.io/wire/wire_compiler/#kotlin")
|
||||||
|
|
||||||
public override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
if (other === this) return true
|
if (other === this) return true
|
||||||
if (other !is Point) return false
|
if (other !is Point) return false
|
||||||
if (unknownFields != other.unknownFields) return false
|
if (unknownFields != other.unknownFields) return false
|
||||||
@ -37,7 +39,7 @@ public class Point(
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
var result = super.hashCode
|
var result = super.hashCode
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
result = unknownFields.hashCode()
|
result = unknownFields.hashCode()
|
||||||
@ -47,7 +49,7 @@ public class Point(
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun toString(): String {
|
override fun toString(): String {
|
||||||
val result = mutableListOf<String>()
|
val result = mutableListOf<String>()
|
||||||
if (channels.isNotEmpty()) result += """channels=$channels"""
|
if (channels.isNotEmpty()) result += """channels=$channels"""
|
||||||
return result.joinToString(prefix = "Point{", separator = ", ", postfix = "}")
|
return result.joinToString(prefix = "Point{", separator = ", ", postfix = "}")
|
||||||
@ -66,23 +68,23 @@ public class Point(
|
|||||||
null,
|
null,
|
||||||
"numass-proto.proto"
|
"numass-proto.proto"
|
||||||
) {
|
) {
|
||||||
public override fun encodedSize(`value`: Point): Int {
|
override fun encodedSize(`value`: Point): Int {
|
||||||
var size = value.unknownFields.size
|
var size = value.unknownFields.size
|
||||||
size += Channel.ADAPTER.asRepeated().encodedSizeWithTag(1, value.channels)
|
size += Channel.ADAPTER.asRepeated().encodedSizeWithTag(1, value.channels)
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun encode(writer: ProtoWriter, `value`: Point): Unit {
|
override fun encode(writer: ProtoWriter, `value`: Point) {
|
||||||
Channel.ADAPTER.asRepeated().encodeWithTag(writer, 1, value.channels)
|
Channel.ADAPTER.asRepeated().encodeWithTag(writer, 1, value.channels)
|
||||||
writer.writeBytes(value.unknownFields)
|
writer.writeBytes(value.unknownFields)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun encode(writer: ReverseProtoWriter, `value`: Point): Unit {
|
override fun encode(writer: ReverseProtoWriter, `value`: Point) {
|
||||||
writer.writeBytes(value.unknownFields)
|
writer.writeBytes(value.unknownFields)
|
||||||
Channel.ADAPTER.asRepeated().encodeWithTag(writer, 1, value.channels)
|
Channel.ADAPTER.asRepeated().encodeWithTag(writer, 1, value.channels)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun decode(reader: ProtoReader): Point {
|
override fun decode(reader: ProtoReader): Point {
|
||||||
val channels = mutableListOf<Channel>()
|
val channels = mutableListOf<Channel>()
|
||||||
val unknownFields = reader.forEachTag { tag ->
|
val unknownFields = reader.forEachTag { tag ->
|
||||||
when (tag) {
|
when (tag) {
|
||||||
@ -96,7 +98,7 @@ public class Point(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun redact(`value`: Point): Point = value.copy(
|
override fun redact(`value`: Point): Point = value.copy(
|
||||||
channels = value.channels.redactElements(Channel.ADAPTER),
|
channels = value.channels.redactElements(Channel.ADAPTER),
|
||||||
unknownFields = ByteString.EMPTY
|
unknownFields = ByteString.EMPTY
|
||||||
)
|
)
|
||||||
@ -116,6 +118,7 @@ public class Point(
|
|||||||
tag = 1,
|
tag = 1,
|
||||||
adapter = "com.squareup.wire.ProtoAdapter#UINT64",
|
adapter = "com.squareup.wire.ProtoAdapter#UINT64",
|
||||||
label = WireField.Label.OMIT_IDENTITY,
|
label = WireField.Label.OMIT_IDENTITY,
|
||||||
|
schemaIndex = 0,
|
||||||
)
|
)
|
||||||
public val id: Long = 0L,
|
public val id: Long = 0L,
|
||||||
blocks: List<Block> = emptyList(),
|
blocks: List<Block> = emptyList(),
|
||||||
@ -128,6 +131,7 @@ public class Point(
|
|||||||
tag = 2,
|
tag = 2,
|
||||||
adapter = "ru.inr.mass.data.proto.Point${'$'}Channel${'$'}Block#ADAPTER",
|
adapter = "ru.inr.mass.data.proto.Point${'$'}Channel${'$'}Block#ADAPTER",
|
||||||
label = WireField.Label.REPEATED,
|
label = WireField.Label.REPEATED,
|
||||||
|
schemaIndex = 1,
|
||||||
)
|
)
|
||||||
public val blocks: List<Block> = immutableCopyOf("blocks", blocks)
|
public val blocks: List<Block> = immutableCopyOf("blocks", blocks)
|
||||||
|
|
||||||
@ -135,10 +139,10 @@ public class Point(
|
|||||||
message = "Shouldn't be used in Kotlin",
|
message = "Shouldn't be used in Kotlin",
|
||||||
level = DeprecationLevel.HIDDEN,
|
level = DeprecationLevel.HIDDEN,
|
||||||
)
|
)
|
||||||
public override fun newBuilder(): Nothing = throw
|
override fun newBuilder(): Nothing = throw
|
||||||
AssertionError("Builders are deprecated and only available in a javaInterop build; see https://square.github.io/wire/wire_compiler/#kotlin")
|
AssertionError("Builders are deprecated and only available in a javaInterop build; see https://square.github.io/wire/wire_compiler/#kotlin")
|
||||||
|
|
||||||
public override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
if (other === this) return true
|
if (other === this) return true
|
||||||
if (other !is Channel) return false
|
if (other !is Channel) return false
|
||||||
if (unknownFields != other.unknownFields) return false
|
if (unknownFields != other.unknownFields) return false
|
||||||
@ -147,7 +151,7 @@ public class Point(
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
var result = super.hashCode
|
var result = super.hashCode
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
result = unknownFields.hashCode()
|
result = unknownFields.hashCode()
|
||||||
@ -158,7 +162,7 @@ public class Point(
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun toString(): String {
|
override fun toString(): String {
|
||||||
val result = mutableListOf<String>()
|
val result = mutableListOf<String>()
|
||||||
result += """id=$id"""
|
result += """id=$id"""
|
||||||
if (blocks.isNotEmpty()) result += """blocks=$blocks"""
|
if (blocks.isNotEmpty()) result += """blocks=$blocks"""
|
||||||
@ -181,26 +185,26 @@ public class Point(
|
|||||||
null,
|
null,
|
||||||
"numass-proto.proto"
|
"numass-proto.proto"
|
||||||
) {
|
) {
|
||||||
public override fun encodedSize(`value`: Channel): Int {
|
override fun encodedSize(`value`: Channel): Int {
|
||||||
var size = value.unknownFields.size
|
var size = value.unknownFields.size
|
||||||
if (value.id != 0L) size += ProtoAdapter.UINT64.encodedSizeWithTag(1, value.id)
|
if (value.id != 0L) size += ProtoAdapter.UINT64.encodedSizeWithTag(1, value.id)
|
||||||
size += Block.ADAPTER.asRepeated().encodedSizeWithTag(2, value.blocks)
|
size += Block.ADAPTER.asRepeated().encodedSizeWithTag(2, value.blocks)
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun encode(writer: ProtoWriter, `value`: Channel): Unit {
|
override fun encode(writer: ProtoWriter, `value`: Channel) {
|
||||||
if (value.id != 0L) ProtoAdapter.UINT64.encodeWithTag(writer, 1, value.id)
|
if (value.id != 0L) ProtoAdapter.UINT64.encodeWithTag(writer, 1, value.id)
|
||||||
Block.ADAPTER.asRepeated().encodeWithTag(writer, 2, value.blocks)
|
Block.ADAPTER.asRepeated().encodeWithTag(writer, 2, value.blocks)
|
||||||
writer.writeBytes(value.unknownFields)
|
writer.writeBytes(value.unknownFields)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun encode(writer: ReverseProtoWriter, `value`: Channel): Unit {
|
override fun encode(writer: ReverseProtoWriter, `value`: Channel) {
|
||||||
writer.writeBytes(value.unknownFields)
|
writer.writeBytes(value.unknownFields)
|
||||||
Block.ADAPTER.asRepeated().encodeWithTag(writer, 2, value.blocks)
|
Block.ADAPTER.asRepeated().encodeWithTag(writer, 2, value.blocks)
|
||||||
if (value.id != 0L) ProtoAdapter.UINT64.encodeWithTag(writer, 1, value.id)
|
if (value.id != 0L) ProtoAdapter.UINT64.encodeWithTag(writer, 1, value.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun decode(reader: ProtoReader): Channel {
|
override fun decode(reader: ProtoReader): Channel {
|
||||||
var id: Long = 0L
|
var id: Long = 0L
|
||||||
val blocks = mutableListOf<Block>()
|
val blocks = mutableListOf<Block>()
|
||||||
val unknownFields = reader.forEachTag { tag ->
|
val unknownFields = reader.forEachTag { tag ->
|
||||||
@ -217,7 +221,7 @@ public class Point(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun redact(`value`: Channel): Channel = value.copy(
|
override fun redact(`value`: Channel): Channel = value.copy(
|
||||||
blocks = value.blocks.redactElements(Block.ADAPTER),
|
blocks = value.blocks.redactElements(Block.ADAPTER),
|
||||||
unknownFields = ByteString.EMPTY
|
unknownFields = ByteString.EMPTY
|
||||||
)
|
)
|
||||||
@ -237,6 +241,7 @@ public class Point(
|
|||||||
tag = 1,
|
tag = 1,
|
||||||
adapter = "com.squareup.wire.ProtoAdapter#UINT64",
|
adapter = "com.squareup.wire.ProtoAdapter#UINT64",
|
||||||
label = WireField.Label.OMIT_IDENTITY,
|
label = WireField.Label.OMIT_IDENTITY,
|
||||||
|
schemaIndex = 0,
|
||||||
)
|
)
|
||||||
public val time: Long = 0L,
|
public val time: Long = 0L,
|
||||||
frames: List<Frame> = emptyList(),
|
frames: List<Frame> = emptyList(),
|
||||||
@ -247,6 +252,7 @@ public class Point(
|
|||||||
tag = 3,
|
tag = 3,
|
||||||
adapter = "ru.inr.mass.data.proto.Point${'$'}Channel${'$'}Block${'$'}Events#ADAPTER",
|
adapter = "ru.inr.mass.data.proto.Point${'$'}Channel${'$'}Block${'$'}Events#ADAPTER",
|
||||||
label = WireField.Label.OMIT_IDENTITY,
|
label = WireField.Label.OMIT_IDENTITY,
|
||||||
|
schemaIndex = 2,
|
||||||
)
|
)
|
||||||
public val events: Events? = null,
|
public val events: Events? = null,
|
||||||
/**
|
/**
|
||||||
@ -256,6 +262,7 @@ public class Point(
|
|||||||
tag = 4,
|
tag = 4,
|
||||||
adapter = "com.squareup.wire.ProtoAdapter#UINT64",
|
adapter = "com.squareup.wire.ProtoAdapter#UINT64",
|
||||||
label = WireField.Label.OMIT_IDENTITY,
|
label = WireField.Label.OMIT_IDENTITY,
|
||||||
|
schemaIndex = 3,
|
||||||
)
|
)
|
||||||
public val length: Long = 0L,
|
public val length: Long = 0L,
|
||||||
/**
|
/**
|
||||||
@ -266,6 +273,7 @@ public class Point(
|
|||||||
adapter = "com.squareup.wire.ProtoAdapter#UINT64",
|
adapter = "com.squareup.wire.ProtoAdapter#UINT64",
|
||||||
label = WireField.Label.OMIT_IDENTITY,
|
label = WireField.Label.OMIT_IDENTITY,
|
||||||
jsonName = "binSize",
|
jsonName = "binSize",
|
||||||
|
schemaIndex = 4,
|
||||||
)
|
)
|
||||||
public val bin_size: Long = 0L,
|
public val bin_size: Long = 0L,
|
||||||
unknownFields: ByteString = ByteString.EMPTY,
|
unknownFields: ByteString = ByteString.EMPTY,
|
||||||
@ -277,6 +285,7 @@ public class Point(
|
|||||||
tag = 2,
|
tag = 2,
|
||||||
adapter = "ru.inr.mass.data.proto.Point${'$'}Channel${'$'}Block${'$'}Frame#ADAPTER",
|
adapter = "ru.inr.mass.data.proto.Point${'$'}Channel${'$'}Block${'$'}Frame#ADAPTER",
|
||||||
label = WireField.Label.REPEATED,
|
label = WireField.Label.REPEATED,
|
||||||
|
schemaIndex = 1,
|
||||||
)
|
)
|
||||||
public val frames: List<Frame> = immutableCopyOf("frames", frames)
|
public val frames: List<Frame> = immutableCopyOf("frames", frames)
|
||||||
|
|
||||||
@ -284,10 +293,10 @@ public class Point(
|
|||||||
message = "Shouldn't be used in Kotlin",
|
message = "Shouldn't be used in Kotlin",
|
||||||
level = DeprecationLevel.HIDDEN,
|
level = DeprecationLevel.HIDDEN,
|
||||||
)
|
)
|
||||||
public override fun newBuilder(): Nothing = throw
|
override fun newBuilder(): Nothing = throw
|
||||||
AssertionError("Builders are deprecated and only available in a javaInterop build; see https://square.github.io/wire/wire_compiler/#kotlin")
|
AssertionError("Builders are deprecated and only available in a javaInterop build; see https://square.github.io/wire/wire_compiler/#kotlin")
|
||||||
|
|
||||||
public override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
if (other === this) return true
|
if (other === this) return true
|
||||||
if (other !is Block) return false
|
if (other !is Block) return false
|
||||||
if (unknownFields != other.unknownFields) return false
|
if (unknownFields != other.unknownFields) return false
|
||||||
@ -299,7 +308,7 @@ public class Point(
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
var result = super.hashCode
|
var result = super.hashCode
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
result = unknownFields.hashCode()
|
result = unknownFields.hashCode()
|
||||||
@ -313,7 +322,7 @@ public class Point(
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun toString(): String {
|
override fun toString(): String {
|
||||||
val result = mutableListOf<String>()
|
val result = mutableListOf<String>()
|
||||||
result += """time=$time"""
|
result += """time=$time"""
|
||||||
if (frames.isNotEmpty()) result += """frames=$frames"""
|
if (frames.isNotEmpty()) result += """frames=$frames"""
|
||||||
@ -342,7 +351,7 @@ public class Point(
|
|||||||
null,
|
null,
|
||||||
"numass-proto.proto"
|
"numass-proto.proto"
|
||||||
) {
|
) {
|
||||||
public override fun encodedSize(`value`: Block): Int {
|
override fun encodedSize(`value`: Block): Int {
|
||||||
var size = value.unknownFields.size
|
var size = value.unknownFields.size
|
||||||
if (value.time != 0L) size += ProtoAdapter.UINT64.encodedSizeWithTag(1, value.time)
|
if (value.time != 0L) size += ProtoAdapter.UINT64.encodedSizeWithTag(1, value.time)
|
||||||
size += Frame.ADAPTER.asRepeated().encodedSizeWithTag(2, value.frames)
|
size += Frame.ADAPTER.asRepeated().encodedSizeWithTag(2, value.frames)
|
||||||
@ -353,7 +362,7 @@ public class Point(
|
|||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun encode(writer: ProtoWriter, `value`: Block): Unit {
|
override fun encode(writer: ProtoWriter, `value`: Block) {
|
||||||
if (value.time != 0L) ProtoAdapter.UINT64.encodeWithTag(writer, 1, value.time)
|
if (value.time != 0L) ProtoAdapter.UINT64.encodeWithTag(writer, 1, value.time)
|
||||||
Frame.ADAPTER.asRepeated().encodeWithTag(writer, 2, value.frames)
|
Frame.ADAPTER.asRepeated().encodeWithTag(writer, 2, value.frames)
|
||||||
if (value.events != null) Events.ADAPTER.encodeWithTag(writer, 3, value.events)
|
if (value.events != null) Events.ADAPTER.encodeWithTag(writer, 3, value.events)
|
||||||
@ -362,7 +371,7 @@ public class Point(
|
|||||||
writer.writeBytes(value.unknownFields)
|
writer.writeBytes(value.unknownFields)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun encode(writer: ReverseProtoWriter, `value`: Block): Unit {
|
override fun encode(writer: ReverseProtoWriter, `value`: Block) {
|
||||||
writer.writeBytes(value.unknownFields)
|
writer.writeBytes(value.unknownFields)
|
||||||
if (value.bin_size != 0L) ProtoAdapter.UINT64.encodeWithTag(writer, 5, value.bin_size)
|
if (value.bin_size != 0L) ProtoAdapter.UINT64.encodeWithTag(writer, 5, value.bin_size)
|
||||||
if (value.length != 0L) ProtoAdapter.UINT64.encodeWithTag(writer, 4, value.length)
|
if (value.length != 0L) ProtoAdapter.UINT64.encodeWithTag(writer, 4, value.length)
|
||||||
@ -371,7 +380,7 @@ public class Point(
|
|||||||
if (value.time != 0L) ProtoAdapter.UINT64.encodeWithTag(writer, 1, value.time)
|
if (value.time != 0L) ProtoAdapter.UINT64.encodeWithTag(writer, 1, value.time)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun decode(reader: ProtoReader): Block {
|
override fun decode(reader: ProtoReader): Block {
|
||||||
var time: Long = 0L
|
var time: Long = 0L
|
||||||
val frames = mutableListOf<Frame>()
|
val frames = mutableListOf<Frame>()
|
||||||
var events: Events? = null
|
var events: Events? = null
|
||||||
@ -397,7 +406,7 @@ public class Point(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun redact(`value`: Block): Block = value.copy(
|
override fun redact(`value`: Block): Block = value.copy(
|
||||||
frames = value.frames.redactElements(Frame.ADAPTER),
|
frames = value.frames.redactElements(Frame.ADAPTER),
|
||||||
events = value.events?.let(Events.ADAPTER::redact),
|
events = value.events?.let(Events.ADAPTER::redact),
|
||||||
unknownFields = ByteString.EMPTY
|
unknownFields = ByteString.EMPTY
|
||||||
@ -418,6 +427,7 @@ public class Point(
|
|||||||
tag = 1,
|
tag = 1,
|
||||||
adapter = "com.squareup.wire.ProtoAdapter#UINT64",
|
adapter = "com.squareup.wire.ProtoAdapter#UINT64",
|
||||||
label = WireField.Label.OMIT_IDENTITY,
|
label = WireField.Label.OMIT_IDENTITY,
|
||||||
|
schemaIndex = 0,
|
||||||
)
|
)
|
||||||
public val time: Long = 0L,
|
public val time: Long = 0L,
|
||||||
/**
|
/**
|
||||||
@ -428,6 +438,7 @@ public class Point(
|
|||||||
adapter = "com.squareup.wire.ProtoAdapter#BYTES",
|
adapter = "com.squareup.wire.ProtoAdapter#BYTES",
|
||||||
label = WireField.Label.OMIT_IDENTITY,
|
label = WireField.Label.OMIT_IDENTITY,
|
||||||
declaredName = "data",
|
declaredName = "data",
|
||||||
|
schemaIndex = 1,
|
||||||
)
|
)
|
||||||
public val data_: ByteString = ByteString.EMPTY,
|
public val data_: ByteString = ByteString.EMPTY,
|
||||||
unknownFields: ByteString = ByteString.EMPTY,
|
unknownFields: ByteString = ByteString.EMPTY,
|
||||||
@ -436,10 +447,10 @@ public class Point(
|
|||||||
message = "Shouldn't be used in Kotlin",
|
message = "Shouldn't be used in Kotlin",
|
||||||
level = DeprecationLevel.HIDDEN,
|
level = DeprecationLevel.HIDDEN,
|
||||||
)
|
)
|
||||||
public override fun newBuilder(): Nothing = throw
|
override fun newBuilder(): Nothing = throw
|
||||||
AssertionError("Builders are deprecated and only available in a javaInterop build; see https://square.github.io/wire/wire_compiler/#kotlin")
|
AssertionError("Builders are deprecated and only available in a javaInterop build; see https://square.github.io/wire/wire_compiler/#kotlin")
|
||||||
|
|
||||||
public override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
if (other === this) return true
|
if (other === this) return true
|
||||||
if (other !is Frame) return false
|
if (other !is Frame) return false
|
||||||
if (unknownFields != other.unknownFields) return false
|
if (unknownFields != other.unknownFields) return false
|
||||||
@ -448,7 +459,7 @@ public class Point(
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
var result = super.hashCode
|
var result = super.hashCode
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
result = unknownFields.hashCode()
|
result = unknownFields.hashCode()
|
||||||
@ -459,7 +470,7 @@ public class Point(
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun toString(): String {
|
override fun toString(): String {
|
||||||
val result = mutableListOf<String>()
|
val result = mutableListOf<String>()
|
||||||
result += """time=$time"""
|
result += """time=$time"""
|
||||||
result += """data_=$data_"""
|
result += """data_=$data_"""
|
||||||
@ -482,7 +493,7 @@ public class Point(
|
|||||||
null,
|
null,
|
||||||
"numass-proto.proto"
|
"numass-proto.proto"
|
||||||
) {
|
) {
|
||||||
public override fun encodedSize(`value`: Frame): Int {
|
override fun encodedSize(`value`: Frame): Int {
|
||||||
var size = value.unknownFields.size
|
var size = value.unknownFields.size
|
||||||
if (value.time != 0L) size += ProtoAdapter.UINT64.encodedSizeWithTag(1, value.time)
|
if (value.time != 0L) size += ProtoAdapter.UINT64.encodedSizeWithTag(1, value.time)
|
||||||
if (value.data_ != ByteString.EMPTY) size += ProtoAdapter.BYTES.encodedSizeWithTag(2,
|
if (value.data_ != ByteString.EMPTY) size += ProtoAdapter.BYTES.encodedSizeWithTag(2,
|
||||||
@ -490,21 +501,21 @@ public class Point(
|
|||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun encode(writer: ProtoWriter, `value`: Frame): Unit {
|
override fun encode(writer: ProtoWriter, `value`: Frame) {
|
||||||
if (value.time != 0L) ProtoAdapter.UINT64.encodeWithTag(writer, 1, value.time)
|
if (value.time != 0L) ProtoAdapter.UINT64.encodeWithTag(writer, 1, value.time)
|
||||||
if (value.data_ != ByteString.EMPTY) ProtoAdapter.BYTES.encodeWithTag(writer, 2,
|
if (value.data_ != ByteString.EMPTY) ProtoAdapter.BYTES.encodeWithTag(writer, 2,
|
||||||
value.data_)
|
value.data_)
|
||||||
writer.writeBytes(value.unknownFields)
|
writer.writeBytes(value.unknownFields)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun encode(writer: ReverseProtoWriter, `value`: Frame): Unit {
|
override fun encode(writer: ReverseProtoWriter, `value`: Frame) {
|
||||||
writer.writeBytes(value.unknownFields)
|
writer.writeBytes(value.unknownFields)
|
||||||
if (value.data_ != ByteString.EMPTY) ProtoAdapter.BYTES.encodeWithTag(writer, 2,
|
if (value.data_ != ByteString.EMPTY) ProtoAdapter.BYTES.encodeWithTag(writer, 2,
|
||||||
value.data_)
|
value.data_)
|
||||||
if (value.time != 0L) ProtoAdapter.UINT64.encodeWithTag(writer, 1, value.time)
|
if (value.time != 0L) ProtoAdapter.UINT64.encodeWithTag(writer, 1, value.time)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun decode(reader: ProtoReader): Frame {
|
override fun decode(reader: ProtoReader): Frame {
|
||||||
var time: Long = 0L
|
var time: Long = 0L
|
||||||
var data_: ByteString = ByteString.EMPTY
|
var data_: ByteString = ByteString.EMPTY
|
||||||
val unknownFields = reader.forEachTag { tag ->
|
val unknownFields = reader.forEachTag { tag ->
|
||||||
@ -521,7 +532,7 @@ public class Point(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun redact(`value`: Frame): Frame = value.copy(
|
override fun redact(`value`: Frame): Frame = value.copy(
|
||||||
unknownFields = ByteString.EMPTY
|
unknownFields = ByteString.EMPTY
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -547,6 +558,7 @@ public class Point(
|
|||||||
tag = 1,
|
tag = 1,
|
||||||
adapter = "com.squareup.wire.ProtoAdapter#UINT64",
|
adapter = "com.squareup.wire.ProtoAdapter#UINT64",
|
||||||
label = WireField.Label.PACKED,
|
label = WireField.Label.PACKED,
|
||||||
|
schemaIndex = 0,
|
||||||
)
|
)
|
||||||
public val times: List<Long> = immutableCopyOf("times", times)
|
public val times: List<Long> = immutableCopyOf("times", times)
|
||||||
|
|
||||||
@ -557,6 +569,7 @@ public class Point(
|
|||||||
tag = 2,
|
tag = 2,
|
||||||
adapter = "com.squareup.wire.ProtoAdapter#UINT64",
|
adapter = "com.squareup.wire.ProtoAdapter#UINT64",
|
||||||
label = WireField.Label.PACKED,
|
label = WireField.Label.PACKED,
|
||||||
|
schemaIndex = 1,
|
||||||
)
|
)
|
||||||
public val amplitudes: List<Long> = immutableCopyOf("amplitudes", amplitudes)
|
public val amplitudes: List<Long> = immutableCopyOf("amplitudes", amplitudes)
|
||||||
|
|
||||||
@ -564,10 +577,10 @@ public class Point(
|
|||||||
message = "Shouldn't be used in Kotlin",
|
message = "Shouldn't be used in Kotlin",
|
||||||
level = DeprecationLevel.HIDDEN,
|
level = DeprecationLevel.HIDDEN,
|
||||||
)
|
)
|
||||||
public override fun newBuilder(): Nothing = throw
|
override fun newBuilder(): Nothing = throw
|
||||||
AssertionError("Builders are deprecated and only available in a javaInterop build; see https://square.github.io/wire/wire_compiler/#kotlin")
|
AssertionError("Builders are deprecated and only available in a javaInterop build; see https://square.github.io/wire/wire_compiler/#kotlin")
|
||||||
|
|
||||||
public override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
if (other === this) return true
|
if (other === this) return true
|
||||||
if (other !is Events) return false
|
if (other !is Events) return false
|
||||||
if (unknownFields != other.unknownFields) return false
|
if (unknownFields != other.unknownFields) return false
|
||||||
@ -576,7 +589,7 @@ public class Point(
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
var result = super.hashCode
|
var result = super.hashCode
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
result = unknownFields.hashCode()
|
result = unknownFields.hashCode()
|
||||||
@ -587,7 +600,7 @@ public class Point(
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun toString(): String {
|
override fun toString(): String {
|
||||||
val result = mutableListOf<String>()
|
val result = mutableListOf<String>()
|
||||||
if (times.isNotEmpty()) result += """times=$times"""
|
if (times.isNotEmpty()) result += """times=$times"""
|
||||||
if (amplitudes.isNotEmpty()) result += """amplitudes=$amplitudes"""
|
if (amplitudes.isNotEmpty()) result += """amplitudes=$amplitudes"""
|
||||||
@ -610,43 +623,61 @@ public class Point(
|
|||||||
null,
|
null,
|
||||||
"numass-proto.proto"
|
"numass-proto.proto"
|
||||||
) {
|
) {
|
||||||
public override fun encodedSize(`value`: Events): Int {
|
override fun encodedSize(`value`: Events): Int {
|
||||||
var size = value.unknownFields.size
|
var size = value.unknownFields.size
|
||||||
size += ProtoAdapter.UINT64.asPacked().encodedSizeWithTag(1, value.times)
|
size += ProtoAdapter.UINT64.asPacked().encodedSizeWithTag(1, value.times)
|
||||||
size += ProtoAdapter.UINT64.asPacked().encodedSizeWithTag(2, value.amplitudes)
|
size += ProtoAdapter.UINT64.asPacked().encodedSizeWithTag(2, value.amplitudes)
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun encode(writer: ProtoWriter, `value`: Events): Unit {
|
override fun encode(writer: ProtoWriter, `value`: Events) {
|
||||||
ProtoAdapter.UINT64.asPacked().encodeWithTag(writer, 1, value.times)
|
ProtoAdapter.UINT64.asPacked().encodeWithTag(writer, 1, value.times)
|
||||||
ProtoAdapter.UINT64.asPacked().encodeWithTag(writer, 2, value.amplitudes)
|
ProtoAdapter.UINT64.asPacked().encodeWithTag(writer, 2, value.amplitudes)
|
||||||
writer.writeBytes(value.unknownFields)
|
writer.writeBytes(value.unknownFields)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun encode(writer: ReverseProtoWriter, `value`: Events): Unit {
|
override fun encode(writer: ReverseProtoWriter, `value`: Events) {
|
||||||
writer.writeBytes(value.unknownFields)
|
writer.writeBytes(value.unknownFields)
|
||||||
ProtoAdapter.UINT64.asPacked().encodeWithTag(writer, 2, value.amplitudes)
|
ProtoAdapter.UINT64.asPacked().encodeWithTag(writer, 2, value.amplitudes)
|
||||||
ProtoAdapter.UINT64.asPacked().encodeWithTag(writer, 1, value.times)
|
ProtoAdapter.UINT64.asPacked().encodeWithTag(writer, 1, value.times)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun decode(reader: ProtoReader): Events {
|
override fun decode(reader: ProtoReader): Events {
|
||||||
val times = mutableListOf<Long>()
|
var times: MutableList<Long>? = null
|
||||||
val amplitudes = mutableListOf<Long>()
|
var amplitudes: MutableList<Long>? = null
|
||||||
val unknownFields = reader.forEachTag { tag ->
|
val unknownFields = reader.forEachTag { tag ->
|
||||||
when (tag) {
|
when (tag) {
|
||||||
1 -> times.add(ProtoAdapter.UINT64.decode(reader))
|
1 -> {
|
||||||
2 -> amplitudes.add(ProtoAdapter.UINT64.decode(reader))
|
if (times == null) {
|
||||||
|
val minimumByteSize = 1
|
||||||
|
val initialCapacity = (reader.nextFieldMinLengthInBytes() / minimumByteSize)
|
||||||
|
.coerceAtMost(Int.MAX_VALUE.toLong())
|
||||||
|
.toInt()
|
||||||
|
times = ArrayList(initialCapacity)
|
||||||
|
}
|
||||||
|
times!!.add(ProtoAdapter.UINT64.decode(reader))
|
||||||
|
}
|
||||||
|
2 -> {
|
||||||
|
if (amplitudes == null) {
|
||||||
|
val minimumByteSize = 1
|
||||||
|
val initialCapacity = (reader.nextFieldMinLengthInBytes() / minimumByteSize)
|
||||||
|
.coerceAtMost(Int.MAX_VALUE.toLong())
|
||||||
|
.toInt()
|
||||||
|
amplitudes = ArrayList(initialCapacity)
|
||||||
|
}
|
||||||
|
amplitudes!!.add(ProtoAdapter.UINT64.decode(reader))
|
||||||
|
}
|
||||||
else -> reader.readUnknownField(tag)
|
else -> reader.readUnknownField(tag)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Events(
|
return Events(
|
||||||
times = times,
|
times = times ?: listOf(),
|
||||||
amplitudes = amplitudes,
|
amplitudes = amplitudes ?: listOf(),
|
||||||
unknownFields = unknownFields
|
unknownFields = unknownFields
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun redact(`value`: Events): Events = value.copy(
|
override fun redact(`value`: Events): Events = value.copy(
|
||||||
unknownFields = ByteString.EMPTY
|
unknownFields = ByteString.EMPTY
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@ import java.nio.file.Path
|
|||||||
import kotlin.io.path.exists
|
import kotlin.io.path.exists
|
||||||
import kotlin.io.path.isDirectory
|
import kotlin.io.path.isDirectory
|
||||||
import kotlin.io.path.relativeTo
|
import kotlin.io.path.relativeTo
|
||||||
import kotlin.reflect.KClass
|
|
||||||
|
|
||||||
public class NumassProtoPlugin : AbstractPlugin() {
|
public class NumassProtoPlugin : AbstractPlugin() {
|
||||||
public val io: IOPlugin by require(IOPlugin)
|
public val io: IOPlugin by require(IOPlugin)
|
||||||
@ -35,7 +34,6 @@ public class NumassProtoPlugin : AbstractPlugin() {
|
|||||||
public companion object : PluginFactory<NumassProtoPlugin> {
|
public companion object : PluginFactory<NumassProtoPlugin> {
|
||||||
override fun build(context: Context, meta: Meta): NumassProtoPlugin = NumassProtoPlugin()
|
override fun build(context: Context, meta: Meta): NumassProtoPlugin = NumassProtoPlugin()
|
||||||
override val tag: PluginTag = PluginTag("numass-proto", group = "ru.inr.mass")
|
override val tag: PluginTag = PluginTag("numass-proto", group = "ru.inr.mass")
|
||||||
override val type: KClass<out NumassProtoPlugin> = NumassProtoPlugin::class
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,24 +39,8 @@ public class TaggedNumassEnvelopeFormat(private val io: IOPlugin) : EnvelopeForm
|
|||||||
writeRawString(END_SEQUENCE)
|
writeRawString(END_SEQUENCE)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun writeEnvelope(
|
override fun writeObject(output: Output, obj: Envelope) {
|
||||||
output: Output,
|
|
||||||
envelope: Envelope,
|
|
||||||
metaFormatFactory: MetaFormatFactory,
|
|
||||||
formatMeta: Meta,
|
|
||||||
) {
|
|
||||||
error("Don't write legacy formats")
|
error("Don't write legacy formats")
|
||||||
// val metaFormat = metaFormatFactory.invoke(formatMeta, io.context)
|
|
||||||
// val metaBytes = metaFormat.toBinary(envelope.meta)
|
|
||||||
// val actualSize: ULong = (envelope.data?.size ?: 0).toULong()
|
|
||||||
// val tag = Tag(metaFormatFactory.key, metaBytes.size.toUInt() + 2u, actualSize)
|
|
||||||
// output.writeBinary(tag.toBinary())
|
|
||||||
// output.writeBinary(metaBytes)
|
|
||||||
// output.writeRawString("\r\n")
|
|
||||||
// envelope.data?.let {
|
|
||||||
// output.writeBinary(it)
|
|
||||||
// }
|
|
||||||
// output.flush()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -68,31 +52,30 @@ public class TaggedNumassEnvelopeFormat(private val io: IOPlugin) : EnvelopeForm
|
|||||||
override fun readObject(input: Input): Envelope {
|
override fun readObject(input: Input): Envelope {
|
||||||
val tag = input.readTag()
|
val tag = input.readTag()
|
||||||
|
|
||||||
val metaFormat = io.resolveMetaFormat(tag.metaFormatKey)
|
val metaFormat = io.resolveMetaFormat(tag.metaFormatKey) ?: JsonMetaFormat
|
||||||
?: error("Meta format with key ${tag.metaFormatKey} not found")
|
|
||||||
|
|
||||||
val meta: Meta = metaFormat.readObjectFrom(input.readBinary(tag.metaSize.toInt()))
|
val meta: Meta = metaFormat.readObjectFrom(input.readBinary(tag.metaSize.toInt()))
|
||||||
|
|
||||||
val data = input.readBinary(tag.dataSize.toInt())
|
val data = input.readBinary(tag.dataSize.toInt())
|
||||||
|
|
||||||
return SimpleEnvelope(meta, data)
|
return Envelope(meta, data)
|
||||||
}
|
|
||||||
|
|
||||||
override fun readPartial(input: Input): PartialEnvelope {
|
|
||||||
val tag = input.readTag()
|
|
||||||
|
|
||||||
val metaFormat = if (tag.metaFormatKey == 1.toShort()) {
|
|
||||||
JsonMetaFormat
|
|
||||||
} else {
|
|
||||||
io.resolveMetaFormat(tag.metaFormatKey)
|
|
||||||
?: error("Meta format with key ${tag.metaFormatKey} not found")
|
|
||||||
}
|
|
||||||
|
|
||||||
val meta: Meta = metaFormat.readObjectFrom(input.readBinary(tag.metaSize.toInt()))
|
|
||||||
|
|
||||||
|
|
||||||
return PartialEnvelope(meta, 30 + tag.metaSize.toInt(), tag.dataSize)
|
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
// override fun readPartial(input: Input): PartialEnvelope {
|
||||||
|
// val tag = input.readTag()
|
||||||
|
//
|
||||||
|
// val metaFormat = if (tag.metaFormatKey == 1.toShort()) {
|
||||||
|
// JsonMetaFormat
|
||||||
|
// } else {
|
||||||
|
// io.resolveMetaFormat(tag.metaFormatKey)
|
||||||
|
// ?: error("Meta format with key ${tag.metaFormatKey} not found")
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// val meta: Meta = metaFormat.readObjectFrom(input.readBinary(tag.metaSize.toInt()))
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// return PartialEnvelope(meta, 30 + tag.metaSize.toInt(), tag.dataSize)
|
||||||
|
// }
|
||||||
|
|
||||||
private data class Tag(
|
private data class Tag(
|
||||||
val metaFormatKey: Short,
|
val metaFormatKey: Short,
|
||||||
@ -149,23 +132,11 @@ public class TaggedNumassEnvelopeFormat(private val io: IOPlugin) : EnvelopeForm
|
|||||||
|
|
||||||
private val default by lazy { invoke() }
|
private val default by lazy { invoke() }
|
||||||
|
|
||||||
override fun readPartial(input: Input): PartialEnvelope =
|
override fun writeObject(output: Output, obj: Envelope) {
|
||||||
default.run { readPartial(input) }
|
error("Don't write legacy formats")
|
||||||
|
|
||||||
override fun writeEnvelope(
|
|
||||||
output: Output,
|
|
||||||
envelope: Envelope,
|
|
||||||
metaFormatFactory: MetaFormatFactory,
|
|
||||||
formatMeta: Meta,
|
|
||||||
): Unit = default.run {
|
|
||||||
writeEnvelope(
|
|
||||||
output,
|
|
||||||
envelope,
|
|
||||||
metaFormatFactory,
|
|
||||||
formatMeta
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun readObject(input: Input): Envelope = default.readObject(input)
|
override fun readObject(input: Input): Envelope = default.readObject(input)
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id("space.kscience.gradle.mpp")
|
id("space.kscience.gradle.mpp")
|
||||||
|
id("org.jetbrains.compose")
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7,17 +8,17 @@ val visionForgeVersion: String by rootProject.extra
|
|||||||
|
|
||||||
val production: Boolean by rootProject.extra(true)
|
val production: Boolean by rootProject.extra(true)
|
||||||
|
|
||||||
kotlin {
|
|
||||||
js(IR) {
|
kscience {
|
||||||
browser {
|
fullStack("js/numass-web.js")
|
||||||
webpackTask {
|
|
||||||
this.outputFileName = "js/numass-web.js"
|
useSerialization {
|
||||||
}
|
json()
|
||||||
}
|
|
||||||
binaries.executable()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
useContextReceivers()
|
||||||
|
useKtor()
|
||||||
|
|
||||||
commonMain {
|
commonMain {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(project(":numass-data-model"))
|
implementation(project(":numass-data-model"))
|
||||||
@ -25,36 +26,23 @@ kotlin {
|
|||||||
implementation("space.kscience:visionforge-plotly:$visionForgeVersion")
|
implementation("space.kscience:visionforge-plotly:$visionForgeVersion")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
jvmMain {
|
}
|
||||||
|
|
||||||
|
kotlin{
|
||||||
|
sourceSets{
|
||||||
|
getByName("jvmMain"){
|
||||||
dependencies{
|
dependencies{
|
||||||
|
implementation(compose.runtime)
|
||||||
implementation(project(":numass-data-proto"))
|
implementation(project(":numass-data-proto"))
|
||||||
implementation("space.kscience:visionforge-server:$visionForgeVersion")
|
implementation("io.ktor:ktor-server-cio")
|
||||||
|
implementation("io.ktor:ktor-server-html-builder")
|
||||||
|
implementation("space.kscience:visionforge-plotly:$visionForgeVersion")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
getByName("jsMain"){
|
||||||
}
|
dependencies{
|
||||||
}
|
implementation(compose.html.core)
|
||||||
|
|
||||||
afterEvaluate {
|
|
||||||
val distributionTask = if (production) {
|
|
||||||
tasks.getByName("jsBrowserDistribution")
|
|
||||||
} else {
|
|
||||||
tasks.getByName("jsBrowserDevelopmentExecutableDistribution")
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.getByName<ProcessResources>("jvmProcessResources") {
|
|
||||||
dependsOn(distributionTask)
|
|
||||||
from(distributionTask)
|
|
||||||
include("**/*.js")
|
|
||||||
if (production) {
|
|
||||||
include("**/*.map")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
kscience {
|
|
||||||
useSerialization {
|
|
||||||
json()
|
|
||||||
}
|
|
||||||
withContextReceivers()
|
|
||||||
}
|
}
|
@ -9,7 +9,6 @@ import space.kscience.dataforge.context.PluginTag
|
|||||||
import space.kscience.dataforge.meta.Meta
|
import space.kscience.dataforge.meta.Meta
|
||||||
import space.kscience.visionforge.Vision
|
import space.kscience.visionforge.Vision
|
||||||
import space.kscience.visionforge.VisionPlugin
|
import space.kscience.visionforge.VisionPlugin
|
||||||
import kotlin.reflect.KClass
|
|
||||||
|
|
||||||
public class NumassCommonPlugin(meta: Meta = Meta.EMPTY) : VisionPlugin(meta) {
|
public class NumassCommonPlugin(meta: Meta = Meta.EMPTY) : VisionPlugin(meta) {
|
||||||
override val tag: PluginTag get() = Companion.tag
|
override val tag: PluginTag get() = Companion.tag
|
||||||
@ -18,7 +17,6 @@ public class NumassCommonPlugin(meta: Meta = Meta.EMPTY) : VisionPlugin(meta) {
|
|||||||
|
|
||||||
public companion object : PluginFactory<NumassCommonPlugin> {
|
public companion object : PluginFactory<NumassCommonPlugin> {
|
||||||
override val tag: PluginTag = PluginTag("numass.common", "ru.inr.mass")
|
override val tag: PluginTag = PluginTag("numass.common", "ru.inr.mass")
|
||||||
override val type: KClass<NumassCommonPlugin> = NumassCommonPlugin::class
|
|
||||||
|
|
||||||
override fun build(context: Context, meta: Meta): NumassCommonPlugin = NumassCommonPlugin()
|
override fun build(context: Context, meta: Meta): NumassCommonPlugin = NumassCommonPlugin()
|
||||||
|
|
||||||
|
@ -12,16 +12,16 @@ import space.kscience.dataforge.names.Name
|
|||||||
import space.kscience.dataforge.names.asName
|
import space.kscience.dataforge.names.asName
|
||||||
import space.kscience.plotly.models.LineShape
|
import space.kscience.plotly.models.LineShape
|
||||||
import space.kscience.plotly.models.ScatterMode
|
import space.kscience.plotly.models.ScatterMode
|
||||||
import space.kscience.plotly.plotElement
|
import space.kscience.plotly.plotDiv
|
||||||
import space.kscience.plotly.scatter
|
import space.kscience.plotly.scatter
|
||||||
import space.kscience.visionforge.ElementVisionRenderer
|
import space.kscience.visionforge.ElementVisionRenderer
|
||||||
|
import space.kscience.visionforge.JsVisionClient
|
||||||
import space.kscience.visionforge.Vision
|
import space.kscience.visionforge.Vision
|
||||||
import space.kscience.visionforge.VisionClient
|
import space.kscience.visionforge.VisionClient
|
||||||
import space.kscience.visionforge.plotly.PlotlyPlugin
|
import space.kscience.visionforge.plotly.PlotlyPlugin
|
||||||
import kotlin.reflect.KClass
|
|
||||||
|
|
||||||
public class NumassJsPlugin : AbstractPlugin(), ElementVisionRenderer {
|
public class NumassJsPlugin : AbstractPlugin(), ElementVisionRenderer {
|
||||||
public val client: VisionClient by require(VisionClient)
|
public val client: VisionClient by require(JsVisionClient)
|
||||||
public val numassCommon: NumassCommonPlugin by require(NumassCommonPlugin)
|
public val numassCommon: NumassCommonPlugin by require(NumassCommonPlugin)
|
||||||
public val plotly: PlotlyPlugin by require(PlotlyPlugin)
|
public val plotly: PlotlyPlugin by require(PlotlyPlugin)
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ public class NumassJsPlugin : AbstractPlugin(), ElementVisionRenderer {
|
|||||||
else -> super.content(target)
|
else -> super.content(target)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render(element: Element, vision: Vision, meta: Meta) {
|
override fun render(element: Element, name: Name, vision: Vision, meta: Meta) {
|
||||||
when (vision) {
|
when (vision) {
|
||||||
is VisionOfNumassHv -> element.append {
|
is VisionOfNumassHv -> element.append {
|
||||||
h1 { +"HV" }
|
h1 { +"HV" }
|
||||||
@ -60,11 +60,11 @@ public class NumassJsPlugin : AbstractPlugin(), ElementVisionRenderer {
|
|||||||
|
|
||||||
is VisionOfNumassPoint -> element.append {
|
is VisionOfNumassPoint -> element.append {
|
||||||
h1 { +"Point" }
|
h1 { +"Point" }
|
||||||
plotElement {
|
plotDiv {
|
||||||
vision.spectra.forEach { (channel, spectrum) ->
|
vision.spectra.forEach { (channel, spectrum) ->
|
||||||
val pairs = spectrum.entries.sortedBy { it.key }
|
val pairs = spectrum.entries.sortedBy { it.key }
|
||||||
scatter {
|
scatter {
|
||||||
name = channel
|
this.name = channel
|
||||||
mode = ScatterMode.lines
|
mode = ScatterMode.lines
|
||||||
line {
|
line {
|
||||||
shape = LineShape.hv
|
shape = LineShape.hv
|
||||||
@ -83,8 +83,6 @@ public class NumassJsPlugin : AbstractPlugin(), ElementVisionRenderer {
|
|||||||
|
|
||||||
public companion object : PluginFactory<NumassJsPlugin> {
|
public companion object : PluginFactory<NumassJsPlugin> {
|
||||||
override val tag: PluginTag = PluginTag("numass.js", "ru.inr.mass")
|
override val tag: PluginTag = PluginTag("numass.js", "ru.inr.mass")
|
||||||
override val type: KClass<NumassJsPlugin> = NumassJsPlugin::class
|
|
||||||
|
|
||||||
override fun build(context: Context, meta: Meta): NumassJsPlugin = NumassJsPlugin()
|
override fun build(context: Context, meta: Meta): NumassJsPlugin = NumassJsPlugin()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
package ru.inr.mass.data.server
|
||||||
|
|
||||||
|
import org.jetbrains.compose.web.dom.Div
|
||||||
|
import org.jetbrains.compose.web.renderComposable
|
||||||
|
import org.w3c.dom.Document
|
||||||
|
import space.kscience.dataforge.context.Context
|
||||||
|
import space.kscience.visionforge.Application
|
||||||
|
|
||||||
|
public class NumassViewerApplication : Application {
|
||||||
|
private val context = Context("NumassViewer") {
|
||||||
|
plugin(NumassJsPlugin)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun start(document: Document, state: Map<String, Any>) {
|
||||||
|
renderComposable(rootElementId = "application") {
|
||||||
|
Div({ classes("container") }) {
|
||||||
|
Div({ classes("row") })
|
||||||
|
Div({ classes("col-md-3") }) {
|
||||||
|
|
||||||
|
}
|
||||||
|
Div({ classes("col-md-9") }) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,15 +1,20 @@
|
|||||||
package ru.inr.mass.data.server
|
package ru.inr.mass.data.server
|
||||||
|
|
||||||
|
import io.ktor.http.ContentType
|
||||||
import io.ktor.http.HttpStatusCode
|
import io.ktor.http.HttpStatusCode
|
||||||
import io.ktor.http.URLBuilder
|
import io.ktor.server.application.Application
|
||||||
import io.ktor.server.application.call
|
import io.ktor.server.application.call
|
||||||
import io.ktor.server.cio.CIO
|
import io.ktor.server.cio.CIO
|
||||||
import io.ktor.server.engine.embeddedServer
|
import io.ktor.server.engine.embeddedServer
|
||||||
|
import io.ktor.server.html.respondHtml
|
||||||
|
import io.ktor.server.http.content.resources
|
||||||
import io.ktor.server.response.respondText
|
import io.ktor.server.response.respondText
|
||||||
import io.ktor.server.routing.get
|
import io.ktor.server.routing.get
|
||||||
import io.ktor.server.routing.routing
|
import io.ktor.server.routing.routing
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.runBlocking
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
import kotlinx.html.*
|
||||||
import ru.inr.mass.data.api.NumassPoint
|
import ru.inr.mass.data.api.NumassPoint
|
||||||
import ru.inr.mass.data.proto.NumassDirectorySet
|
import ru.inr.mass.data.proto.NumassDirectorySet
|
||||||
import ru.inr.mass.data.proto.NumassProtoPlugin
|
import ru.inr.mass.data.proto.NumassProtoPlugin
|
||||||
@ -22,12 +27,15 @@ import space.kscience.dataforge.names.Name
|
|||||||
import space.kscience.dataforge.names.NameToken
|
import space.kscience.dataforge.names.NameToken
|
||||||
import space.kscience.dataforge.names.cutLast
|
import space.kscience.dataforge.names.cutLast
|
||||||
import space.kscience.dataforge.names.lastOrNull
|
import space.kscience.dataforge.names.lastOrNull
|
||||||
import space.kscience.visionforge.server.close
|
|
||||||
import space.kscience.visionforge.server.openInBrowser
|
|
||||||
import space.kscience.visionforge.server.visionServer
|
|
||||||
|
|
||||||
|
|
||||||
public suspend fun main() {
|
public fun main() {
|
||||||
|
val port = 7777
|
||||||
|
val host = "localhost"
|
||||||
|
embeddedServer(CIO, port, host, module = Application::numassModule).start()
|
||||||
|
}
|
||||||
|
|
||||||
|
public fun Application.numassModule(repositoryName: String = "D:\\Work\\Numass\\data\\test") {
|
||||||
val context = Context("Numass") {
|
val context = Context("Numass") {
|
||||||
plugin(NumassProtoPlugin)
|
plugin(NumassProtoPlugin)
|
||||||
plugin(NumassCommonPlugin)
|
plugin(NumassCommonPlugin)
|
||||||
@ -37,23 +45,47 @@ public suspend fun main() {
|
|||||||
val numassCommon = context.fetch(NumassCommonPlugin)
|
val numassCommon = context.fetch(NumassCommonPlugin)
|
||||||
|
|
||||||
val visionManager = numassCommon.visionManager
|
val visionManager = numassCommon.visionManager
|
||||||
|
val repository: DataTree<NumassDirectorySet> = runBlocking { numassProto.readRepository(repositoryName) }
|
||||||
|
|
||||||
val repositroyName = "D:\\Work\\Numass\\data\\test"
|
|
||||||
|
|
||||||
val port = 7777
|
|
||||||
val host = "localhost"
|
|
||||||
|
|
||||||
val url = URLBuilder(host = host, port = port).build()
|
|
||||||
|
|
||||||
val repository: DataTree<NumassDirectorySet> = numassProto.readRepository(repositroyName)
|
|
||||||
|
|
||||||
val visionOfNumassRepository = VisionOfNumassRepository(Name.EMPTY, repository)
|
|
||||||
|
|
||||||
val server = context.embeddedServer(CIO, port, host) {
|
|
||||||
routing {
|
routing {
|
||||||
|
resources()
|
||||||
|
|
||||||
|
get("/") {
|
||||||
|
call.respondHtml {
|
||||||
|
head {
|
||||||
|
meta { charset = "utf-8" }
|
||||||
|
meta {
|
||||||
|
name = "viewport"
|
||||||
|
content = "width=device-width, initial-scale=1"
|
||||||
|
}
|
||||||
|
title("Numass Data Viewer")
|
||||||
|
link {
|
||||||
|
href = "https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css"
|
||||||
|
rel = "stylesheet"
|
||||||
|
attributes["integrity"] =
|
||||||
|
"sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65"
|
||||||
|
attributes["crossorigin"] = "anonymous"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
div {
|
||||||
|
id = "application"
|
||||||
|
}
|
||||||
|
script {
|
||||||
|
src = "js/numass-web.js"
|
||||||
|
}
|
||||||
|
script {
|
||||||
|
src = "https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"
|
||||||
|
integrity = "sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4"
|
||||||
|
attributes["crossorigin"] = "anonymous"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
get("/repository") {
|
get("/repository") {
|
||||||
call.respondText {
|
call.respondText(ContentType.Application.Json) {
|
||||||
visionManager.encodeToString(visionOfNumassRepository)
|
visionManager.encodeToString(VisionOfNumassRepository(Name.EMPTY, repository))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +104,7 @@ public suspend fun main() {
|
|||||||
return@get
|
return@get
|
||||||
}
|
}
|
||||||
|
|
||||||
call.respondText {
|
call.respondText(ContentType.Application.Json) {
|
||||||
visionManager.encodeToString(VisionOfNumassSet(setName, set))
|
visionManager.encodeToString(VisionOfNumassSet(setName, set))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -101,32 +133,10 @@ public suspend fun main() {
|
|||||||
call.respondText(status = HttpStatusCode.NotFound) { "A point with name $setName/$pointIndex not found in the repository" }
|
call.respondText(status = HttpStatusCode.NotFound) { "A point with name $setName/$pointIndex not found in the repository" }
|
||||||
return@get
|
return@get
|
||||||
}
|
}
|
||||||
call.respondText {
|
call.respondText(ContentType.Application.Json) {
|
||||||
visionManager.encodeToString(point.toVision())
|
visionManager.encodeToString(point.toVision())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
visionServer(numassCommon.visionManager, url)
|
//serveVisionData(VisionRoute("/visions", visionManager))
|
||||||
}.start()
|
|
||||||
|
|
||||||
// val server = context.visionManager.serve {
|
|
||||||
// header("numass", VisionPage.scriptHeader("js/numass-web.js"))
|
|
||||||
// page {
|
|
||||||
// div("flex-column") {
|
|
||||||
// h1 { +"Visionforge file demo" }
|
|
||||||
// vision { visionOfNumass }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
server.openInBrowser()
|
|
||||||
|
|
||||||
|
|
||||||
println("Enter 'exit' to close server")
|
|
||||||
while (readLine() != "exit") {
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
server.close()
|
|
||||||
|
|
||||||
}
|
}
|
@ -2,11 +2,8 @@ package ru.inr.mass.data.server
|
|||||||
|
|
||||||
import space.kscience.dataforge.context.Context
|
import space.kscience.dataforge.context.Context
|
||||||
import space.kscience.dataforge.misc.DFExperimental
|
import space.kscience.dataforge.misc.DFExperimental
|
||||||
import space.kscience.visionforge.html.HtmlVisionFragment
|
import space.kscience.visionforge.html.*
|
||||||
import space.kscience.visionforge.html.ResourceLocation
|
import space.kscience.visionforge.visionManager
|
||||||
import space.kscience.visionforge.html.VisionPage
|
|
||||||
import space.kscience.visionforge.html.importScriptHeader
|
|
||||||
import space.kscience.visionforge.makeFile
|
|
||||||
import java.awt.Desktop
|
import java.awt.Desktop
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
|
|
||||||
@ -19,7 +16,7 @@ public fun Context.makeNumassWebFile(
|
|||||||
show: Boolean = true,
|
show: Boolean = true,
|
||||||
content: HtmlVisionFragment,
|
content: HtmlVisionFragment,
|
||||||
): Unit {
|
): Unit {
|
||||||
val actualPath = VisionPage(this, content = content).makeFile(path) { actualPath: Path ->
|
val actualPath = VisionPage(visionManager, content = content).makeFile(path) { actualPath: Path ->
|
||||||
mapOf(
|
mapOf(
|
||||||
"title" to VisionPage.title(title),
|
"title" to VisionPage.title(title),
|
||||||
"numassWeb" to VisionPage.importScriptHeader("js/numass-web.js", resourceLocation, actualPath)
|
"numassWeb" to VisionPage.importScriptHeader("js/numass-web.js", resourceLocation, actualPath)
|
||||||
|
@ -7,7 +7,9 @@ plugins {
|
|||||||
val dataforgeVersion: String by rootProject.extra
|
val dataforgeVersion: String by rootProject.extra
|
||||||
val kmathVersion: String by rootProject.extra
|
val kmathVersion: String by rootProject.extra
|
||||||
|
|
||||||
kotlin.sourceSets {
|
kscience{
|
||||||
|
jvm()
|
||||||
|
js()
|
||||||
commonMain {
|
commonMain {
|
||||||
dependencies {
|
dependencies {
|
||||||
api("space.kscience:dataforge-context:$dataforgeVersion")
|
api("space.kscience:dataforge-context:$dataforgeVersion")
|
||||||
@ -15,7 +17,10 @@ kotlin.sourceSets {
|
|||||||
api("space.kscience:kmath-functions:$kmathVersion")
|
api("space.kscience:kmath-functions:$kmathVersion")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
jvmMain {
|
}
|
||||||
|
|
||||||
|
kotlin.sourceSets{
|
||||||
|
getByName("jvmMain"){
|
||||||
dependencies {
|
dependencies {
|
||||||
api("space.kscience:kmath-commons:$kmathVersion")
|
api("space.kscience:kmath-commons:$kmathVersion")
|
||||||
api("ch.qos.logback:logback-classic:1.2.3")
|
api("ch.qos.logback:logback-classic:1.2.3")
|
||||||
|
@ -15,10 +15,10 @@
|
|||||||
*/
|
*/
|
||||||
package ru.inr.mass.models
|
package ru.inr.mass.models
|
||||||
|
|
||||||
|
import space.kscience.kmath.UnstableKMathAPI
|
||||||
import space.kscience.kmath.data.ColumnarData
|
import space.kscience.kmath.data.ColumnarData
|
||||||
import space.kscience.kmath.expressions.Symbol
|
import space.kscience.kmath.expressions.Symbol
|
||||||
import space.kscience.kmath.expressions.symbol
|
import space.kscience.kmath.expressions.symbol
|
||||||
import space.kscience.kmath.misc.UnstableKMathAPI
|
|
||||||
import space.kscience.kmath.structures.Buffer
|
import space.kscience.kmath.structures.Buffer
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,8 +32,8 @@ public class NBkgSpectrum(public val source: Spectrum) : DifferentiableSpectrum
|
|||||||
override fun derivativeOrNull(symbols: List<Symbol>): Spectrum? = when {
|
override fun derivativeOrNull(symbols: List<Symbol>): Spectrum? = when {
|
||||||
symbols.isEmpty() -> this
|
symbols.isEmpty() -> this
|
||||||
symbols.size == 1 -> when (symbols.first()) {
|
symbols.size == 1 -> when (symbols.first()) {
|
||||||
norm -> Spectrum { x, arguments -> source(x, arguments) + (arguments[bkg] ?: 0.0) }
|
norm -> Spectrum { x, arguments -> source(x, arguments) }
|
||||||
bkg -> Spectrum { x, arguments -> (arguments[norm] ?: 1.0) * source(x, arguments) }
|
bkg -> Spectrum { _, _ -> 1.0 }
|
||||||
else -> (source as? DifferentiableSpectrum)?.derivativeOrNull(symbols)?.let { NBkgSpectrum(it) }
|
else -> (source as? DifferentiableSpectrum)?.derivativeOrNull(symbols)?.let { NBkgSpectrum(it) }
|
||||||
}
|
}
|
||||||
else -> null
|
else -> null
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
* To change this template file, choose Tools | Templates
|
* To change this template file, choose Tools | Templates
|
||||||
* and open the template in the editor.
|
* and open the template in the editor.
|
||||||
*/
|
*/
|
||||||
|
@file:Suppress("PARAMETER_NAME_CHANGED_ON_OVERRIDE")
|
||||||
|
|
||||||
package ru.inr.mass.models
|
package ru.inr.mass.models
|
||||||
|
|
||||||
import space.kscience.kmath.expressions.Symbol
|
import space.kscience.kmath.expressions.Symbol
|
||||||
|
@ -12,6 +12,8 @@ import kotlin.math.sqrt
|
|||||||
/**
|
/**
|
||||||
* @author [Alexander Nozik](mailto:altavir@gmail.com)
|
* @author [Alexander Nozik](mailto:altavir@gmail.com)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@Suppress("PARAMETER_NAME_CHANGED_ON_OVERRIDE")
|
||||||
public class NumassResolution(
|
public class NumassResolution(
|
||||||
public val resA: Double = 8.3e-5,
|
public val resA: Double = 8.3e-5,
|
||||||
public val resB: Double = 0.0,
|
public val resB: Double = 0.0,
|
||||||
@ -43,12 +45,12 @@ public class NumassResolution(
|
|||||||
// else -> ResolutionFunction.getConstantTail()
|
// else -> ResolutionFunction.getConstantTail()
|
||||||
// }
|
// }
|
||||||
|
|
||||||
private fun getValueFast(E: Double, U: Double): Double {
|
private fun getValueFast(e: Double, u: Double): Double {
|
||||||
val delta = resA * E
|
val delta = resA * e
|
||||||
return when {
|
return when {
|
||||||
E - U < 0 -> 0.0
|
e - u < 0 -> 0.0
|
||||||
E - U > delta -> tailFunction(E, U)
|
e - u > delta -> tailFunction(e, u)
|
||||||
else -> (E - U) / delta
|
else -> (e - u) / delta
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,15 +59,15 @@ public class NumassResolution(
|
|||||||
override val x: Symbol get() = e
|
override val x: Symbol get() = e
|
||||||
override val y: Symbol get() = u
|
override val y: Symbol get() = u
|
||||||
|
|
||||||
override fun invoke(E: Double, U: Double, arguments: Map<Symbol, Double>): Double {
|
override fun invoke(e: Double, u: Double, arguments: Map<Symbol, Double>): Double {
|
||||||
if (resB <= 0) {
|
if (resB <= 0) {
|
||||||
return this.getValueFast(E, U)
|
return this.getValueFast(e, u)
|
||||||
}
|
}
|
||||||
val delta = resA * E
|
val delta = resA * e
|
||||||
return when {
|
return when {
|
||||||
E - U < 0 -> 0.0
|
e - u < 0 -> 0.0
|
||||||
E - U > delta -> tailFunction(E, U)
|
e - u > delta -> tailFunction(e, u)
|
||||||
else -> (1 - sqrt(1 - (E - U) / E * resB)) / (1 - sqrt(1 - resA * resB))
|
else -> (1 - sqrt(1 - (e - u) / e * resB)) / (1 - sqrt(1 - resA * resB))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,13 +274,13 @@ public class NumassTransmission(
|
|||||||
* Значение полной производной функции потерь с учетом всех неисчезающих
|
* Значение полной производной функции потерь с учетом всех неисчезающих
|
||||||
* порядков
|
* порядков
|
||||||
*
|
*
|
||||||
* @param X
|
* @param thickness
|
||||||
* @param eIn
|
* @param eIn
|
||||||
* @param eOut
|
* @param eOut
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private fun getTotalLossDeriv(X: Double, eIn: Double, eOut: Double): Double {
|
private fun getTotalLossDeriv(thickness: Double, eIn: Double, eOut: Double): Double {
|
||||||
val probs = getLossProbDerivs(X)
|
val probs = getLossProbDerivs(thickness)
|
||||||
|
|
||||||
var sum = 0.0
|
var sum = 0.0
|
||||||
for (i in 1 until probs.size) {
|
for (i in 1 until probs.size) {
|
||||||
@ -399,8 +399,8 @@ public class NumassTransmission(
|
|||||||
// return getSingleScatterFunction(exPos, ionPos, exW, ionW, exIonRatio)
|
// return getSingleScatterFunction(exPos, ionPos, exW, ionW, exIonRatio)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public val trapFunction: (Double, Double) -> Double = { Ei: Double, Ef: Double ->
|
public val trapFunction: (Double, Double) -> Double = { ei: Double, ef: Double ->
|
||||||
val eps = Ei - Ef
|
val eps = ei - ef
|
||||||
if (eps > 10) {
|
if (eps > 10) {
|
||||||
1.86e-04 * exp(-eps / 25.0) + 5.5e-05
|
1.86e-04 * exp(-eps / 25.0) + 5.5e-05
|
||||||
} else {
|
} else {
|
||||||
|
@ -20,7 +20,8 @@ dependencies {
|
|||||||
implementation("space.kscience:dataforge-workspace:$dataforgeVersion")
|
implementation("space.kscience:dataforge-workspace:$dataforgeVersion")
|
||||||
|
|
||||||
implementation("space.kscience:kmath-jupyter:$kmathVersion")
|
implementation("space.kscience:kmath-jupyter:$kmathVersion")
|
||||||
implementation("space.kscience:tables-kt:$tablesVersion")
|
implementation("space.kscience:tables-kt-csv:$tablesVersion")
|
||||||
|
implementation("org.apache.commons:commons-csv:1.10.0")
|
||||||
implementation("space.kscience:visionforge-plotly:$visionForgeVersion")
|
implementation("space.kscience:visionforge-plotly:$visionForgeVersion")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
80
numass-workspace/src/main/kotlin/ru/inr/mass/scripts/fit.kt
Normal file
80
numass-workspace/src/main/kotlin/ru/inr/mass/scripts/fit.kt
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
package ru.inr.mass.scripts
|
||||||
|
|
||||||
|
import ru.inr.mass.models.*
|
||||||
|
import ru.inr.mass.workspace.buffer
|
||||||
|
import ru.inr.mass.workspace.fitWith
|
||||||
|
import ru.inr.mass.workspace.generate
|
||||||
|
import space.kscience.kmath.UnstableKMathAPI
|
||||||
|
import space.kscience.kmath.expressions.Symbol
|
||||||
|
import space.kscience.kmath.expressions.derivative
|
||||||
|
import space.kscience.kmath.operations.asSequence
|
||||||
|
import space.kscience.kmath.optimization.*
|
||||||
|
import space.kscience.kmath.real.step
|
||||||
|
import space.kscience.plotly.Plotly
|
||||||
|
import space.kscience.plotly.makeFile
|
||||||
|
import space.kscience.plotly.models.ScatterMode
|
||||||
|
import space.kscience.plotly.scatter
|
||||||
|
import kotlin.math.pow
|
||||||
|
|
||||||
|
|
||||||
|
@OptIn(UnstableKMathAPI::class)
|
||||||
|
suspend fun main() {
|
||||||
|
val spectrum: NBkgSpectrum = SterileNeutrinoSpectrum(
|
||||||
|
fss = FSS.default,
|
||||||
|
// resolution = NumassResolution(8.2e-5)
|
||||||
|
).withNBkg()
|
||||||
|
|
||||||
|
val args: Map<Symbol, Double> = mapOf(
|
||||||
|
NBkgSpectrum.norm to 8e5,
|
||||||
|
NBkgSpectrum.bkg to 2.0,
|
||||||
|
NumassBeta.mnu2 to 0.0,
|
||||||
|
NumassBeta.e0 to 18575.0,
|
||||||
|
NumassBeta.msterile2 to 1000.0.pow(2),
|
||||||
|
NumassBeta.u2 to 1e-2,
|
||||||
|
NumassTransmission.thickness to 0.3,
|
||||||
|
NumassTransmission.trap to 1.0
|
||||||
|
)
|
||||||
|
|
||||||
|
listOf(NBkgSpectrum.norm, NBkgSpectrum.bkg, NumassBeta.e0).forEach {
|
||||||
|
println("$it: ${spectrum.derivative(it).invoke(14000.0, args)}")
|
||||||
|
}
|
||||||
|
|
||||||
|
val timePerPoint = 30.0
|
||||||
|
|
||||||
|
val strategy = (12000.0..19000.0 step 100.0).asSequence().associateWith { timePerPoint }
|
||||||
|
|
||||||
|
val generatedData = spectrum.generate(strategy, args)
|
||||||
|
|
||||||
|
val fit: XYFit = generatedData.fitWith(
|
||||||
|
optimizer = QowOptimizer,
|
||||||
|
modelExpression = spectrum,
|
||||||
|
startingPoint = args + mapOf(NBkgSpectrum.norm to 8.1e5),
|
||||||
|
OptimizationParameters(NBkgSpectrum.norm, NBkgSpectrum.bkg, NumassBeta.e0),
|
||||||
|
OptimizationIterations(20)
|
||||||
|
)
|
||||||
|
|
||||||
|
println("Chi squared/dof: ${fit.chiSquaredOrNull}/${fit.dof}")
|
||||||
|
|
||||||
|
Plotly.plot {
|
||||||
|
scatter {
|
||||||
|
name = "Generated"
|
||||||
|
mode = ScatterMode.markers
|
||||||
|
x.buffer = generatedData.x
|
||||||
|
y.buffer = generatedData.y
|
||||||
|
}
|
||||||
|
|
||||||
|
scatter {
|
||||||
|
name = "Initial"
|
||||||
|
mode = ScatterMode.lines
|
||||||
|
x.buffer = 12000.0..18600.0 step 50.0
|
||||||
|
y.numbers = x.doubles.map { spectrum(it, args) }
|
||||||
|
}
|
||||||
|
|
||||||
|
scatter {
|
||||||
|
name = "Fit"
|
||||||
|
mode = ScatterMode.lines
|
||||||
|
x.buffer = 12000.0..18600.0 step 10.0
|
||||||
|
y.numbers = x.doubles.map { spectrum(it, args + fit.resultPoint) }
|
||||||
|
}
|
||||||
|
}.makeFile()
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package ru.inr.mass.scripts
|
||||||
|
|
||||||
|
//import com.google.cloud.storage.contrib.nio.CloudStorageFileSystem
|
||||||
|
//import ru.inr.mass.data.proto.NumassDirectorySet
|
||||||
|
//import ru.inr.mass.workspace.Numass
|
||||||
|
//import space.kscience.dataforge.data.DataTree
|
||||||
|
//
|
||||||
|
//// https://storage.cloud.google.com/numass-data/2020_12/Adiabaticity/16/set_3/p10(10s)(HV1%3D13750)
|
||||||
|
//
|
||||||
|
//suspend fun main() {
|
||||||
|
// CloudStorageFileSystem.forBucket("numass-data").use { fs ->
|
||||||
|
// val repo: DataTree<NumassDirectorySet> = Numass.readRepository(fs.getPath("2020_12/Adiabaticity"))
|
||||||
|
// repo.items().forEach{ (key,item)->
|
||||||
|
// println(key)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
@ -0,0 +1,97 @@
|
|||||||
|
package ru.inr.mass.scripts
|
||||||
|
|
||||||
|
import org.apache.commons.csv.CSVFormat
|
||||||
|
import ru.inr.mass.models.*
|
||||||
|
import ru.inr.mass.workspace.Numass
|
||||||
|
import ru.inr.mass.workspace.buffer
|
||||||
|
import ru.inr.mass.workspace.fitWith
|
||||||
|
import space.kscience.dataforge.meta.Value
|
||||||
|
import space.kscience.dataforge.meta.double
|
||||||
|
import space.kscience.kmath.UnstableKMathAPI
|
||||||
|
import space.kscience.kmath.data.XYErrorColumnarData
|
||||||
|
import space.kscience.kmath.expressions.Symbol
|
||||||
|
import space.kscience.kmath.optimization.*
|
||||||
|
import space.kscience.kmath.real.map
|
||||||
|
import space.kscience.kmath.real.step
|
||||||
|
import space.kscience.kmath.structures.DoubleBuffer
|
||||||
|
import space.kscience.kmath.structures.indices
|
||||||
|
import space.kscience.plotly.*
|
||||||
|
import space.kscience.plotly.models.ScatterMode
|
||||||
|
import space.kscience.tables.Column
|
||||||
|
import space.kscience.tables.Table
|
||||||
|
import space.kscience.tables.csv.readAsCsv
|
||||||
|
import space.kscience.tables.get
|
||||||
|
import kotlin.math.pow
|
||||||
|
|
||||||
|
fun Column<Value>.toDoubleBuffer() = DoubleBuffer(size) { get(it).double }
|
||||||
|
|
||||||
|
@OptIn(UnstableKMathAPI::class)
|
||||||
|
suspend fun main() {
|
||||||
|
val input = Table.readAsCsv(
|
||||||
|
Numass::class.java.getResource("/data/2023_events.tsv")!!,
|
||||||
|
csvFormat = CSVFormat.TDF
|
||||||
|
)
|
||||||
|
|
||||||
|
val timePerPoint = 30.0 * 129
|
||||||
|
|
||||||
|
val data: XYErrorColumnarData<Double, Double, Double> = XYErrorColumnarData.of(
|
||||||
|
input.columns["U"].toDoubleBuffer(),
|
||||||
|
input.columns["events"].toDoubleBuffer().map { it / timePerPoint },
|
||||||
|
input.columns["error"].toDoubleBuffer().map { it / timePerPoint }
|
||||||
|
)
|
||||||
|
|
||||||
|
val spectrum: NBkgSpectrum = SterileNeutrinoSpectrum(fss = FSS.default).withNBkg()
|
||||||
|
|
||||||
|
val args: Map<Symbol, Double> = mapOf(
|
||||||
|
NBkgSpectrum.norm to 215443.0,
|
||||||
|
NBkgSpectrum.bkg to 2.0,
|
||||||
|
NumassBeta.mnu2 to 0.0,
|
||||||
|
NumassBeta.e0 to 18575.0,
|
||||||
|
NumassBeta.msterile2 to 2000.0.pow(2),
|
||||||
|
NumassBeta.u2 to 0.0,
|
||||||
|
NumassTransmission.thickness to 0.3,
|
||||||
|
NumassTransmission.trap to 1.0
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
val fit: XYFit = data.fitWith(
|
||||||
|
optimizer = QowOptimizer,
|
||||||
|
modelExpression = spectrum,
|
||||||
|
startingPoint = args,
|
||||||
|
OptimizationParameters(NBkgSpectrum.norm, NBkgSpectrum.bkg, NumassBeta.e0),
|
||||||
|
OptimizationIterations(20)
|
||||||
|
)
|
||||||
|
|
||||||
|
println("Chi squared/dof: ${fit.chiSquaredOrNull}/${fit.dof}")
|
||||||
|
|
||||||
|
|
||||||
|
Plotly.page {
|
||||||
|
plot {
|
||||||
|
scatter {
|
||||||
|
name = "Data"
|
||||||
|
mode = ScatterMode.markers
|
||||||
|
x.buffer = data.x
|
||||||
|
y.buffer = data.y
|
||||||
|
}
|
||||||
|
|
||||||
|
scatter {
|
||||||
|
name = "Fit"
|
||||||
|
mode = ScatterMode.lines
|
||||||
|
x.buffer = 12000.0..18600.0 step 10.0
|
||||||
|
y.numbers = x.doubles.map { spectrum(it, args + fit.resultPoint) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
plot {
|
||||||
|
layout.title = "residuals"
|
||||||
|
scatter {
|
||||||
|
mode = ScatterMode.markers
|
||||||
|
x.buffer = data.x
|
||||||
|
y.numbers = data.x.indices.map {
|
||||||
|
(data.y[it] - spectrum(data.x[it], args + fit.resultPoint))/data.yErr[it]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.makeFile()
|
||||||
|
|
||||||
|
}
|
@ -18,7 +18,6 @@ import space.kscience.dataforge.workspace.WorkspacePlugin
|
|||||||
import space.kscience.dataforge.workspace.pipeFrom
|
import space.kscience.dataforge.workspace.pipeFrom
|
||||||
import space.kscience.dataforge.workspace.task
|
import space.kscience.dataforge.workspace.task
|
||||||
import space.kscience.tables.Table
|
import space.kscience.tables.Table
|
||||||
import kotlin.reflect.KClass
|
|
||||||
|
|
||||||
class NumassWorkspacePlugin : WorkspacePlugin() {
|
class NumassWorkspacePlugin : WorkspacePlugin() {
|
||||||
override val tag: PluginTag get() = Companion.tag
|
override val tag: PluginTag get() = Companion.tag
|
||||||
@ -128,7 +127,6 @@ class NumassWorkspacePlugin : WorkspacePlugin() {
|
|||||||
|
|
||||||
companion object : PluginFactory<NumassWorkspacePlugin> {
|
companion object : PluginFactory<NumassWorkspacePlugin> {
|
||||||
override val tag: PluginTag = PluginTag("numass", "ru.mipt.npm")
|
override val tag: PluginTag = PluginTag("numass", "ru.mipt.npm")
|
||||||
override val type: KClass<out NumassWorkspacePlugin> = NumassWorkspacePlugin::class
|
|
||||||
override fun build(context: Context, meta: Meta): NumassWorkspacePlugin = NumassWorkspacePlugin()
|
override fun build(context: Context, meta: Meta): NumassWorkspacePlugin = NumassWorkspacePlugin()
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,67 @@
|
|||||||
|
@file:OptIn(UnstableKMathAPI::class)
|
||||||
|
|
||||||
|
package ru.inr.mass.workspace
|
||||||
|
|
||||||
|
import ru.inr.mass.models.Spectrum
|
||||||
|
import space.kscience.kmath.UnstableKMathAPI
|
||||||
|
import space.kscience.kmath.data.XYColumnarData
|
||||||
|
import space.kscience.kmath.data.XYErrorColumnarData
|
||||||
|
import space.kscience.kmath.expressions.DifferentiableExpression
|
||||||
|
import space.kscience.kmath.expressions.Symbol
|
||||||
|
import space.kscience.kmath.misc.FeatureSet
|
||||||
|
import space.kscience.kmath.misc.Loggable
|
||||||
|
import space.kscience.kmath.optimization.*
|
||||||
|
import space.kscience.kmath.random.RandomGenerator
|
||||||
|
import space.kscience.kmath.samplers.PoissonSampler
|
||||||
|
import space.kscience.kmath.stat.next
|
||||||
|
import space.kscience.kmath.structures.asBuffer
|
||||||
|
import kotlin.math.sqrt
|
||||||
|
|
||||||
|
public suspend fun XYColumnarData<Double, Double, Double>.fitWith(
|
||||||
|
optimizer: Optimizer<Double, XYFit>,
|
||||||
|
modelExpression: DifferentiableExpression<Double>,
|
||||||
|
startingPoint: Map<Symbol, Double>,
|
||||||
|
vararg features: OptimizationFeature = emptyArray(),
|
||||||
|
xSymbol: Symbol = Symbol.x,
|
||||||
|
pointToCurveDistance: PointToCurveDistance = PointToCurveDistance.byY,
|
||||||
|
pointWeight: PointWeight = PointWeight.byYSigma,
|
||||||
|
): XYFit {
|
||||||
|
var actualFeatures = FeatureSet.of(*features, OptimizationStartPoint(startingPoint))
|
||||||
|
|
||||||
|
if (actualFeatures.getFeature<OptimizationLog>() == null) {
|
||||||
|
actualFeatures = actualFeatures.with(OptimizationLog(Loggable.console))
|
||||||
|
}
|
||||||
|
val problem = XYFit(
|
||||||
|
this,
|
||||||
|
modelExpression,
|
||||||
|
actualFeatures,
|
||||||
|
pointToCurveDistance,
|
||||||
|
pointWeight,
|
||||||
|
xSymbol
|
||||||
|
)
|
||||||
|
return optimizer.optimize(problem)
|
||||||
|
}
|
||||||
|
|
||||||
|
public suspend fun Spectrum.generate(
|
||||||
|
strategy: Map<Double, Double>,
|
||||||
|
arguments: Map<Symbol, Double>,
|
||||||
|
generator: RandomGenerator = RandomGenerator.default,
|
||||||
|
): XYErrorColumnarData<Double, Double, Double> {
|
||||||
|
val xs = mutableListOf<Double>()
|
||||||
|
val ys = mutableListOf<Double>()
|
||||||
|
val errors = mutableListOf<Double>()
|
||||||
|
|
||||||
|
strategy.forEach { (x, time) ->
|
||||||
|
xs.add(x)
|
||||||
|
val mu = invoke(x, arguments) * time
|
||||||
|
val y = PoissonSampler(mu).next(generator) / time
|
||||||
|
val error = sqrt(mu) / time
|
||||||
|
ys.add(y)
|
||||||
|
errors.add(error)
|
||||||
|
}
|
||||||
|
return XYErrorColumnarData.of(
|
||||||
|
xs.toTypedArray().asBuffer(),
|
||||||
|
ys.toTypedArray().asBuffer(),
|
||||||
|
errors.toTypedArray().asBuffer()
|
||||||
|
)
|
||||||
|
}
|
@ -12,9 +12,9 @@ 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.meta.asValue
|
import space.kscience.dataforge.meta.asValue
|
||||||
import space.kscience.dataforge.meta.double
|
import space.kscience.dataforge.meta.double
|
||||||
|
import space.kscience.kmath.UnstableKMathAPI
|
||||||
import space.kscience.kmath.domains.center
|
import space.kscience.kmath.domains.center
|
||||||
import space.kscience.kmath.histogram.Histogram1D
|
import space.kscience.kmath.histogram.Histogram1D
|
||||||
import space.kscience.kmath.misc.UnstableKMathAPI
|
|
||||||
import space.kscience.kmath.operations.asIterable
|
import space.kscience.kmath.operations.asIterable
|
||||||
import space.kscience.kmath.structures.Buffer
|
import space.kscience.kmath.structures.Buffer
|
||||||
import space.kscience.kmath.structures.DoubleBuffer
|
import space.kscience.kmath.structures.DoubleBuffer
|
||||||
|
108
numass-workspace/src/main/resources/data/2023_events.tsv
Normal file
108
numass-workspace/src/main/resources/data/2023_events.tsv
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
U events error
|
||||||
|
12000 6.452460E+07 8032.720335
|
||||||
|
12050 6.308058E+07 7942.32812
|
||||||
|
12100 6.166233E+07 7852.536369
|
||||||
|
12150 6.026178E+07 7762.846435
|
||||||
|
12200 5.888044E+07 7673.359382
|
||||||
|
12250 5.752020E+07 7584.207129
|
||||||
|
12300 5.618589E+07 7495.725049
|
||||||
|
12350 5.486976E+07 7407.412404
|
||||||
|
12400 5.357057E+07 7319.192132
|
||||||
|
12450 5.229649E+07 7231.631507
|
||||||
|
12500 5.104097E+07 7144.295993
|
||||||
|
12550 4.980586E+07 7057.326711
|
||||||
|
12600 4.858747E+07 6970.471306
|
||||||
|
12650 4.739252E+07 6884.222328
|
||||||
|
12700 4.621748E+07 6798.344134
|
||||||
|
12750 4.505844E+07 6712.55872
|
||||||
|
12800 4.392086E+07 6627.281125
|
||||||
|
12850 4.280192E+07 6542.317643
|
||||||
|
12900 4.170236E+07 6457.736238
|
||||||
|
12950 4.062241E+07 6373.571204
|
||||||
|
13000 3.955862E+07 6289.564579
|
||||||
|
13050 3.851518E+07 6206.059556
|
||||||
|
13100 3.748997E+07 6122.905734
|
||||||
|
13150 3.648207E+07 6040.03875
|
||||||
|
13200 3.549434E+07 5957.712236
|
||||||
|
13250 3.452146E+07 5875.496153
|
||||||
|
13300 3.356598E+07 5793.615159
|
||||||
|
13350 3.263059E+07 5712.318869
|
||||||
|
13400 3.171169E+07 5631.313607
|
||||||
|
13450 3.080984E+07 5550.661274
|
||||||
|
13500 2.992572E+07 5470.440919
|
||||||
|
13550 2.905686E+07 5390.441869
|
||||||
|
13600 2.820575E+07 5310.908839
|
||||||
|
13650 2.737116E+07 5231.745008
|
||||||
|
13700 2.655560E+07 5153.212589
|
||||||
|
13750 2.575232E+07 5074.674515
|
||||||
|
13800 2.496715E+07 4996.713422
|
||||||
|
13850 2.419569E+07 4918.911404
|
||||||
|
13900 2.344232E+07 4841.727268
|
||||||
|
13950 2.270363E+07 4764.832291
|
||||||
|
14000 2.198215E+07 4688.512852
|
||||||
|
14050 2.127411E+07 4612.386446
|
||||||
|
14100 2.058196E+07 4536.734227
|
||||||
|
14150 1.990347E+07 4461.330615
|
||||||
|
14200 1.924117E+07 4386.475463
|
||||||
|
14250 1.859371E+07 4312.041926
|
||||||
|
14300 1.796066E+07 4238.001528
|
||||||
|
14350 1.734144E+07 4164.305627
|
||||||
|
14400 1.673491E+07 4090.832005
|
||||||
|
14450 1.614486E+07 4018.066921
|
||||||
|
14500 1.556582E+07 3945.354348
|
||||||
|
14550 1.500395E+07 3873.492826
|
||||||
|
14600 1.445357E+07 3801.785423
|
||||||
|
14650 1.391677E+07 3730.51812
|
||||||
|
14700 1.339411E+07 3659.796472
|
||||||
|
14750 1.288430E+07 3589.470303
|
||||||
|
14800 1.238646E+07 3519.440284
|
||||||
|
14850 1.190164E+07 3449.875909
|
||||||
|
14900 1.143011E+07 3380.844281
|
||||||
|
14950 1.097078E+07 3312.217027
|
||||||
|
15000 1.052425E+07 3244.109423
|
||||||
|
15050 1.008924E+07 3176.356172
|
||||||
|
15100 9.665787E+06 3108.984892
|
||||||
|
15150 9.254249E+06 3042.079724
|
||||||
|
15200 8.854339E+06 2975.624154
|
||||||
|
15250 8.467155E+06 2909.837666
|
||||||
|
15300 8.090963E+06 2844.46187
|
||||||
|
15350 7.725603E+06 2779.496931
|
||||||
|
15400 7.370687E+06 2714.900844
|
||||||
|
15450 7.028022E+06 2651.041609
|
||||||
|
15500 6.694518E+06 2587.376647
|
||||||
|
15550 6.372090E+06 2524.299879
|
||||||
|
15600 6.058846E+06 2461.472259
|
||||||
|
15650 5.758606E+06 2399.709617
|
||||||
|
15700 5.466336E+06 2338.019685
|
||||||
|
15750 5.183979E+06 2276.835393
|
||||||
|
15800 4.912587E+06 2216.435542
|
||||||
|
15850 4.648231E+06 2155.975548
|
||||||
|
15900 4.396058E+06 2096.677784
|
||||||
|
15950 4.151727E+06 2037.578662
|
||||||
|
16000 3.916397E+06 1978.98901
|
||||||
|
16100 3.473288E+06 1863.676016
|
||||||
|
16200 3.065010E+06 1750.717128
|
||||||
|
16300 2.688767E+06 1639.746111
|
||||||
|
16400 2.344119E+06 1531.051707
|
||||||
|
16500 2.029421E+06 1424.577365
|
||||||
|
16600 1.743956E+06 1320.589413
|
||||||
|
16700 1.487062E+06 1219.45145
|
||||||
|
16800 1.255541E+06 1120.509421
|
||||||
|
16900 1.049216E+06 1024.312329
|
||||||
|
17000 8.724297E+05 934.0394267
|
||||||
|
17100 7.157295E+05 846.0079518
|
||||||
|
17200 5.750288E+05 758.3065238
|
||||||
|
17300 4.560588E+05 675.3212528
|
||||||
|
17400 3.553991E+05 596.1536111
|
||||||
|
17500 2.697442E+05 519.3690855
|
||||||
|
17600 2.005270E+05 447.8024159
|
||||||
|
17700 1.434300E+05 378.7215839
|
||||||
|
17800 9.860455E+04 314.0136092
|
||||||
|
17900 6.354514E+04 252.0816166
|
||||||
|
18000 3.898907E+04 197.456499
|
||||||
|
18100 2.149273E+04 146.6039915
|
||||||
|
18200 1.010559E+04 100.5265405
|
||||||
|
18300 4.910901E+03 70.07781835
|
||||||
|
18400 2.252190E+03 47.4572434
|
||||||
|
18500 1.860929E+03 43.13848425
|
||||||
|
18600 1.760000E+03 41.95235393
|
|
@ -1,7 +1,6 @@
|
|||||||
rootProject.name = "numass"
|
rootProject.name = "numass"
|
||||||
|
|
||||||
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
|
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
|
||||||
enableFeaturePreview("VERSION_CATALOGS")
|
|
||||||
|
|
||||||
pluginManagement {
|
pluginManagement {
|
||||||
|
|
||||||
@ -15,6 +14,7 @@ pluginManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
|
id("org.jetbrains.compose").version(extra["compose.version"] as String)
|
||||||
id("space.kscience.gradle.project") version toolsVersion
|
id("space.kscience.gradle.project") version toolsVersion
|
||||||
id("space.kscience.gradle.mpp") version toolsVersion
|
id("space.kscience.gradle.mpp") version toolsVersion
|
||||||
id("space.kscience.gradle.jvm") version toolsVersion
|
id("space.kscience.gradle.jvm") version toolsVersion
|
||||||
|
Loading…
Reference in New Issue
Block a user