From 5aa438ec68adf74c77131a04dadc7d065c6c48b2 Mon Sep 17 00:00:00 2001 From: Israel Martinez Date: Wed, 27 Nov 2024 10:56:59 -0500 Subject: [PATCH] No need to pass paramter_file separately. YAYC Configurator keeps track of the path --- cosipy/image_deconvolution/RichardsonLucy.py | 2 +- cosipy/image_deconvolution/RichardsonLucyParallel.py | 6 +++--- cosipy/image_deconvolution/RichardsonLucySimple.py | 2 +- cosipy/image_deconvolution/image_deconvolution.py | 11 +---------- 4 files changed, 6 insertions(+), 15 deletions(-) diff --git a/cosipy/image_deconvolution/RichardsonLucy.py b/cosipy/image_deconvolution/RichardsonLucy.py index 46eedc57..99e038d2 100644 --- a/cosipy/image_deconvolution/RichardsonLucy.py +++ b/cosipy/image_deconvolution/RichardsonLucy.py @@ -36,7 +36,7 @@ class RichardsonLucy(DeconvolutionAlgorithmBase): """ - def __init__(self, initial_model, dataset, mask, parameter, parameter_filepath = None): + def __init__(self, initial_model, dataset, mask, parameter): DeconvolutionAlgorithmBase.__init__(self, initial_model, dataset, mask, parameter) diff --git a/cosipy/image_deconvolution/RichardsonLucyParallel.py b/cosipy/image_deconvolution/RichardsonLucyParallel.py index 031266d2..b86186fe 100644 --- a/cosipy/image_deconvolution/RichardsonLucyParallel.py +++ b/cosipy/image_deconvolution/RichardsonLucyParallel.py @@ -25,7 +25,7 @@ class RichardsonLucyParallel(DeconvolutionAlgorithmBase): background_normalization_optimization: True """ - def __init__(self, initial_model, dataset, mask, parameter, parameter_filepath): + def __init__(self, initial_model, dataset, mask, parameter): """ NOTE: Copied from RichardsonLucy.py """ @@ -67,7 +67,7 @@ def __init__(self, initial_model, dataset, mask, parameter, parameter_filepath): self.data_dir = parameter.get('data_dir', './data') # NOTE: Data should ideally be present in disk scratch space. self.numrows = np.product(image_response.contents.shape[-3:]) # Em, Phi, PsiChi. NOTE: Change the "-3" if more general model space definitions are expected self.numcols = np.product(image_response.contents.shape[:-3]) # Remaining columns - self.config_file = parameter_filepath + self.config_file = parameter.absolute_path def initialization(self): """ @@ -151,4 +151,4 @@ def post_processing(self): def check_stopping_criteria(self): pass def register_result(self): - pass \ No newline at end of file + pass diff --git a/cosipy/image_deconvolution/RichardsonLucySimple.py b/cosipy/image_deconvolution/RichardsonLucySimple.py index c9eea0c1..65fde9d6 100644 --- a/cosipy/image_deconvolution/RichardsonLucySimple.py +++ b/cosipy/image_deconvolution/RichardsonLucySimple.py @@ -22,7 +22,7 @@ class RichardsonLucySimple(DeconvolutionAlgorithmBase): background_normalization_optimization: True """ - def __init__(self, initial_model, dataset, mask, parameter, parameter_filepath = None): + def __init__(self, initial_model, dataset, mask, parameter): DeconvolutionAlgorithmBase.__init__(self, initial_model, dataset, mask, parameter) diff --git a/cosipy/image_deconvolution/image_deconvolution.py b/cosipy/image_deconvolution/image_deconvolution.py index 9720875f..e07c4d85 100644 --- a/cosipy/image_deconvolution/image_deconvolution.py +++ b/cosipy/image_deconvolution/image_deconvolution.py @@ -62,7 +62,6 @@ def read_parameterfile(self, parameter_filepath): Path of parameter file. """ - self._parameter_filepath = parameter_filepath self._parameter = Configurator.open(parameter_filepath) logger.debug(f"parameter file for image deconvolution was set -> {parameter_filepath}") @@ -81,13 +80,6 @@ def parameter(self): """ return self._parameter - @property - def parameter_filepath(self): - """ - Return the registered parameter filepath. - """ - return self._parameter_filepath - def override_parameter(self, *args): """ Override parameter @@ -207,8 +199,7 @@ def register_deconvolution_algorithm(self): self._deconvolution = self._deconvolution_class(initial_model = self.initial_model, dataset = self.dataset, mask = self.mask, - parameter = algorithm_parameter, - parameter_filepath = self.parameter_filepath) + parameter = algorithm_parameter) logger.info("---- parameters ----") logger.info(parameter_deconvolution.dump())