Fixed adapters

This commit is contained in:
Alexander Nozik 2017-11-28 18:31:50 +03:00
parent 96d7598355
commit ad96c7a78b
4 changed files with 7 additions and 8 deletions

View File

@ -17,7 +17,6 @@ package inr.numass.data;
import hep.dataforge.meta.Meta; import hep.dataforge.meta.Meta;
import hep.dataforge.meta.MetaBuilder; import hep.dataforge.meta.MetaBuilder;
import hep.dataforge.tables.Adapters;
import hep.dataforge.tables.BasicAdapter; import hep.dataforge.tables.BasicAdapter;
import hep.dataforge.tables.ValueMap; import hep.dataforge.tables.ValueMap;
import hep.dataforge.tables.ValuesAdapter; import hep.dataforge.tables.ValuesAdapter;
@ -108,6 +107,6 @@ public class SpectrumAdapter extends BasicAdapter {
@Override @Override
public Stream<String> listComponents() { 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();
} }
} }

View File

@ -67,7 +67,7 @@ new GrindShell(ctx).eval {
ph.plot(data: (2000..19500).step(50).collectEntries { [it, model.value(it, params)] }, name: "spectrum-mod") 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") .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") .configure(color: "blue")
FitState state = new FitState(data, model, params); FitState state = new FitState(data, model, params);

View File

@ -67,7 +67,7 @@ public class SpectrumGenerator implements Generator {
@Override @Override
public Table generateData(Iterable<Values> config) { 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) { for (Values aConfig : config) {
res.row(this.generateDataPoint(aConfig)); res.row(this.generateDataPoint(aConfig));
} }
@ -82,7 +82,7 @@ public class SpectrumGenerator implements Generator {
* @return * @return
*/ */
public Table generateExactData(Iterable<Values> config) { 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) { for (Values aConfig : config) {
res.row(this.generateExactDataPoint(aConfig)); res.row(this.generateExactDataPoint(aConfig));
} }

View File

@ -61,7 +61,7 @@ public class OldDataReader {
public static Table readData(String path, double Elow) { public static Table readData(String path, double Elow) {
SpectrumAdapter factory = new SpectrumAdapter(Meta.empty()); 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); Path file = Global.instance().getIo().getFile(path);
double x; double x;
int count; int count;
@ -113,7 +113,7 @@ public class OldDataReader {
public static Table readDataAsGun(String path, double Elow) { public static Table readDataAsGun(String path, double Elow) {
SpectrumAdapter factory = new SpectrumAdapter(Meta.empty()); 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); Path file = Global.instance().getIo().getFile(path);
double x; double x;
long count; long count;
@ -146,7 +146,7 @@ public class OldDataReader {
public static Table readSpectrumData(String path) { public static Table readSpectrumData(String path) {
SpectrumAdapter factory = new SpectrumAdapter(Meta.empty()); 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); Path file = Global.instance().getIo().getFile(path);
double x; double x;
double count; double count;