casangi / xradio

Xarray Radio Astronomy Data IO
Other
9 stars 5 forks source link

Ephemeris data selection and interpolation. #179

Closed Jan-Willem closed 6 days ago

Jan-Willem commented 1 month ago

When creating the field_and_source_xds only the ephemeris data relevant to the time coordinate in the main dataset should be selected. There should also be an option to interpolate to the main dataset time coordinates. This is similar to what is currently being done for pointing data.

To issue https://github.com/casangi/xradio/issues/167 should be reviewed to gain an understanding of the field_and_source_xds.

The branch 162-create-combined-field-source-and-ephemeris-dataset should be used for development.

Features to add:

FedeMPouzols commented 3 weeks ago

@Jan-Willem : I'm getting errors in read_processing_set() with this branch when the input test MS has "CORRECTED" (or other "DATA" columns):

venv_xradio_python_39/lib/python3.9/site-packages/xradio/vis/read_processing_set.py", line 53, in read_processing_set
    field_and_source_xds_dict[data_group_name]
KeyError: 'corrected'

This could be fixed with something like:

--- a/src/xradio/vis/_vis_utils/_ms/conversion.py
+++ b/src/xradio/vis/_vis_utils/_ms/conversion.py
@@ -845,9 +845,13 @@ def convert_and_write_partition(
             if storage_backend == "zarr":
                 xds.to_zarr(store=os.path.join(file_name, "MAIN"), mode=mode)
                 ant_xds.to_zarr(store=os.path.join(file_name, "ANTENNA"), mode=mode)
-                field_and_source_xds.to_zarr(
-                    store=os.path.join(file_name, "FIELD_AND_SOURCE_BASE"), mode=mode
-                )
+                for group_name in xds.attrs["data_groups"]:
+                    field_and_source_xds.to_zarr(
+                        store=os.path.join(
+                            file_name, f"FIELD_AND_SOURCE_{group_name.upper()}"
+                        ),
+                        mode=mode,
+                    )

I can add the fix to the branch, but I'm wondering whether that was the intention, or are there some other updates in the making that will change how the FIELD_AND_SOURCE sub-xdss are saved/loaded?

Jan-Willem commented 3 weeks ago

Yes, @FedeMPouzols you can go ahead with the fix.