From 97455bc3786c5ae017ff2904d91a7e86d0d89ea6 Mon Sep 17 00:00:00 2001 From: Alexander R Craven <12934018+alexcraven@users.noreply.github.com> Date: Tue, 5 Nov 2024 14:39:23 +0100 Subject: [PATCH] Fix lint errors in updated GE reader --- spec2nii/GE/ge_pfile.py | 10 +++++++--- spec2nii/GE/ge_read_pfile.py | 10 +++++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/spec2nii/GE/ge_pfile.py b/spec2nii/GE/ge_pfile.py index 4de2aa4..4af6bd4 100644 --- a/spec2nii/GE/ge_pfile.py +++ b/spec2nii/GE/ge_pfile.py @@ -90,7 +90,7 @@ def _process_svs_pfile(pfile): :return: List of file name suffixes """ - assert(pfile.encoding is not None) # encoding should have been set in ge_read_pfile get_mapper + assert pfile.encoding is not None # encoding should have been set in ge_read_pfile get_mapper psd = pfile.hdr.rhi_psdname.decode(pfile.encoding, errors='replace').lower() proto = pfile.hdr.rhs_se_desc.decode(pfile.encoding, errors='replace').lower() @@ -433,7 +433,7 @@ def _process_mrsi_pfile(pfile): :return: List of file name suffixes """ - assert(pfile.encoding is not None) # encoding should have been set in ge_read_pfile get_mapper + assert pfile.encoding is not None # encoding should have been set in ge_read_pfile get_mapper psd = pfile.hdr.rhi_psdname.decode(pfile.encoding, errors='replace').lower() @@ -591,7 +591,11 @@ def _populate_metadata(pfile, water_suppressed=True, data_dimensions=None): # 'TxCoil' # Not Known # 'RxCoil' - meta.set_user_def(key='ReceiveCoilName', value=hdr.rhi_cname.decode(pfile.encoding, errors='replace'), doc='Rx coil name.') + meta.set_user_def( + key="ReceiveCoilName", + value=hdr.rhi_cname.decode(pfile.encoding, errors="replace"), + doc="Rx coil name.", + ) # # 5.3 Sequence information # 'SequenceName' diff --git a/spec2nii/GE/ge_read_pfile.py b/spec2nii/GE/ge_read_pfile.py index caf6811..b45b94a 100644 --- a/spec2nii/GE/ge_read_pfile.py +++ b/spec2nii/GE/ge_read_pfile.py @@ -194,14 +194,14 @@ def get_mapper(self): if psd == "hbcd" and "press" in proto: psd = self.hdr.rhs_se_desc.decode(encoding, errors).lower() - except UnicodeDecodeError as err: + except UnicodeDecodeError: psd = "" proto = "" continue self.encoding = encoding break - assert(self.encoding is not None) # final codec must should have succeeded + assert self.encoding is not None # final codec must should have succeeded # MM: Some 'gaba' psd strings contain full path names, so truncate to the end of the path if psd.endswith('gaba'): @@ -667,7 +667,7 @@ def get_dcos(self): dcos[0][0] = (self.hdr.rhi_trhc_R - self.hdr.rhi_tlhc_R) dcos[0][1] = (self.hdr.rhi_trhc_A - self.hdr.rhi_tlhc_A) - dcos[0][2] = (self.hdr.rhi_trhc_S - self.hdr.rhi_tlhc_S) + dcos[0][2] = (self.hdr.rhi_trhc_S - self.hdr.rhi_tlhc_S) dcosLengthX = np.sqrt(dcos[0][0] * dcos[0][0] + dcos[0][1] * dcos[0][1] @@ -679,7 +679,7 @@ def get_dcos(self): dcos[1][0] = (self.hdr.rhi_brhc_R - self.hdr.rhi_trhc_R) dcos[1][1] = (self.hdr.rhi_brhc_A - self.hdr.rhi_trhc_A) - dcos[1][2] = (self.hdr.rhi_brhc_S - self.hdr.rhi_trhc_S) + dcos[1][2] = (self.hdr.rhi_brhc_S - self.hdr.rhi_trhc_S) dcosLengthY = np.sqrt(dcos[1][0] * dcos[1][0] + dcos[1][1] * dcos[1][1] @@ -1008,7 +1008,7 @@ def read_data(self): numTimePts = self.get_num_time_points numSpecPts = self.hdr.rhr_rh_frame_size numFreqPts = numSpecPts - numComponents = 2 + numComponents = 2 dataWordSize = self.hdr.rhr_rh_point_size numBytesInVol = self.get_num_kspace_points * numSpecPts * numComponents * dataWordSize