Skip to content

Commit

Permalink
Modified unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
hiyoneda committed Jul 24, 2024
1 parent 874c6a2 commit 8c942e4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ deconvolution:
algorithm: "RLsimple"
parameter:
iteration_max: 2
background_normalization_optimization: True
background_normalization_optimization:
activate: True
26 changes: 13 additions & 13 deletions tests/image_deconvolution/test_algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@

from cosipy.image_deconvolution import RichardsonLucySimple, RichardsonLucy

def test_RicharsonLucySimple(dataset, model, mask):
def test_RicharsonLucySimple(dataset, model, mask, tmp_path):

parameter = Configurator({"iteration_max": 2,
"minimum_flux": {"value": 0.0, "unit": "cm-2 s-1 sr-1"},
"background_normalization_optimization": True})
"background_normalization_optimization": {"activate": True,
"range": {"bkg": [0.9, 1.1]}},
"save_results": {"activate": True, "directory": f"{str(tmp_path)}", "only_final_result": True}
})

algorithm = RichardsonLucySimple(initial_model = model,
dataset = dataset,
Expand All @@ -25,16 +28,13 @@ def test_RicharsonLucy(dataset, model, mask, tmp_path):

parameter = Configurator({"iteration_max": 2,
"minimum_flux": {"value": 0.0, "unit": "cm-2 s-1 sr-1"},
"acceleration": True,
"alpha_max": 10.0,
"response_weighting": True,
"response_weighting_index": 0.5,
"smoothing": True,
"smoothing_FWHM": {"value": 2.0, "unit": "deg"},
"background_normalization_optimization": True,
"background_normalization_range": {"bkg": [0.9, 1.1]},
"save_results": True,
"save_results_directory": f"{str(tmp_path)}/results"})
"acceleration": {"activate": True, "alpha_max": 10.0},
"response_weighting": {"activate": True, "index": 0.5},
"smoothing": {"activate": True, "FWHM": {"value": 2.0, "unit": "deg"}},
"background_normalization_optimization": {"activate": True,
"range": {"bkg": [0.9, 1.1]}},
"save_results": {"activate": True, "directory": f"{str(tmp_path)}", "only_final_result": True}
})

# w/ acceleration
algorithm = RichardsonLucy(initial_model = model,
Expand All @@ -50,7 +50,7 @@ def test_RicharsonLucy(dataset, model, mask, tmp_path):
algorithm.finalization()

# wo/ acceleration and overwrite the directory
parameter["acceleration"] = False
parameter["acceleration:activate"] = False

algorithm = RichardsonLucy(initial_model = model,
dataset = dataset,
Expand Down

0 comments on commit 8c942e4

Please sign in to comment.