-
Notifications
You must be signed in to change notification settings - Fork 2
Description
I am trying to calibrate a data set where the raw data come in as uvfits files and the model visibilities come from an FHD run, so they come in as .sav files. Note that I ran FHD on the raw data files to create the model visibiliites so the data sets should be perfectly matched. This is nominally supported, but when I run it I get the following error:
2025-10-21 13:15:52 - ERROR:
An error occurred in PyFHD: Could not match the time steps in the data uvfits: (PosixPath('/Users/bryna/Projects/Physics/data_files/mwa_data/2013_golden'), '1061316296.uvfits') and model uvfits in /Users/bryna/Projects/Physics/data_files/pyfhd_testing/2013_golden/fhd_pyfhd_test_cal1sav. Please check the model and try again. Exiting now.
Exiting PyFHD.
Traceback (most recent call last):
File "/Users/bryna/Projects/Physics/PyFHD/PyFHD/pyfhd.py", line 313, in main
vis_model_arr = vis_model_transfer(pyfhd_config, obs, params, logger)
File "/Users/bryna/Projects/Physics/PyFHD/PyFHD/source_modeling/vis_model_transfer.py", line 61, in vis_model_transfer
vis_model = flag_model_visibilities(
vis_model, params, params_model, obs, pyfhd_config, logger
)
File "/Users/bryna/Projects/Physics/PyFHD/PyFHD/source_modeling/vis_model_transfer.py", line 366, in flag_model_visibilities
raise ValueError(
...<3 lines>...
)
ValueError: Could not match the time steps in the data uvfits: (PosixPath('/Users/bryna/Projects/Physics/data_files/mwa_data/2013_golden'), '1061316296.uvfits') and model uvfits in /Users/bryna/Projects/Physics/data_files/pyfhd_testing/2013_golden/fhd_pyfhd_test_cal1sav. Please check the model and try again. Exiting now.
Digging into the code, I can see the problem. When the data are read in from FHD sav files, the times are taken from the time tag of the params struct. However, these are generally not JDs, they are typically offsets from a starting JD. They are then being compared to the times that come from the DATE parameter in uvfits files which are JDs. The pyuvdata reader for FHD files has this comment:
# bl_info.JDATE (a vector of length Ntimes) is the only safe date/time
# to use in FHD files.
# (obs.JD0 (float) and params.TIME (vector of length Nblts) are
# context dependent and are not safe
# because they depend on the phasing of the visibilities)
I can of course back port this into pyFHD, but I feel like it might make more sense to just use UVData to read in data files rather than rolling our own over again.