Skip to content

Commit

Permalink
Fix lint errors in updated GE reader
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcraven authored Nov 5, 2024
1 parent bdf8334 commit 97455bc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 7 additions & 3 deletions spec2nii/GE/ge_pfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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'
Expand Down
10 changes: 5 additions & 5 deletions spec2nii/GE/ge_read_pfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'):
Expand Down Expand Up @@ -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]
Expand All @@ -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]
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 97455bc

Please sign in to comment.