I am running a customized workflow similar to toast_sim_ground.py with a few tweaks on the weather parameters for each observing session.
After calling sim_ground.apply(data), I need to:
- Redraw wind parameters with a more realistic distribution — the default wind speed in TOAST for Atacama is usually ~a few m/s (10m above the telescope), but observations (eg ACT : modeling bulk atmospheric motion) report values closer to tens of m/s. My understanding is that TOAST implement linear wind speed, and thus the speed is also too small at high altitudes.
- Redraw PWV rather than discarding observations that exceed a threshold.
The Weather class exposes PWV and wind parameters as read-only properties, with no public setter. To modify them I am forced to access protected attributes directly (_sim_pwv, _sim_west_wind, _sim_south_wind), which I probably should not do:
for i, ob in enumerate(data.obs):
weather = ob.telescope.site.weather
wind_mag = rand_gaussian_quantity(
avg_wind_speed * u.m / u.s, sigma_wind_speed * u.m / u.s, seed=seed_base + i
)
np.random.seed(seed_base + i)
angle = np.random.uniform(0, 2 * np.pi)
weather._sim_west_wind = np.cos(angle) * wind_mag
weather._sim_south_wind = np.sin(angle) * wind_mag
if ob.comm_col_rank == 0:
print(f"Start : {ob.session.start}", flush=True)
print(f"End : {ob.session.end}", flush=True)
print(f"West wind : {ob.telescope.site.weather.west_wind}", flush=True)
print(f"South wind : {ob.telescope.site.weather.south_wind}", flush=True)
wind_amplitude = np.sqrt(
ob.telescope.site.weather.west_wind**2
+ ob.telescope.site.weather.south_wind**2
)
print(f"Wind amplitude : {wind_amplitude}", flush=True)
print(f"PWV for Obs {i}: {weather._sim_pwv:.2f}", flush=True)
if weather._sim_pwv > pwv_threshold * u.mm:
weather._sim_pwv = np.random.uniform(0, pwv_threshold) * u.mm
if ob.comm_col_rank == 0:
print("PWV too high. Redrawing.", flush=True)
print(f"New PWV for Obs {i}: {weather._sim_pwv:.2f}", flush=True)
Is it possible to implement a public setter method in the Weather class?
Also, the atmosphere simulation operator correctly picks up the modified values at runtime:
TOAST DEBUG: Observation South_West55-76-1 using 0.02 GB of total memory
Start time: 15:45:33
Start : 2030-09-16 06:00:00+00:00
End : 2030-09-16 06:59:59.975000+00:00
West wind : 7.745302894521325 m / s
South wind : -6.176433424437544 m / s
Wind amplitude : 9.906464897953745 m / s
PWV for Obs 0: 4.39 mm
PWV too high. Redrawing.
New PWV for Obs 0: 0.50 mm
However, after saving and reloading the data object, the original pre-modification values are restored:
South_West55-76-1
PWV : 4.3870065725551015 mm
west wind : 3.687255474094476 m / s
south wind : -0.9769726377451503 m / s
I think this is probably linked to the first issue, of the Weather Class not having a public setter method; Can we ensure that manually set weather parameters are serialized correctly and survive a save/reload cycle.
I am running a customized workflow similar to toast_sim_ground.py with a few tweaks on the weather parameters for each observing session.
After calling
sim_ground.apply(data), I need to:The Weather class exposes PWV and wind parameters as read-only properties, with no public setter. To modify them I am forced to access protected attributes directly (_sim_pwv, _sim_west_wind, _sim_south_wind), which I probably should not do:
Is it possible to implement a public setter method in the Weather class?
Also, the atmosphere simulation operator correctly picks up the modified values at runtime:
However, after saving and reloading the data object, the original pre-modification values are restored:
I think this is probably linked to the first issue, of the Weather Class not having a public setter method; Can we ensure that manually set weather parameters are serialized correctly and survive a save/reload cycle.