Skip to content

Commit

Permalink
add safety check for scale == 0
Browse files Browse the repository at this point in the history
  • Loading branch information
JannesSP committed Nov 27, 2024
1 parent 314b132 commit 249176d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions read5/AbstractFileReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -1005,6 +1005,10 @@ def getPolyAStandardizedSignal(self, readid : str, polyAstart : int, polyAend :
shift = np.mean(polyASignal)
scale = np.std(polyASignal)

# safety check when working with simulated signals where stdev = 0
if scale == 0:
scale = 1

return ((self.getpASignal(readid) - shift) / scale) * polyAStdev + polyAMean

def getStartTimeInMinutes(self, readid) -> float:
Expand Down

0 comments on commit 249176d

Please sign in to comment.