diff --git a/wfdb/io/_signal.py b/wfdb/io/_signal.py index a7f124fb..868d3596 100644 --- a/wfdb/io/_signal.py +++ b/wfdb/io/_signal.py @@ -698,9 +698,9 @@ def convert_dtype(self, physical, return_res, smooth_frames): N/A """ - if physical is True: + if physical: return_dtype = 'float'+str(return_res) - if smooth_frames is True: + if smooth_frames: current_dtype = self.p_signal.dtype if current_dtype != return_dtype: self.p_signal = self.p_signal.astype(return_dtype, copy=False) @@ -715,7 +715,7 @@ def convert_dtype(self, physical, return_res, smooth_frames): self.p_signal[ch] = self.p_signal[ch].astype(return_dtype, copy=False) else: return_dtype = 'int'+str(return_res) - if smooth_frames is True: + if smooth_frames: current_dtype = self.d_signal.dtype if current_dtype != return_dtype: # Do not allow changing integer dtype to lower value due to over/underflow @@ -1891,7 +1891,7 @@ def _np_dtype(bit_res, discrete): if bit_res <= np_res: break - if discrete is True: + if discrete: return 'int' + str(np_res) else: # No float8 dtype diff --git a/wfdb/io/record.py b/wfdb/io/record.py index 077c03b5..bc51cda8 100644 --- a/wfdb/io/record.py +++ b/wfdb/io/record.py @@ -409,12 +409,12 @@ def check_read_inputs(self, sampfrom, sampto, channels, physical, if return_res not in [64, 32, 16, 8]: raise ValueError("return_res must be one of the following: 64, 32, 16, 8") - if physical is True and return_res == 8: + if physical and return_res == 8: raise ValueError("return_res must be one of the following when physical is True: 64, 32, 16") # Cannot expand multiple samples/frame for multi-segment records if isinstance(self, MultiRecord): - if smooth_frames is False: + if not smooth_frames: raise ValueError('This package version cannot expand all samples when reading multi-segment records. Must enable frame smoothing.')