66from astropy import units as un
77from astropy .time import Time
88from joblib import Parallel , delayed
9- from rich import print
9+ from rich . pretty import pretty_repr
1010from tqdm .auto import tqdm
1111
1212import pyvisgen .fits .writer as writer
2222from pyvisgen .simulation .visibility import vis_loop
2323from pyvisgen .utils .config import read_data_set_conf
2424from pyvisgen .utils .data import load_bundles , open_bundles
25+ from pyvisgen .utils .logging import setup_logger
2526
2627__all__ = ["SimulateDataSet" ]
2728
29+ LOGGER = setup_logger ()
2830
2931DATEFMT = "%d-%m-%Y %H:%M:%S"
3032
@@ -111,7 +113,8 @@ def from_config(
111113 else :
112114 raise ValueError ("Expected config to be one of str, Path or dict!" )
113115
114- print ("Simulation Config:\n " , cls .conf )
116+ LOGGER .info ("Simulation Config:" )
117+ LOGGER .info (pretty_repr (cls .conf ))
115118
116119 cls .device = cls .conf ["device" ]
117120
@@ -125,7 +128,7 @@ def from_config(
125128
126129 cls .data_paths = load_bundles (cls .conf ["in_path" ])
127130
128- if not cls .num_images :
131+ if cls .num_images is None :
129132 data_bundles = tqdm (
130133 range (len (cls .data_paths )),
131134 position = 0 ,
@@ -211,7 +214,7 @@ def _run(self) -> None:
211214 truth_fft = convert_real_imag (truth_fft , sky_sim = True )
212215
213216 if sim_data .shape [1 ] != 2 :
214- raise ValueError ("Expected sim_data axis 1 to be 2!" )
217+ raise ValueError ("Expected sim_data axis at index 1 to be 2!" )
215218
216219 out = self .out_path / Path (
217220 f"samp_{ self .conf ['file_prefix' ]} _" + str (i ) + ".h5"
@@ -234,7 +237,7 @@ def _run(self) -> None:
234237 f"samp_{ self .conf ['file_prefix' ]} _<id>.fits"
235238 )
236239
237- print (
240+ LOGGER . info (
238241 f"Successfully simulated and saved { samp_opts_idx } images to '{ path_msg } '!"
239242 )
240243
0 commit comments