[no commit message]
This commit is contained in:
parent
32cfbff1e2
commit
243f9f541c
@ -160,7 +160,7 @@ public class NumassPlugin extends BasicPlugin {
|
||||
double weightReductionFactor = an.getDouble("weightReductionFactor", 2.0);
|
||||
|
||||
Model res = new WeightedXYModel("scatter-variable", spectrum, getAdapter(an), (dp) -> weightReductionFactor);
|
||||
res.configure(an);
|
||||
res.setMeta(an);
|
||||
return res;
|
||||
});
|
||||
|
||||
@ -196,7 +196,7 @@ public class NumassPlugin extends BasicPlugin {
|
||||
double weightReductionFactor = an.getDouble("weightReductionFactor", 2.0);
|
||||
|
||||
Model res = new WeightedXYModel("scatter-empiric-experimental", spectrum, getAdapter(an), (dp) -> weightReductionFactor);
|
||||
res.configure(an);
|
||||
res.setMeta(an);
|
||||
return res;
|
||||
});
|
||||
|
||||
|
@ -102,7 +102,7 @@ public class MergeDataAction extends ManyToOneAction<DataSet, DataSet> {
|
||||
* Указываем путь только если он одинаковый для всех входных файлов
|
||||
*/
|
||||
if (numassPath != null) {
|
||||
res.configure(res.meta().getBuilder().putValue("numass.path", numassPath).build());
|
||||
res.setMeta(res.meta().getBuilder().putValue("numass.path", numassPath).build());
|
||||
}
|
||||
|
||||
res = res.sort("Uset", true);
|
||||
|
@ -34,7 +34,6 @@ import inr.numass.data.NMPoint;
|
||||
import inr.numass.data.RawNMPoint;
|
||||
import java.io.OutputStream;
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneOffset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
package inr.numass.data;
|
||||
|
||||
import hep.dataforge.content.AbstractContent;
|
||||
import hep.dataforge.content.NamedMetaHolder;
|
||||
import hep.dataforge.description.ValueDef;
|
||||
import hep.dataforge.meta.Meta;
|
||||
import hep.dataforge.meta.MetaBuilder;
|
||||
@ -33,7 +33,7 @@ import java.util.List;
|
||||
*/
|
||||
@ValueDef(name = "numass.path", info = "Path to this data file in numass repository.")
|
||||
@ValueDef(name = "numass.name", info = "The name of this data file.")
|
||||
public class NMFile extends AbstractContent implements NumassData {
|
||||
public class NMFile extends NamedMetaHolder implements NumassData {
|
||||
|
||||
public static NMFile readStream(InputStream is, String fname, Meta config) throws IOException{
|
||||
return new NMFile(new NumassDataReader(is, fname, config).read());
|
||||
|
@ -13,120 +13,121 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package inr.numass.data;
|
||||
|
||||
import hep.dataforge.content.AbstractContent;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Contains the whole data but requires a lot of memory
|
||||
* @author Darksnake
|
||||
*/
|
||||
public class RawNMFile extends AbstractContent {
|
||||
|
||||
// public static String TYPE = ":data:numassdatafile";
|
||||
|
||||
private final List<RawNMPoint> points;
|
||||
|
||||
private String head;
|
||||
|
||||
public void setHead(String head) {
|
||||
this.head = head;
|
||||
}
|
||||
|
||||
public String getHead() {
|
||||
return head;
|
||||
}
|
||||
|
||||
public RawNMFile(String fileName) {
|
||||
super(fileName);
|
||||
this.points = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void generatePAW(OutputStream stream) {
|
||||
PrintWriter writer = new PrintWriter(new BufferedOutputStream(stream));
|
||||
long counter = 0;
|
||||
for (RawNMPoint point : this.getData()) {
|
||||
double U = point.getUread();
|
||||
for (NMEvent event : point.getEvents()) {
|
||||
counter++;
|
||||
writer.printf("%d\t%f\t%d\t%.1f\t%.2f%n", counter, event.getTime(), event.getChanel(), point.getLength(), U);
|
||||
}
|
||||
|
||||
}
|
||||
writer.flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* merge of all point with given Uset
|
||||
* @param U
|
||||
* @return
|
||||
*/
|
||||
public RawNMPoint getByUset(double U) {
|
||||
RawNMPoint res = null;
|
||||
|
||||
for (RawNMPoint point : points) {
|
||||
if (point.getUset() == U) {
|
||||
if (res == null) {
|
||||
res = point.clone();
|
||||
} else {
|
||||
res = res.merge(point);
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* merge of all point with given Uread
|
||||
* @param U
|
||||
* @return
|
||||
*/
|
||||
public RawNMPoint getByUread(double U) {
|
||||
RawNMPoint res = null;
|
||||
|
||||
for (RawNMPoint point : points) {
|
||||
if (point.getUread()== U) {
|
||||
if (res == null) {
|
||||
res = point.clone();
|
||||
} else {
|
||||
res = res.merge(point);
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the data
|
||||
*/
|
||||
public List<RawNMPoint> getData() {
|
||||
return points;
|
||||
}
|
||||
|
||||
void putEvent(double U, short chanel, double time) {
|
||||
for (RawNMPoint point : this.getData()) {
|
||||
if (U == point.getUread()) {
|
||||
point.putEvent(new NMEvent(chanel, time));
|
||||
return;
|
||||
}
|
||||
}
|
||||
RawNMPoint newpoint = new RawNMPoint();
|
||||
newpoint.putEvent(new NMEvent(chanel, time));
|
||||
this.putPoint(newpoint);
|
||||
}
|
||||
|
||||
public void putPoint(RawNMPoint point) {
|
||||
points.add(point);
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return this.points.size();
|
||||
}
|
||||
|
||||
}
|
||||
package inr.numass.data;
|
||||
|
||||
import hep.dataforge.content.Content;
|
||||
import hep.dataforge.content.NamedMetaHolder;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Contains the whole data but requires a lot of memory
|
||||
* @author Darksnake
|
||||
*/
|
||||
public class RawNMFile extends NamedMetaHolder implements Content {
|
||||
|
||||
// public static String TYPE = ":data:numassdatafile";
|
||||
|
||||
private final List<RawNMPoint> points;
|
||||
|
||||
private String head;
|
||||
|
||||
public void setHead(String head) {
|
||||
this.head = head;
|
||||
}
|
||||
|
||||
public String getHead() {
|
||||
return head;
|
||||
}
|
||||
|
||||
public RawNMFile(String fileName) {
|
||||
super(fileName);
|
||||
this.points = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void generatePAW(OutputStream stream) {
|
||||
PrintWriter writer = new PrintWriter(new BufferedOutputStream(stream));
|
||||
long counter = 0;
|
||||
for (RawNMPoint point : this.getData()) {
|
||||
double U = point.getUread();
|
||||
for (NMEvent event : point.getEvents()) {
|
||||
counter++;
|
||||
writer.printf("%d\t%f\t%d\t%.1f\t%.2f%n", counter, event.getTime(), event.getChanel(), point.getLength(), U);
|
||||
}
|
||||
|
||||
}
|
||||
writer.flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* merge of all point with given Uset
|
||||
* @param U
|
||||
* @return
|
||||
*/
|
||||
public RawNMPoint getByUset(double U) {
|
||||
RawNMPoint res = null;
|
||||
|
||||
for (RawNMPoint point : points) {
|
||||
if (point.getUset() == U) {
|
||||
if (res == null) {
|
||||
res = point.clone();
|
||||
} else {
|
||||
res = res.merge(point);
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* merge of all point with given Uread
|
||||
* @param U
|
||||
* @return
|
||||
*/
|
||||
public RawNMPoint getByUread(double U) {
|
||||
RawNMPoint res = null;
|
||||
|
||||
for (RawNMPoint point : points) {
|
||||
if (point.getUread()== U) {
|
||||
if (res == null) {
|
||||
res = point.clone();
|
||||
} else {
|
||||
res = res.merge(point);
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the data
|
||||
*/
|
||||
public List<RawNMPoint> getData() {
|
||||
return points;
|
||||
}
|
||||
|
||||
void putEvent(double U, short chanel, double time) {
|
||||
for (RawNMPoint point : this.getData()) {
|
||||
if (U == point.getUread()) {
|
||||
point.putEvent(new NMEvent(chanel, time));
|
||||
return;
|
||||
}
|
||||
}
|
||||
RawNMPoint newpoint = new RawNMPoint();
|
||||
newpoint.putEvent(new NMEvent(chanel, time));
|
||||
this.putPoint(newpoint);
|
||||
}
|
||||
|
||||
public void putPoint(RawNMPoint point) {
|
||||
points.add(point);
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return this.points.size();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -13,43 +13,43 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package inr.numass.prop.ar;
|
||||
|
||||
import hep.dataforge.meta.Meta;
|
||||
import hep.dataforge.content.AbstractContent;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* An episode of JNA measurements
|
||||
*
|
||||
* @author Darksnake
|
||||
*/
|
||||
public class JNAEpisode extends AbstractContent implements Iterable<JNASpectrum> {
|
||||
|
||||
private final List<JNASpectrum> spectra;
|
||||
|
||||
public JNAEpisode(String name, List<JNASpectrum> spectra) {
|
||||
super(name);
|
||||
this.spectra = spectra;
|
||||
}
|
||||
|
||||
public JNAEpisode(String name, Meta annotation, List<JNASpectrum> spectra) {
|
||||
super(name, annotation);
|
||||
this.spectra = spectra;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<JNASpectrum> iterator() {
|
||||
return spectra.iterator();
|
||||
}
|
||||
|
||||
public JNASpectrum get(int i) {
|
||||
return spectra.get(i);
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return spectra.size();
|
||||
}
|
||||
|
||||
}
|
||||
package inr.numass.prop.ar;
|
||||
|
||||
import hep.dataforge.meta.Meta;
|
||||
import hep.dataforge.content.NamedMetaHolder;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* An episode of JNA measurements
|
||||
*
|
||||
* @author Darksnake
|
||||
*/
|
||||
public class JNAEpisode extends NamedMetaHolder implements Iterable<JNASpectrum> {
|
||||
|
||||
private final List<JNASpectrum> spectra;
|
||||
|
||||
public JNAEpisode(String name, List<JNASpectrum> spectra) {
|
||||
super(name);
|
||||
this.spectra = spectra;
|
||||
}
|
||||
|
||||
public JNAEpisode(String name, Meta annotation, List<JNASpectrum> spectra) {
|
||||
super(name, annotation);
|
||||
this.spectra = spectra;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<JNASpectrum> iterator() {
|
||||
return spectra.iterator();
|
||||
}
|
||||
|
||||
public JNASpectrum get(int i) {
|
||||
return spectra.get(i);
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return spectra.size();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ package inr.numass.prop.ar;
|
||||
|
||||
import hep.dataforge.meta.Meta;
|
||||
import hep.dataforge.meta.MetaBuilder;
|
||||
import hep.dataforge.content.AbstractContent;
|
||||
import hep.dataforge.content.NamedMetaHolder;
|
||||
import hep.dataforge.description.NodeDef;
|
||||
import hep.dataforge.description.ValueDef;
|
||||
import hep.dataforge.data.DataPoint;
|
||||
@ -37,7 +37,7 @@ import java.util.Map;
|
||||
@NodeDef(name = "temperature", info = "The temperature measurements data for this spectrum.")
|
||||
@ValueDef(name = "relativeStartTime", type = "NUMBER", info = "Start time in days relative to some starting point.")
|
||||
@ValueDef(name = "relativeStopTime", type = "NUMBER", info = "Stop time in days relative to some starting point.")
|
||||
public class JNASpectrum extends AbstractContent {
|
||||
public class JNASpectrum extends NamedMetaHolder {
|
||||
|
||||
public static String[] names = {"chanel", "count"};
|
||||
|
||||
|
@ -21,7 +21,6 @@ import hep.dataforge.context.Context;
|
||||
import hep.dataforge.description.ValueDef;
|
||||
import hep.dataforge.description.TypedActionDef;
|
||||
import hep.dataforge.io.log.Logable;
|
||||
import hep.dataforge.values.ValueType;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
@ -13,44 +13,44 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package inr.numass.prop;
|
||||
|
||||
import hep.dataforge.meta.MetaBuilder;
|
||||
import hep.dataforge.context.GlobalContext;
|
||||
import hep.dataforge.data.DataSet;
|
||||
import hep.dataforge.data.FileData;
|
||||
import hep.dataforge.datafitter.MINUITPlugin;
|
||||
import hep.dataforge.io.ColumnedDataWriter;
|
||||
import inr.numass.prop.ar.FitJNAData;
|
||||
import inr.numass.prop.ar.JNAEpisode;
|
||||
import inr.numass.prop.ar.ReadJNADataAction;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Darksnake
|
||||
*/
|
||||
public class TestFit {
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
public static void main(String[] args) throws FileNotFoundException, InterruptedException {
|
||||
GlobalContext.instance().loadPlugin(new MINUITPlugin());
|
||||
|
||||
File sourceDir = new File("c:\\Users\\Darksnake\\Dropbox\\jna_data");
|
||||
|
||||
FileData file = new FileData(new File(sourceDir, "ar37e2.dat"));
|
||||
file.annotate(new MetaBuilder("meta")
|
||||
.putValue("timeFile", "tar37e2.dat")
|
||||
.putValue("temperatureFile", "e2temp.txt")
|
||||
);
|
||||
JNAEpisode spectra = new ReadJNADataAction(GlobalContext.instance(), null).runOne(file);
|
||||
|
||||
DataSet data = new FitJNAData(GlobalContext.instance(), null).runOne(spectra);
|
||||
|
||||
ColumnedDataWriter.writeDataSet(System.out, data, "***RESULT***");
|
||||
}
|
||||
|
||||
}
|
||||
package inr.numass.prop;
|
||||
|
||||
import hep.dataforge.meta.MetaBuilder;
|
||||
import hep.dataforge.context.GlobalContext;
|
||||
import hep.dataforge.data.DataSet;
|
||||
import hep.dataforge.data.FileData;
|
||||
import hep.dataforge.datafitter.MINUITPlugin;
|
||||
import hep.dataforge.io.ColumnedDataWriter;
|
||||
import inr.numass.prop.ar.FitJNAData;
|
||||
import inr.numass.prop.ar.JNAEpisode;
|
||||
import inr.numass.prop.ar.ReadJNADataAction;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Darksnake
|
||||
*/
|
||||
public class TestFit {
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
public static void main(String[] args) throws FileNotFoundException, InterruptedException {
|
||||
GlobalContext.instance().loadPlugin(new MINUITPlugin());
|
||||
|
||||
File sourceDir = new File("c:\\Users\\Darksnake\\Dropbox\\jna_data");
|
||||
|
||||
FileData file = new FileData(new File(sourceDir, "ar37e2.dat"));
|
||||
file.setMeta(new MetaBuilder("meta")
|
||||
.putValue("timeFile", "tar37e2.dat")
|
||||
.putValue("temperatureFile", "e2temp.txt")
|
||||
);
|
||||
JNAEpisode spectra = new ReadJNADataAction(GlobalContext.instance(), null).runOne(file);
|
||||
|
||||
DataSet data = new FitJNAData(GlobalContext.instance(), null).runOne(spectra);
|
||||
|
||||
ColumnedDataWriter.writeDataSet(System.out, data, "***RESULT***");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public class TestReader {
|
||||
// new MINUITModule().load();
|
||||
|
||||
FileData file = new FileData(new File("c:\\Users\\Darksnake\\Dropbox\\jna_data\\ar37e2.dat"));
|
||||
file.annotate(new MetaBuilder("meta")
|
||||
file.setMeta(new MetaBuilder("meta")
|
||||
.putValue("timeFile", "c:\\Users\\Darksnake\\Dropbox\\jna_data\\tar37e2.dat")
|
||||
.putValue("temperatureFile", "c:\\Users\\Darksnake\\Dropbox\\jna_data\\e2temp.txt")
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user