casangi / xradio

Xarray Radio Astronomy Data IO
https://xradio.readthedocs.io/en/latest/
Other
16 stars 7 forks source link

Review ms_xds.attrs.antenna_xds schema and XRADIO interface. #168

Open Jan-Willem opened 5 months ago

Jan-Willem commented 5 months ago

Review Instructions

The review ipynb can be found here: https://github.com/casangi/xradio/blob/main/reviews/review_antenna_xds.ipynb

Please review the MSv4 antenna_xds schema and the XRADIO interface (ps['MSv4_name'].antenna_xds). Note that the PS (processing set) interface or the main_xds should not be reviewed.

The antenna_xds schema specification: https://docs.google.com/spreadsheets/d/14a6qMap9M5r_vjpLnaBKxsR9TF4azN5LVdOxLacOX-s/edit#gid=257301047

The processing set is a loose collection of MSv4 which might come from multiple MSv2 (or ASDMS). Consequently, arbitrary ids are avoided in favor of descriptive strings.

Two example datasets will be used VLBA_TL016B_split_lsrk.ms (VLBI) and uid___A002_X1015532_X1926f.small.ms (Single Dish).

Preparatory Material

Go over Xarray nomenclature and selection syntax:

MSv2 and CASA documentation:

VLBI MSv2 extension: https://casacore.github.io/casacore-notes/265.pdf

antenna_xds Schema

The ANTENNA, FEED, GAIN_CURVE, PHASE_CAL, and INTERFEROMETER_MODEL (VLBI, not yet included) tables in the MSv2 contain closely related information that is all related to the antenna. The MSv4 contains a single SPW, consequently, an antenna will only have a single feed associated with it.

Antennaids are no longer used in favor of the antenna name (for antennas that can move the name consists of the name + "" + station). This allows for easy comparison of MSv4s from different observations.

Key Questions to Answer

Schema Questions

XRADIO

2.1) Please check all the data variables (names,dimensions,measures) and coordinates (names,dimensions,measures) in both the google spreadsheet and ipynb.

Environment instructions

It is recommended to use the conda environment manager to create a clean, self-contained runtime where xradio and all its dependencies can be installed:

conda create --name xradio python=3.11 --no-default-packages
conda activate xradio

Clone the repository, checkout the review branch and do a local install:

git clone https://github.com/casangi/xradio.git
git checkout 168-review-ms_xdsattrsantenna_xds-schema-and-xradio-interface
cd xradio
pip install -e .

On macOS it is required to pre-install python-casacore using bash conda install -c conda-forge python-casacore.

kettenis commented 3 months ago

Here are the the issues that I found during my review. I'll address the explicit review questions in a separate comment.

kettenis commented 3 months ago
kettenis commented 3 months ago

Looking closer at the PHASE_CAL coordinate order issue, I now understand why GAIN_CURVE ended up with receptor_name as its last axis. PHASE_CAL needs that too, or if we want to swap the coordinates like I'm proposing for GAIN_CURVE the data array needs to be transposed accordingly.

Jan-Willem commented 3 months ago

Here are some initial notes. We will discuss things in more detail during the VIPER meeting today.

kettenis commented 3 months ago

Just quickly checked the PHASE_CAL and GAIN_CURVE fixes. PHASE_CAL looks good to me now. Having the gain_curve_type depend on the gain_curve_time coordinate seems strange. Technically speaking it is of course possible to use a different parametrization of the gain curve over time but I think that is extremely unlikely to happen within a single MSv4.

tnakazato commented 3 months ago

I'm sorry I couldn't attend the review meeting as I took a day off. Here is my comments/questions.

Jan-Willem commented 3 months ago

In response to @tnakazato :

Jan-Willem commented 3 months ago

The following feedback from the review meeting have been incorporated:

The pointing information will be handled in a separate ticket.

tnakazato commented 3 months ago

Hi @Jan-Willem,

Thank you for your reply.

"How do you envision the way to fit multi-feed receiver into the schema?" Since we split by SPW a single MSv4 should have no more than one feed associated with an antenna. MSv4 is also limited to a single beam per antenna. We have ASKAP stakeholder datasets to demonstrate this where each beam is its own MSv4.

I understand that individual MSv4 only contain single feed and single beam. But even in that case, we should take into account the difference of pointing direction among feeds/beams in some way. In our NRO MSv2 data, POINTING table absorbs such difference. POINTING table contains pointing direction for each feed and they can be distinguished by ANTENNA_ID since we regard each feed as separate antenna in ANTENNA table.

Assuming that MSv4 takes similar approach, pointing direction stored in POINTING xds will take all offset information into account. Then, the direction at a certain time in POINTING xds can be different across MSv4 even if antenna name or antenna_station name is the same. Is my understanding correct?

1.2) "But, I think either ANTENNA_DISH_DIAMETER or ANTENNA_EFFECTIVE_DISH_DIAMETER should be mandatory (not optional) because antenna diameter is required to estimate spatial resolution of the single-dish observation." The issue is that some dishes are not circular. We can change the definition to "The diameter of the main reflector (or the largest dimension for non-circular apertures)." and make it nonoptional (@kettenis would this work?).

Ah, I see. Then how about having xds/attribute/data for antenna beam model instead of making ANTENNA_DISH_DIAMETER mandatory?

"Regarding 1.5), does BEAM_OFFSET vary in time if it is defined as sky_dir_label?" I think it does not vary with time because it is an offset. It is defined as "Beam position offset, as defined on the sky but in the antenna reference frame."

Maybe I'm just ignorant, but I don't understand what "defined on the sky" means. Does it mean the offset is defined on the celestial sphere? Then, the value is in the antenna reference frame?

"Antenna_ids are no longer used in favor of the antenna name": does this mean we no longer associate antenna_xds with, e.g., main_xds/pointing_xds using antenna_id, and we instead use name (or name_station) for this purpose? Yes

Understood.

gmoellen commented 2 months ago

Assuming that "BEAM_OFFSET" is a strict mechanical offset of the nominal direction of peak sensitivity, owing to the structural details of feed positioning not otherwise compensated for (e.g., by tilting the subreflector), it is indeed a direction offset specified within the antenna reference frame and somehow associated with the details of the antenna mount type. And constant in time for fixed mechanicals in the antenna. Any coordinate or label that refers to "(ra,dec)" is confusing, at best, here. One also has to be a little bit careful with direction offsets when the antenna's native pointing coordinates are Az/El. A fixed mechanical beam offset (due to offset feed position within the optics) will not be a constant Azimuth offset over the full range of elevation. It would be better described as El/Cross-El, where Cross-El is an angle measured perpendicular to El on a great circle (which Az is not). All of this is subject to the direction coordinate systems we adopt to describe these things. Strings like "sky_dir_label" and "sky_coord_offset" are not intuitive to me in a general way....

tnakazato commented 2 months ago

Thanks @gmoellen for detailed explanation.