Bug Description
In SignalObj.m, the shiftMe method updates sObj.data and sObj.time but does not update sObj.minTime or sObj.maxTime. After calling shiftMe, these properties are stale and any code that relies on them (e.g., alignTime, findPeaks's default minDistance, duration calculations) will use the pre-shift time bounds.
Location
SignalObj.m, lines 1496–1506:
function shiftMe(sObj,deltaT,updateLabels)
if(nargin<3)
updateLabels=0;
end
sTemp = sObj.shift(deltaT,updateLabels);
sObj.data=sTemp.data;
sObj.time=sTemp.time;
% BUG: sObj.minTime and sObj.maxTime are never updated
end
Expected Behavior
After shifting, minTime and maxTime should reflect the new time vector:
function shiftMe(sObj,deltaT,updateLabels)
if(nargin<3)
updateLabels=0;
end
sTemp = sObj.shift(deltaT,updateLabels);
sObj.data=sTemp.data;
sObj.time=sTemp.time;
sObj.minTime=min(sObj.time);
sObj.maxTime=max(sObj.time);
end
Impact
alignTime calls shiftMe but then checks sObj.minTime / sObj.maxTime for subsequent operations — these remain at pre-shift values.
findPeaks' default minDistance is computed from sObj.maxTime - sObj.minTime, which would be incorrect after a shift.
- Any user code reading
.minTime / .maxTime after a shift gets wrong values.
Found During
Python port (cajigaslab/nSTAT-python) — fixed in the Python implementation.
Bug Description
In
SignalObj.m, theshiftMemethod updatessObj.dataandsObj.timebut does not updatesObj.minTimeorsObj.maxTime. After callingshiftMe, these properties are stale and any code that relies on them (e.g.,alignTime,findPeaks's defaultminDistance, duration calculations) will use the pre-shift time bounds.Location
SignalObj.m, lines 1496–1506:Expected Behavior
After shifting,
minTimeandmaxTimeshould reflect the new time vector:Impact
alignTimecallsshiftMebut then checkssObj.minTime/sObj.maxTimefor subsequent operations — these remain at pre-shift values.findPeaks' defaultminDistanceis computed fromsObj.maxTime - sObj.minTime, which would be incorrect after a shift..minTime/.maxTimeafter a shift gets wrong values.Found During
Python port (cajigaslab/nSTAT-python) — fixed in the Python implementation.