Fixed adapters
This commit is contained in:
parent
96d7598355
commit
ad96c7a78b
@ -17,7 +17,6 @@ package inr.numass.data;
|
||||
|
||||
import hep.dataforge.meta.Meta;
|
||||
import hep.dataforge.meta.MetaBuilder;
|
||||
import hep.dataforge.tables.Adapters;
|
||||
import hep.dataforge.tables.BasicAdapter;
|
||||
import hep.dataforge.tables.ValueMap;
|
||||
import hep.dataforge.tables.ValuesAdapter;
|
||||
@ -108,6 +107,6 @@ public class SpectrumAdapter extends BasicAdapter {
|
||||
|
||||
@Override
|
||||
public Stream<String> listComponents() {
|
||||
return Stream.concat(super.listComponents(), Stream.of(Adapters.Y_VALUE_KEY, Adapters.Y_ERROR_KEY)).distinct();
|
||||
return Stream.concat(super.listComponents(), Stream.of(X_VALUE_KEY, Y_VALUE_KEY, POINT_LENGTH_NAME)).distinct();
|
||||
}
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ new GrindShell(ctx).eval {
|
||||
ph.plot(data: (2000..19500).step(50).collectEntries { [it, model.value(it, params)] }, name: "spectrum-mod")
|
||||
.configure(showLine: true, showSymbol: false, showErrors: false, thickness: 2, connectionType: "spline", color: "green")
|
||||
|
||||
ph.plot(data: data, adapter: new SpectrumAdapter())
|
||||
ph.plot(data: data, adapter: new SpectrumAdapter(Meta.empty()))
|
||||
.configure(color: "blue")
|
||||
|
||||
FitState state = new FitState(data, model, params);
|
||||
|
@ -67,7 +67,7 @@ public class SpectrumGenerator implements Generator {
|
||||
|
||||
@Override
|
||||
public Table generateData(Iterable<Values> config) {
|
||||
ListTable.Builder res = new ListTable.Builder(Adapters.getXYFormat(adapter));
|
||||
ListTable.Builder res = new ListTable.Builder(Adapters.getFormat(adapter));
|
||||
for (Values aConfig : config) {
|
||||
res.row(this.generateDataPoint(aConfig));
|
||||
}
|
||||
@ -82,7 +82,7 @@ public class SpectrumGenerator implements Generator {
|
||||
* @return
|
||||
*/
|
||||
public Table generateExactData(Iterable<Values> config) {
|
||||
ListTable.Builder res = new ListTable.Builder(Adapters.getXYFormat(adapter));
|
||||
ListTable.Builder res = new ListTable.Builder(Adapters.getFormat(adapter));
|
||||
for (Values aConfig : config) {
|
||||
res.row(this.generateExactDataPoint(aConfig));
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ public class OldDataReader {
|
||||
|
||||
public static Table readData(String path, double Elow) {
|
||||
SpectrumAdapter factory = new SpectrumAdapter(Meta.empty());
|
||||
ListTable.Builder res = new ListTable.Builder(Adapters.getXYFormat(factory));
|
||||
ListTable.Builder res = new ListTable.Builder(Adapters.getFormat(factory));
|
||||
Path file = Global.instance().getIo().getFile(path);
|
||||
double x;
|
||||
int count;
|
||||
@ -113,7 +113,7 @@ public class OldDataReader {
|
||||
|
||||
public static Table readDataAsGun(String path, double Elow) {
|
||||
SpectrumAdapter factory = new SpectrumAdapter(Meta.empty());
|
||||
ListTable.Builder res = new ListTable.Builder(Adapters.getXYFormat(factory));
|
||||
ListTable.Builder res = new ListTable.Builder(Adapters.getFormat(factory));
|
||||
Path file = Global.instance().getIo().getFile(path);
|
||||
double x;
|
||||
long count;
|
||||
@ -146,7 +146,7 @@ public class OldDataReader {
|
||||
|
||||
public static Table readSpectrumData(String path) {
|
||||
SpectrumAdapter factory = new SpectrumAdapter(Meta.empty());
|
||||
ListTable.Builder res = new ListTable.Builder(Adapters.getXYFormat(factory));
|
||||
ListTable.Builder res = new ListTable.Builder(Adapters.getFormat(factory));
|
||||
Path file = Global.instance().getIo().getFile(path);
|
||||
double x;
|
||||
double count;
|
||||
|
Loading…
Reference in New Issue
Block a user