Skip to content

Commit

Permalink
Make RL work with no units
Browse files Browse the repository at this point in the history
  • Loading branch information
israelmcmc committed Jul 24, 2024
1 parent 0c90da1 commit 4f637d6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion cosipy/image_deconvolution/deconvolution_algorithm_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ def __init__(self, initial_model, dataset, mask, parameter):
logger.debug(f'dict_bkg_norm: {self.dict_bkg_norm}')
logger.debug(f'dict_dataset_indexlist_for_bkg_models: {self.dict_dataset_indexlist_for_bkg_models}')

self.minimum_flux = parameter.get('minimum_flux:value', 0.0) * u.Unit(parameter.get('minimum_flux:unit', initial_model.unit))
self.minimum_flux = parameter.get('minimum_flux:value', 0.0)

minimum_flux_unit = parameter.get('minimum_flux:unit', initial_model.unit)
if minimum_flux_unit is not None:
self.minimum_flux = self.minimum_flux*u.Unit(minimum_flux_unit)

# parameters of the iteration
self.iteration_count = 0
Expand Down
2 changes: 1 addition & 1 deletion cosipy/image_deconvolution/model_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def mask_pixels(self, mask, fill_value = 0):
fill_value: float or :py:class:`astropy.units.quantity.Quantity`
"""

if not isinstance(fill_value, u.quantity.Quantity):
if not isinstance(fill_value, u.quantity.Quantity) and self.unit is not None:
fill_value *= self.contents.unit

model_new = copy.deepcopy(self)
Expand Down

0 comments on commit 4f637d6

Please sign in to comment.