Skip to content

Commit

Permalink
No need to pass paramter_file separately. YAYC Configurator keeps tra…
Browse files Browse the repository at this point in the history
…ck of the path
  • Loading branch information
israelmcmc committed Nov 27, 2024
1 parent 27c8afe commit 5aa438e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 15 deletions.
2 changes: 1 addition & 1 deletion cosipy/image_deconvolution/RichardsonLucy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 3 additions & 3 deletions cosipy/image_deconvolution/RichardsonLucyParallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
Expand Down Expand Up @@ -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

Check warning on line 70 in cosipy/image_deconvolution/RichardsonLucyParallel.py

View check run for this annotation

Codecov / codecov/patch

cosipy/image_deconvolution/RichardsonLucyParallel.py#L63-L70

Added lines #L63 - L70 were not covered by tests

def initialization(self):
"""
Expand Down Expand Up @@ -151,4 +151,4 @@ def post_processing(self):
def check_stopping_criteria(self):
pass

Check warning on line 152 in cosipy/image_deconvolution/RichardsonLucyParallel.py

View check run for this annotation

Codecov / codecov/patch

cosipy/image_deconvolution/RichardsonLucyParallel.py#L152

Added line #L152 was not covered by tests
def register_result(self):
pass
pass

Check warning on line 154 in cosipy/image_deconvolution/RichardsonLucyParallel.py

View check run for this annotation

Codecov / codecov/patch

cosipy/image_deconvolution/RichardsonLucyParallel.py#L154

Added line #L154 was not covered by tests
2 changes: 1 addition & 1 deletion cosipy/image_deconvolution/RichardsonLucySimple.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
11 changes: 1 addition & 10 deletions cosipy/image_deconvolution/image_deconvolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand All @@ -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
Expand Down Expand Up @@ -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())
Expand Down

0 comments on commit 5aa438e

Please sign in to comment.