From 4bda72739f01c1e79fc21c4f33b84e6e7c7854d5 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Wed, 11 Sep 2024 14:33:51 +0100 Subject: [PATCH] slight lint --- SIRF_data_preparation/Mediso_NEMA_IQ/README.md | 2 +- SIRF_data_preparation/Mediso_NEMA_IQ/prepare.py | 5 +++-- SIRF_data_preparation/plot_BSREM_metrics.py | 4 ++-- petric.py | 3 ++- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/SIRF_data_preparation/Mediso_NEMA_IQ/README.md b/SIRF_data_preparation/Mediso_NEMA_IQ/README.md index 670bce5..3aaec0a 100644 --- a/SIRF_data_preparation/Mediso_NEMA_IQ/README.md +++ b/SIRF_data_preparation/Mediso_NEMA_IQ/README.md @@ -12,7 +12,7 @@ cd Mediso_NEMA_IQ/ # trim sinograms to avoid "corner" problems in mult_factors # TODO for next data: use 30 (as some problems remain) for f in additive_term.hs mult_factors.hs prompts.hs; do - SSRB -t 20 $f $orgpath/sinograms/$f; + SSRB -t 20 $f $orgpath/sinograms/$f done # alternative if we don't need to trim #cp -rp $orgpath/sinograms/* . diff --git a/SIRF_data_preparation/Mediso_NEMA_IQ/prepare.py b/SIRF_data_preparation/Mediso_NEMA_IQ/prepare.py index 68c2f42..82ad5f6 100644 --- a/SIRF_data_preparation/Mediso_NEMA_IQ/prepare.py +++ b/SIRF_data_preparation/Mediso_NEMA_IQ/prepare.py @@ -1,10 +1,11 @@ # Set NaNs to zero in additive_term -import sirf.STIR import numpy as np + +import sirf.STIR + additive = sirf.STIR.AcquisitionData('additive_term.hs') add_arr = additive.as_array() add_arr = np.nan_to_num(add_arr) new_add = additive.clone() new_add.fill(add_arr) new_add.write('additive_term.hs') - diff --git a/SIRF_data_preparation/plot_BSREM_metrics.py b/SIRF_data_preparation/plot_BSREM_metrics.py index a5d0606..39bb828 100644 --- a/SIRF_data_preparation/plot_BSREM_metrics.py +++ b/SIRF_data_preparation/plot_BSREM_metrics.py @@ -1,4 +1,4 @@ -#%% +# %% # """Preliminary file to check evolution of metrics as well as pass_index""" # %load_ext autoreload # %autoreload 2 @@ -71,7 +71,7 @@ reference_image = STIR.ImageData(str(datadir / 'iter_final.hv')) qm = QualityMetrics(reference_image, data.whole_object_mask, data.background_mask, tb_summary_writer=None, voi_mask_dict=data.voi_masks) -#%% get update ("iteration") numbers from objective functions +# %% get update ("iteration") numbers from objective functions last_iteration = int(objs[-1, 0] + .5) # find interval(don't use last value, as that interval can be smaller) iteration_interval = int(objs[-2, 0] - objs[-3, 0] + .5) diff --git a/petric.py b/petric.py index 18fb47a..bef5936 100755 --- a/petric.py +++ b/petric.py @@ -141,7 +141,8 @@ def keys(self): class MetricsWithTimeout(cil_callbacks.Callback): """Stops the algorithm after `seconds`""" - def __init__(self, seconds=600, outdir=OUTDIR, transverse_slice=None, coronal_slice=None, sagittal_slice=None, **kwargs): + def __init__(self, seconds=600, outdir=OUTDIR, transverse_slice=None, coronal_slice=None, sagittal_slice=None, + **kwargs): super().__init__(**kwargs) self._seconds = seconds self.callbacks = [