Skip to content

Commit

Permalink
Fixed Proteus Netzsch import
Browse files Browse the repository at this point in the history
Included import of diameter
  • Loading branch information
Artem Lunev committed Jun 11, 2021
1 parent 093ea66 commit 8fb90b3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/main/java/pulse/input/ExperimentalData.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import java.util.stream.Collectors;

import pulse.AbstractData;
import pulse.baseline.LinearBaseline;
import pulse.baseline.FlatBaseline;
import pulse.input.listeners.DataEvent;
import pulse.input.listeners.DataListener;
import pulse.properties.NumericProperty;
Expand Down Expand Up @@ -219,7 +219,7 @@ public double maxAdjustedSignal() {
public double halfRiseTime() {
var degraded = runningAverage(REDUCTION_FACTOR);
double max = (max(degraded, pointComparator)).getY();
var baseline = new LinearBaseline();
var baseline = new FlatBaseline();
baseline.fitTo(this);

double halfMax = (max + baseline.valueAt(0)) / 2.0;
Expand Down
9 changes: 8 additions & 1 deletion src/main/java/pulse/io/readers/NetzschCSVReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public class NetzschCSVReader implements CurveReader {
private final static String SHOT_DATA = "Shot_data";
private final static String DETECTOR = "DETECTOR";
private final static String THICKNESS = "Thickness_RT";

private final static String DIAMETER = "Diameter";

/**
* Note comma is included as a delimiter character here.
*/
Expand Down Expand Up @@ -90,6 +91,9 @@ public List<ExperimentalData> read(File file) throws IOException {
var tempTokens = findLineByLabel(reader, THICKNESS, delims).split(delims);
final double thickness = Double.parseDouble( tempTokens[tempTokens.length - 1] ) * TO_METRES;

tempTokens = findLineByLabel(reader, DIAMETER, delims).split(delims);
final double diameter = Double.parseDouble( tempTokens[tempTokens.length - 1] ) * TO_METRES;

tempTokens = findLineByLabel(reader, SAMPLE_TEMPERATURE, delims).split(delims);
final double sampleTemperature = Double.parseDouble( tempTokens[tempTokens.length - 1] ) + TO_KELVIN;

Expand All @@ -109,6 +113,9 @@ public List<ExperimentalData> read(File file) throws IOException {

var met = new Metadata(derive(TEST_TEMPERATURE, sampleTemperature), shotId);
met.set(NumericPropertyKeyword.THICKNESS, derive(NumericPropertyKeyword.THICKNESS, thickness));
met.set(NumericPropertyKeyword.DIAMETER, derive(NumericPropertyKeyword.DIAMETER, diameter));
met.set(NumericPropertyKeyword.FOV_OUTER, derive(NumericPropertyKeyword.FOV_OUTER, 0.85*diameter));
met.set(NumericPropertyKeyword.SPOT_DIAMETER, derive(NumericPropertyKeyword.SPOT_DIAMETER, 0.94*diameter));

curve.setMetadata(met);
curve.setRange(new Range(curve.getTimeSequence()));
Expand Down

0 comments on commit 8fb90b3

Please sign in to comment.