Skip to content

Commit

Permalink
Use list comprehensions
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitriPapadopoulos committed Sep 30, 2023
1 parent fee3141 commit 20fac3b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
7 changes: 4 additions & 3 deletions spec2nii/GE/ge_pfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,10 @@ def _process_svs_pfile(pfile):

orientation = NIFTIOrient(_calculate_affine(pfile))

out_nmrs = []
for dd, mm in zip(data, meta):
out_nmrs.append(gen_nifti_mrs_hdr_ext(dd, dwelltime, mm, orientation.Q44, no_conj=True))
out_nmrs = [
gen_nifti_mrs_hdr_ext(dd, dwelltime, mm, orientation.Q44, no_conj=True)
for dd, mm in zip(data, meta)
]

return out_nmrs, fname_suffix

Expand Down
9 changes: 5 additions & 4 deletions spec2nii/Philips/philips_data_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,11 @@ def read_data_list_pair(data_file, list_file, aux_file, special_case=None):

meta = base_meta.copy()

kept_ind = []
for ii, sha in zip(indices, data.shape[1:]):
if sha > 1:
kept_ind.append(ii)
kept_ind = [
ii
for ii, sha in zip(indices, data.shape[1:])
if sha > 1
]

out_data = data.squeeze()
if len(kept_ind) > 3:
Expand Down

0 comments on commit 20fac3b

Please sign in to comment.