Skip to content

Commit

Permalink
formatted with black package
Browse files Browse the repository at this point in the history
  • Loading branch information
briangow committed Oct 29, 2024
1 parent c9808ad commit 0615440
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions wfdb/io/_signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,9 @@ def calc_adc_params(self):
maxvals = np.nanmax(self.p_signal, axis=0)

for ch in range(np.shape(self.p_signal)[1]):
adc_gain, baseline = self.calc_adc_gain_baseline(ch, minvals, maxvals)
adc_gain, baseline = self.calc_adc_gain_baseline(
ch, minvals, maxvals
)
adc_gains.append(adc_gain)
baselines.append(baseline)

Expand All @@ -841,16 +843,22 @@ def calc_adc_params(self):
minvals.append(min(x for x in ch if not math.isnan(x)))
maxvals.append(max(x for x in ch if not math.isnan(x)))

if any(x == math.inf for x in minvals) or any(x == math.inf for x in maxvals):
if any(x == math.inf for x in minvals) or any(
x == math.inf for x in maxvals
):
raise ValueError("Signal contains inf. Cannot perform adc.")

for ch, _ in enumerate(self.e_p_signal):
adc_gain, baseline = self.calc_adc_gain_baseline(ch, minvals, maxvals)
adc_gain, baseline = self.calc_adc_gain_baseline(
ch, minvals, maxvals
)
adc_gains.append(adc_gain)
baselines.append(baseline)

else:
raise Exception('Must supply p_signal or e_p_signal to calc_adc_params')
raise Exception(
"Must supply p_signal or e_p_signal to calc_adc_params"
)

return (adc_gains, baselines)

Expand Down

0 comments on commit 0615440

Please sign in to comment.