Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert_msv2_to_processing_set pointing KeyError exception #245

Closed
pford opened this issue Sep 4, 2024 · 2 comments · Fixed by #248
Closed

convert_msv2_to_processing_set pointing KeyError exception #245

pford opened this issue Sep 4, 2024 · 2 comments · Fixed by #248
Assignees
Labels
bug Something isn't working

Comments

@pford
Copy link
Contributor

pford commented Sep 4, 2024

xradio version: 0.0.38

convert_msv2_to_processing_set(with_pointing=True) raises an exception for msv2s where antenna ids are missing from the main table.

An example is a VLA casaguides tutorial calibrated MS (1.4GB) which contains VLA-SgrA-Sband-Aconfig.ms, VLA-SgrA-Sband-Bconfig.ms, and VLA-SgrA-Sband-Cconfig.ms. All three MSs get the conversion exception; the Aconfig MS has 26 antennas (id 0-25) defined in the ANTENNA and POINTING tables but antenna id 12 is missing from the main table, so the selection fails:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/groot/casa/github/xradio/src/xradio/vis/convert_msv2_to_processing_set.py", line 104, in convert_msv2_to_processing_set
    convert_and_write_partition(
  File "/home/groot/casa/github/xradio/src/xradio/vis/_vis_utils/_ms/conversion.py", line 902, in convert_and_write_partition
    pointing_xds = create_pointing_xds(
                   ^^^^^^^^^^^^^^^^^^^^
  File "/home/groot/casa/github/xradio/src/xradio/vis/_vis_utils/_ms/msv4_sub_xdss.py", line 320, in create_pointing_xds
    "antenna_name": ant_xds_name_ids.sel(
                    ^^^^^^^^^^^^^^^^^^^^^
  File "/home/groot/anaconda3/envs/gui_env/lib/python3.11/site-packages/xarray/core/dataarray.py", line 1614, in sel
    ds = self._to_temp_dataset().sel(
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/groot/anaconda3/envs/gui_env/lib/python3.11/site-packages/xarray/core/dataset.py", line 3091, in sel
    query_results = map_index_queries(
                    ^^^^^^^^^^^^^^^^^^
  File "/home/groot/anaconda3/envs/gui_env/lib/python3.11/site-packages/xarray/core/indexing.py", line 190, in map_index_queries
    results.append(index.sel(labels, **options))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/groot/anaconda3/envs/gui_env/lib/python3.11/site-packages/xarray/core/indexes.py", line 784, in sel
    raise KeyError(f"not all values found in index {coord_name!r}")
KeyError: "not all values found in index 'antenna_id'"
@pford pford added the bug Something isn't working label Sep 4, 2024
@Jan-Willem Jan-Willem self-assigned this Sep 4, 2024
@Jan-Willem
Copy link
Member

@pford I have pushed a fix to the branch (245-convert_msv2_to_processing_set-pointing-keyerror-exception).

@pford
Copy link
Contributor Author

pford commented Sep 6, 2024

This branch worked for the VLA-SgrA msv2s as well as another failing VLA ms. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants