Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2004-2022 The MZmine Development Team
* Copyright (c) 2004-2024 The mzmine Development Team
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
Expand Down Expand Up @@ -143,10 +143,28 @@ public List<Range<Double>> resolve(double[] x, double[] y) {
// Check the shape of the peak.
if (numberOfDataPoints >= minDataPoints && currentRegionHeight >= minHeight
&& currentRegionHeight >= peakMinLeft * minRatio
&& currentRegionHeight >= peakMinRight * minRatio && xRange
.contains(x[currentRegionEnd] - x[currentRegionStart])) {
&& currentRegionHeight >= peakMinRight * minRatio && xRange.contains(
x[currentRegionEnd] - x[currentRegionStart])) {

// adjust start and end points of signals to produce better peak shapes
// (e.g. include 0 intensity points on the edges.), as start and end points of this
// resolver will never be 0.
int start;
if (y[currentRegionStart] != 0 && y[Math.max(currentRegionStart - 1, 0)] == 0.0) {
start = currentRegionStart - 1;
} else {
start = currentRegionStart;
}

int end;
if (y[currentRegionEnd] != 0
&& y[Math.min(currentRegionEnd + 1, y.length - 1)] == 0.0) {
end = currentRegionEnd + 1;
} else {
end = currentRegionEnd;
}

resolved.add(Range.closed(x[currentRegionStart], x[currentRegionEnd]));
resolved.add(Range.closed(x[start], x[end]));
}

// Set the next region start to current region end - 1
Expand Down Expand Up @@ -203,8 +221,8 @@ public List<Range<Double>> resolve(double[] x, double[] y) {
// Check the shape of the peak.
if (numberOfDataPoints >= minDataPoints && currentRegionHeight >= minHeight
&& currentRegionHeight >= peakMinLeft * minRatio
&& currentRegionHeight >= peakMinRight * minRatio && xRange
.contains(x[currentRegionEnd] - x[currentRegionStart])) {
&& currentRegionHeight >= peakMinRight * minRatio && xRange.contains(
x[currentRegionEnd] - x[currentRegionStart])) {

resolved.add(Range.closed(x[currentRegionStart], x[currentRegionEnd]));
}
Expand Down