From bc507bfdaa3e6b878bea2b05c634ea38ef3e8b4d Mon Sep 17 00:00:00 2001 From: Jan-Willem Date: Thu, 5 Mar 2026 12:06:38 -0500 Subject: [PATCH 1/2] Fix graph building ipynb. --- docs/graph_building_tutorial.ipynb | 564 +++++++++++------- .../graph_tools/coordinate_utils.py | 6 +- 2 files changed, 362 insertions(+), 208 deletions(-) diff --git a/docs/graph_building_tutorial.ipynb b/docs/graph_building_tutorial.ipynb index 874bae6..3b96cb5 100644 --- a/docs/graph_building_tutorial.ipynb +++ b/docs/graph_building_tutorial.ipynb @@ -103,9 +103,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "[\u001b[38;2;128;05;128m2026-01-22 08:49:39,711\u001b[0m] \u001b[38;2;50;50;205m INFO\u001b[0m\u001b[38;2;112;128;144m graphviper: \u001b[0m Module path: \u001b[38;2;50;50;205m/Users/jsteeb/miniforge3/envs/timg/lib/python3.13/site-packages/toolviper\u001b[0m \n", - "[\u001b[38;2;128;05;128m2026-01-22 08:49:39,715\u001b[0m] \u001b[38;2;255;160;0m WARNING\u001b[0m\u001b[38;2;112;128;144m graphviper: \u001b[0m It is recommended that the local cache directory be set using the \u001b[38;2;50;50;205mdask_local_dir\u001b[0m parameter. \n", - "[\u001b[38;2;128;05;128m2026-01-22 08:49:39,716\u001b[0m] \u001b[38;2;50;50;205m INFO\u001b[0m\u001b[38;2;112;128;144m graphviper: \u001b[0m Running client in synchronous mode. \n" + "[\u001b[38;2;128;05;128m2026-03-05 12:05:48,111\u001b[0m] \u001b[38;2;255;160;0m WARNING\u001b[0m\u001b[38;2;112;128;144m graphviper: \u001b[0m It is recommended that the local cache directory be set using the \u001b[38;2;50;50;205mdask_local_dir\u001b[0m parameter. \n", + "[\u001b[38;2;128;05;128m2026-03-05 12:05:48,111\u001b[0m] \u001b[38;2;50;50;205m INFO\u001b[0m\u001b[38;2;112;128;144m graphviper: \u001b[0m Running client in synchronous mode. \n" ] } ], @@ -136,7 +135,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "[\u001b[38;2;128;05;128m2026-01-22 08:49:39,720\u001b[0m] \u001b[38;2;50;50;205m INFO\u001b[0m\u001b[38;2;112;128;144m graphviper: \u001b[0m Downloading from [cloudflare] .... \n" + "[\u001b[38;2;128;05;128m2026-03-05 12:05:48,117\u001b[0m] \u001b[38;2;50;50;205m INFO\u001b[0m\u001b[38;2;112;128;144m graphviper: \u001b[0m Downloading from [cloudflare] .... \n" ] }, { @@ -164,18 +163,21 @@ "name": "stdout", "output_type": "stream", "text": [ - "[\u001b[38;2;128;05;128m2026-01-22 08:49:39,725\u001b[0m] \u001b[38;2;50;50;205m INFO\u001b[0m\u001b[38;2;112;128;144m graphviper: \u001b[0m File exists: Antennae_North.cal.lsrk.split.ms \n" + "[\u001b[38;2;128;05;128m2026-03-05 12:05:48,119\u001b[0m] \u001b[38;2;50;50;205m INFO\u001b[0m\u001b[38;2;112;128;144m graphviper: \u001b[0m File exists: Antennae_North.cal.lsrk.split.ms \n" ] }, { "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "bdbdf5a2d7da42a5a900747854d9af03", - "version_major": 2, - "version_minor": 0 - }, + "text/html": [ + "
/Users/jsteeb/miniforge3/envs/zinc/lib/python3.13/site-packages/rich/live.py:260: UserWarning: install \"ipywidgets\"\n",
+       "for Jupyter support\n",
+       "  warnings.warn('install \"ipywidgets\" for Jupyter support')\n",
+       "
\n" + ], "text/plain": [ - "Output()" + "/Users/jsteeb/miniforge3/envs/zinc/lib/python3.13/site-packages/rich/live.py:260: UserWarning: install \"ipywidgets\"\n", + "for Jupyter support\n", + " warnings.warn('install \"ipywidgets\" for Jupyter support')\n" ] }, "metadata": {}, @@ -195,12 +197,12 @@ "name": "stdout", "output_type": "stream", "text": [ - "[\u001b[38;2;128;05;128m2026-01-22 08:49:40,747\u001b[0m] \u001b[38;2;50;50;205m INFO\u001b[0m\u001b[38;2;112;128;144m graphviper: \u001b[0m Updated partition scheme used: ['DATA_DESC_ID', 'OBS_MODE', 'OBSERVATION_ID'] \n", - "[\u001b[38;2;128;05;128m2026-01-22 08:49:40,750\u001b[0m] \u001b[38;2;50;50;205m INFO\u001b[0m\u001b[38;2;112;128;144m graphviper: \u001b[0m Number of partitions: 4 \n", - "[\u001b[38;2;128;05;128m2026-01-22 08:49:40,751\u001b[0m] \u001b[38;2;50;50;205m INFO\u001b[0m\u001b[38;2;112;128;144m graphviper: \u001b[0m OBSERVATION_ID [0], DDI [0], STATE [23, 24, 25, 30, 31, 32, 33, 34, 37], FIELD [0, 1, 2], SCAN [9, 17, 21, 25], EPHEMERIS [None] \n", - "[\u001b[38;2;128;05;128m2026-01-22 08:49:40,989\u001b[0m] \u001b[38;2;50;50;205m INFO\u001b[0m\u001b[38;2;112;128;144m graphviper: \u001b[0m OBSERVATION_ID [1], DDI [0], STATE [23, 24, 25, 30, 31, 32, 33, 34, 37], FIELD [0, 1, 2], SCAN [26, 34, 38, 42], EPHEMERIS [None] \n", - "[\u001b[38;2;128;05;128m2026-01-22 08:49:41,147\u001b[0m] \u001b[38;2;50;50;205m INFO\u001b[0m\u001b[38;2;112;128;144m graphviper: \u001b[0m OBSERVATION_ID [2], DDI [0], STATE [32, 33, 34], FIELD [0, 1, 2], SCAN [43], EPHEMERIS [None] \n", - "[\u001b[38;2;128;05;128m2026-01-22 08:49:41,305\u001b[0m] \u001b[38;2;50;50;205m INFO\u001b[0m\u001b[38;2;112;128;144m graphviper: \u001b[0m OBSERVATION_ID [3], DDI [0], STATE [39, 40, 41, 46, 47, 48, 49, 50, 53], FIELD [0, 1, 2], SCAN [48, 56, 60, 64], EPHEMERIS [None] \n" + "[\u001b[38;2;128;05;128m2026-03-05 12:05:48,707\u001b[0m] \u001b[38;2;50;50;205m INFO\u001b[0m\u001b[38;2;112;128;144m graphviper: \u001b[0m Updated partition scheme used: ['DATA_DESC_ID', 'OBS_MODE', 'OBSERVATION_ID'] \n", + "[\u001b[38;2;128;05;128m2026-03-05 12:05:48,715\u001b[0m] \u001b[38;2;50;50;205m INFO\u001b[0m\u001b[38;2;112;128;144m graphviper: \u001b[0m Number of partitions: 4 \n", + "[\u001b[38;2;128;05;128m2026-03-05 12:05:48,715\u001b[0m] \u001b[38;2;50;50;205m INFO\u001b[0m\u001b[38;2;112;128;144m graphviper: \u001b[0m OBSERVATION_ID [0], DDI [0], STATE [23, 24, 25, 30, 31, 32, 33, 34, 37], FIELD [0, 1, 2], SCAN [9, 17, 21, 25], EPHEMERIS [None] \n", + "[\u001b[38;2;128;05;128m2026-03-05 12:05:48,900\u001b[0m] \u001b[38;2;50;50;205m INFO\u001b[0m\u001b[38;2;112;128;144m graphviper: \u001b[0m OBSERVATION_ID [1], DDI [0], STATE [23, 24, 25, 30, 31, 32, 33, 34, 37], FIELD [0, 1, 2], SCAN [26, 34, 38, 42], EPHEMERIS [None] \n", + "[\u001b[38;2;128;05;128m2026-03-05 12:05:49,063\u001b[0m] \u001b[38;2;50;50;205m INFO\u001b[0m\u001b[38;2;112;128;144m graphviper: \u001b[0m OBSERVATION_ID [2], DDI [0], STATE [32, 33, 34], FIELD [0, 1, 2], SCAN [43], EPHEMERIS [None] \n", + "[\u001b[38;2;128;05;128m2026-03-05 12:05:49,211\u001b[0m] \u001b[38;2;50;50;205m INFO\u001b[0m\u001b[38;2;112;128;144m graphviper: \u001b[0m OBSERVATION_ID [3], DDI [0], STATE [39, 40, 41, 46, 47, 48, 49, 50, 53], FIELD [0, 1, 2], SCAN [48, 56, 60, 64], EPHEMERIS [None] \n" ] } ], @@ -550,6 +552,7 @@ " min-width: 300px;\n", " max-width: 700px;\n", " line-height: 1.6;\n", + " padding-bottom: 4px;\n", "}\n", "\n", ".xr-text-repr-fallback {\n", @@ -560,8 +563,11 @@ ".xr-header {\n", " padding-top: 6px;\n", " padding-bottom: 6px;\n", - " margin-bottom: 4px;\n", + "}\n", + "\n", + ".xr-header {\n", " border-bottom: solid 1px var(--xr-border-color);\n", + " margin-bottom: 4px;\n", "}\n", "\n", ".xr-header > div,\n", @@ -572,20 +578,15 @@ "}\n", "\n", ".xr-obj-type,\n", - ".xr-obj-name,\n", - ".xr-group-name {\n", + ".xr-obj-name {\n", " margin-left: 2px;\n", " margin-right: 10px;\n", "}\n", "\n", - ".xr-group-name::before {\n", - " content: \"📁\";\n", - " padding-right: 0.3em;\n", - "}\n", - "\n", - ".xr-group-name,\n", - ".xr-obj-type {\n", + ".xr-obj-type,\n", + ".xr-group-box-contents > label {\n", " color: var(--xr-font-color2);\n", + " display: block;\n", "}\n", "\n", ".xr-sections {\n", @@ -600,28 +601,39 @@ " display: contents;\n", "}\n", "\n", - ".xr-section-item input {\n", - " display: inline-block;\n", + ".xr-section-item > input,\n", + ".xr-group-box-contents > input,\n", + ".xr-array-wrap > input {\n", + " display: block;\n", " opacity: 0;\n", " height: 0;\n", " margin: 0;\n", "}\n", "\n", - ".xr-section-item input + label {\n", + ".xr-section-item > input + label,\n", + ".xr-var-item > input + label {\n", " color: var(--xr-disabled-color);\n", - " border: 2px solid transparent !important;\n", "}\n", "\n", - ".xr-section-item input:enabled + label {\n", + ".xr-section-item > input:enabled + label,\n", + ".xr-var-item > input:enabled + label,\n", + ".xr-array-wrap > input:enabled + label,\n", + ".xr-group-box-contents > input:enabled + label {\n", " cursor: pointer;\n", " color: var(--xr-font-color2);\n", "}\n", "\n", - ".xr-section-item input:focus + label {\n", - " border: 2px solid var(--xr-font-color0) !important;\n", + ".xr-section-item > input:focus-visible + label,\n", + ".xr-var-item > input:focus-visible + label,\n", + ".xr-array-wrap > input:focus-visible + label,\n", + ".xr-group-box-contents > input:focus-visible + label {\n", + " outline: auto;\n", "}\n", "\n", - ".xr-section-item input:enabled + label:hover {\n", + ".xr-section-item > input:enabled + label:hover,\n", + ".xr-var-item > input:enabled + label:hover,\n", + ".xr-array-wrap > input:enabled + label:hover,\n", + ".xr-group-box-contents > input:enabled + label:hover {\n", " color: var(--xr-font-color0);\n", "}\n", "\n", @@ -629,11 +641,25 @@ " grid-column: 1;\n", " color: var(--xr-font-color2);\n", " font-weight: 500;\n", + " white-space: nowrap;\n", + "}\n", + "\n", + ".xr-section-summary > em {\n", + " font-weight: normal;\n", + "}\n", + "\n", + ".xr-span-grid {\n", + " grid-column-end: -1;\n", "}\n", "\n", ".xr-section-summary > span {\n", " display: inline-block;\n", - " padding-left: 0.5em;\n", + " padding-left: 0.3em;\n", + "}\n", + "\n", + ".xr-group-box-contents > input:checked + label > span {\n", + " display: inline-block;\n", + " padding-left: 0.6em;\n", "}\n", "\n", ".xr-section-summary-in:disabled + label {\n", @@ -661,7 +687,8 @@ "}\n", "\n", ".xr-section-summary,\n", - ".xr-section-inline-details {\n", + ".xr-section-inline-details,\n", + ".xr-group-box-contents > label {\n", " padding-top: 4px;\n", "}\n", "\n", @@ -670,20 +697,29 @@ "}\n", "\n", ".xr-section-details {\n", - " display: none;\n", " grid-column: 1 / -1;\n", " margin-top: 4px;\n", " margin-bottom: 5px;\n", "}\n", "\n", + ".xr-section-summary-in ~ .xr-section-details {\n", + " display: none;\n", + "}\n", + "\n", ".xr-section-summary-in:checked ~ .xr-section-details {\n", " display: contents;\n", "}\n", "\n", + ".xr-children {\n", + " display: inline-grid;\n", + " grid-template-columns: 100%;\n", + " grid-column: 1 / -1;\n", + " padding-top: 4px;\n", + "}\n", + "\n", ".xr-group-box {\n", " display: inline-grid;\n", - " grid-template-columns: 0px 20px auto;\n", - " width: 100%;\n", + " grid-template-columns: 0px 30px auto;\n", "}\n", "\n", ".xr-group-box-vline {\n", @@ -697,13 +733,43 @@ " grid-column-start: 2;\n", " grid-row-start: 1;\n", " height: 1em;\n", - " width: 20px;\n", + " width: 26px;\n", " border-bottom: 0.2em solid;\n", " border-color: var(--xr-border-color);\n", "}\n", "\n", ".xr-group-box-contents {\n", " grid-column-start: 3;\n", + " padding-bottom: 4px;\n", + "}\n", + "\n", + ".xr-group-box-contents > label::before {\n", + " content: \"📂\";\n", + " padding-right: 0.3em;\n", + "}\n", + "\n", + ".xr-group-box-contents > input:checked + label::before {\n", + " content: \"📁\";\n", + "}\n", + "\n", + ".xr-group-box-contents > input:checked + label {\n", + " padding-bottom: 0px;\n", + "}\n", + "\n", + ".xr-group-box-contents > input:checked ~ .xr-sections {\n", + " display: none;\n", + "}\n", + "\n", + ".xr-group-box-contents > input + label > span {\n", + " display: none;\n", + "}\n", + "\n", + ".xr-group-box-ellipsis {\n", + " font-size: 1.4em;\n", + " font-weight: 900;\n", + " color: var(--xr-font-color2);\n", + " letter-spacing: 0.15em;\n", + " cursor: default;\n", "}\n", "\n", ".xr-array-wrap {\n", @@ -939,14 +1005,14 @@ "│ polarization: 2, uvw_label: 3)\n", "│ Coordinates:\n", "│ * time (time) float64 400B 1.307e+09 ... 1.307e+09\n", + "│ field_name (time) <U46 9kB dask.array<chunksize=(50,), meta=np.ndarray>\n", + "│ scan_name (time) <U21 4kB dask.array<chunksize=(50,), meta=np.ndarray>\n", "│ * baseline_id (baseline_id) int64 360B 0 1 2 3 ... 41 42 43 44\n", + "│ baseline_antenna1_name (baseline_id) <U9 2kB dask.array<chunksize=(45,), meta=np.ndarray>\n", + "│ baseline_antenna2_name (baseline_id) <U9 2kB dask.array<chunksize=(45,), meta=np.ndarray>\n", "│ * frequency (frequency) float64 64B 3.439e+11 ... 3.44e+11\n", "│ * polarization (polarization) <U2 16B 'XX' 'YY'\n", "│ * uvw_label (uvw_label) <U1 12B 'u' 'v' 'w'\n", - "│ baseline_antenna1_name (baseline_id) <U9 2kB dask.array<chunksize=(45,), meta=np.ndarray>\n", - "│ baseline_antenna2_name (baseline_id) <U9 2kB dask.array<chunksize=(45,), meta=np.ndarray>\n", - "│ field_name (time) <U46 9kB dask.array<chunksize=(50,), meta=np.ndarray>\n", - "│ scan_name (time) <U21 4kB dask.array<chunksize=(50,), meta=np.ndarray>\n", "│ Data variables:\n", "│ EFFECTIVE_INTEGRATION_TIME (time, baseline_id) float64 18kB dask.array<chunksize=(50, 45), meta=np.ndarray>\n", "│ FLAG (time, baseline_id, frequency, polarization) bool 36kB dask.array<chunksize=(50, 45, 3, 2), meta=np.ndarray>\n", @@ -955,8 +1021,8 @@ "│ VISIBILITY (time, baseline_id, frequency, polarization) complex64 288kB dask.array<chunksize=(50, 45, 3, 2), meta=np.ndarray>\n", "│ WEIGHT (time, baseline_id, frequency, polarization) float32 144kB dask.array<chunksize=(50, 45, 3, 2), meta=np.ndarray>\n", "│ Attributes:\n", - "│ creation_date: 2026-01-22T13:49:40.777220+00:00\n", - "│ creator: {'software_name': 'xradio', 'version': '1.1.0'}\n", + "│ creation_date: 2026-03-05T17:05:48.735585+00:00\n", + "│ creator: {'software_name': 'xradio', 'version': '1.1.1'}\n", "│ data_groups: {'base': {'correlated_data': 'VISIBILITY', 'date': '20...\n", "│ observation_info: {'execution_block_UID': 'uid://A002/X1ff7b0/Xb', 'obse...\n", "│ processor_info: {'sub_type': 'ALMA_CORRELATOR_MODE', 'type': 'CORRELAT...\n", @@ -967,12 +1033,12 @@ "│ receptor_label: 2)\n", "│ Coordinates:\n", "│ * antenna_name (antenna_name) <U9 360B 'DV02_A015' ... 'PM03_J504'\n", - "│ * cartesian_pos_label (cartesian_pos_label) <U1 12B 'x' 'y' 'z'\n", - "│ * receptor_label (receptor_label) <U5 40B 'pol_0' 'pol_1'\n", "│ mount (antenna_name) <U6 240B dask.array<chunksize=(10,), meta=np.ndarray>\n", - "│ polarization_type (antenna_name, receptor_label) <U1 80B dask.array<chunksize=(10, 2), meta=np.ndarray>\n", "│ station_name (antenna_name) <U4 160B dask.array<chunksize=(10,), meta=np.ndarray>\n", "│ telescope_name (antenna_name) <U4 160B dask.array<chunksize=(10,), meta=np.ndarray>\n", + "│ * cartesian_pos_label (cartesian_pos_label) <U1 12B 'x' 'y' 'z'\n", + "│ * receptor_label (receptor_label) <U5 40B 'pol_0' 'pol_1'\n", + "│ polarization_type (antenna_name, receptor_label) <U1 80B dask.array<chunksize=(10, 2), meta=np.ndarray>\n", "│ Data variables:\n", "│ ANTENNA_DISH_DIAMETER (antenna_name) float64 80B dask.array<chunksize=(10,), meta=np.ndarray>\n", "│ ANTENNA_POSITION (antenna_name, cartesian_pos_label) float64 240B dask.array<chunksize=(10, 3), meta=np.ndarray>\n", @@ -985,8 +1051,8 @@ "│ Dimensions: (field_name: 3, sky_dir_label: 2)\n", "│ Coordinates:\n", "│ * field_name (field_name) <U46 552B 'NGC4038 - Antennae ...\n", - "│ * sky_dir_label (sky_dir_label) <U3 24B 'ra' 'dec'\n", "│ source_name (field_name) <U46 552B dask.array<chunksize=(3,), meta=np.ndarray>\n", + "│ * sky_dir_label (sky_dir_label) <U3 24B 'ra' 'dec'\n", "│ Data variables:\n", "│ FIELD_PHASE_CENTER_DIRECTION (field_name, sky_dir_label) float64 48B dask.array<chunksize=(3, 2), meta=np.ndarray>\n", "│ SOURCE_DIRECTION (field_name, sky_dir_label) float64 48B dask.array<chunksize=(3, 2), meta=np.ndarray>\n", @@ -1008,7 +1074,7 @@ " WIND_DIRECTION (station_name, time_weather) float64 4kB dask.array<chunksize=(2, 259), meta=np.ndarray>\n", " WIND_SPEED (station_name, time_weather) float64 4kB dask.array<chunksize=(2, 259), meta=np.ndarray>\n", " Attributes:\n", - " type: weather