From 8e45062957461a4eed28c1e9a5661a027f678c91 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Tue, 7 Nov 2023 21:10:05 +0300 Subject: [PATCH] Update dependencies and build --- build.gradle.kts | 50 +- dataforge-gui/build.gradle.kts | 5 +- dataforge-plots/plots-jfc/build.gradle.kts | 4 +- dataforge-plots/plots-viewer/build.gradle | 1 - dataforge-stat/dataforge-minuit/build.gradle | 5 +- gradle/wrapper/gradle-wrapper.properties | 2 +- grind/build.gradle | 5 +- .../numass-data-proto/build.gradle.kts | 9 +- .../java/inr/numass/data/NumassProto.java | 1058 ++++++++--------- numass-main/build.gradle | 7 +- .../numass/scripts/CountRateSummary.groovy | 23 - .../inr/numass/scripts/FindExIonRatio.groovy | 109 -- .../numass/scripts/LossNormCalculation.groovy | 46 - .../numass/scripts/LossTailCalculation.groovy | 41 - .../groovy/inr/numass/scripts/OldTest.groovy | 104 -- .../numass/scripts/PrintLossFunctions.groovy | 61 - .../inr/numass/scripts/ReadTextFile.groovy | 15 - .../inr/numass/scripts/ShowSpectrum.groovy | 65 - .../numass/scripts/SignificanceTest.groovy | 110 -- .../groovy/inr/numass/scripts/Simulate.groovy | 102 -- .../inr/numass/scripts/SimulateGun.groovy | 67 -- .../inr/numass/scripts/SimulatePileup.groovy | 157 --- .../inr/numass/scripts/SterileDemo.groovy | 81 -- .../numass/scripts/SystTransmission.groovy | 101 -- .../inr/numass/scripts/Systematics.groovy | 99 -- ...estExperimentalVariableLossSpectrum.groovy | 68 -- .../scripts/TheoreticalLossFunction.groovy | 46 - .../inr/numass/scripts/TritiumTest.groovy | 119 -- .../numass/scripts/models/TristanModel.groovy | 100 -- .../scripts/underflow/ResponseFunction.groovy | 66 - .../numass/scripts/underflow/Underflow.groovy | 139 --- .../inr/numass/scripts/analysis/Run2020_12.kt | 11 +- .../inr/numass/scripts/utils/ScanTree.kt | 4 +- numass-viewer/build.gradle.kts | 2 +- settings.gradle.kts | 4 + 35 files changed, 548 insertions(+), 2338 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 1d6d6a30..610bb266 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,9 @@ +import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + plugins { - kotlin("jvm") version "1.5.31" - id("org.openjfx.javafxplugin") version "0.0.10" apply false + kotlin("jvm") version "1.9.20" apply false + id("org.openjfx.javafxplugin") version "0.1.0" apply false id("com.github.johnrengelman.shadow") version "7.1.0" apply false } @@ -15,47 +18,44 @@ allprojects { maven("https://oss.sonatype.org/content/repositories/snapshots") } + extensions.findByType()?.jvmToolchain(16) + + dependencies { - api(kotlin("reflect")) - api("org.jetbrains:annotations:23.0.0") - testImplementation("junit:junit:4.13.2") + add("api", kotlin("reflect")) + add("api", "org.jetbrains:annotations:24.0.1") + add("testImplementation", "junit:junit:4.13.2") //Spock dependencies. To be removed later // https://mvnrepository.com/artifact/org.spockframework/spock-core - testImplementation("org.spockframework:spock-core:2.0-groovy-3.0") - + add("testImplementation", "org.spockframework:spock-core:2.3-groovy-4.0") } tasks { - compileJava{ + + withType { + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + } + + withType { options.encoding = "UTF-8" } - compileTestJava{ - options.encoding = "UTF-8" - } - compileKotlin { + withType { kotlinOptions { - jvmTarget = "16" javaParameters = true freeCompilerArgs = freeCompilerArgs + listOf( - "-Xjvm-default=all", - "-progressive", - "-Xuse-experimental=kotlin.Experimental" + "-Xjvm-default=all" ) } } - compileTestKotlin { - kotlinOptions { - jvmTarget = "16" - javaParameters = true - freeCompilerArgs = freeCompilerArgs + listOf( - "-Xjvm-default=all", - "-progressive", - "-Xuse-experimental=kotlin.Experimental" - ) + withType{ + val compileKotlinTask = getByName("compileKotlin") + dependsOn(compileKotlinTask) + afterEvaluate { + classpath += files(compileKotlinTask.destinationDirectory) } } } diff --git a/dataforge-gui/build.gradle.kts b/dataforge-gui/build.gradle.kts index e101ef90..d54d64c6 100644 --- a/dataforge-gui/build.gradle.kts +++ b/dataforge-gui/build.gradle.kts @@ -12,9 +12,7 @@ description = "A tornadofx based kotlin library" dependencies { api(project(":dataforge-plots")) api(project(":dataforge-gui:dataforge-html")) - api("no.tornado:tornadofx:1.7.20"){ - exclude("org.jetbrains.kotlin") - } + api("no.tornado:tornadofx:1.7.20") api("org.controlsfx:controlsfx:11.1.0") api("no.tornado:tornadofx-controlsfx:0.1.1") api("org.fxmisc.richtext:richtextfx:0.10.7") @@ -24,4 +22,3 @@ dependencies { //compileOnly project(":dataforge-plots:plots-jfc") } - diff --git a/dataforge-plots/plots-jfc/build.gradle.kts b/dataforge-plots/plots-jfc/build.gradle.kts index ff8cb75f..cf7ac861 100644 --- a/dataforge-plots/plots-jfc/build.gradle.kts +++ b/dataforge-plots/plots-jfc/build.gradle.kts @@ -10,9 +10,9 @@ javafx { description = "jFreeChart plugin" dependencies { - api("org.jfree:jfreesvg:3.4.2") + api("org.jfree:org.jfree.svg:5.0.5") // https://mvnrepository.com/artifact/org.jfree/org.jfree.chart.fx - api(group= "org.jfree", name= "jfreechart-fx", version= "1.0.1") + api("org.jfree:org.jfree.chart.fx:2.0.1") api(project(":dataforge-plots")) diff --git a/dataforge-plots/plots-viewer/build.gradle b/dataforge-plots/plots-viewer/build.gradle index 4e98362f..384ced12 100644 --- a/dataforge-plots/plots-viewer/build.gradle +++ b/dataforge-plots/plots-viewer/build.gradle @@ -19,7 +19,6 @@ application{ compileKotlin { kotlinOptions { - jvmTarget = "1.8" javaParameters = true } } diff --git a/dataforge-stat/dataforge-minuit/build.gradle b/dataforge-stat/dataforge-minuit/build.gradle index ff10d621..ebf3c688 100644 --- a/dataforge-stat/dataforge-minuit/build.gradle +++ b/dataforge-stat/dataforge-minuit/build.gradle @@ -1,5 +1,4 @@ - description = 'dataforge-minuit' dependencies { - api project(':dataforge-stat') -} + api project(':dataforge-stat') +} \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e750102e..e411586a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/grind/build.gradle b/grind/build.gradle index 1c785067..b92c753b 100644 --- a/grind/build.gradle +++ b/grind/build.gradle @@ -2,13 +2,10 @@ apply plugin: 'groovy' description = 'The GRIND (GRoovy INteractive Dataforge) environment' -compileGroovy.dependsOn(compileKotlin) -compileGroovy.classpath += files(compileKotlin.destinationDir) - dependencies { api project(":dataforge-core") // https://mvnrepository.com/artifact/org.codehaus.groovy/groovy-all - api 'org.codehaus.groovy:groovy-all:3.0.9' + api 'org.apache.groovy:groovy-all:4.0.15' testImplementation project(":dataforge-gui") diff --git a/numass-core/numass-data-proto/build.gradle.kts b/numass-core/numass-data-proto/build.gradle.kts index 072cd036..cb7413c0 100644 --- a/numass-core/numass-data-proto/build.gradle.kts +++ b/numass-core/numass-data-proto/build.gradle.kts @@ -1,11 +1,9 @@ -import com.google.protobuf.gradle.protobuf -import com.google.protobuf.gradle.protoc import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { idea kotlin("jvm") - id("com.google.protobuf") version "0.8.16" + id("com.google.protobuf") version "0.9.4" } @@ -14,13 +12,12 @@ repositories { } dependencies { - api("com.google.protobuf:protobuf-java:3.17.1") + api("com.google.protobuf:protobuf-java:3.25.0") api(project(":numass-core:numass-data-api")) api(project(":dataforge-storage")) } tasks.withType { - kotlinOptions.jvmTarget = "1.8" dependsOn(":numass-core:numass-data-proto:generateProto") } @@ -36,7 +33,7 @@ protobuf { // Configure the protoc executable protoc { // Download from repositories - artifact = "com.google.protobuf:protoc:3.17.1" + artifact = "com.google.protobuf:protoc:3.25.0" } generatedFilesBaseDir = "$projectDir/gen" } diff --git a/numass-core/numass-data-proto/gen/main/java/inr/numass/data/NumassProto.java b/numass-core/numass-data-proto/gen/main/java/inr/numass/data/NumassProto.java index a914447b..397783e6 100644 --- a/numass-core/numass-data-proto/gen/main/java/inr/numass/data/NumassProto.java +++ b/numass-core/numass-data-proto/gen/main/java/inr/numass/data/NumassProto.java @@ -1,6 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: inr/numas/numass-proto.proto +// Protobuf Java Version: 3.25.0 package inr.numass.data; public final class NumassProto { @@ -85,61 +86,6 @@ public final class NumassProto { return new Point(); } - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Point( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: { - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - channels_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000001; - } - channels_.add( - input.readMessage(inr.numass.data.NumassProto.Point.Channel.parser(), extensionRegistry)); - break; - } - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000001) != 0)) { - channels_ = java.util.Collections.unmodifiableList(channels_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return inr.numass.data.NumassProto.internal_static_inr_numass_data_Point_descriptor; @@ -238,66 +184,6 @@ public final class NumassProto { return new Channel(); } - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Channel( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: { - - id_ = input.readUInt64(); - break; - } - case 18: { - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - blocks_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000001; - } - blocks_.add( - input.readMessage(inr.numass.data.NumassProto.Point.Channel.Block.parser(), extensionRegistry)); - break; - } - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000001) != 0)) { - blocks_ = java.util.Collections.unmodifiableList(blocks_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return inr.numass.data.NumassProto.internal_static_inr_numass_data_Point_Channel_descriptor; @@ -443,89 +329,6 @@ public final class NumassProto { return new Block(); } - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Block( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: { - - time_ = input.readUInt64(); - break; - } - case 18: { - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - frames_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000001; - } - frames_.add( - input.readMessage(inr.numass.data.NumassProto.Point.Channel.Block.Frame.parser(), extensionRegistry)); - break; - } - case 26: { - inr.numass.data.NumassProto.Point.Channel.Block.Events.Builder subBuilder = null; - if (events_ != null) { - subBuilder = events_.toBuilder(); - } - events_ = input.readMessage(inr.numass.data.NumassProto.Point.Channel.Block.Events.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(events_); - events_ = subBuilder.buildPartial(); - } - - break; - } - case 32: { - - length_ = input.readUInt64(); - break; - } - case 40: { - - binSize_ = input.readUInt64(); - break; - } - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000001) != 0)) { - frames_ = java.util.Collections.unmodifiableList(frames_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return inr.numass.data.NumassProto.internal_static_inr_numass_data_Point_Channel_Block_descriptor; @@ -590,58 +393,6 @@ public final class NumassProto { return new Frame(); } - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Frame( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: { - - time_ = input.readUInt64(); - break; - } - case 18: { - - data_ = input.readBytes(); - break; - } - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return inr.numass.data.NumassProto.internal_static_inr_numass_data_Point_Channel_Block_Frame_descriptor; @@ -656,7 +407,7 @@ public final class NumassProto { } public static final int TIME_FIELD_NUMBER = 1; - private long time_; + private long time_ = 0L; /** *
            * Time in nanos from the beginning of the block
@@ -671,7 +422,7 @@ public final class NumassProto {
           }
 
           public static final int DATA_FIELD_NUMBER = 2;
-          private com.google.protobuf.ByteString data_;
+          private com.google.protobuf.ByteString data_ = com.google.protobuf.ByteString.EMPTY;
           /**
            * 
            * Frame data as an array of int16 mesured in arbitrary channels
@@ -705,7 +456,7 @@ public final class NumassProto {
             if (!data_.isEmpty()) {
               output.writeBytes(2, data_);
             }
-            unknownFields.writeTo(output);
+            getUnknownFields().writeTo(output);
           }
 
           @java.lang.Override
@@ -722,7 +473,7 @@ public final class NumassProto {
               size += com.google.protobuf.CodedOutputStream
                 .computeBytesSize(2, data_);
             }
-            size += unknownFields.getSerializedSize();
+            size += getUnknownFields().getSerializedSize();
             memoizedSize = size;
             return size;
           }
@@ -741,7 +492,7 @@ public final class NumassProto {
                 != other.getTime()) return false;
             if (!getData()
                 .equals(other.getData())) return false;
-            if (!unknownFields.equals(other.unknownFields)) return false;
+            if (!getUnknownFields().equals(other.getUnknownFields())) return false;
             return true;
           }
 
@@ -757,7 +508,7 @@ public final class NumassProto {
                 getTime());
             hash = (37 * hash) + DATA_FIELD_NUMBER;
             hash = (53 * hash) + getData().hashCode();
-            hash = (29 * hash) + unknownFields.hashCode();
+            hash = (29 * hash) + getUnknownFields().hashCode();
             memoizedHashCode = hash;
             return hash;
           }
@@ -806,11 +557,13 @@ public final class NumassProto {
             return com.google.protobuf.GeneratedMessageV3
                 .parseWithIOException(PARSER, input, extensionRegistry);
           }
+
           public static inr.numass.data.NumassProto.Point.Channel.Block.Frame parseDelimitedFrom(java.io.InputStream input)
               throws java.io.IOException {
             return com.google.protobuf.GeneratedMessageV3
                 .parseDelimitedWithIOException(PARSER, input);
           }
+
           public static inr.numass.data.NumassProto.Point.Channel.Block.Frame parseDelimitedFrom(
               java.io.InputStream input,
               com.google.protobuf.ExtensionRegistryLite extensionRegistry)
@@ -878,26 +631,20 @@ public final class NumassProto {
 
             // Construct using inr.numass.data.NumassProto.Point.Channel.Block.Frame.newBuilder()
             private Builder() {
-              maybeForceBuilderInitialization();
+
             }
 
             private Builder(
                 com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
               super(parent);
-              maybeForceBuilderInitialization();
-            }
-            private void maybeForceBuilderInitialization() {
-              if (com.google.protobuf.GeneratedMessageV3
-                      .alwaysUseFieldBuilders) {
-              }
+
             }
             @java.lang.Override
             public Builder clear() {
               super.clear();
+              bitField0_ = 0;
               time_ = 0L;
-
               data_ = com.google.protobuf.ByteString.EMPTY;
-
               return this;
             }
 
@@ -924,12 +671,21 @@ public final class NumassProto {
             @java.lang.Override
             public inr.numass.data.NumassProto.Point.Channel.Block.Frame buildPartial() {
               inr.numass.data.NumassProto.Point.Channel.Block.Frame result = new inr.numass.data.NumassProto.Point.Channel.Block.Frame(this);
-              result.time_ = time_;
-              result.data_ = data_;
+              if (bitField0_ != 0) { buildPartial0(result); }
               onBuilt();
               return result;
             }
 
+            private void buildPartial0(inr.numass.data.NumassProto.Point.Channel.Block.Frame result) {
+              int from_bitField0_ = bitField0_;
+              if (((from_bitField0_ & 0x00000001) != 0)) {
+                result.time_ = time_;
+              }
+              if (((from_bitField0_ & 0x00000002) != 0)) {
+                result.data_ = data_;
+              }
+            }
+
             @java.lang.Override
             public Builder clone() {
               return super.clone();
@@ -980,7 +736,7 @@ public final class NumassProto {
               if (other.getData() != com.google.protobuf.ByteString.EMPTY) {
                 setData(other.getData());
               }
-              this.mergeUnknownFields(other.unknownFields);
+              this.mergeUnknownFields(other.getUnknownFields());
               onChanged();
               return this;
             }
@@ -995,19 +751,43 @@ public final class NumassProto {
                 com.google.protobuf.CodedInputStream input,
                 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                 throws java.io.IOException {
-              inr.numass.data.NumassProto.Point.Channel.Block.Frame parsedMessage = null;
+              if (extensionRegistry == null) {
+                throw new java.lang.NullPointerException();
+              }
               try {
-                parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+                boolean done = false;
+                while (!done) {
+                  int tag = input.readTag();
+                  switch (tag) {
+                    case 0:
+                      done = true;
+                      break;
+                    case 8: {
+                      time_ = input.readUInt64();
+                      bitField0_ |= 0x00000001;
+                      break;
+                    } // case 8
+                    case 18: {
+                      data_ = input.readBytes();
+                      bitField0_ |= 0x00000002;
+                      break;
+                    } // case 18
+                    default: {
+                      if (!super.parseUnknownField(input, extensionRegistry, tag)) {
+                        done = true; // was an endgroup tag
+                      }
+                      break;
+                    } // default:
+                  } // switch (tag)
+                } // while (!done)
               } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-                parsedMessage = (inr.numass.data.NumassProto.Point.Channel.Block.Frame) e.getUnfinishedMessage();
                 throw e.unwrapIOException();
               } finally {
-                if (parsedMessage != null) {
-                  mergeFrom(parsedMessage);
-                }
-              }
+                onChanged();
+              } // finally
               return this;
             }
+            private int bitField0_;
 
             private long time_ ;
             /**
@@ -1032,8 +812,9 @@ public final class NumassProto {
              * @return This builder for chaining.
              */
             public Builder setTime(long value) {
-              
+
               time_ = value;
+              bitField0_ |= 0x00000001;
               onChanged();
               return this;
             }
@@ -1046,7 +827,7 @@ public final class NumassProto {
              * @return This builder for chaining.
              */
             public Builder clearTime() {
-              
+              bitField0_ = (bitField0_ & ~0x00000001);
               time_ = 0L;
               onChanged();
               return this;
@@ -1075,11 +856,9 @@ public final class NumassProto {
              * @return This builder for chaining.
              */
             public Builder setData(com.google.protobuf.ByteString value) {
-              if (value == null) {
-    throw new NullPointerException();
-  }
-  
+              if (value == null) { throw new NullPointerException(); }
               data_ = value;
+              bitField0_ |= 0x00000002;
               onChanged();
               return this;
             }
@@ -1092,7 +871,7 @@ public final class NumassProto {
              * @return This builder for chaining.
              */
             public Builder clearData() {
-              
+              bitField0_ = (bitField0_ & ~0x00000002);
               data_ = getDefaultInstance().getData();
               onChanged();
               return this;
@@ -1130,7 +909,18 @@ public final class NumassProto {
                 com.google.protobuf.CodedInputStream input,
                 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                 throws com.google.protobuf.InvalidProtocolBufferException {
-              return new Frame(input, extensionRegistry);
+              Builder builder = newBuilder();
+              try {
+                builder.mergeFrom(input, extensionRegistry);
+              } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+                throw e.setUnfinishedMessage(builder.buildPartial());
+              } catch (com.google.protobuf.UninitializedMessageException e) {
+                throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
+              } catch (java.io.IOException e) {
+                throw new com.google.protobuf.InvalidProtocolBufferException(e)
+                    .setUnfinishedMessage(builder.buildPartial());
+              }
+              return builder.buildPartial();
             }
           };
 
@@ -1242,97 +1032,6 @@ public final class NumassProto {
             return new Events();
           }
 
-          @java.lang.Override
-          public final com.google.protobuf.UnknownFieldSet
-          getUnknownFields() {
-            return this.unknownFields;
-          }
-          private Events(
-              com.google.protobuf.CodedInputStream input,
-              com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-              throws com.google.protobuf.InvalidProtocolBufferException {
-            this();
-            if (extensionRegistry == null) {
-              throw new java.lang.NullPointerException();
-            }
-            int mutable_bitField0_ = 0;
-            com.google.protobuf.UnknownFieldSet.Builder unknownFields =
-                com.google.protobuf.UnknownFieldSet.newBuilder();
-            try {
-              boolean done = false;
-              while (!done) {
-                int tag = input.readTag();
-                switch (tag) {
-                  case 0:
-                    done = true;
-                    break;
-                  case 8: {
-                    if (!((mutable_bitField0_ & 0x00000001) != 0)) {
-                      times_ = newLongList();
-                      mutable_bitField0_ |= 0x00000001;
-                    }
-                    times_.addLong(input.readUInt64());
-                    break;
-                  }
-                  case 10: {
-                    int length = input.readRawVarint32();
-                    int limit = input.pushLimit(length);
-                    if (!((mutable_bitField0_ & 0x00000001) != 0) && input.getBytesUntilLimit() > 0) {
-                      times_ = newLongList();
-                      mutable_bitField0_ |= 0x00000001;
-                    }
-                    while (input.getBytesUntilLimit() > 0) {
-                      times_.addLong(input.readUInt64());
-                    }
-                    input.popLimit(limit);
-                    break;
-                  }
-                  case 16: {
-                    if (!((mutable_bitField0_ & 0x00000002) != 0)) {
-                      amplitudes_ = newLongList();
-                      mutable_bitField0_ |= 0x00000002;
-                    }
-                    amplitudes_.addLong(input.readUInt64());
-                    break;
-                  }
-                  case 18: {
-                    int length = input.readRawVarint32();
-                    int limit = input.pushLimit(length);
-                    if (!((mutable_bitField0_ & 0x00000002) != 0) && input.getBytesUntilLimit() > 0) {
-                      amplitudes_ = newLongList();
-                      mutable_bitField0_ |= 0x00000002;
-                    }
-                    while (input.getBytesUntilLimit() > 0) {
-                      amplitudes_.addLong(input.readUInt64());
-                    }
-                    input.popLimit(limit);
-                    break;
-                  }
-                  default: {
-                    if (!parseUnknownField(
-                        input, unknownFields, extensionRegistry, tag)) {
-                      done = true;
-                    }
-                    break;
-                  }
-                }
-              }
-            } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-              throw e.setUnfinishedMessage(this);
-            } catch (java.io.IOException e) {
-              throw new com.google.protobuf.InvalidProtocolBufferException(
-                  e).setUnfinishedMessage(this);
-            } finally {
-              if (((mutable_bitField0_ & 0x00000001) != 0)) {
-                times_.makeImmutable(); // C
-              }
-              if (((mutable_bitField0_ & 0x00000002) != 0)) {
-                amplitudes_.makeImmutable(); // C
-              }
-              this.unknownFields = unknownFields.build();
-              makeExtensionsImmutable();
-            }
-          }
           public static final com.google.protobuf.Descriptors.Descriptor
               getDescriptor() {
             return inr.numass.data.NumassProto.internal_static_inr_numass_data_Point_Channel_Block_Events_descriptor;
@@ -1347,7 +1046,9 @@ public final class NumassProto {
           }
 
           public static final int TIMES_FIELD_NUMBER = 1;
-          private com.google.protobuf.Internal.LongList times_;
+          @SuppressWarnings("serial")
+          private com.google.protobuf.Internal.LongList times_ =
+              emptyLongList();
           /**
            * 
            * Array of time in nanos from the beginning of the block
@@ -1387,7 +1088,9 @@ public final class NumassProto {
           private int timesMemoizedSerializedSize = -1;
 
           public static final int AMPLITUDES_FIELD_NUMBER = 2;
-          private com.google.protobuf.Internal.LongList amplitudes_;
+          @SuppressWarnings("serial")
+          private com.google.protobuf.Internal.LongList amplitudes_ =
+              emptyLongList();
           /**
            * 
            * Array of amplitudes of events in channels
@@ -1455,7 +1158,7 @@ public final class NumassProto {
             for (int i = 0; i < amplitudes_.size(); i++) {
               output.writeUInt64NoTag(amplitudes_.getLong(i));
             }
-            unknownFields.writeTo(output);
+            getUnknownFields().writeTo(output);
           }
 
           @java.lang.Override
@@ -1492,7 +1195,7 @@ public final class NumassProto {
               }
               amplitudesMemoizedSerializedSize = dataSize;
             }
-            size += unknownFields.getSerializedSize();
+            size += getUnknownFields().getSerializedSize();
             memoizedSize = size;
             return size;
           }
@@ -1511,7 +1214,7 @@ public final class NumassProto {
                 .equals(other.getTimesList())) return false;
             if (!getAmplitudesList()
                 .equals(other.getAmplitudesList())) return false;
-            if (!unknownFields.equals(other.unknownFields)) return false;
+            if (!getUnknownFields().equals(other.getUnknownFields())) return false;
             return true;
           }
 
@@ -1530,7 +1233,7 @@ public final class NumassProto {
               hash = (37 * hash) + AMPLITUDES_FIELD_NUMBER;
               hash = (53 * hash) + getAmplitudesList().hashCode();
             }
-            hash = (29 * hash) + unknownFields.hashCode();
+            hash = (29 * hash) + getUnknownFields().hashCode();
             memoizedHashCode = hash;
             return hash;
           }
@@ -1579,11 +1282,13 @@ public final class NumassProto {
             return com.google.protobuf.GeneratedMessageV3
                 .parseWithIOException(PARSER, input, extensionRegistry);
           }
+
           public static inr.numass.data.NumassProto.Point.Channel.Block.Events parseDelimitedFrom(java.io.InputStream input)
               throws java.io.IOException {
             return com.google.protobuf.GeneratedMessageV3
                 .parseDelimitedWithIOException(PARSER, input);
           }
+
           public static inr.numass.data.NumassProto.Point.Channel.Block.Events parseDelimitedFrom(
               java.io.InputStream input,
               com.google.protobuf.ExtensionRegistryLite extensionRegistry)
@@ -1653,26 +1358,20 @@ public final class NumassProto {
 
             // Construct using inr.numass.data.NumassProto.Point.Channel.Block.Events.newBuilder()
             private Builder() {
-              maybeForceBuilderInitialization();
+
             }
 
             private Builder(
                 com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
               super(parent);
-              maybeForceBuilderInitialization();
-            }
-            private void maybeForceBuilderInitialization() {
-              if (com.google.protobuf.GeneratedMessageV3
-                      .alwaysUseFieldBuilders) {
-              }
+
             }
             @java.lang.Override
             public Builder clear() {
               super.clear();
+              bitField0_ = 0;
               times_ = emptyLongList();
-              bitField0_ = (bitField0_ & ~0x00000001);
               amplitudes_ = emptyLongList();
-              bitField0_ = (bitField0_ & ~0x00000002);
               return this;
             }
 
@@ -1699,21 +1398,23 @@ public final class NumassProto {
             @java.lang.Override
             public inr.numass.data.NumassProto.Point.Channel.Block.Events buildPartial() {
               inr.numass.data.NumassProto.Point.Channel.Block.Events result = new inr.numass.data.NumassProto.Point.Channel.Block.Events(this);
-              int from_bitField0_ = bitField0_;
-              if (((bitField0_ & 0x00000001) != 0)) {
-                times_.makeImmutable();
-                bitField0_ = (bitField0_ & ~0x00000001);
-              }
-              result.times_ = times_;
-              if (((bitField0_ & 0x00000002) != 0)) {
-                amplitudes_.makeImmutable();
-                bitField0_ = (bitField0_ & ~0x00000002);
-              }
-              result.amplitudes_ = amplitudes_;
+              if (bitField0_ != 0) { buildPartial0(result); }
               onBuilt();
               return result;
             }
 
+            private void buildPartial0(inr.numass.data.NumassProto.Point.Channel.Block.Events result) {
+              int from_bitField0_ = bitField0_;
+              if (((from_bitField0_ & 0x00000001) != 0)) {
+                times_.makeImmutable();
+                result.times_ = times_;
+              }
+              if (((from_bitField0_ & 0x00000002) != 0)) {
+                amplitudes_.makeImmutable();
+                result.amplitudes_ = amplitudes_;
+              }
+            }
+
             @java.lang.Override
             public Builder clone() {
               return super.clone();
@@ -1761,7 +1462,8 @@ public final class NumassProto {
               if (!other.times_.isEmpty()) {
                 if (times_.isEmpty()) {
                   times_ = other.times_;
-                  bitField0_ = (bitField0_ & ~0x00000001);
+                  times_.makeImmutable();
+                  bitField0_ |= 0x00000001;
                 } else {
                   ensureTimesIsMutable();
                   times_.addAll(other.times_);
@@ -1771,14 +1473,15 @@ public final class NumassProto {
               if (!other.amplitudes_.isEmpty()) {
                 if (amplitudes_.isEmpty()) {
                   amplitudes_ = other.amplitudes_;
-                  bitField0_ = (bitField0_ & ~0x00000002);
+                  amplitudes_.makeImmutable();
+                  bitField0_ |= 0x00000002;
                 } else {
                   ensureAmplitudesIsMutable();
                   amplitudes_.addAll(other.amplitudes_);
                 }
                 onChanged();
               }
-              this.mergeUnknownFields(other.unknownFields);
+              this.mergeUnknownFields(other.getUnknownFields());
               onChanged();
               return this;
             }
@@ -1793,27 +1496,72 @@ public final class NumassProto {
                 com.google.protobuf.CodedInputStream input,
                 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                 throws java.io.IOException {
-              inr.numass.data.NumassProto.Point.Channel.Block.Events parsedMessage = null;
+              if (extensionRegistry == null) {
+                throw new java.lang.NullPointerException();
+              }
               try {
-                parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+                boolean done = false;
+                while (!done) {
+                  int tag = input.readTag();
+                  switch (tag) {
+                    case 0:
+                      done = true;
+                      break;
+                    case 8: {
+                      long v = input.readUInt64();
+                      ensureTimesIsMutable();
+                      times_.addLong(v);
+                      break;
+                    } // case 8
+                    case 10: {
+                      int length = input.readRawVarint32();
+                      int limit = input.pushLimit(length);
+                      ensureTimesIsMutable();
+                      while (input.getBytesUntilLimit() > 0) {
+                        times_.addLong(input.readUInt64());
+                      }
+                      input.popLimit(limit);
+                      break;
+                    } // case 10
+                    case 16: {
+                      long v = input.readUInt64();
+                      ensureAmplitudesIsMutable();
+                      amplitudes_.addLong(v);
+                      break;
+                    } // case 16
+                    case 18: {
+                      int length = input.readRawVarint32();
+                      int limit = input.pushLimit(length);
+                      ensureAmplitudesIsMutable();
+                      while (input.getBytesUntilLimit() > 0) {
+                        amplitudes_.addLong(input.readUInt64());
+                      }
+                      input.popLimit(limit);
+                      break;
+                    } // case 18
+                    default: {
+                      if (!super.parseUnknownField(input, extensionRegistry, tag)) {
+                        done = true; // was an endgroup tag
+                      }
+                      break;
+                    } // default:
+                  } // switch (tag)
+                } // while (!done)
               } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-                parsedMessage = (inr.numass.data.NumassProto.Point.Channel.Block.Events) e.getUnfinishedMessage();
                 throw e.unwrapIOException();
               } finally {
-                if (parsedMessage != null) {
-                  mergeFrom(parsedMessage);
-                }
-              }
+                onChanged();
+              } // finally
               return this;
             }
             private int bitField0_;
 
             private com.google.protobuf.Internal.LongList times_ = emptyLongList();
             private void ensureTimesIsMutable() {
-              if (!((bitField0_ & 0x00000001) != 0)) {
-                times_ = mutableCopy(times_);
-                bitField0_ |= 0x00000001;
-               }
+              if (!times_.isModifiable()) {
+                times_ = makeMutableCopy(times_);
+              }
+              bitField0_ |= 0x00000001;
             }
             /**
              * 
@@ -1825,8 +1573,8 @@ public final class NumassProto {
              */
             public java.util.List
                 getTimesList() {
-              return ((bitField0_ & 0x00000001) != 0) ?
-                       java.util.Collections.unmodifiableList(times_) : times_;
+              times_.makeImmutable();
+              return times_;
             }
             /**
              * 
@@ -1863,8 +1611,10 @@ public final class NumassProto {
              */
             public Builder setTimes(
                 int index, long value) {
+
               ensureTimesIsMutable();
               times_.setLong(index, value);
+              bitField0_ |= 0x00000001;
               onChanged();
               return this;
             }
@@ -1878,8 +1628,10 @@ public final class NumassProto {
              * @return This builder for chaining.
              */
             public Builder addTimes(long value) {
+
               ensureTimesIsMutable();
               times_.addLong(value);
+              bitField0_ |= 0x00000001;
               onChanged();
               return this;
             }
@@ -1897,6 +1649,7 @@ public final class NumassProto {
               ensureTimesIsMutable();
               com.google.protobuf.AbstractMessageLite.Builder.addAll(
                   values, times_);
+              bitField0_ |= 0x00000001;
               onChanged();
               return this;
             }
@@ -1917,10 +1670,10 @@ public final class NumassProto {
 
             private com.google.protobuf.Internal.LongList amplitudes_ = emptyLongList();
             private void ensureAmplitudesIsMutable() {
-              if (!((bitField0_ & 0x00000002) != 0)) {
-                amplitudes_ = mutableCopy(amplitudes_);
-                bitField0_ |= 0x00000002;
-               }
+              if (!amplitudes_.isModifiable()) {
+                amplitudes_ = makeMutableCopy(amplitudes_);
+              }
+              bitField0_ |= 0x00000002;
             }
             /**
              * 
@@ -1932,8 +1685,8 @@ public final class NumassProto {
              */
             public java.util.List
                 getAmplitudesList() {
-              return ((bitField0_ & 0x00000002) != 0) ?
-                       java.util.Collections.unmodifiableList(amplitudes_) : amplitudes_;
+              amplitudes_.makeImmutable();
+              return amplitudes_;
             }
             /**
              * 
@@ -1970,8 +1723,10 @@ public final class NumassProto {
              */
             public Builder setAmplitudes(
                 int index, long value) {
+
               ensureAmplitudesIsMutable();
               amplitudes_.setLong(index, value);
+              bitField0_ |= 0x00000002;
               onChanged();
               return this;
             }
@@ -1985,8 +1740,10 @@ public final class NumassProto {
              * @return This builder for chaining.
              */
             public Builder addAmplitudes(long value) {
+
               ensureAmplitudesIsMutable();
               amplitudes_.addLong(value);
+              bitField0_ |= 0x00000002;
               onChanged();
               return this;
             }
@@ -2004,6 +1761,7 @@ public final class NumassProto {
               ensureAmplitudesIsMutable();
               com.google.protobuf.AbstractMessageLite.Builder.addAll(
                   values, amplitudes_);
+              bitField0_ |= 0x00000002;
               onChanged();
               return this;
             }
@@ -2054,7 +1812,18 @@ public final class NumassProto {
                 com.google.protobuf.CodedInputStream input,
                 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                 throws com.google.protobuf.InvalidProtocolBufferException {
-              return new Events(input, extensionRegistry);
+              Builder builder = newBuilder();
+              try {
+                builder.mergeFrom(input, extensionRegistry);
+              } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+                throw e.setUnfinishedMessage(builder.buildPartial());
+              } catch (com.google.protobuf.UninitializedMessageException e) {
+                throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
+              } catch (java.io.IOException e) {
+                throw new com.google.protobuf.InvalidProtocolBufferException(e)
+                    .setUnfinishedMessage(builder.buildPartial());
+              }
+              return builder.buildPartial();
             }
           };
 
@@ -2074,8 +1843,9 @@ public final class NumassProto {
 
         }
 
+        private int bitField0_;
         public static final int TIME_FIELD_NUMBER = 1;
-        private long time_;
+        private long time_ = 0L;
         /**
          * 
          * Block start in epoch nanos
@@ -2090,6 +1860,7 @@ public final class NumassProto {
         }
 
         public static final int FRAMES_FIELD_NUMBER = 2;
+        @SuppressWarnings("serial")
         private java.util.List frames_;
         /**
          * 
@@ -2161,7 +1932,7 @@ public final class NumassProto {
          */
         @java.lang.Override
         public boolean hasEvents() {
-          return events_ != null;
+          return ((bitField0_ & 0x00000001) != 0);
         }
         /**
          * 
@@ -2184,11 +1955,11 @@ public final class NumassProto {
          */
         @java.lang.Override
         public inr.numass.data.NumassProto.Point.Channel.Block.EventsOrBuilder getEventsOrBuilder() {
-          return getEvents();
+          return events_ == null ? inr.numass.data.NumassProto.Point.Channel.Block.Events.getDefaultInstance() : events_;
         }
 
         public static final int LENGTH_FIELD_NUMBER = 4;
-        private long length_;
+        private long length_ = 0L;
         /**
          * 
          * block size in nanos. If missing, take from meta.
@@ -2203,7 +1974,7 @@ public final class NumassProto {
         }
 
         public static final int BIN_SIZE_FIELD_NUMBER = 5;
-        private long binSize_;
+        private long binSize_ = 0L;
         /**
          * 
          * tick size in nanos. Obsolete, to be removed
@@ -2237,7 +2008,7 @@ public final class NumassProto {
           for (int i = 0; i < frames_.size(); i++) {
             output.writeMessage(2, frames_.get(i));
           }
-          if (events_ != null) {
+          if (((bitField0_ & 0x00000001) != 0)) {
             output.writeMessage(3, getEvents());
           }
           if (length_ != 0L) {
@@ -2246,7 +2017,7 @@ public final class NumassProto {
           if (binSize_ != 0L) {
             output.writeUInt64(5, binSize_);
           }
-          unknownFields.writeTo(output);
+          getUnknownFields().writeTo(output);
         }
 
         @java.lang.Override
@@ -2263,7 +2034,7 @@ public final class NumassProto {
             size += com.google.protobuf.CodedOutputStream
               .computeMessageSize(2, frames_.get(i));
           }
-          if (events_ != null) {
+          if (((bitField0_ & 0x00000001) != 0)) {
             size += com.google.protobuf.CodedOutputStream
               .computeMessageSize(3, getEvents());
           }
@@ -2275,7 +2046,7 @@ public final class NumassProto {
             size += com.google.protobuf.CodedOutputStream
               .computeUInt64Size(5, binSize_);
           }
-          size += unknownFields.getSerializedSize();
+          size += getUnknownFields().getSerializedSize();
           memoizedSize = size;
           return size;
         }
@@ -2303,7 +2074,7 @@ public final class NumassProto {
               != other.getLength()) return false;
           if (getBinSize()
               != other.getBinSize()) return false;
-          if (!unknownFields.equals(other.unknownFields)) return false;
+          if (!getUnknownFields().equals(other.getUnknownFields())) return false;
           return true;
         }
 
@@ -2331,7 +2102,7 @@ public final class NumassProto {
           hash = (37 * hash) + BIN_SIZE_FIELD_NUMBER;
           hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
               getBinSize());
-          hash = (29 * hash) + unknownFields.hashCode();
+          hash = (29 * hash) + getUnknownFields().hashCode();
           memoizedHashCode = hash;
           return hash;
         }
@@ -2380,11 +2151,13 @@ public final class NumassProto {
           return com.google.protobuf.GeneratedMessageV3
               .parseWithIOException(PARSER, input, extensionRegistry);
         }
+
         public static inr.numass.data.NumassProto.Point.Channel.Block parseDelimitedFrom(java.io.InputStream input)
             throws java.io.IOException {
           return com.google.protobuf.GeneratedMessageV3
               .parseDelimitedWithIOException(PARSER, input);
         }
+
         public static inr.numass.data.NumassProto.Point.Channel.Block parseDelimitedFrom(
             java.io.InputStream input,
             com.google.protobuf.ExtensionRegistryLite extensionRegistry)
@@ -2464,29 +2237,28 @@ public final class NumassProto {
             if (com.google.protobuf.GeneratedMessageV3
                     .alwaysUseFieldBuilders) {
               getFramesFieldBuilder();
+              getEventsFieldBuilder();
             }
           }
           @java.lang.Override
           public Builder clear() {
             super.clear();
+            bitField0_ = 0;
             time_ = 0L;
-
             if (framesBuilder_ == null) {
               frames_ = java.util.Collections.emptyList();
-              bitField0_ = (bitField0_ & ~0x00000001);
             } else {
+              frames_ = null;
               framesBuilder_.clear();
             }
-            if (eventsBuilder_ == null) {
-              events_ = null;
-            } else {
-              events_ = null;
+            bitField0_ = (bitField0_ & ~0x00000002);
+            events_ = null;
+            if (eventsBuilder_ != null) {
+              eventsBuilder_.dispose();
               eventsBuilder_ = null;
             }
             length_ = 0L;
-
             binSize_ = 0L;
-
             return this;
           }
 
@@ -2513,26 +2285,43 @@ public final class NumassProto {
           @java.lang.Override
           public inr.numass.data.NumassProto.Point.Channel.Block buildPartial() {
             inr.numass.data.NumassProto.Point.Channel.Block result = new inr.numass.data.NumassProto.Point.Channel.Block(this);
-            int from_bitField0_ = bitField0_;
-            result.time_ = time_;
+            buildPartialRepeatedFields(result);
+            if (bitField0_ != 0) { buildPartial0(result); }
+            onBuilt();
+            return result;
+          }
+
+          private void buildPartialRepeatedFields(inr.numass.data.NumassProto.Point.Channel.Block result) {
             if (framesBuilder_ == null) {
-              if (((bitField0_ & 0x00000001) != 0)) {
+              if (((bitField0_ & 0x00000002) != 0)) {
                 frames_ = java.util.Collections.unmodifiableList(frames_);
-                bitField0_ = (bitField0_ & ~0x00000001);
+                bitField0_ = (bitField0_ & ~0x00000002);
               }
               result.frames_ = frames_;
             } else {
               result.frames_ = framesBuilder_.build();
             }
-            if (eventsBuilder_ == null) {
-              result.events_ = events_;
-            } else {
-              result.events_ = eventsBuilder_.build();
+          }
+
+          private void buildPartial0(inr.numass.data.NumassProto.Point.Channel.Block result) {
+            int from_bitField0_ = bitField0_;
+            if (((from_bitField0_ & 0x00000001) != 0)) {
+              result.time_ = time_;
             }
-            result.length_ = length_;
-            result.binSize_ = binSize_;
-            onBuilt();
-            return result;
+            int to_bitField0_ = 0;
+            if (((from_bitField0_ & 0x00000004) != 0)) {
+              result.events_ = eventsBuilder_ == null
+                  ? events_
+                  : eventsBuilder_.build();
+              to_bitField0_ |= 0x00000001;
+            }
+            if (((from_bitField0_ & 0x00000008) != 0)) {
+              result.length_ = length_;
+            }
+            if (((from_bitField0_ & 0x00000010) != 0)) {
+              result.binSize_ = binSize_;
+            }
+            result.bitField0_ |= to_bitField0_;
           }
 
           @java.lang.Override
@@ -2586,7 +2375,7 @@ public final class NumassProto {
               if (!other.frames_.isEmpty()) {
                 if (frames_.isEmpty()) {
                   frames_ = other.frames_;
-                  bitField0_ = (bitField0_ & ~0x00000001);
+                  bitField0_ = (bitField0_ & ~0x00000002);
                 } else {
                   ensureFramesIsMutable();
                   frames_.addAll(other.frames_);
@@ -2599,7 +2388,7 @@ public final class NumassProto {
                   framesBuilder_.dispose();
                   framesBuilder_ = null;
                   frames_ = other.frames_;
-                  bitField0_ = (bitField0_ & ~0x00000001);
+                  bitField0_ = (bitField0_ & ~0x00000002);
                   framesBuilder_ = 
                     com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ?
                        getFramesFieldBuilder() : null;
@@ -2617,7 +2406,7 @@ public final class NumassProto {
             if (other.getBinSize() != 0L) {
               setBinSize(other.getBinSize());
             }
-            this.mergeUnknownFields(other.unknownFields);
+            this.mergeUnknownFields(other.getUnknownFields());
             onChanged();
             return this;
           }
@@ -2632,17 +2421,65 @@ public final class NumassProto {
               com.google.protobuf.CodedInputStream input,
               com.google.protobuf.ExtensionRegistryLite extensionRegistry)
               throws java.io.IOException {
-            inr.numass.data.NumassProto.Point.Channel.Block parsedMessage = null;
+            if (extensionRegistry == null) {
+              throw new java.lang.NullPointerException();
+            }
             try {
-              parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+              boolean done = false;
+              while (!done) {
+                int tag = input.readTag();
+                switch (tag) {
+                  case 0:
+                    done = true;
+                    break;
+                  case 8: {
+                    time_ = input.readUInt64();
+                    bitField0_ |= 0x00000001;
+                    break;
+                  } // case 8
+                  case 18: {
+                    inr.numass.data.NumassProto.Point.Channel.Block.Frame m =
+                        input.readMessage(
+                            inr.numass.data.NumassProto.Point.Channel.Block.Frame.parser(),
+                            extensionRegistry);
+                    if (framesBuilder_ == null) {
+                      ensureFramesIsMutable();
+                      frames_.add(m);
+                    } else {
+                      framesBuilder_.addMessage(m);
+                    }
+                    break;
+                  } // case 18
+                  case 26: {
+                    input.readMessage(
+                        getEventsFieldBuilder().getBuilder(),
+                        extensionRegistry);
+                    bitField0_ |= 0x00000004;
+                    break;
+                  } // case 26
+                  case 32: {
+                    length_ = input.readUInt64();
+                    bitField0_ |= 0x00000008;
+                    break;
+                  } // case 32
+                  case 40: {
+                    binSize_ = input.readUInt64();
+                    bitField0_ |= 0x00000010;
+                    break;
+                  } // case 40
+                  default: {
+                    if (!super.parseUnknownField(input, extensionRegistry, tag)) {
+                      done = true; // was an endgroup tag
+                    }
+                    break;
+                  } // default:
+                } // switch (tag)
+              } // while (!done)
             } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-              parsedMessage = (inr.numass.data.NumassProto.Point.Channel.Block) e.getUnfinishedMessage();
               throw e.unwrapIOException();
             } finally {
-              if (parsedMessage != null) {
-                mergeFrom(parsedMessage);
-              }
-            }
+              onChanged();
+            } // finally
             return this;
           }
           private int bitField0_;
@@ -2670,8 +2507,9 @@ public final class NumassProto {
            * @return This builder for chaining.
            */
           public Builder setTime(long value) {
-            
+
             time_ = value;
+            bitField0_ |= 0x00000001;
             onChanged();
             return this;
           }
@@ -2684,7 +2522,7 @@ public final class NumassProto {
            * @return This builder for chaining.
            */
           public Builder clearTime() {
-            
+            bitField0_ = (bitField0_ & ~0x00000001);
             time_ = 0L;
             onChanged();
             return this;
@@ -2693,9 +2531,9 @@ public final class NumassProto {
           private java.util.List frames_ =
             java.util.Collections.emptyList();
           private void ensureFramesIsMutable() {
-            if (!((bitField0_ & 0x00000001) != 0)) {
+            if (!((bitField0_ & 0x00000002) != 0)) {
               frames_ = new java.util.ArrayList(frames_);
-              bitField0_ |= 0x00000001;
+              bitField0_ |= 0x00000002;
              }
           }
 
@@ -2889,7 +2727,7 @@ public final class NumassProto {
           public Builder clearFrames() {
             if (framesBuilder_ == null) {
               frames_ = java.util.Collections.emptyList();
-              bitField0_ = (bitField0_ & ~0x00000001);
+              bitField0_ = (bitField0_ & ~0x00000002);
               onChanged();
             } else {
               framesBuilder_.clear();
@@ -2994,7 +2832,7 @@ public final class NumassProto {
               framesBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3<
                   inr.numass.data.NumassProto.Point.Channel.Block.Frame, inr.numass.data.NumassProto.Point.Channel.Block.Frame.Builder, inr.numass.data.NumassProto.Point.Channel.Block.FrameOrBuilder>(
                       frames_,
-                      ((bitField0_ & 0x00000001) != 0),
+                      ((bitField0_ & 0x00000002) != 0),
                       getParentForChildren(),
                       isClean());
               frames_ = null;
@@ -3014,7 +2852,7 @@ public final class NumassProto {
            * @return Whether the events field is set.
            */
           public boolean hasEvents() {
-            return eventsBuilder_ != null || events_ != null;
+            return ((bitField0_ & 0x00000004) != 0);
           }
           /**
            * 
@@ -3044,11 +2882,11 @@ public final class NumassProto {
                 throw new NullPointerException();
               }
               events_ = value;
-              onChanged();
             } else {
               eventsBuilder_.setMessage(value);
             }
-
+            bitField0_ |= 0x00000004;
+            onChanged();
             return this;
           }
           /**
@@ -3062,11 +2900,11 @@ public final class NumassProto {
               inr.numass.data.NumassProto.Point.Channel.Block.Events.Builder builderForValue) {
             if (eventsBuilder_ == null) {
               events_ = builderForValue.build();
-              onChanged();
             } else {
               eventsBuilder_.setMessage(builderForValue.build());
             }
-
+            bitField0_ |= 0x00000004;
+            onChanged();
             return this;
           }
           /**
@@ -3078,17 +2916,20 @@ public final class NumassProto {
            */
           public Builder mergeEvents(inr.numass.data.NumassProto.Point.Channel.Block.Events value) {
             if (eventsBuilder_ == null) {
-              if (events_ != null) {
-                events_ =
-                  inr.numass.data.NumassProto.Point.Channel.Block.Events.newBuilder(events_).mergeFrom(value).buildPartial();
+              if (((bitField0_ & 0x00000004) != 0) &&
+                events_ != null &&
+                events_ != inr.numass.data.NumassProto.Point.Channel.Block.Events.getDefaultInstance()) {
+                getEventsBuilder().mergeFrom(value);
               } else {
                 events_ = value;
               }
-              onChanged();
             } else {
               eventsBuilder_.mergeFrom(value);
             }
-
+            if (events_ != null) {
+              bitField0_ |= 0x00000004;
+              onChanged();
+            }
             return this;
           }
           /**
@@ -3099,14 +2940,13 @@ public final class NumassProto {
            * .inr.numass.data.Point.Channel.Block.Events events = 3;
            */
           public Builder clearEvents() {
-            if (eventsBuilder_ == null) {
-              events_ = null;
-              onChanged();
-            } else {
-              events_ = null;
+            bitField0_ = (bitField0_ & ~0x00000004);
+            events_ = null;
+            if (eventsBuilder_ != null) {
+              eventsBuilder_.dispose();
               eventsBuilder_ = null;
             }
-
+            onChanged();
             return this;
           }
           /**
@@ -3117,7 +2957,7 @@ public final class NumassProto {
            * .inr.numass.data.Point.Channel.Block.Events events = 3;
            */
           public inr.numass.data.NumassProto.Point.Channel.Block.Events.Builder getEventsBuilder() {
-            
+            bitField0_ |= 0x00000004;
             onChanged();
             return getEventsFieldBuilder().getBuilder();
           }
@@ -3180,8 +3020,9 @@ public final class NumassProto {
            * @return This builder for chaining.
            */
           public Builder setLength(long value) {
-            
+
             length_ = value;
+            bitField0_ |= 0x00000008;
             onChanged();
             return this;
           }
@@ -3194,7 +3035,7 @@ public final class NumassProto {
            * @return This builder for chaining.
            */
           public Builder clearLength() {
-            
+            bitField0_ = (bitField0_ & ~0x00000008);
             length_ = 0L;
             onChanged();
             return this;
@@ -3223,8 +3064,9 @@ public final class NumassProto {
            * @return This builder for chaining.
            */
           public Builder setBinSize(long value) {
-            
+
             binSize_ = value;
+            bitField0_ |= 0x00000010;
             onChanged();
             return this;
           }
@@ -3237,7 +3079,7 @@ public final class NumassProto {
            * @return This builder for chaining.
            */
           public Builder clearBinSize() {
-            
+            bitField0_ = (bitField0_ & ~0x00000010);
             binSize_ = 0L;
             onChanged();
             return this;
@@ -3275,7 +3117,18 @@ public final class NumassProto {
               com.google.protobuf.CodedInputStream input,
               com.google.protobuf.ExtensionRegistryLite extensionRegistry)
               throws com.google.protobuf.InvalidProtocolBufferException {
-            return new Block(input, extensionRegistry);
+            Builder builder = newBuilder();
+            try {
+              builder.mergeFrom(input, extensionRegistry);
+            } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+              throw e.setUnfinishedMessage(builder.buildPartial());
+            } catch (com.google.protobuf.UninitializedMessageException e) {
+              throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
+            } catch (java.io.IOException e) {
+              throw new com.google.protobuf.InvalidProtocolBufferException(e)
+                  .setUnfinishedMessage(builder.buildPartial());
+            }
+            return builder.buildPartial();
           }
         };
 
@@ -3296,7 +3149,7 @@ public final class NumassProto {
       }
 
       public static final int ID_FIELD_NUMBER = 1;
-      private long id_;
+      private long id_ = 0L;
       /**
        * 
        * The number of measuring channel
@@ -3311,6 +3164,7 @@ public final class NumassProto {
       }
 
       public static final int BLOCKS_FIELD_NUMBER = 2;
+      @SuppressWarnings("serial")
       private java.util.List blocks_;
       /**
        * 
@@ -3390,7 +3244,7 @@ public final class NumassProto {
         for (int i = 0; i < blocks_.size(); i++) {
           output.writeMessage(2, blocks_.get(i));
         }
-        unknownFields.writeTo(output);
+        getUnknownFields().writeTo(output);
       }
 
       @java.lang.Override
@@ -3407,7 +3261,7 @@ public final class NumassProto {
           size += com.google.protobuf.CodedOutputStream
             .computeMessageSize(2, blocks_.get(i));
         }
-        size += unknownFields.getSerializedSize();
+        size += getUnknownFields().getSerializedSize();
         memoizedSize = size;
         return size;
       }
@@ -3426,7 +3280,7 @@ public final class NumassProto {
             != other.getId()) return false;
         if (!getBlocksList()
             .equals(other.getBlocksList())) return false;
-        if (!unknownFields.equals(other.unknownFields)) return false;
+        if (!getUnknownFields().equals(other.getUnknownFields())) return false;
         return true;
       }
 
@@ -3444,7 +3298,7 @@ public final class NumassProto {
           hash = (37 * hash) + BLOCKS_FIELD_NUMBER;
           hash = (53 * hash) + getBlocksList().hashCode();
         }
-        hash = (29 * hash) + unknownFields.hashCode();
+        hash = (29 * hash) + getUnknownFields().hashCode();
         memoizedHashCode = hash;
         return hash;
       }
@@ -3493,11 +3347,13 @@ public final class NumassProto {
         return com.google.protobuf.GeneratedMessageV3
             .parseWithIOException(PARSER, input, extensionRegistry);
       }
+
       public static inr.numass.data.NumassProto.Point.Channel parseDelimitedFrom(java.io.InputStream input)
           throws java.io.IOException {
         return com.google.protobuf.GeneratedMessageV3
             .parseDelimitedWithIOException(PARSER, input);
       }
+
       public static inr.numass.data.NumassProto.Point.Channel parseDelimitedFrom(
           java.io.InputStream input,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
@@ -3565,31 +3421,26 @@ public final class NumassProto {
 
         // Construct using inr.numass.data.NumassProto.Point.Channel.newBuilder()
         private Builder() {
-          maybeForceBuilderInitialization();
+
         }
 
         private Builder(
             com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
           super(parent);
-          maybeForceBuilderInitialization();
-        }
-        private void maybeForceBuilderInitialization() {
-          if (com.google.protobuf.GeneratedMessageV3
-                  .alwaysUseFieldBuilders) {
-            getBlocksFieldBuilder();
-          }
+
         }
         @java.lang.Override
         public Builder clear() {
           super.clear();
+          bitField0_ = 0;
           id_ = 0L;
-
           if (blocksBuilder_ == null) {
             blocks_ = java.util.Collections.emptyList();
-            bitField0_ = (bitField0_ & ~0x00000001);
           } else {
+            blocks_ = null;
             blocksBuilder_.clear();
           }
+          bitField0_ = (bitField0_ & ~0x00000002);
           return this;
         }
 
@@ -3616,19 +3467,29 @@ public final class NumassProto {
         @java.lang.Override
         public inr.numass.data.NumassProto.Point.Channel buildPartial() {
           inr.numass.data.NumassProto.Point.Channel result = new inr.numass.data.NumassProto.Point.Channel(this);
-          int from_bitField0_ = bitField0_;
-          result.id_ = id_;
+          buildPartialRepeatedFields(result);
+          if (bitField0_ != 0) { buildPartial0(result); }
+          onBuilt();
+          return result;
+        }
+
+        private void buildPartialRepeatedFields(inr.numass.data.NumassProto.Point.Channel result) {
           if (blocksBuilder_ == null) {
-            if (((bitField0_ & 0x00000001) != 0)) {
+            if (((bitField0_ & 0x00000002) != 0)) {
               blocks_ = java.util.Collections.unmodifiableList(blocks_);
-              bitField0_ = (bitField0_ & ~0x00000001);
+              bitField0_ = (bitField0_ & ~0x00000002);
             }
             result.blocks_ = blocks_;
           } else {
             result.blocks_ = blocksBuilder_.build();
           }
-          onBuilt();
-          return result;
+        }
+
+        private void buildPartial0(inr.numass.data.NumassProto.Point.Channel result) {
+          int from_bitField0_ = bitField0_;
+          if (((from_bitField0_ & 0x00000001) != 0)) {
+            result.id_ = id_;
+          }
         }
 
         @java.lang.Override
@@ -3682,7 +3543,7 @@ public final class NumassProto {
             if (!other.blocks_.isEmpty()) {
               if (blocks_.isEmpty()) {
                 blocks_ = other.blocks_;
-                bitField0_ = (bitField0_ & ~0x00000001);
+                bitField0_ = (bitField0_ & ~0x00000002);
               } else {
                 ensureBlocksIsMutable();
                 blocks_.addAll(other.blocks_);
@@ -3695,7 +3556,7 @@ public final class NumassProto {
                 blocksBuilder_.dispose();
                 blocksBuilder_ = null;
                 blocks_ = other.blocks_;
-                bitField0_ = (bitField0_ & ~0x00000001);
+                bitField0_ = (bitField0_ & ~0x00000002);
                 blocksBuilder_ = 
                   com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ?
                      getBlocksFieldBuilder() : null;
@@ -3704,7 +3565,7 @@ public final class NumassProto {
               }
             }
           }
-          this.mergeUnknownFields(other.unknownFields);
+          this.mergeUnknownFields(other.getUnknownFields());
           onChanged();
           return this;
         }
@@ -3719,17 +3580,48 @@ public final class NumassProto {
             com.google.protobuf.CodedInputStream input,
             com.google.protobuf.ExtensionRegistryLite extensionRegistry)
             throws java.io.IOException {
-          inr.numass.data.NumassProto.Point.Channel parsedMessage = null;
+          if (extensionRegistry == null) {
+            throw new java.lang.NullPointerException();
+          }
           try {
-            parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+            boolean done = false;
+            while (!done) {
+              int tag = input.readTag();
+              switch (tag) {
+                case 0:
+                  done = true;
+                  break;
+                case 8: {
+                  id_ = input.readUInt64();
+                  bitField0_ |= 0x00000001;
+                  break;
+                } // case 8
+                case 18: {
+                  inr.numass.data.NumassProto.Point.Channel.Block m =
+                      input.readMessage(
+                          inr.numass.data.NumassProto.Point.Channel.Block.parser(),
+                          extensionRegistry);
+                  if (blocksBuilder_ == null) {
+                    ensureBlocksIsMutable();
+                    blocks_.add(m);
+                  } else {
+                    blocksBuilder_.addMessage(m);
+                  }
+                  break;
+                } // case 18
+                default: {
+                  if (!super.parseUnknownField(input, extensionRegistry, tag)) {
+                    done = true; // was an endgroup tag
+                  }
+                  break;
+                } // default:
+              } // switch (tag)
+            } // while (!done)
           } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-            parsedMessage = (inr.numass.data.NumassProto.Point.Channel) e.getUnfinishedMessage();
             throw e.unwrapIOException();
           } finally {
-            if (parsedMessage != null) {
-              mergeFrom(parsedMessage);
-            }
-          }
+            onChanged();
+          } // finally
           return this;
         }
         private int bitField0_;
@@ -3757,8 +3649,9 @@ public final class NumassProto {
          * @return This builder for chaining.
          */
         public Builder setId(long value) {
-          
+
           id_ = value;
+          bitField0_ |= 0x00000001;
           onChanged();
           return this;
         }
@@ -3771,7 +3664,7 @@ public final class NumassProto {
          * @return This builder for chaining.
          */
         public Builder clearId() {
-          
+          bitField0_ = (bitField0_ & ~0x00000001);
           id_ = 0L;
           onChanged();
           return this;
@@ -3780,9 +3673,9 @@ public final class NumassProto {
         private java.util.List blocks_ =
           java.util.Collections.emptyList();
         private void ensureBlocksIsMutable() {
-          if (!((bitField0_ & 0x00000001) != 0)) {
+          if (!((bitField0_ & 0x00000002) != 0)) {
             blocks_ = new java.util.ArrayList(blocks_);
-            bitField0_ |= 0x00000001;
+            bitField0_ |= 0x00000002;
            }
         }
 
@@ -3976,7 +3869,7 @@ public final class NumassProto {
         public Builder clearBlocks() {
           if (blocksBuilder_ == null) {
             blocks_ = java.util.Collections.emptyList();
-            bitField0_ = (bitField0_ & ~0x00000001);
+            bitField0_ = (bitField0_ & ~0x00000002);
             onChanged();
           } else {
             blocksBuilder_.clear();
@@ -4081,7 +3974,7 @@ public final class NumassProto {
             blocksBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3<
                 inr.numass.data.NumassProto.Point.Channel.Block, inr.numass.data.NumassProto.Point.Channel.Block.Builder, inr.numass.data.NumassProto.Point.Channel.BlockOrBuilder>(
                     blocks_,
-                    ((bitField0_ & 0x00000001) != 0),
+                    ((bitField0_ & 0x00000002) != 0),
                     getParentForChildren(),
                     isClean());
             blocks_ = null;
@@ -4121,7 +4014,18 @@ public final class NumassProto {
             com.google.protobuf.CodedInputStream input,
             com.google.protobuf.ExtensionRegistryLite extensionRegistry)
             throws com.google.protobuf.InvalidProtocolBufferException {
-          return new Channel(input, extensionRegistry);
+          Builder builder = newBuilder();
+          try {
+            builder.mergeFrom(input, extensionRegistry);
+          } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+            throw e.setUnfinishedMessage(builder.buildPartial());
+          } catch (com.google.protobuf.UninitializedMessageException e) {
+            throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
+          } catch (java.io.IOException e) {
+            throw new com.google.protobuf.InvalidProtocolBufferException(e)
+                .setUnfinishedMessage(builder.buildPartial());
+          }
+          return builder.buildPartial();
         }
       };
 
@@ -4142,6 +4046,7 @@ public final class NumassProto {
     }
 
     public static final int CHANNELS_FIELD_NUMBER = 1;
+    @SuppressWarnings("serial")
     private java.util.List channels_;
     /**
      * 
@@ -4218,7 +4123,7 @@ public final class NumassProto {
       for (int i = 0; i < channels_.size(); i++) {
         output.writeMessage(1, channels_.get(i));
       }
-      unknownFields.writeTo(output);
+      getUnknownFields().writeTo(output);
     }
 
     @java.lang.Override
@@ -4231,7 +4136,7 @@ public final class NumassProto {
         size += com.google.protobuf.CodedOutputStream
           .computeMessageSize(1, channels_.get(i));
       }
-      size += unknownFields.getSerializedSize();
+      size += getUnknownFields().getSerializedSize();
       memoizedSize = size;
       return size;
     }
@@ -4248,7 +4153,7 @@ public final class NumassProto {
 
       if (!getChannelsList()
           .equals(other.getChannelsList())) return false;
-      if (!unknownFields.equals(other.unknownFields)) return false;
+      if (!getUnknownFields().equals(other.getUnknownFields())) return false;
       return true;
     }
 
@@ -4263,7 +4168,7 @@ public final class NumassProto {
         hash = (37 * hash) + CHANNELS_FIELD_NUMBER;
         hash = (53 * hash) + getChannelsList().hashCode();
       }
-      hash = (29 * hash) + unknownFields.hashCode();
+      hash = (29 * hash) + getUnknownFields().hashCode();
       memoizedHashCode = hash;
       return hash;
     }
@@ -4312,11 +4217,13 @@ public final class NumassProto {
       return com.google.protobuf.GeneratedMessageV3
           .parseWithIOException(PARSER, input, extensionRegistry);
     }
+
     public static inr.numass.data.NumassProto.Point parseDelimitedFrom(java.io.InputStream input)
         throws java.io.IOException {
       return com.google.protobuf.GeneratedMessageV3
           .parseDelimitedWithIOException(PARSER, input);
     }
+
     public static inr.numass.data.NumassProto.Point parseDelimitedFrom(
         java.io.InputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
@@ -4380,29 +4287,25 @@ public final class NumassProto {
 
       // Construct using inr.numass.data.NumassProto.Point.newBuilder()
       private Builder() {
-        maybeForceBuilderInitialization();
+
       }
 
       private Builder(
           com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
         super(parent);
-        maybeForceBuilderInitialization();
-      }
-      private void maybeForceBuilderInitialization() {
-        if (com.google.protobuf.GeneratedMessageV3
-                .alwaysUseFieldBuilders) {
-          getChannelsFieldBuilder();
-        }
+
       }
       @java.lang.Override
       public Builder clear() {
         super.clear();
+        bitField0_ = 0;
         if (channelsBuilder_ == null) {
           channels_ = java.util.Collections.emptyList();
-          bitField0_ = (bitField0_ & ~0x00000001);
         } else {
+          channels_ = null;
           channelsBuilder_.clear();
         }
+        bitField0_ = (bitField0_ & ~0x00000001);
         return this;
       }
 
@@ -4429,7 +4332,13 @@ public final class NumassProto {
       @java.lang.Override
       public inr.numass.data.NumassProto.Point buildPartial() {
         inr.numass.data.NumassProto.Point result = new inr.numass.data.NumassProto.Point(this);
-        int from_bitField0_ = bitField0_;
+        buildPartialRepeatedFields(result);
+        if (bitField0_ != 0) { buildPartial0(result); }
+        onBuilt();
+        return result;
+      }
+
+      private void buildPartialRepeatedFields(inr.numass.data.NumassProto.Point result) {
         if (channelsBuilder_ == null) {
           if (((bitField0_ & 0x00000001) != 0)) {
             channels_ = java.util.Collections.unmodifiableList(channels_);
@@ -4439,8 +4348,10 @@ public final class NumassProto {
         } else {
           result.channels_ = channelsBuilder_.build();
         }
-        onBuilt();
-        return result;
+      }
+
+      private void buildPartial0(inr.numass.data.NumassProto.Point result) {
+        int from_bitField0_ = bitField0_;
       }
 
       @java.lang.Override
@@ -4513,7 +4424,7 @@ public final class NumassProto {
             }
           }
         }
-        this.mergeUnknownFields(other.unknownFields);
+        this.mergeUnknownFields(other.getUnknownFields());
         onChanged();
         return this;
       }
@@ -4528,17 +4439,43 @@ public final class NumassProto {
           com.google.protobuf.CodedInputStream input,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
           throws java.io.IOException {
-        inr.numass.data.NumassProto.Point parsedMessage = null;
+        if (extensionRegistry == null) {
+          throw new java.lang.NullPointerException();
+        }
         try {
-          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+          boolean done = false;
+          while (!done) {
+            int tag = input.readTag();
+            switch (tag) {
+              case 0:
+                done = true;
+                break;
+              case 10: {
+                inr.numass.data.NumassProto.Point.Channel m =
+                    input.readMessage(
+                        inr.numass.data.NumassProto.Point.Channel.parser(),
+                        extensionRegistry);
+                if (channelsBuilder_ == null) {
+                  ensureChannelsIsMutable();
+                  channels_.add(m);
+                } else {
+                  channelsBuilder_.addMessage(m);
+                }
+                break;
+              } // case 10
+              default: {
+                if (!super.parseUnknownField(input, extensionRegistry, tag)) {
+                  done = true; // was an endgroup tag
+                }
+                break;
+              } // default:
+            } // switch (tag)
+          } // while (!done)
         } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (inr.numass.data.NumassProto.Point) e.getUnfinishedMessage();
           throw e.unwrapIOException();
         } finally {
-          if (parsedMessage != null) {
-            mergeFrom(parsedMessage);
-          }
-        }
+          onChanged();
+        } // finally
         return this;
       }
       private int bitField0_;
@@ -4887,7 +4824,18 @@ public final class NumassProto {
           com.google.protobuf.CodedInputStream input,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
           throws com.google.protobuf.InvalidProtocolBufferException {
-        return new Point(input, extensionRegistry);
+        Builder builder = newBuilder();
+        try {
+          builder.mergeFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          throw e.setUnfinishedMessage(builder.buildPartial());
+        } catch (com.google.protobuf.UninitializedMessageException e) {
+          throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
+        } catch (java.io.IOException e) {
+          throw new com.google.protobuf.InvalidProtocolBufferException(e)
+              .setUnfinishedMessage(builder.buildPartial());
+        }
+        return builder.buildPartial();
       }
     };
 
diff --git a/numass-main/build.gradle b/numass-main/build.gradle
index a895c4a5..78c423f2 100644
--- a/numass-main/build.gradle
+++ b/numass-main/build.gradle
@@ -1,5 +1,4 @@
 plugins {
-    id 'groovy'
     id 'application'
     id "org.openjfx.javafxplugin"
 }
@@ -15,18 +14,16 @@ mainClassName = 'inr.numass.LaunchGrindShell'
 
 description = "Main numass project"
 
-compileGroovy.dependsOn(compileKotlin)
-compileGroovy.classpath += files(compileKotlin.destinationDir)
-
 dependencies {
     api group: 'commons-cli', name: 'commons-cli', version: '1.+'
     api group: 'commons-io', name: 'commons-io', version: '2.+'
     api project(':numass-core')
     api project(':numass-core:numass-signal-processing')
-    compileOnly "org.jetbrains.kotlin:kotlin-main-kts:1.3.21"
+    compileOnly "org.jetbrains.kotlin:kotlin-main-kts:1.9.20"
     api project(':dataforge-stat:dataforge-minuit')
     api project(':grind:grind-terminal')
     api project(":dataforge-gui")
+    api project(':dataforge-plots:plots-jfc')
     //api "hep.dataforge:dataforge-html"
 
     // https://mvnrepository.com/artifact/org.ehcache/ehcache
diff --git a/numass-main/src/main/groovy/inr/numass/scripts/CountRateSummary.groovy b/numass-main/src/main/groovy/inr/numass/scripts/CountRateSummary.groovy
index 4a168020..e69de29b 100644
--- a/numass-main/src/main/groovy/inr/numass/scripts/CountRateSummary.groovy
+++ b/numass-main/src/main/groovy/inr/numass/scripts/CountRateSummary.groovy
@@ -1,23 +0,0 @@
-package inr.numass.scripts
-
-
-import hep.dataforge.tables.Table
-import hep.dataforge.workspace.FileBasedWorkspace
-import hep.dataforge.workspace.Workspace
-
-import java.nio.file.Paths
-
-/**
- * Created by darksnake on 26-Dec-16.
- */
-
-
-Workspace numass = FileBasedWorkspace.build(Paths.get("D:/Work/Numass/sterile2016_10/workspace.groovy"))
-
-numass.runTask("prepare", "fill_1_all").forEachData(Table) {
-    Table table = it.get();
-    def dp18 = table.find { it["Uset"] == 18000 }
-    def dp17 = table.find { it["Uset"] == 17000 }
-    println "${it.name}\t${dp18["CR"]}\t${dp18["CRerr"]}\t${dp17["CR"]}\t${dp17["CRerr"]}"
-}
-
diff --git a/numass-main/src/main/groovy/inr/numass/scripts/FindExIonRatio.groovy b/numass-main/src/main/groovy/inr/numass/scripts/FindExIonRatio.groovy
index d4b1b35e..e69de29b 100644
--- a/numass-main/src/main/groovy/inr/numass/scripts/FindExIonRatio.groovy
+++ b/numass-main/src/main/groovy/inr/numass/scripts/FindExIonRatio.groovy
@@ -1,109 +0,0 @@
-/* 
- * Copyright 2015 Alexander Nozik.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package inr.numass.scripts
-
-import hep.dataforge.maths.integration.UnivariateIntegrator
-import hep.dataforge.plots.PlotFrame
-import hep.dataforge.plots.data.XYFunctionPlot
-import hep.dataforge.plots.jfreechart.JFreeChartFrame
-import hep.dataforge.stat.fit.ParamSet
-import inr.numass.models.misc.LossCalculator
-import org.apache.commons.math3.analysis.UnivariateFunction
-import org.apache.commons.math3.analysis.solvers.BisectionSolver
-
-ParamSet params = new ParamSet()
-        .setParValue("exPos", 12.76)
-        .setParValue("ionPos", 13.95)
-        .setParValue("exW", 1.2)
-        .setParValue("ionW", 13.5)
-        .setParValue("exIonRatio", 4.55)
-
-
-
-
-UnivariateFunction scatterFunction = LossCalculator.getSingleScatterFunction(params);
-
-PlotFrame frame = JFreeChartFrame.drawFrame("Differential scatter function", null);
-frame.add(XYFunctionPlot.plotFunction("differential", scatterFunction, 0, 100, 400));
-
-UnivariateIntegrator integrator = NumassContext.defaultIntegrator;
-
-double border = 13.6;
-
-UnivariateFunction ratioFunction = { e -> integrator.integrate(0, e, scatterFunction) / integrator.integrate(e, 100, scatterFunction) }
-
-double ratio = ratioFunction.value(border);
-println "The true excitation to ionization ratio with border energy $border is $ratio";
-
-
-double resolution = 1.5d;
-
-
-def X = 0.527;
-
-LossCalculator calculator = LossCalculator.INSTANCE;
-
-List lossProbs = calculator.getGunLossProbabilities(X);
-
-UnivariateFunction newScatterFunction = { double d ->
-    double res = scatterFunction.value(d);
-    for (i = 1; i < lossProbs.size(); i++) {
-        res += lossProbs.get(i) * calculator.getLossValue(i, d, 0);
-    }
-    return res;
-}
-
-
-UnivariateFunction resolutionValue = { double e ->
-    if (e <= 0d) {
-        return 0d;
-    } else if (e >= resolution) {
-        return 1d;
-    } else {
-        return e / resolution;
-    }
-};
-
-
-UnivariateFunction integral = { double u ->
-    if (u <= 0d) {
-        return 0d;
-    } else {
-        UnivariateFunction integrand = { double e -> resolutionValue.value(u - e) * newScatterFunction.value(e) };
-        return integrator.integrate(0d, u, integrand)
-    }
-}
-
-
-frame.add(XYFunctionPlot.plotFunction("integral", integral, 0, 100, 800));
-
-BisectionSolver solver = new BisectionSolver(1e-3);
-
-UnivariateFunction integralShifted = { u ->
-    def integr = integral.value(u);
-    return integr / (1 - integr) - ratio;
-}
-
-double integralBorder = solver.solve(400, integralShifted, 10d, 20d);
-
-println "The integral border is $integralBorder";
-
-double newBorder = 14.43
-double integralValue = integral.value(newBorder);
-
-double err = Math.abs(integralValue / (1 - integralValue) / ratio - 1d)
-
-println "The relative error ic case of using $newBorder instead of real one is $err";
\ No newline at end of file
diff --git a/numass-main/src/main/groovy/inr/numass/scripts/LossNormCalculation.groovy b/numass-main/src/main/groovy/inr/numass/scripts/LossNormCalculation.groovy
index afee80a4..e69de29b 100644
--- a/numass-main/src/main/groovy/inr/numass/scripts/LossNormCalculation.groovy
+++ b/numass-main/src/main/groovy/inr/numass/scripts/LossNormCalculation.groovy
@@ -1,46 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package inr.numass.scripts
-
-import hep.dataforge.maths.integration.GaussRuleIntegrator
-import hep.dataforge.maths.integration.UnivariateIntegrator
-import org.apache.commons.math3.analysis.UnivariateFunction
-
-UnivariateIntegrator integrator = new GaussRuleIntegrator(400);
-def exPos = 12.695;
-def ionPos = 13.29;
-def exW = 1.22;
-def ionW = 11.99;
-def exIonRatio = 3.6;
-
-def cutoff = 25d
-
-UnivariateFunction func = {double eps -> 
-    if (eps <= 0) {
-        return 0;
-    }
-    double z1 = eps - exPos;
-    double ex = exIonRatio * Math.exp(-2 * z1 * z1 / exW / exW);
-
-    double z = 4 * (eps - ionPos) * (eps - ionPos);
-    double ion = 1 / (1 + z / ionW / ionW);
-
-    double res;
-    if (eps < exPos) {
-        res = ex;
-    } else {
-        res = Math.max(ex, ion);
-    }
-
-    return res;
-};
-
-//caclulating lorentz integral analythically
-double tailNorm = (Math.atan((ionPos - cutoff) * 2d / ionW) + 0.5 * Math.PI) * ionW / 2d;
-final double norm = integrator.integrate(0d, cutoff, func) + tailNorm;
-
-println 1/norm;
\ No newline at end of file
diff --git a/numass-main/src/main/groovy/inr/numass/scripts/LossTailCalculation.groovy b/numass-main/src/main/groovy/inr/numass/scripts/LossTailCalculation.groovy
index cc018f8a..e69de29b 100644
--- a/numass-main/src/main/groovy/inr/numass/scripts/LossTailCalculation.groovy
+++ b/numass-main/src/main/groovy/inr/numass/scripts/LossTailCalculation.groovy
@@ -1,41 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package inr.numass.scripts
-
-import hep.dataforge.maths.integration.GaussRuleIntegrator
-import hep.dataforge.maths.integration.UnivariateIntegrator
-import org.apache.commons.math3.analysis.UnivariateFunction
-
-UnivariateIntegrator integrator = new GaussRuleIntegrator(400);
-
-def exPos = 12.587;
-def ionPos = 11.11;
-def exW = 1.20;
-def ionW = 11.02;
-def exIonRatio = 2.43;
-
-def cutoff = 20d
-
-UnivariateFunction loss = LossCalculator.getSingleScatterFunction(exPos, ionPos, exW, ionW, exIonRatio);
-
-
-println integrator.integrate(0, 600, loss);
-println integrator.integrate(0, cutoff, loss);
-println integrator.integrate(cutoff, 600d, loss);
-
-println (integrator.integrate(0, cutoff, loss) + integrator.integrate(cutoff, 3000d, loss));
-//double tailValue = (Math.atan((ionPos-cutoff)*2d/ionW) + 0.5*Math.PI)*ionW/2;
-//println tailValue
-//println integrator.integrate(loss,0,100);
-//println integrator.integrate(loss,100,600);
-
-//def lorentz = {eps->
-//    double z = 4 * (eps - ionPos) * (eps - ionPos);
-//    1 / (1 + z / ionW / ionW);
-//}
-//
-//println(integrator.integrate(lorentz, cutoff, 800))
\ No newline at end of file
diff --git a/numass-main/src/main/groovy/inr/numass/scripts/OldTest.groovy b/numass-main/src/main/groovy/inr/numass/scripts/OldTest.groovy
index 371599f6..e69de29b 100644
--- a/numass-main/src/main/groovy/inr/numass/scripts/OldTest.groovy
+++ b/numass-main/src/main/groovy/inr/numass/scripts/OldTest.groovy
@@ -1,104 +0,0 @@
-/* 
- * Copyright 2015 Alexander Nozik.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package inr.numass.scripts
-
-import hep.dataforge.context.Global
-import hep.dataforge.stat.fit.FitManager
-import hep.dataforge.stat.fit.FitState
-import hep.dataforge.stat.fit.MINUITPlugin
-import hep.dataforge.stat.fit.ParamSet
-import hep.dataforge.stat.models.XYModel
-import hep.dataforge.tables.ListTable
-import inr.numass.data.SpectrumAdapter
-import inr.numass.models.BetaSpectrum
-import inr.numass.models.ModularSpectrum
-import inr.numass.models.NBkgSpectrum
-import inr.numass.models.ResolutionFunction
-import org.apache.commons.math3.analysis.BivariateFunction
-
-import static inr.numass.utils.OldDataReader.readData
-
-PrintWriter out = Global.out();
-Locale.setDefault(Locale.US);
-
-new MINUITPlugin().startGlobal();
-
-FitManager fm = new FitManager();
-
-//        setSeed(543982);
-File fssfile = new File("c:\\Users\\Darksnake\\Dropbox\\PlayGround\\FS.txt");
-
-BivariateFunction resolution = new ResolutionFunction(2.28e-4);
-//resolution.setTailFunction(ResolutionFunction.getRealTail())
-
-ModularSpectrum sp = new ModularSpectrum(new BetaSpectrum(fssfile), resolution, 18395d, 18580d);
-sp.setCaching(false);
-//RangedNamedSetSpectrum beta = new BetaSpectrum(fssfile);
-//ModularSpectrum sp = new ModularSpectrum(beta, 2.28e-4, 18395d, 18580d);
-
-//        ModularTritiumSpectrum beta = new ModularTritiumSpectrum(2.28e-4, 18395d, 18580d, "d:\\PlayGround\\FS.txt");
-NBkgSpectrum spectrum = new NBkgSpectrum(sp);
-XYModel model = new XYModel("tritium", spectrum, new SpectrumAdapter());
-
-ParamSet allPars = new ParamSet();
-
-allPars.setParValue("N", 602533.94);
-//значение 6е-6 соответствует полной интенстивности 6е7 распадов в секунду
-//Проблема была в переполнении счетчика событий в генераторе. Заменил на long. Возможно стоит поставить туда число с плавающей точкой
-allPars.setParError("N", 1000);
-allPars.setParDomain("N", 0d, Double.POSITIVE_INFINITY);
-allPars.setParValue("bkg", 0.012497889);
-allPars.setParError("bkg", 1e-4);
-allPars.setParValue("E0", 18575.986);
-allPars.setParError("E0", 0.05);
-allPars.setParValue("mnu2", 0d);
-allPars.setParError("mnu2", 1d);
-allPars.setParValue("msterile2", 50 * 50);
-allPars.setParValue("U2", 0);
-allPars.setParError("U2", 1e-2);
-allPars.setParDomain("U2", -1d, 1d);
-allPars.setParValue("X", 0.47);
-allPars.setParError("X", 0.014);
-allPars.setParDomain("X", 0d, Double.POSITIVE_INFINITY);
-allPars.setParValue("trap", 1d);
-allPars.setParError("trap", 0.2d);
-allPars.setParDomain("trap", 0d, Double.POSITIVE_INFINITY);
-
-ListTable data = readData("c:\\Users\\Darksnake\\Dropbox\\PlayGround\\RUN23.DAT", 18400d);
-
-FitState state = new FitState(data, model, allPars);
-
-FitState res = fm.runDefaultStage(state, "E0", "N", "bkg");
-
-res = fm.runDefaultStage(res, "E0", "N", "bkg", "mnu2");
-
-res.print(out);
-
-//spectrum.counter.print(onComplete);
-//
-////        fm.setPriorProb(new Gaussian("X", 0.47, 0.47*0.03));
-////        fm.setPriorProb(new MultivariateGaussianPrior(allPars.getSubSet("X","trap")));
-//res = fm.runStage(res, "MINUIT", "run", "E0", "N", "bkg", "mnu2");
-////
-//res.print(onComplete);
-
-//sp.setCaching(true);
-//sp.setSuppressWarnings(true);
-//
-//BayesianConfidenceLimit bm = new BayesianConfidenceLimit();
-//bm.printMarginalLikelihood(onComplete, "U2", res, ["E0", "N", "bkg", "U2", "X"], 10000);
-
-//        PrintNamed.printLike2D(Out.onComplete, "like", res, "N", "E0", 30, 60, 2);
diff --git a/numass-main/src/main/groovy/inr/numass/scripts/PrintLossFunctions.groovy b/numass-main/src/main/groovy/inr/numass/scripts/PrintLossFunctions.groovy
index d91c4460..e69de29b 100644
--- a/numass-main/src/main/groovy/inr/numass/scripts/PrintLossFunctions.groovy
+++ b/numass-main/src/main/groovy/inr/numass/scripts/PrintLossFunctions.groovy
@@ -1,61 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package inr.numass.scripts
-
-import inr.numass.models.misc.LossCalculator
-
-
-LossCalculator loss = LossCalculator.INSTANCE
-
-def X = 0.36
-
-def lossProbs = loss.getGunLossProbabilities(X);
-
-printf("%8s\t%8s\t%8s\t%8s\t%n",
-        "eps",
-        "p1",
-        "p2",
-        "p3"
-)
-
-/*
-'exPos'	= 12.587 ± 0.049
-'ionPos'	= 11.11 ± 0.50
-'exW'	= 1.20 ± 0.12
-'ionW'	= 11.02 ± 0.68
-'exIonRatio'	= 2.43 ± 0.42
- */
-
-def singleScatter = loss.getSingleScatterFunction(
-        12.860,
-        16.62,
-        1.71,
-        12.09,
-        4.59
-);
-
-for (double d = 0; d < 30; d += 0.3) {
-    double ei = 18500;
-    double ef = ei - d;
-    printf("%8f\t%8f\t%8f\t%8f\t%n",
-            d,
-            lossProbs[1] * singleScatter.value(ei - ef),
-            lossProbs[2] * loss.getLossValue(2, ei, ef),
-            lossProbs[3] * loss.getLossValue(3, ei, ef)
-    )
-}
-
-for (double d = 30; d < 100; d += 1) {
-    double ei = 18500;
-    double ef = ei - d;
-    printf("%8f\t%8f\t%8f\t%8f\t%n",
-            d,
-            lossProbs[1] * singleScatter.value(ei - ef),
-            lossProbs[2] * loss.getLossValue(2, ei, ef),
-            lossProbs[3] * loss.getLossValue(3, ei, ef)
-    )
-}
diff --git a/numass-main/src/main/groovy/inr/numass/scripts/ReadTextFile.groovy b/numass-main/src/main/groovy/inr/numass/scripts/ReadTextFile.groovy
index eefff99e..e69de29b 100644
--- a/numass-main/src/main/groovy/inr/numass/scripts/ReadTextFile.groovy
+++ b/numass-main/src/main/groovy/inr/numass/scripts/ReadTextFile.groovy
@@ -1,15 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package inr.numass.scripts
-
-import hep.dataforge.io.ColumnedDataReader
-import hep.dataforge.io.ColumnedDataWriter
-import hep.dataforge.tables.Table
-
-File file = new File("D:\\Work\\Numass\\sterile2016\\empty.dat" )
-Table referenceTable = new ColumnedDataReader(file).toTable();
-ColumnedDataWriter.writeTable(System.out, referenceTable,"")
\ No newline at end of file
diff --git a/numass-main/src/main/groovy/inr/numass/scripts/ShowSpectrum.groovy b/numass-main/src/main/groovy/inr/numass/scripts/ShowSpectrum.groovy
index d9dcbf64..e69de29b 100644
--- a/numass-main/src/main/groovy/inr/numass/scripts/ShowSpectrum.groovy
+++ b/numass-main/src/main/groovy/inr/numass/scripts/ShowSpectrum.groovy
@@ -1,65 +0,0 @@
-package inr.numass.scripts
-
-import hep.dataforge.context.Global
-import hep.dataforge.grind.Grind
-import hep.dataforge.meta.Meta
-import hep.dataforge.stat.fit.FitManager
-import hep.dataforge.stat.fit.ParamSet
-import hep.dataforge.stat.models.XYModel
-import inr.numass.NumassPlugin
-
-/**
- * Created by darksnake on 14-Dec-16.
- */
-
-
-Locale.setDefault(Locale.US);
-new NumassPlugin().startGlobal();
-
-
-def fm = Global.instance().provide("fitting", FitManager.class).getFitManager();
-def mm = fm.modelManager
-
-
-Meta modelMeta = Grind.buildMeta(modelName: "sterile") {
-    resolution(width: 8.3e-5, tailAlpha: 3e-3)
-    transmission(trapping: "function::numass.trap.nominal") // numass.trap.nominal = 1.2e-4 - 4.5e-9 * Ei
-}
-
-/*
-
- 'N'	= 2.76515e+06 ± 2.4e+03	(0.00000,Infinity)
- 'bkg'	= 41.195 ± 0.053
- 'E0'	= 18576.35 ± 0.32
- 'mnu2'	= 0.00 ± 0.010
- 'msterile2'	= 1000000.00 ± 1.0
- 'U2'	= 0.00314 ± 0.0010
- 'X'	= 0.12000 ± 0.010	(0.00000,Infinity)
- 'trap'	= 1.089 ± 0.026
- */
-
-Meta paramMeta = Grind.buildMeta("params") {
-    N(value: 2.76515e+06, err: 30, lower: 0)
-    bkg(value: 41.195, err: 0.1)
-    E0(value: 18576.35, err: 0.1)
-    mnu2(value: 0, err: 0.01)
-    msterile2(value: 1000**2, err: 1)
-    U2(value: 0.00314, err: 1e-3)
-    X(value: 0.12000, err: 0.01, lower: 0)
-    trap(value: 1.089, err: 0.05)
-}
-
-XYModel model = mm.getModel(modelMeta)
-
-ParamSet allPars = ParamSet.fromMeta(paramMeta);
-
-def a = 16000;
-def b = 18600;
-def step = 50;
-
-
-for (double x = a; x < b; x += step) {
-    println "${x}\t${model.value(x, allPars)}"
-}
-
-Global.terminate()
\ No newline at end of file
diff --git a/numass-main/src/main/groovy/inr/numass/scripts/SignificanceTest.groovy b/numass-main/src/main/groovy/inr/numass/scripts/SignificanceTest.groovy
index eba201e8..e69de29b 100644
--- a/numass-main/src/main/groovy/inr/numass/scripts/SignificanceTest.groovy
+++ b/numass-main/src/main/groovy/inr/numass/scripts/SignificanceTest.groovy
@@ -1,110 +0,0 @@
-/* 
- * Copyright 2015 Alexander Nozik.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package inr.numass.scripts
-
-import hep.dataforge.context.Global
-import hep.dataforge.meta.MetaBuilder
-import hep.dataforge.stat.fit.ParamSet
-import inr.numass.data.SpectrumInformation
-import inr.numass.models.BetaSpectrum
-import inr.numass.models.ModularSpectrum
-import inr.numass.models.NBkgSpectrum
-import inr.numass.models.ResolutionFunction
-import org.apache.commons.math3.analysis.UnivariateFunction
-
-import static java.util.Locale.setDefault
-
-setDefault(Locale.US);
-Global global = Global.instance();
-//        global.loadModule(new MINUIT());
-
-//        FitManager fm = new FitManager("data 2013");
-UnivariateFunction reolutionTail = {x -> 
-    if (x > 1500) {
-        return 0.98;
-    } else //Intercept = 1.00051, Slope = -1.3552E-5
-    {
-        return 1.00051 - 1.3552E-5 * x;
-    }
-};
-
-ModularSpectrum beta = new ModularSpectrum(new BetaSpectrum(),
-    new ResolutionFunction(8.3e-5, reolutionTail), 14490d, 19001d);
-beta.setCaching(false);
-NBkgSpectrum spectrum = new NBkgSpectrum(beta);
-
-//        XYModel model = new XYModel("tritium", spectrum);
-ParamSet allPars = new ParamSet();
-
-allPars.setParValue("N", 3090.1458);
-//значение 6е-6 соответствует полной интенстивности 6е7 распадов в секунду
-//Проблема была в переполнении счетчика событий в генераторе. Заменил на long. Возможно стоит поставить туда число с плавающей точкой
-allPars.setParError("N", 6);
-allPars.setParDomain("N", 0d, Double.POSITIVE_INFINITY);
-allPars.setParValue("bkg", 2.2110028);
-allPars.setParError("bkg", 0.03);
-allPars.setParValue("E0", 18580.742);
-allPars.setParError("E0", 2);
-allPars.setParValue("mnu2", 0d);
-allPars.setParError("mnu2", 1d);
-allPars.setParValue("msterile2", 1000 * 1000);
-allPars.setParValue("U2", 0);
-allPars.setParError("U2", 1e-4);
-allPars.setParDomain("U2", -1d, 1d);
-allPars.setParValue("X", 1.0);
-allPars.setParError("X", 0.01);
-allPars.setParDomain("X", 0d, Double.POSITIVE_INFINITY);
-allPars.setParValue("trap", 1.0d);
-allPars.setParError("trap", 0.01d);
-allPars.setParDomain("trap", 0d, Double.POSITIVE_INFINITY);
-
-SpectrumInformation sign = new SpectrumInformation(spectrum);
-
-//        double Elow = 14000d;
-//        double Eup = 18600d;
-//        int numpoints = (int) ((Eup - Elow) / 50);
-//        double time = 1e6 / numpoints;
-//        DataSet config = getUniformSpectrumConfiguration(Elow, Eup, time, numpoints);
-//        NamedMatrix infoMatrix = sign.getInformationMatrix(allPars, config,"U2","E0","N");
-//
-//        PrintNamed.printNamedMatrix(Out.out, infoMatrix);
-//        NamedMatrix cov = sign.getExpetedCovariance(allPars, config,"U2","E0","N");
-//
-//        PrintWriter onComplete = Global.onComplete();
-//
-//        printNamedMatrix(out, cov);
-//
-//        cov = sign.getExpetedCovariance(allPars, config,"U2","E0","N","X");
-//
-//        printNamedMatrix(out, cov);
-//PlotPlugin pm = new PlotPlugin();
-
-Map functions = new HashMap<>();
-
-functions.put("U2", sign.getSignificanceFunction(allPars, "U2", "U2"));
-//        functions.put("UX", sign.getSignificanceFunction(allPars, "U2", "X"));
-functions.put("X", sign.getSignificanceFunction(allPars, "X", "X"));
-functions.put("trap", sign.getSignificanceFunction(allPars, "trap", "trap"));
-functions.put("E0", sign.getSignificanceFunction(allPars, "E0", "E0"));
-
-MetaBuilder builder = new MetaBuilder("significance");
-builder.putValue("from", 14000d);
-builder.putValue("to", 18500d);
-
-pm.plotFunction(builder.build(), functions);
-
-//        printFuntionSimple(out(), func, 14000d, 18600d, 200);
-
diff --git a/numass-main/src/main/groovy/inr/numass/scripts/Simulate.groovy b/numass-main/src/main/groovy/inr/numass/scripts/Simulate.groovy
index 1e29b6d6..e69de29b 100644
--- a/numass-main/src/main/groovy/inr/numass/scripts/Simulate.groovy
+++ b/numass-main/src/main/groovy/inr/numass/scripts/Simulate.groovy
@@ -1,102 +0,0 @@
-/* 
- * Copyright 2015 Alexander Nozik.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package inr.numass.scripts
-
-import hep.dataforge.context.Global
-import hep.dataforge.io.ColumnedDataWriter
-import hep.dataforge.meta.Meta
-import hep.dataforge.stat.fit.FitHelper
-import hep.dataforge.stat.fit.FitResult
-import hep.dataforge.stat.fit.FitStage
-import hep.dataforge.stat.fit.ParamSet
-import hep.dataforge.stat.models.XYModel
-import inr.numass.NumassPlugin
-import inr.numass.data.SpectrumAdapter
-import inr.numass.data.SpectrumGenerator
-import inr.numass.models.NBkgSpectrum
-import inr.numass.models.sterile.SterileNeutrinoSpectrum
-import inr.numass.utils.DataModelUtils
-
-import static java.util.Locale.setDefault
-
-/**
- *
- * @author Darksnake
- */
-
-setDefault(Locale.US);
-new NumassPlugin().startGlobal()
-
-SterileNeutrinoSpectrum sp = new SterileNeutrinoSpectrum(Global.INSTANCE, Meta.empty());
-//beta.setCaching(false);
-
-NBkgSpectrum spectrum = new NBkgSpectrum(sp);
-XYModel model = new XYModel(Meta.empty(), new SpectrumAdapter(Meta.empty()), spectrum);
-
-ParamSet allPars = new ParamSet();
-
-allPars.setParValue("N", 2e6 / 100);
-//значение 6е-6 соответствует полной интенстивности 6е7 распадов в секунду
-//Проблема была в переполнении счетчика событий в генераторе. Заменил на long. Возможно стоит поставить туда число с плавающей точкой
-allPars.setParError("N", 6);
-allPars.setParDomain("N", 0d, Double.POSITIVE_INFINITY);
-allPars.setParValue("bkg", 2d);
-allPars.setParError("bkg", 0.03);
-allPars.setParValue("E0", 18575.0);
-allPars.setParError("E0", 2);
-allPars.setParValue("mnu2", 0d);
-allPars.setParError("mnu2", 1d);
-allPars.setParValue("msterile2", 8000 * 8000);
-allPars.setParValue("U2", 0);
-allPars.setParError("U2", 1e-4);
-allPars.setParDomain("U2", -1d, 1d);
-allPars.setParValue("X", 0);
-allPars.setParError("X", 0.01);
-allPars.setParDomain("X", 0d, Double.POSITIVE_INFINITY);
-allPars.setParValue("trap", 0d);
-allPars.setParError("trap", 0.01d);
-allPars.setParDomain("trap", 0d, Double.POSITIVE_INFINITY);
-
-//        PrintNamed.printSpectrum(Global.onComplete(), spectrum, allPars, 0.0, 18700.0, 600);
-//String fileName = "d:\\PlayGround\\merge\\scans.onComplete";
-//        String configName = "d:\\PlayGround\\SCAN.CFG";
-//        ListTable config = OldDataReader.readConfig(configName);
-SpectrumGenerator generator = new SpectrumGenerator(model, allPars, 12316);
-
-def data = generator.generateData(DataModelUtils.getUniformSpectrumConfiguration(12000, 18500, 604800 / 100 * 100, 130));
-
-//data = TritiumUtils.correctForDeadTime(data, new SpectrumAdapter(), 10e-9);
-//        data = data.filter("X", Value.of(15510.0), Value.of(18610.0));
-//        allPars.setParValue("X", 0.4);
-
-
-ColumnedDataWriter.writeTable(System.out, data, "--- DATA ---");
-//FitState state = new FitState(data, model, allPars);
-////new PlotFitResultAction().eval(state);
-//
-//
-//def res = fm.runStage(state, "QOW", FitStage.TASK_RUN, "N", "bkg", "E0", "U2");
-
-FitResult res = new FitHelper(Global.INSTANCE).fit(data)
-        .model(model)
-        .params(allPars)
-        .stage("QOW", FitStage.TASK_RUN, "N", "E0")
-        .run();
-//
-//
-//
-res.printState(new PrintWriter(System.out));
-
diff --git a/numass-main/src/main/groovy/inr/numass/scripts/SimulateGun.groovy b/numass-main/src/main/groovy/inr/numass/scripts/SimulateGun.groovy
index 8071bfe0..e69de29b 100644
--- a/numass-main/src/main/groovy/inr/numass/scripts/SimulateGun.groovy
+++ b/numass-main/src/main/groovy/inr/numass/scripts/SimulateGun.groovy
@@ -1,67 +0,0 @@
-/* 
- * Copyright 2015 Alexander Nozik.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package inr.numass.scripts
-
-import hep.dataforge.context.Global
-import hep.dataforge.io.FittingIOUtils
-import hep.dataforge.stat.fit.FitManager
-import hep.dataforge.stat.fit.ParamSet
-import hep.dataforge.stat.models.XYModel
-import inr.numass.data.SpectrumAdapter
-import inr.numass.models.GunSpectrum
-import inr.numass.models.NBkgSpectrum
-
-import static java.util.Locale.setDefault
-
-setDefault(Locale.US);
-Global global = Global.instance();
-//        global.loadModule(new MINUITModule());
-
-FitManager fm = new FitManager();
-
-GunSpectrum gsp = new GunSpectrum();
-NBkgSpectrum spectrum = new NBkgSpectrum(gsp);
-
-XYModel model = new XYModel("gun", spectrum, new SpectrumAdapter());
-
-ParamSet allPars = new ParamSet()
-.setPar("N", 1e3, 1e2)
-.setPar("pos", 18500, 0.1)
-.setPar("bkg", 50, 1)
-.setPar("resA", 5.3e-5, 1e-5)
-.setPar("sigma", 0.3, 0.03);
-
-PrintNamed.printSpectrum(new PrintWriter(System.out), spectrum, allPars, 18495, 18505, 100);
-
-allPars.setParValue("sigma", 0.6);
-
-FittingIOUtils.printSpectrum(new PrintWriter(System.out), spectrum, allPars, 18495, 18505, 100);
-
-//        //String fileName = "d:\\PlayGround\\merge\\scans.onComplete";
-////        String configName = "d:\\PlayGround\\SCAN.CFG";
-////        ListTable config = OldDataReader.readConfig(configName);
-//        SpectrumGenerator generator = new SpectrumGenerator(model, allPars, 12316);
-//
-//        ListTable data = generator.generateData(DataModelUtils.getUniformSpectrumConfiguration(18495, 18505, 20, 20));
-//
-////        data = data.filter("X", Value.of(15510.0), Value.of(18610.0));
-////        allPars.setParValue("X", 0.4);
-//        FitState state = FitTaskManager.buildState(data, model, allPars);
-//
-//        FitState res = fm.runStage(state, "QOW", FitTask.TASK_RUN, "N", "bkg", "pos", "sigma");
-//
-//        res.print(onComplete());
-
diff --git a/numass-main/src/main/groovy/inr/numass/scripts/SimulatePileup.groovy b/numass-main/src/main/groovy/inr/numass/scripts/SimulatePileup.groovy
index b8efe3c5..e69de29b 100644
--- a/numass-main/src/main/groovy/inr/numass/scripts/SimulatePileup.groovy
+++ b/numass-main/src/main/groovy/inr/numass/scripts/SimulatePileup.groovy
@@ -1,157 +0,0 @@
-///*
-// * To change this license header, choose License Headers in Project Properties.
-// * To change this template file, choose Tools | Templates
-// * and open the template in the editor.
-// */
-//
-//package inr.numass.scripts
-//
-//import hep.dataforge.grind.Grind
-//import hep.dataforge.values.Values
-//import inr.numass.NumassUtils
-//import inr.numass.data.api.NumassPoint
-//import inr.numass.data.storage.NumassDataLoader
-//
-//import inr.numass.data.PileUpSimulator
-//import inr.numass.utils.UnderflowCorrection
-//import org.apache.commons.math3.random.JDKRandomGenerator
-//
-//rnd = new JDKRandomGenerator();
-//
-//////Loading data
-//File dataDir = new File("D:\\Work\\Numass\\data\\2016_10\\Fill_1\\set_28")
-////File dataDir = new File("D:\\Work\\Numass\\data\\2016_10\\Fill_2_wide\\set_7")
-//if (!dataDir.exists()) {
-//    println "dataDir directory does not exist"
-//}
-//def data = NumassDataLoader.fromLocalDir(null, dataDir).getNMPoints()
-//
-////File rootDir = new File("D:\\Work\\Numass\\data\\2016_10\\Fill_1")
-//////File rootDir = new File("D:\\Work\\Numass\\data\\2016_10\\Fill_2_wide")
-//////File rootDir = new File("D:\\Work\\Numass\\data\\2017_01\\Fill_2_wide")
-////
-////NumassStorage storage = NumassStorage.buildLocalNumassRoot(rootDir, true);
-////
-////Collection data = NumassDataUtils.joinSpectra(
-////        StorageUtils.loaderStream(storage)
-////                .filter { it.key.matches("set_3.") }
-////                .map {
-////            println "loading ${it.key}"
-////            it.value
-////        }
-////)
-//
-////Simulation process
-//Map> res = [:]
-//
-//List generated = new ArrayList<>();
-//List registered = new ArrayList<>();
-//List firstIteration = new ArrayList<>();
-//List secondIteration = new ArrayList<>();
-//List pileup = new ArrayList<>();
-//
-//lowerChannel = 400;
-//upperChannel = 1800;
-//
-//PileUpSimulator buildSimulator(NumassPoint point, double cr, NumassPoint reference = null, boolean extrapolate = true, double scale = 1d) {
-//    def cfg = Grind.buildMeta(cr: cr) {
-//        pulser(mean: 3450, sigma: 86.45, freq: 66.43)
-//    }
-//    //NMEventGeneratorWithPulser generator = new NMEventGeneratorWithPulser(rnd, cfg)
-//
-//    def generator = b
-//
-//    if (extrapolate) {
-//        double[] chanels = new double[RawNMPoint.MAX_CHANEL];
-//        double[] values = new double[RawNMPoint.MAX_CHANEL];
-//        Values fitResult = new UnderflowCorrection().fitPoint(point, 400, 600, 1800, 20);
-//
-//        def amp = fitResult.getDouble("amp")
-//        def sigma = fitResult.getDouble("expConst")
-//        if (sigma > 0) {
-//
-//        for (int i = 0; i < upperChannel; i++) {
-//            chanels[i] = i;
-//            if (i < lowerChannel) {
-//                values[i] = point.getLength()*amp * Math.exp((i as double) / sigma)
-//            } else {
-//                values[i] = Math.max(0, point.getCount(i) - (reference == null ? 0 : reference.getCount(i)) as int);
-//            }
-//        }
-//        generator.loadSpectrum(chanels, values)
-//        } else {
-//            generator.loadSpectrum(point, reference, lowerChannel, upperChannel);
-//        }
-//    } else {
-//        generator.loadSpectrum(point, reference, lowerChannel, upperChannel);
-//    }
-//
-//    return new PileUpSimulator(point.length * scale, rnd, generator).withUset(point.voltage).generate();
-//}
-//
-//double adjustCountRate(PileUpSimulator simulator, NumassPoint point) {
-//    double generatedInChannel = simulator.generated().getCountInWindow(lowerChannel, upperChannel);
-//    double registeredInChannel = simulator.registered().getCountInWindow(lowerChannel, upperChannel);
-//    return (generatedInChannel / registeredInChannel) * (point.getCountInWindow(lowerChannel, upperChannel) / point.getLength());
-//}
-//
-//data.forEach { point ->
-//    double cr = NumassUtils.countRateWithDeadTime(point, lowerChannel, upperChannel, 6.55e-6);
-//
-//    PileUpSimulator simulator = buildSimulator(point, cr);
-//
-//    //second iteration to exclude pileup overlap
-//    NumassPoint pileupPoint = simulator.pileup();
-//    firstIteration.add(simulator.registered());
-//
-//    //updating count rate
-//    cr = adjustCountRate(simulator, point);
-//    simulator = buildSimulator(point, cr, pileupPoint);
-//
-//    pileupPoint = simulator.pileup();
-//    secondIteration.add(simulator.registered());
-//
-//    cr = adjustCountRate(simulator, point);
-//    simulator = buildSimulator(point, cr, pileupPoint);
-//
-//    generated.add(simulator.generated());
-//    registered.add(simulator.registered());
-//    pileup.add(simulator.pileup());
-//}
-//res.put("original", data);
-//res.put("generated", generated);
-//res.put("registered", registered);
-////    res.put("firstIteration", new SimulatedPoint("firstIteration", firstIteration));
-////    res.put("secondIteration", new SimulatedPoint("secondIteration", secondIteration));
-//res.put("pileup", pileup);
-//
-//def keys = res.keySet();
-//
-////print spectra for selected point
-//double u = 16500d;
-//
-//List points = res.values().collect { it.find { it.voltage == u }.getMap(20, true) }
-//
-//println "\n Spectrum example for U = ${u}\n"
-//
-//print "channel\t"
-//println keys.join("\t")
-//
-//points.first().keySet().each {
-//    print "${it}\t"
-//    println points.collect { map -> map[it] }.join("\t")
-//}
-//
-////printing count rate in window
-//print "U\tLength\t"
-//print keys.collect { it + "[total]" }.join("\t") + "\t"
-//print keys.collect { it + "[pulse]" }.join("\t") + "\t"
-//println keys.join("\t")
-//
-//for (int i = 0; i < data.size(); i++) {
-//    print "${data.get(i).getVoltage()}\t"
-//    print "${data.get(i).getLength()}\t"
-//    print keys.collect { res[it].get(i).getTotalCount() }.join("\t") + "\t"
-//    print keys.collect { res[it].get(i).getCountInWindow(3100, 3800) }.join("\t") + "\t"
-//    println keys.collect { res[it].get(i).getCountInWindow(400, 3100) }.join("\t")
-//}
diff --git a/numass-main/src/main/groovy/inr/numass/scripts/SterileDemo.groovy b/numass-main/src/main/groovy/inr/numass/scripts/SterileDemo.groovy
index abb51b17..e69de29b 100644
--- a/numass-main/src/main/groovy/inr/numass/scripts/SterileDemo.groovy
+++ b/numass-main/src/main/groovy/inr/numass/scripts/SterileDemo.groovy
@@ -1,81 +0,0 @@
-/* 
- * Copyright 2015 Alexander Nozik.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package inr.numass.scripts
-
-import hep.dataforge.context.Global
-import hep.dataforge.grind.GrindMetaBuilder
-import hep.dataforge.io.FittingIOUtils
-import hep.dataforge.meta.Meta
-import hep.dataforge.stat.fit.ParamSet
-import hep.dataforge.stat.models.XYModel
-import hep.dataforge.stat.parametric.ParametricFunction
-import inr.numass.data.SpectrumAdapter
-import inr.numass.models.NBkgSpectrum
-import inr.numass.models.sterile.SterileNeutrinoSpectrum
-
-import static java.util.Locale.setDefault
-
-/**
- *
- * @author Darksnake
- */
-
-setDefault(Locale.US);
-
-//ParametricFunction beta = new BetaSpectrum();
-
-//ModularSpectrum beta = new ModularSpectrum(new BetaSpectrum(), 8.3e-5, 13990d, 18600d);
-//beta.setCaching(false)
-
-Meta cfg = new GrindMetaBuilder().meta() {
-    resolution(width: 8.3e-5)
-}.build();
-
-ParametricFunction beta = new SterileNeutrinoSpectrum(Global.instance(), cfg);
-
-NBkgSpectrum spectrum = new NBkgSpectrum(beta);
-XYModel model = new XYModel(spectrum, new SpectrumAdapter());
-
-ParamSet allPars = new ParamSet();
-
-allPars.setPar("N", 6.6579e+05, 1.8e+03, 0d, Double.POSITIVE_INFINITY);
-allPars.setPar("bkg", 0.5387, 0.050);
-allPars.setPar("E0", 18574.94, 1.4);
-allPars.setPar("mnu2", 0d, 1d);
-allPars.setPar("msterile2", 1000d * 1000d, 0);
-allPars.setPar("U2", 0.0, 1e-4, -1d, 1d);
-allPars.setPar("X", 0.04, 0.01, 0d, Double.POSITIVE_INFINITY);
-allPars.setPar("trap", 1.634, 0.01, 0d, Double.POSITIVE_INFINITY);
-
-FittingIOUtils.printSpectrum(Global.out(), spectrum, allPars, 14000, 18600.0, 400);
-
-//SpectrumGenerator generator = new SpectrumGenerator(model, allPars, 12316);
-//
-//ListTable data = generator.generateData(DataModelUtils.getUniformSpectrumConfiguration(14000d, 18500, 2000, 90));
-//
-//data = NumassUtils.correctForDeadTime(data, new SpectrumAdapter(), 1e-8);
-////        data = data.filter("X", Value.of(15510.0), Value.of(18610.0));
-////        allPars.setParValue("X", 0.4);
-//FitState state = new FitState(data, model, allPars);
-////new PlotFitResultAction().eval(state);
-//        
-//        
-//FitState res = fm.runStage(state, "QOW", FitTask.TASK_RUN, "N", "bkg", "E0", "U2", "trap");
-//
-//        
-//
-//res.print(onComplete());
-//
diff --git a/numass-main/src/main/groovy/inr/numass/scripts/SystTransmission.groovy b/numass-main/src/main/groovy/inr/numass/scripts/SystTransmission.groovy
index d3917e96..e69de29b 100644
--- a/numass-main/src/main/groovy/inr/numass/scripts/SystTransmission.groovy
+++ b/numass-main/src/main/groovy/inr/numass/scripts/SystTransmission.groovy
@@ -1,101 +0,0 @@
-/* 
- * Copyright 2015 Alexander Nozik.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package inr.numass.scripts
-
-import hep.dataforge.stat.fit.FitManager
-import hep.dataforge.stat.fit.FitState
-import hep.dataforge.stat.fit.MINUITPlugin
-import hep.dataforge.stat.fit.ParamSet
-import hep.dataforge.stat.models.XYModel
-import hep.dataforge.tables.ListTable
-import inr.numass.data.SpectrumAdapter
-import inr.numass.data.SpectrumGenerator
-import inr.numass.models.BetaSpectrum
-import inr.numass.models.ModularSpectrum
-import inr.numass.models.NBkgSpectrum
-import inr.numass.models.ResolutionFunction
-import inr.numass.utils.DataModelUtils
-
-import static java.util.Locale.setDefault
-
-/**
- *
- * @author Darksnake
- */
-
-setDefault(Locale.US);
-new MINUITPlugin().startGlobal();
-
-FitManager fm = new FitManager();
-
-ResolutionFunction resolution = new ResolutionFunction(8.3e-5);
-//resolution.setTailFunction(ResolutionFunction.getRealTail());
-resolution.setTailFunction(ResolutionFunction.getAngledTail(0.00325));
-ModularSpectrum beta = new ModularSpectrum(new BetaSpectrum(), resolution, 18395d, 18580d);
-beta.setCaching(false);
-
-NBkgSpectrum spectrum = new NBkgSpectrum(beta);
-XYModel model = new XYModel("tritium", spectrum, new SpectrumAdapter());
-
-ParamSet allPars = new ParamSet();
-
-
-allPars.setPar("N", 6e9, 1e5, 0, Double.POSITIVE_INFINITY);
-
-allPars.setPar("bkg", 0.002, 0.005 );
-
-allPars.setPar("E0", 18575.0, 0.1 );
-
-allPars.setPar("mnu2", 0, 2);
-
-def mster = 3000;// Mass of sterile neutrino in eV
-
-allPars.setPar("msterile2", mster**2, 1);
-
-allPars.setPar("U2", 0, 1e-4);
-
-allPars.setPar("X", 0, 0.05, 0d, Double.POSITIVE_INFINITY);
-
-allPars.setPar("trap", 1, 0.01, 0d, Double.POSITIVE_INFINITY);
-
-int seed = 12316
-SpectrumGenerator generator = new SpectrumGenerator(model, allPars, seed);
-
-def config = DataModelUtils.getUniformSpectrumConfiguration(18530d, 18580, 1e7, 60)
-//def config = DataModelUtils.getSpectrumConfigurationFromResource("/data/run23.cfg")
-
-ListTable data = generator.generateExactData(config);
-
-FitState state = new FitState(data, model, allPars);
-
-println("Simulating data with real tail")
-
-println("Fitting data with real parameters")
-
-FitState res = fm.runTask(state, "QOW", FitTask.TASK_RUN, "N", "bkg", "E0", "mnu2");
-res.print(out());
-
-def mnu2 = res.getParameters().getValue("mnu2");
-
-println("Setting constant tail and fitting")
-resolution.setTailFunction(ResolutionFunction.getConstantTail());
-
-res = fm.runTask(state, "QOW", FitTask.TASK_RUN, "N", "bkg","E0","mnu2");
-res.print(out());
-
-def diff = res.getParameters().getValue("mnu2") - mnu2;
-
-println("\n\nSquared mass difference: ${diff}")
\ No newline at end of file
diff --git a/numass-main/src/main/groovy/inr/numass/scripts/Systematics.groovy b/numass-main/src/main/groovy/inr/numass/scripts/Systematics.groovy
index 47ceec13..e69de29b 100644
--- a/numass-main/src/main/groovy/inr/numass/scripts/Systematics.groovy
+++ b/numass-main/src/main/groovy/inr/numass/scripts/Systematics.groovy
@@ -1,99 +0,0 @@
-/* 
- * Copyright 2015 Alexander Nozik.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package inr.numass.scripts
-
-import hep.dataforge.context.Global
-import hep.dataforge.io.FittingIOUtils
-import hep.dataforge.meta.Meta
-import hep.dataforge.stat.fit.*
-import hep.dataforge.stat.models.XYModel
-import inr.numass.data.SpectrumAdapter
-import inr.numass.data.SpectrumGenerator
-import inr.numass.models.BetaSpectrum
-import inr.numass.models.ModularSpectrum
-import inr.numass.models.NBkgSpectrum
-import inr.numass.models.ResolutionFunction
-import inr.numass.utils.DataModelUtils
-import org.apache.commons.math3.analysis.BivariateFunction
-
-import static java.util.Locale.setDefault
-
-/**
- *
- * @author Darksnake
- */
-
-setDefault(Locale.US);
-new MINUITPlugin().startGlobal();
-
-FitManager fm = Global.INSTANCE.get(FitManager)
-
-
-BivariateFunction resolution = new ResolutionFunction(8.3e-5);
-
-ModularSpectrum beta = new ModularSpectrum(new BetaSpectrum(), resolution, 13490d, 18575d);
-beta.setCaching(false);
-
-NBkgSpectrum spectrum = new NBkgSpectrum(beta);
-XYModel model = new XYModel(Meta.empty(), new SpectrumAdapter(Meta.empty()), spectrum);
-
-ParamSet allPars = new ParamSet();
-
-
-allPars.setPar("N", 6e5, 10, 0, Double.POSITIVE_INFINITY);
-
-allPars.setPar("bkg", 2d, 0.1);
-
-allPars.setPar("E0", 18575.0, 0.05);
-
-allPars.setPar("mnu2", 0, 1);
-
-def mster = 3000;// Mass of sterile neutrino in eV
-
-allPars.setPar("msterile2", mster**2, 1);
-
-allPars.setPar("U2", 0, 1e-4);
-
-allPars.setPar("X", 0, 0.05, 0d, Double.POSITIVE_INFINITY);
-
-allPars.setPar("trap", 0, 0.01, 0d, Double.POSITIVE_INFINITY);
-
-SpectrumGenerator generator = new SpectrumGenerator(model, allPars, 12316);
-
-def data = generator.generateData(DataModelUtils.getUniformSpectrumConfiguration(14000d, 18200, 1e6, 60));
-
-//        data = data.filter("X", Value.of(15510.0), Value.of(18610.0));
-allPars.setParValue("U2", 0);
-FitState state = new FitState(data, model, allPars);
-//new PlotFitResultAction(Global.instance(), null).runOne(state);
-
-//double delta = 4e-6;
-
-//resolution.setTailFunction{double E, double U -> 
-//    1-delta*(E-U);
-//}
-
-//resolution.setTailFunction(ResolutionFunction.getRealTail())
-
-//PlotFrame frame = JFreeChartFrame.drawFrame("Transmission function", null);
-//frame.add(new PlottableFunction("transmission",null, {U -> resolution.value(18500,U)},13500,18505,500));
-
-def res = fm.runStage(state, "QOW", FitStage.TASK_RUN, "N", "bkg", "E0", "U2", "trap");
-
-
-res.printState(new PrintWriter(System.out))
-
-FittingIOUtils.printResiduals(new PrintWriter(System.out), res.optState().get())
diff --git a/numass-main/src/main/groovy/inr/numass/scripts/TestExperimentalVariableLossSpectrum.groovy b/numass-main/src/main/groovy/inr/numass/scripts/TestExperimentalVariableLossSpectrum.groovy
index e700b6e5..e69de29b 100644
--- a/numass-main/src/main/groovy/inr/numass/scripts/TestExperimentalVariableLossSpectrum.groovy
+++ b/numass-main/src/main/groovy/inr/numass/scripts/TestExperimentalVariableLossSpectrum.groovy
@@ -1,68 +0,0 @@
-/* 
- * Copyright 2015 Alexander Nozik.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package inr.numass.scripts
-
-import hep.dataforge.io.PrintFunction
-import hep.dataforge.maths.integration.UnivariateIntegrator
-import hep.dataforge.plots.data.XYFunctionPlot
-import hep.dataforge.plots.jfreechart.JFreeChartFrame
-import hep.dataforge.stat.fit.ParamSet
-import inr.numass.models.ExperimentalVariableLossSpectrum
-import org.apache.commons.math3.analysis.UnivariateFunction
-
-//double exPos = 12.94
-//double exW = 1.31
-//double ionPos = 14.13
-//double ionW = 12.79
-//double exIonRatio = 0.6059
-
-ParamSet params = new ParamSet()
-.setParValue("shift",0)
-.setParValue("X", 0.4)
-.setParValue("exPos", 12.94)
-.setParValue("ionPos", 15.6)
-.setParValue("exW", 1.31)
-.setParValue("ionW", 12.79)
-.setParValue("exIonRatio", 0.6059)
-
-ExperimentalVariableLossSpectrum lsp = new ExperimentalVariableLossSpectrum(19005, 8e-5, 19010,0.2);
-
-
-JFreeChartFrame frame = JFreeChartFrame.drawFrame("Experimental Loss Test", null);
-UnivariateIntegrator integrator = NumassContext.defaultIntegrator
-
-UnivariateFunction exFunc = lsp.excitation(params.getValue("exPos"), params.getValue("exW"));
-frame.add(XYFunctionPlot.plotFunction("ex", exFunc, 0d, 50d, 500));
-
-println "excitation norm factor " + integrator.integrate(0, 50, exFunc)
-
-UnivariateFunction ionFunc = lsp.ionization(params.getValue("ionPos"), params.getValue("ionW"));
-frame.add(XYFunctionPlot.plotFunction("ion",  ionFunc, 0d, 50d, 500));
-
-println "ionization norm factor " + integrator.integrate(0, 200, ionFunc)
-
-UnivariateFunction sumFunc = lsp.singleScatterFunction(params);
-frame.add(XYFunctionPlot.plotFunction("sum",  sumFunc, 0d, 50d, 500));
-
-println "sum norm factor " + integrator.integrate(0, 100, sumFunc)
-
-PrintFunction.printFunctionSimple(new PrintWriter(System.out), sumFunc, 0d, 50d, 100)
-
-
-JFreeChartFrame integerFrame = JFreeChartFrame.drawFrame("Experimental Loss Test", null);
-
-UnivariateFunction integr = { d-> lsp.value(d,params)}
-integerFrame.add(XYFunctionPlot.plotFunction("integr", integr, 18950d, 19005d, 500));
\ No newline at end of file
diff --git a/numass-main/src/main/groovy/inr/numass/scripts/TheoreticalLossFunction.groovy b/numass-main/src/main/groovy/inr/numass/scripts/TheoreticalLossFunction.groovy
index 2a3ba881..e69de29b 100644
--- a/numass-main/src/main/groovy/inr/numass/scripts/TheoreticalLossFunction.groovy
+++ b/numass-main/src/main/groovy/inr/numass/scripts/TheoreticalLossFunction.groovy
@@ -1,46 +0,0 @@
-/* 
- * Copyright 2015 Alexander Nozik.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package inr.numass.scripts
-
-import hep.dataforge.plots.data.XYFunctionPlot
-import hep.dataforge.plots.jfreechart.JFreeChartFrame
-import org.apache.commons.math3.analysis.UnivariateFunction
-
-
-def lorenz = {x, x0, gama -> 1/(3.14*gama*(1+(x-x0)*(x-x0)/gama/gama))}
-
-    
-def excitationSpectrum = {Map lines, double gama ->
-    UnivariateFunction function = {x->
-        double res = 0;
-        lines.each{k,v -> res += lorenz(x,k,gama)*v};
-        return res;
-    }
-    return function;
-}
-
-def lines =
-[
-    12.6:0.5,
-    12.4:0.3,
-    12.2:0.2
-]
-
-UnivariateFunction excitation = excitationSpectrum(lines,0.08)
-
-JFreeChartFrame frame = JFreeChartFrame.drawFrame("theoretical loss spectrum", null);
-
-frame.add(XYFunctionPlot.plotFunction("excitation", excitation, 0d, 20d, 500));
\ No newline at end of file
diff --git a/numass-main/src/main/groovy/inr/numass/scripts/TritiumTest.groovy b/numass-main/src/main/groovy/inr/numass/scripts/TritiumTest.groovy
index e3283e9e..e69de29b 100644
--- a/numass-main/src/main/groovy/inr/numass/scripts/TritiumTest.groovy
+++ b/numass-main/src/main/groovy/inr/numass/scripts/TritiumTest.groovy
@@ -1,119 +0,0 @@
-/* 
- * Copyright 2015 Alexander Nozik.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package inr.numass.scripts
-
-import hep.dataforge.context.Global
-import hep.dataforge.data.DataSet
-import hep.dataforge.stat.fit.FitManager
-import hep.dataforge.stat.fit.FitState
-import hep.dataforge.stat.fit.ParamSet
-import hep.dataforge.stat.likelihood.BayesianConfidenceLimit
-import hep.dataforge.stat.models.XYModel
-import hep.dataforge.tables.ListTable
-import inr.numass.data.SpectrumGenerator
-import inr.numass.models.BetaSpectrum
-import inr.numass.models.ModularSpectrum
-import inr.numass.models.NBkgSpectrum
-
-import static inr.numass.utils.DataModelUtils.getUniformSpectrumConfiguration
-
-PrintWriter out = Global.out();
-FitManager fm = new FitManager();
-
-setSeed(543982);
-
-//        TritiumSpectrum beta = new TritiumSpectrum(2e-4, 13995d, 18580d);
-File fssfile = new File("c:\\Users\\Darksnake\\Dropbox\\PlayGround\\FS.txt");
-ModularSpectrum beta = new ModularSpectrum(new BetaSpectrum(),8.3e-5, 14400d, 19010d);
-beta.setCaching(false);
-NBkgSpectrum spectrum = new NBkgSpectrum(beta);
-XYModel model = new XYModel("tritium", spectrum);
-
-ParamSet allPars = new ParamSet();
-
-allPars.setParValue("N", 6e5);
-//значение 6е-6 соответствует полной интенстивности 6е7 распадов в секунду
-//Проблема была в переполнении счетчика событий в генераторе. Заменил на long. Возможно стоит поставить туда число с плавающей точкой
-allPars.setParError("N", 25);
-allPars.setParDomain("N", 0d, Double.POSITIVE_INFINITY);
-allPars.setParValue("bkg", 5);
-allPars.setParError("bkg", 1e-3);
-allPars.setParValue("E0", 18575d);
-allPars.setParError("E0", 0.1);
-allPars.setParValue("mnu2", 0d);
-allPars.setParError("mnu2", 1d);
-allPars.setParValue("msterile2", 1000 * 1000);
-allPars.setParValue("U2", 0);
-allPars.setParError("U2", 1e-4);
-allPars.setParDomain("U2", 0d, 1d);
-allPars.setParValue("X", 0.0);
-allPars.setParDomain("X", 0d, Double.POSITIVE_INFINITY);
-allPars.setParValue("trap", 1d);
-allPars.setParError("trap", 0.01d);
-allPars.setParDomain("trap", 0d, Double.POSITIVE_INFINITY);
-
-//        PlotPlugin pm = new PlotPlugin();
-//        String plotTitle = "Tritium spectrum";
-//        pm.plotFunction(ParametricUtils.getSpectrumFunction(spectrum, allPars), 14000, 18600, 500,plotTitle, null);
-//        PrintNamed.printSpectrum(Out.onComplete, beta.trapping, allPars, 14000d, 18600d, 500);
-//        double e = 18570d;
-//        trans.alpha = 1e-4;
-//        trans.plotTransmission(System.onComplete, allPars, e, e-1000d, e+100d, 200);
-SpectrumGenerator generator = new SpectrumGenerator(model, allPars);
-
-//        ColumnedDataFile file = new ColumnedDataFile("d:\\PlayGround\\RUN36.cfg");
-//        ListTable config = file.getPoints("time","X");
-double Elow = 14000d;
-double Eup = 18600d;
-int numpoints = (int) ((Eup - Elow) / 50);
-double time = 1e6 / numpoints; // 3600 / numpoints;
-DataSet config = getUniformSpectrumConfiguration(Elow, Eup, time, numpoints);
-//        config.addAll(DataModelUtils.getUniformSpectrumConfiguration(Eup, Elow, time, numpoints));// в обратную сторону
-
-ListTable data = generator.generateData(config);
-//        plotTitle = "Generated tritium spectrum data";
-//        pm.plotXYScatter(data, "X", "Y",plotTitle, null);
-//        bareBeta.setFSS("D:\\PlayGround\\FSS.dat");
-//        data = tritiumUtils.applyDrift(data, 2.8e-6);
-
-FitState state = fm.buildState(data, model, allPars);
-
-//       fm.checkDerivs();
-//        res.print(Out.onComplete);
-//        fm.checkFitDerivatives();
-FitState res = fm.runDefaultStage(state, "U2", "N", "trap");
-
-res.print(out);
-
-//        res = fm.runFrom(res);
-//        res = fm.generateErrorsFrom(res);
-beta.setCaching(true);
-beta.setSuppressWarnings(true);
-
-BayesianConfidenceLimit bm = new BayesianConfidenceLimit();
-//        bm.setPriorProb(new OneSidedUniformPrior("trap", 0, true));
-//        bm.setPriorProb(new Gaussian("trap", 1d, 0.002));
-//        bm.printMarginalLikelihood(Out.onComplete,"U2", res);
-
-FitState conf = bm.getConfidenceInterval("U2", res, ["U2", "N", "trap"]);
-//        plotTitle = String.format("Marginal likelihood for parameter \'%s\'", "U2");
-//        pm.plotFunction(bm.getMarginalLikelihood("U2", res), 0, 2e-3, 40,plotTitle, null);
-
-conf.print(out);
-//        PrintNamed.printLogProbRandom(Out.onComplete, res, 5000,0.5d, "E0","N");
-
-spectrum.counter.print(out);
-
diff --git a/numass-main/src/main/groovy/inr/numass/scripts/models/TristanModel.groovy b/numass-main/src/main/groovy/inr/numass/scripts/models/TristanModel.groovy
index 832e6c24..e69de29b 100644
--- a/numass-main/src/main/groovy/inr/numass/scripts/models/TristanModel.groovy
+++ b/numass-main/src/main/groovy/inr/numass/scripts/models/TristanModel.groovy
@@ -1,100 +0,0 @@
-package inr.numass.scripts.models
-
-import hep.dataforge.context.Context
-import hep.dataforge.context.Global
-import hep.dataforge.grind.GrindShell
-import hep.dataforge.grind.helpers.PlotHelper
-import hep.dataforge.meta.Meta
-import hep.dataforge.stat.fit.FitManager
-import hep.dataforge.stat.fit.FitStage
-import hep.dataforge.stat.fit.FitState
-import hep.dataforge.stat.fit.ParamSet
-import hep.dataforge.stat.models.XYModel
-import hep.dataforge.stat.parametric.ParametricFunction
-import hep.dataforge.tables.Table
-import inr.numass.NumassPlugin
-import inr.numass.data.SpectrumAdapter
-import inr.numass.data.SpectrumGenerator
-import inr.numass.models.NBkgSpectrum
-import inr.numass.models.NumassModelsKt
-import inr.numass.models.misc.ModGauss
-import inr.numass.models.sterile.NumassBeta
-import inr.numass.utils.DataModelUtils
-
-
-Context ctx = Global.instance()
-ctx.getPlugins().load(NumassPlugin)
-
-new GrindShell(ctx).eval {
-    PlotHelper ph = plots
-
-    def beta = new NumassBeta().getSpectrum(0)
-    def response = new ModGauss(5.0)
-    ParametricFunction spectrum = NumassModelsKt.convolute(beta, response)
-
-    def model = new XYModel(Meta.empty(), new SpectrumAdapter(Meta.empty()), new NBkgSpectrum(spectrum))
-
-    ParamSet params = morph(ParamSet, [:], "params") {
-        N(value: 1e+14, err: 30, lower: 0)
-        bkg(value: 5.0, err: 0.1)
-        E0(value: 18575.0, err: 0.1)
-        mnu2(value: 0, err: 0.01)
-        msterile2(value: 7000**2, err: 1)
-        U2(value: 0.0, err: 1e-3)
-        //X(value: 0.0, err: 0.01, lower: 0)
-        //trap(value: 1.0, err: 0.05)
-        w(value: 150, err: 5)
-        //shift(value: 1, err: 1e-2)
-        //tailAmp(value: 0.01, err: 1e-2)
-        tailW(value: 300, err: 1)
-    }
-
-//    double norm = NumassIntegrator.defaultIntegrator.integrate(1000d, 18500d) {
-//        model.value(it, params)
-//    }
-
-//    println("The total number of events is $norm")
-//
-//    ph.plotFunction(-2000d, 500d, 400, "actual", "response") { double x ->
-//        response.value(x, params)
-//    }
-
-    SpectrumGenerator generator = new SpectrumGenerator(model, params, 12316);
-
-    ph.plot(data: (2000..19500).step(50).collectEntries {
-        [it, model.value(it, params)]
-    }, name: "spectrum", frame: "test")
-            .configure(showLine: true, showSymbol: false, showErrors: false, thickness: 2, connectionType: "spline", color: "red")
-
-
-    Table data = generator.generateData(DataModelUtils.getUniformSpectrumConfiguration(7000, 19500, 1, 1000));
-
-    //params.setParValue("w", 151)
-    //params.setParValue("tailAmp", 0.011)
-    //params.setParValue("X", 0.01)
-    //params.setParValue("trap", 0.01)
-    //params.setParValue("mnu2", 4)
-
-
-    ph.plotFunction(-2000d, 500d, 400, "supposed", "response") { double x ->
-        response.value(x, params)
-    }
-
-    ph.plot(data: (2000..19500).step(50).collectEntries {
-        [it, model.value(it, params)]
-    }, name: "spectrum-mod", frame: "test")
-            .configure(showLine: true, showSymbol: false, showErrors: false, thickness: 2, connectionType: "spline", color: "green")
-
-    ph.plot(data: data, frame: "test", adapter: new SpectrumAdapter(Meta.empty()))
-            .configure(color: "blue")
-
-    FitState state = new FitState(data, model, params);
-
-    def fm = ctx.get(FitManager)
-
-    def res = fm.runStage(state, "MINUIT", FitStage.TASK_RUN, "N", "bkg", "E0", "U2");
-
-
-    res.printState(ctx.getOutput.out().newPrintWriter());
-    NumassIOKt.display(res, ctx, "fit")
-}
\ No newline at end of file
diff --git a/numass-main/src/main/groovy/inr/numass/scripts/underflow/ResponseFunction.groovy b/numass-main/src/main/groovy/inr/numass/scripts/underflow/ResponseFunction.groovy
index 8683ae33..e69de29b 100644
--- a/numass-main/src/main/groovy/inr/numass/scripts/underflow/ResponseFunction.groovy
+++ b/numass-main/src/main/groovy/inr/numass/scripts/underflow/ResponseFunction.groovy
@@ -1,66 +0,0 @@
-package inr.numass.scripts.underflow
-
-import hep.dataforge.cache.CachePlugin
-import hep.dataforge.context.Context
-import hep.dataforge.context.Global
-import hep.dataforge.data.DataNode
-import hep.dataforge.grind.GrindShell
-import hep.dataforge.io.ColumnedDataWriter
-import hep.dataforge.meta.Meta
-import hep.dataforge.tables.ColumnTable
-import hep.dataforge.tables.Table
-import inr.numass.NumassPlugin
-import inr.numass.data.NumassDataUtils
-
-import static hep.dataforge.grind.Grind.buildMeta
-
-Context ctx = Global.instance()
-ctx.getPlugins().load(FXPlotManager)
-ctx.getPlugins().load(NumassPlugin.class)
-ctx.getPlugins().load(CachePlugin.class)
-
-Meta meta = buildMeta {
-    data(dir: "D:\\Work\\Numass\\data\\2017_05\\Fill_2", mask: "set_.{1,3}")
-    generate(t0: 3e4, sort: false)
-}
-
-def shell = new GrindShell(ctx);
-
-DataNode spectra = UnderflowUtils.getSpectraMap(shell, meta);
-
-shell.eval {
-    def columns = [:];
-
-    Map binned = [:]
-
-
-    (14500..17500).step(500).each {
-        Table up = binned.computeIfAbsent(it) { key ->
-            NumassDataUtils.spectrumWithBinning(spectra.optData(key as String).get().get(), 20, 400, 3100);
-        }
-
-        Table lo = binned.computeIfAbsent(it - 500) { key ->
-            NumassDataUtils.spectrumWithBinning(spectra.optData(key as String).get().get(), 20, 400, 3100);
-        }
-
-        columns << [channel: up.channel]
-
-        columns << [(it as String): NumassDataUtils.subtractSpectrum(lo, up).getColumn("cr")]
-    }
-
-    ColumnedDataWriter.writeTable(System.out, ColumnTable.of(columns), "Response function")
-
-//    println()
-//    println()
-//
-//    columns.clear()
-//
-//    binned.each { key, table ->
-//        columns << [channel: table.channel]
-//        columns << [(key as String): table.cr]
-//    }
-//
-//    ColumnedDataWriter.writeTable(System.out,
-//            ColumnTable.of(columns),
-//            "Spectra")
-}
\ No newline at end of file
diff --git a/numass-main/src/main/groovy/inr/numass/scripts/underflow/Underflow.groovy b/numass-main/src/main/groovy/inr/numass/scripts/underflow/Underflow.groovy
index e1a19942..e69de29b 100644
--- a/numass-main/src/main/groovy/inr/numass/scripts/underflow/Underflow.groovy
+++ b/numass-main/src/main/groovy/inr/numass/scripts/underflow/Underflow.groovy
@@ -1,139 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package inr.numass.scripts.underflow
-
-import hep.dataforge.cache.CachePlugin
-import hep.dataforge.context.Context
-import hep.dataforge.context.Global
-import hep.dataforge.data.DataNode
-import hep.dataforge.grind.GrindShell
-import hep.dataforge.grind.helpers.PlotHelper
-import hep.dataforge.io.ColumnedDataWriter
-import hep.dataforge.meta.Meta
-import hep.dataforge.plots.PlotGroup
-import hep.dataforge.plots.data.DataPlot
-import hep.dataforge.tables.Adapters
-import hep.dataforge.tables.Table
-import inr.numass.NumassPlugin
-import inr.numass.data.analyzers.NumassAnalyzerKt
-import inr.numass.subthreshold.Threshold
-import javafx.application.Platform
-
-import static hep.dataforge.grind.Grind.buildMeta
-import static inr.numass.data.analyzers.NumassAnalyzer.CHANNEL_KEY
-import static inr.numass.data.analyzers.NumassAnalyzer.COUNT_RATE_KEY
-
-Context ctx = Global.instance()
-ctx.getPlugins().load(NumassPlugin)
-ctx.getPlugins().load(CachePlugin)
-
-Meta meta = buildMeta(t0: 3e4) {
-    data(dir: "D:\\Work\\Numass\\data\\2017_11\\Fill_2", mask: "set_3.")
-    subtract(reference: 18500)
-    fit(xLow: 400, xHigh: 600, upper: 3000, binning: 20, method: "pow")
-    scan(
-            hi: [500, 600, 700, 800, 900],
-            lo: [350, 400, 450],
-            def: 700
-    )
-    window(lo: 300, up: 3000)
-}
-
-
-def shell = new GrindShell(ctx);
-
-DataNode
spectra = Threshold.INSTANCE.getSpectraMap(ctx, meta).computeAll(); - -shell.eval { - - //subtracting reference point - Map spectraMap - if (meta.hasValue("subtract.reference")) { - String referenceVoltage = meta["subtract.reference"] - println "subtracting reference point ${referenceVoltage}" - def referencePoint = spectra.get(referenceVoltage) - spectraMap = spectra - .findAll { it.name != referenceVoltage } - .collectEntries { - [(it.meta["voltage"]): NumassAnalyzerKt.subtractAmplitudeSpectrum(it.get(), referencePoint)] - } - } else { - spectraMap = spectra.collectEntries { return [(it.meta["voltage"]): it.get()] } - } - - //Showing selected points - def showPoints = { Map points, int binning = 20, int loChannel = 300, int upChannel = 2000 -> - def plotGroup = new PlotGroup("points"); - def adapter = Adapters.buildXYAdapter(CHANNEL_KEY, COUNT_RATE_KEY) - points.each { - plotGroup.set( - DataPlot.plot( - it.key as String, - adapter, - NumassAnalyzerKt.withBinning(it.value as Table, binning) - ) - ) - } - - //configuring and plotting - plotGroup.configure(showLine: true, showSymbol: false, showErrors: false, connectionType: "step") - def frame = (plots as PlotHelper).getManager().getPlotFrame("Spectra") - frame.configureValue("yAxis.type", "log") - frame.add(plotGroup) - } - - showPoints(spectraMap.findAll { it.key in [14100d, 14200d, 14300d, 14400d, 14800d, 15000d, 15200d, 15700d] }) - - meta["scan.hi"].each { xHigh -> - println "Caclculate correctuion for upper linearity bound: ${xHigh}" - Table correctionTable = TableTransform.filter( - Threshold.INSTANCE.calculateSubThreshold( - spectraMap, - meta.getMeta("fit").builder.setValue("xHigh", xHigh) - ), - "correction", - 0, - 2 - ) - - if (xHigh == meta["scan.def"]) { - ColumnedDataWriter.writeTable(System.out, correctionTable, "underflow parameters") - } - - Platform.runLater { - (plots as PlotHelper).plot( - data: correctionTable, - adapter: Adapters.buildXYAdapter("U", "correction"), - name: "upper_${xHigh}", - frame: "upper" - ) - } - } - - - meta["scan.lo"].each { xLow -> - println "Caclculate correctuion for lower linearity bound: ${xLow}" - Table correctionTable = TableTransform.filter( - Threshold.INSTANCE.calculateSubThreshold( - spectraMap, - meta.getMeta("fit").builder.setValue("xLow", xLow) - ), - "correction", - 0, - 2 - ) - - Platform.runLater { - (plots as PlotHelper).plot( - data: correctionTable, - adapter: Adapters.buildXYAdapter("U", "correction"), - name: "lower_${xLow}", - frame: "lower" - ) - } - } -} \ No newline at end of file diff --git a/numass-main/src/main/kotlin/inr/numass/scripts/analysis/Run2020_12.kt b/numass-main/src/main/kotlin/inr/numass/scripts/analysis/Run2020_12.kt index 3c5300b1..b942cb21 100644 --- a/numass-main/src/main/kotlin/inr/numass/scripts/analysis/Run2020_12.kt +++ b/numass-main/src/main/kotlin/inr/numass/scripts/analysis/Run2020_12.kt @@ -1,17 +1,8 @@ package inr.numass.scripts.analysis import hep.dataforge.context.Global -import hep.dataforge.context.plugin import hep.dataforge.fx.output.FXOutputManager -import hep.dataforge.grind.workspace.GroovyWorkspaceParser -import hep.dataforge.plots.plotData -import hep.dataforge.tables.Adapters -import hep.dataforge.tables.Table import hep.dataforge.workspace.FileBasedWorkspace -import hep.dataforge.workspace.Workspace -import hep.dataforge.workspace.context -import hep.dataforge.workspace.data -import inr.numass.displayChart import java.io.File fun main() { @@ -32,7 +23,7 @@ fun main() { //workspace.context.setValue("cache.enabled", false) - workspace.runTask("fit","Fill_4") + workspace.runTask("fit", "Fill_4") // val result = workspace.runTask("dif", "adiab_19").first().get() as Table // diff --git a/numass-main/src/main/kotlin/inr/numass/scripts/utils/ScanTree.kt b/numass-main/src/main/kotlin/inr/numass/scripts/utils/ScanTree.kt index 738529a5..9457eabf 100644 --- a/numass-main/src/main/kotlin/inr/numass/scripts/utils/ScanTree.kt +++ b/numass-main/src/main/kotlin/inr/numass/scripts/utils/ScanTree.kt @@ -14,7 +14,7 @@ import kotlinx.coroutines.runBlocking import java.io.File private suspend fun createSummaryNode(storage: Storage): MetaBuilder { - Global.logger.info("Reading content of shelf {}", storage.fullName) + Global.logger.info("Reading content of shelf ${storage.fullName}") val builder = MetaBuilder("shelf") .setValue("name", storage.name) @@ -24,7 +24,7 @@ private suspend fun createSummaryNode(storage: Storage): MetaBuilder { if(element is Storage && element.name.startsWith("Fill")){ builder.putNode(createSummaryNode(element)) } else if(element is NumassDataLoader){ - Global.logger.info("Reading content of set {}", element.fullName) + Global.logger.info("Reading content of set ${element.fullName}") val setBuilder = MetaBuilder("set") .setValue("name", element.name) diff --git a/numass-viewer/build.gradle.kts b/numass-viewer/build.gradle.kts index ce9075a9..d033aed4 100644 --- a/numass-viewer/build.gradle.kts +++ b/numass-viewer/build.gradle.kts @@ -2,7 +2,7 @@ plugins { kotlin("jvm") id("org.openjfx.javafxplugin") //id("com.github.johnrengelman.shadow") - id("org.beryx.runtime") version "1.12.7" + id("org.beryx.runtime") version "1.13.0" application } diff --git a/settings.gradle.kts b/settings.gradle.kts index 0c6bcf85..9ec0ed8a 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,5 +1,9 @@ rootProject.name = "numass" +plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0" +} + include(":dataforge-core") // core classes and data structures include(":dataforge-core:dataforge-json") // json meta converter //include(":dataforge-core:osgi") // osgi framework for easy plugin delivery