Removed wildcards from Data and DataNodes
This commit is contained in:
parent
c8d6391219
commit
67d212713a
@ -27,7 +27,9 @@ import hep.dataforge.utils.ReferenceRegistry;
|
||||
import org.apache.commons.io.output.TeeOutputStream;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
@ -105,6 +107,7 @@ public class NumassIO extends BasicIOManager {
|
||||
if (!Files.exists(parentDir)) {
|
||||
throw new RuntimeException("Working directory does not exist");
|
||||
}
|
||||
try {
|
||||
if (dirName != null && !dirName.isEmpty()) {
|
||||
parentDir = parentDir.resolve(dirName);
|
||||
Files.createDirectories(parentDir);
|
||||
@ -112,13 +115,13 @@ public class NumassIO extends BasicIOManager {
|
||||
|
||||
// String output = source.meta().getString("output", this.meta().getString("output", fileName + ".onComplete"));
|
||||
outputFile = parentDir.resolve(fileName);
|
||||
try {
|
||||
|
||||
if (getContext().getBoolean("numass.consoleOutput", false)) {
|
||||
return new TeeOutputStream(Files.newOutputStream(outputFile), System.out);
|
||||
} else {
|
||||
return Files.newOutputStream(outputFile);
|
||||
}
|
||||
} catch (FileNotFoundException ex) {
|
||||
} catch (IOException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
@ -20,8 +20,7 @@ import inr.numass.models.FSS;
|
||||
import inr.numass.utils.NumassIntegrator;
|
||||
import org.apache.commons.math3.analysis.UnivariateFunction;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import static hep.dataforge.values.ValueType.BOOLEAN;
|
||||
@ -61,14 +60,19 @@ public class SterileNeutrinoSpectrum extends AbstractParametricFunction {
|
||||
public SterileNeutrinoSpectrum(Context context, Meta configuration) {
|
||||
super(list);
|
||||
if (configuration.getBoolean("useFSS", true)) {
|
||||
InputStream fssStream;
|
||||
if (configuration.hasValue("fssFile")) {
|
||||
fssStream = context.io().optBinary(configuration.getString("fssFile"))
|
||||
.orElseThrow(()-> new RuntimeException("Could not locate FSS file"))
|
||||
InputStream fssStream = configuration.optString("fssFile")
|
||||
.map(fssFile -> {
|
||||
try {
|
||||
return context.io().optBinary(fssFile)
|
||||
.orElseThrow(() -> new RuntimeException("Could not locate FSS file"))
|
||||
.getStream();
|
||||
} else {
|
||||
fssStream = getClass().getResourceAsStream("/data/FS.txt");
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Could not load FSS file", e);
|
||||
}
|
||||
})
|
||||
.orElse(getClass().getResourceAsStream("/data/FS.txt"));
|
||||
|
||||
|
||||
fss = new FSS(fssStream);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user