16
16
xyz_to_uvw_rotation_matrix ,
17
17
z_rotation_matrix ,
18
18
)
19
+ from fastimgproto .utils import reset_progress_bar
19
20
20
21
_validator_optional_ndarray = attr .validators .optional (
21
22
attr .validators .instance_of (np .ndarray ))
@@ -208,7 +209,7 @@ def _uvw_tracking_skycoord_by_lha(self, pointing_centre, obs_times,
208
209
return lha_uvw_map
209
210
210
211
def uvw_tracking_skycoord (self , pointing_centre , obs_times ,
211
- pbar = None ):
212
+ progress_bar = None ):
212
213
"""
213
214
Calculate the UVW-array towards pointing centre for all obs_times.
214
215
@@ -222,25 +223,24 @@ def uvw_tracking_skycoord(self, pointing_centre, obs_times,
222
223
for UVW calculation.
223
224
obs_times (list): List of :class:`astropy.time.Time`, the instants
224
225
of observation.
225
- pbar (tqdm.tqdm): [Optional] progressbar to update.
226
+ progress_bar (tqdm.tqdm): [Optional] progressbar to update.
226
227
Returns:
227
228
astropy.units.Quantity: UVW-array, with units of metres.
228
229
"""
229
230
n_baselines = len (self .baseline_local_xyz )
230
231
uvw_array = np .zeros ((len (obs_times ) * n_baselines , 3 ),
231
232
dtype = np .float_ ) * self .baseline_local_xyz .unit
232
- if pbar is not None :
233
- pbar .total = len (obs_times )
234
- pbar .desc = 'Generating UVW-baselines'
233
+ if progress_bar is not None :
234
+ reset_progress_bar (progress_bar , len (obs_times ), 'Generating UVW-baselines' )
235
235
236
236
for idx , time in enumerate (obs_times ):
237
237
lha = self .lha (pointing_centre .ra , time )
238
238
output_slice = slice (idx * n_baselines , (idx + 1 ) * n_baselines )
239
239
uvw_array [output_slice ] = self .uvw_at_local_hour_angle (
240
240
local_hour_angle = lha , dec = pointing_centre .dec
241
241
)
242
- if pbar is not None :
243
- pbar .update ()
242
+ if progress_bar is not None :
243
+ progress_bar .update ()
244
244
return uvw_array
245
245
246
246
0 commit comments