File tree 3 files changed +14
-17
lines changed
cosipy/image_deconvolution
3 files changed +14
-17
lines changed Original file line number Diff line number Diff line change @@ -48,8 +48,15 @@ def main():
48
48
parameter_filepath = DATA_DIR / 'imagedeconvolution_parfile_gal_511keV.yml'
49
49
image_deconvolution .read_parameterfile (parameter_filepath )
50
50
51
+ parallel_computation = True
52
+ if comm .Get_rank () == MASTER :
53
+ master_node = True
54
+ else :
55
+ master_node = False
56
+
51
57
# Initialize model
52
- image_deconvolution .initialize (comm = comm )
58
+ image_deconvolution .initialize (parallel_computation = parallel_computation ,
59
+ master_node = master_node )
53
60
54
61
# Execute deconvolution
55
62
image_deconvolution .run_deconvolution ()
Original file line number Diff line number Diff line change @@ -262,9 +262,9 @@ def finalization(self):
262
262
for this_result in self .results :
263
263
iteration_count = this_result ["iteration" ]
264
264
265
- this_result ["model" ].write (f"{ self .save_results_directory } /model_itr{ iteration_count } _2 .hdf5" , overwrite = True )
266
- this_result ["delta_model" ].write (f"{ self .save_results_directory } /delta_model_itr{ iteration_count } _2 .hdf5" , overwrite = True )
267
- this_result ["processed_delta_model" ].write (f"{ self .save_results_directory } /processed_delta_model_itr{ iteration_count } _2 .hdf5" , overwrite = True )
265
+ this_result ["model" ].write (f"{ self .save_results_directory } /model_itr{ iteration_count } .hdf5" , overwrite = True )
266
+ this_result ["delta_model" ].write (f"{ self .save_results_directory } /delta_model_itr{ iteration_count } .hdf5" , overwrite = True )
267
+ this_result ["processed_delta_model" ].write (f"{ self .save_results_directory } /processed_delta_model_itr{ iteration_count } .hdf5" , overwrite = True )
268
268
269
269
#fits
270
270
primary_hdu = fits .PrimaryHDU ()
Original file line number Diff line number Diff line change 11
11
from .RichardsonLucy import RichardsonLucy
12
12
from .RichardsonLucySimple import RichardsonLucySimple
13
13
14
- # MPI Master node
15
- MASTER = 0
16
-
17
14
class ImageDeconvolution :
18
15
"""
19
16
A class to reconstruct all-sky images from COSI data based on image deconvolution methods.
@@ -121,21 +118,14 @@ def results(self):
121
118
"""
122
119
return self ._deconvolution .results
123
120
124
- def initialize (self , comm = None ): # comm is required if the user intends to use parallel features
121
+ def initialize (self , parallel_computation = False , master_node = True ):
125
122
"""
126
123
Initialize an initial model and an image deconvolution algorithm.
127
124
It is mandatory to execute this method before running the image deconvolution.
128
125
"""
129
126
130
- if comm is None :
131
- self .parallel_computation = False
132
- self .master_node = True
133
- elif comm .Get_rank () == MASTER :
134
- self .parallel_computation = True
135
- self .master_node = True
136
- else :
137
- self .parallel_computation = True
138
- self .master_node = False
127
+ self .parallel_computation = parallel_computation
128
+ self .master_node = master_node
139
129
140
130
logger .info ("#### Initialization Starts ####" )
141
131
You can’t perform that action at this time.
0 commit comments