Open In Colab

image.png

Holography Visualization Tutorial

This visualization tutorial uses the same dataset that is used on the VLA tutorial. If the VLA tutorial has been previously run on the same directory the data will be re-utilized.

[1]:
!python -m pip install -e .. >> /dev/null
[2]:
import os

try:
    import astrohack

    print('AstroHACK version', astrohack.__version__, 'already installed.')
except ImportError as e:
    print(e)
    print('Installing AstroHACK')

    os.system("pip install astrohack")

    import astrohack
    print('astrohack version', astrohack.__version__, ' installed.')
No module named 'auror'
Installing AstroHACK
Looking in indexes: https://casa-pip.nrao.edu/repository/pypi-group/simple, https://pypi.org/simple/
Requirement already satisfied: astrohack in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (0.4.3)
Requirement already satisfied: astropy in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from astrohack) (5.2.2)
Requirement already satisfied: auror in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from astrohack) (0.3.10)
Requirement already satisfied: dask in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from astrohack) (2023.5.0)
Requirement already satisfied: distributed in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from astrohack) (2023.5.0)
Requirement already satisfied: matplotlib in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from astrohack) (3.7.4)
Requirement already satisfied: menrva in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from astrohack) (0.0.14)
Requirement already satisfied: numba>=0.57.0 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from astrohack) (0.58.1)
Requirement already satisfied: numpy in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from astrohack) (1.24.4)
Requirement already satisfied: prettytable in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from astrohack) (3.9.0)
Requirement already satisfied: pytest in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from astrohack) (7.4.3)
Requirement already satisfied: pytest-cov in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from astrohack) (4.1.0)
Requirement already satisfied: pytest-html in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from astrohack) (4.1.1)
Requirement already satisfied: scikit-image in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from astrohack) (0.21.0)
Requirement already satisfied: scikit-learn in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from astrohack) (1.3.2)
Requirement already satisfied: scipy in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from astrohack) (1.10.1)
Requirement already satisfied: rich in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from astrohack) (13.7.0)
Requirement already satisfied: skriba in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from astrohack) (0.3.13)
Requirement already satisfied: xarray in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from astrohack) (2023.1.0)
Requirement already satisfied: zarr in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from astrohack) (2.16.1)
Requirement already satisfied: bokeh in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from astrohack) (2.4.2)
Requirement already satisfied: jupyterlab in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from astrohack) (4.0.11)
Requirement already satisfied: python-casacore>=3.5.2 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from astrohack) (3.5.2)
Requirement already satisfied: llvmlite<0.42,>=0.41.0dev0 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from numba>=0.57.0->astrohack) (0.41.1)
Requirement already satisfied: importlib-metadata in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from numba>=0.57.0->astrohack) (7.0.0)
Requirement already satisfied: six in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from python-casacore>=3.5.2->astrohack) (1.16.0)
Requirement already satisfied: pyerfa>=2.0 in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from astropy->astrohack) (2.0.0.1)
Requirement already satisfied: PyYAML>=3.13 in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from astropy->astrohack) (6.0)
Requirement already satisfied: packaging>=19.0 in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from astropy->astrohack) (21.3)
Requirement already satisfied: cerberus in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from auror->astrohack) (1.3.5)
Requirement already satisfied: tqdm in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from auror->astrohack) (4.62.3)
Requirement already satisfied: Jinja2>=2.9 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from bokeh->astrohack) (3.1.3)
Requirement already satisfied: pillow>=7.1.0 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from bokeh->astrohack) (10.1.0)
Requirement already satisfied: tornado>=5.1 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from bokeh->astrohack) (6.4)
Requirement already satisfied: typing-extensions>=3.10.0 in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from bokeh->astrohack) (4.0.1)
Requirement already satisfied: click>=8.0 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from dask->astrohack) (8.1.7)
Requirement already satisfied: cloudpickle>=1.5.0 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from dask->astrohack) (3.0.0)
Requirement already satisfied: fsspec>=2021.09.0 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from dask->astrohack) (2023.12.1)
Requirement already satisfied: partd>=1.2.0 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from dask->astrohack) (1.4.1)
Requirement already satisfied: toolz>=0.10.0 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from dask->astrohack) (0.12.0)
Requirement already satisfied: locket>=1.0.0 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from distributed->astrohack) (1.0.0)
Requirement already satisfied: msgpack>=1.0.0 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from distributed->astrohack) (1.0.7)
Requirement already satisfied: psutil>=5.7.0 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from distributed->astrohack) (5.9.6)
Requirement already satisfied: sortedcontainers>=2.0.5 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from distributed->astrohack) (2.4.0)
Requirement already satisfied: tblib>=1.6.0 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from distributed->astrohack) (3.0.0)
Requirement already satisfied: urllib3>=1.24.3 in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from distributed->astrohack) (1.26.7)
Requirement already satisfied: zict>=2.2.0 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from distributed->astrohack) (3.0.0)
Requirement already satisfied: async-lru>=1.0.0 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from jupyterlab->astrohack) (2.0.4)
Requirement already satisfied: importlib-resources>=1.4 in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from jupyterlab->astrohack) (5.4.0)
Requirement already satisfied: ipykernel in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from jupyterlab->astrohack) (6.6.1)
Requirement already satisfied: jupyter-core in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from jupyterlab->astrohack) (5.5.0)
Requirement already satisfied: jupyter-lsp>=2.0.0 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from jupyterlab->astrohack) (2.2.1)
Requirement already satisfied: jupyter-server<3,>=2.4.0 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from jupyterlab->astrohack) (2.12.0)
Requirement already satisfied: jupyterlab-server<3,>=2.19.0 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from jupyterlab->astrohack) (2.25.2)
Requirement already satisfied: notebook-shim>=0.2 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from jupyterlab->astrohack) (0.2.3)
Requirement already satisfied: tomli in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from jupyterlab->astrohack) (1.2.2)
Requirement already satisfied: traitlets in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from jupyterlab->astrohack) (5.14.0)
Requirement already satisfied: contourpy>=1.0.1 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from matplotlib->astrohack) (1.1.1)
Requirement already satisfied: cycler>=0.10 in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from matplotlib->astrohack) (0.11.0)
Requirement already satisfied: fonttools>=4.22.0 in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from matplotlib->astrohack) (4.28.2)
Requirement already satisfied: kiwisolver>=1.0.1 in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from matplotlib->astrohack) (1.3.2)
Requirement already satisfied: pyparsing>=2.3.1 in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from matplotlib->astrohack) (3.0.6)
Requirement already satisfied: python-dateutil>=2.7 in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from matplotlib->astrohack) (2.8.2)
Requirement already satisfied: dask-jobqueue in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from menrva->astrohack) (0.8.2)
Requirement already satisfied: graphviper in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from menrva->astrohack) (0.0.5)
Requirement already satisfied: wcwidth in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from prettytable->astrohack) (0.2.5)
Requirement already satisfied: iniconfig in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from pytest->astrohack) (1.1.1)
Requirement already satisfied: pluggy<2.0,>=0.12 in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from pytest->astrohack) (1.0.0)
Requirement already satisfied: exceptiongroup>=1.0.0rc8 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from pytest->astrohack) (1.2.0)
Requirement already satisfied: coverage>=5.2.1 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from coverage[toml]>=5.2.1->pytest-cov->astrohack) (7.3.2)
Requirement already satisfied: pytest-metadata>=2.0.0 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from pytest-html->astrohack) (3.0.0)
Requirement already satisfied: markdown-it-py>=2.2.0 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from rich->astrohack) (3.0.0)
Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from rich->astrohack) (2.17.2)
Requirement already satisfied: networkx>=2.8 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from scikit-image->astrohack) (3.1)
Requirement already satisfied: imageio>=2.27 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from scikit-image->astrohack) (2.33.0)
Requirement already satisfied: tifffile>=2022.8.12 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from scikit-image->astrohack) (2023.7.10)
Requirement already satisfied: PyWavelets>=1.1.1 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from scikit-image->astrohack) (1.4.1)
Requirement already satisfied: lazy_loader>=0.2 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from scikit-image->astrohack) (0.3)
Requirement already satisfied: joblib>=1.1.1 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from scikit-learn->astrohack) (1.3.2)
Requirement already satisfied: threadpoolctl>=2.0.0 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from scikit-learn->astrohack) (3.2.0)
Requirement already satisfied: colorama in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from skriba->astrohack) (0.4.6)
Requirement already satisfied: pandas>=1.3 in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from xarray->astrohack) (1.3.5)
Requirement already satisfied: asciitree in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from zarr->astrohack) (0.3.3)
Requirement already satisfied: fasteners in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from zarr->astrohack) (0.19)
Requirement already satisfied: numcodecs>=0.10.0 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from zarr->astrohack) (0.12.1)
Requirement already satisfied: zipp>=0.5 in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from importlib-metadata->numba>=0.57.0->astrohack) (3.7.0)
Requirement already satisfied: MarkupSafe>=2.0 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from Jinja2>=2.9->bokeh->astrohack) (2.1.3)
Requirement already satisfied: anyio>=3.1.0 in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (3.4.0)
Requirement already satisfied: argon2-cffi in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (21.3.0)
Requirement already satisfied: jupyter-client>=7.4.4 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (7.4.9)
Requirement already satisfied: jupyter-events>=0.9.0 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (0.9.0)
Requirement already satisfied: jupyter-server-terminals in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (0.4.4)
Requirement already satisfied: nbconvert>=6.4.4 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (7.12.0)
Requirement already satisfied: nbformat>=5.3.0 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (5.9.2)
Requirement already satisfied: overrides in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (7.4.0)
Requirement already satisfied: prometheus-client in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (0.12.0)
Requirement already satisfied: pyzmq>=24 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (25.1.2)
Requirement already satisfied: send2trash>=1.8.2 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (1.8.2)
Requirement already satisfied: terminado>=0.8.3 in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (0.12.1)
Requirement already satisfied: websocket-client in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (1.2.3)
Requirement already satisfied: platformdirs>=2.5 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from jupyter-core->jupyterlab->astrohack) (4.1.0)
Requirement already satisfied: babel>=2.10 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from jupyterlab-server<3,>=2.19.0->jupyterlab->astrohack) (2.13.1)
Requirement already satisfied: json5>=0.9.0 in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from jupyterlab-server<3,>=2.19.0->jupyterlab->astrohack) (0.9.6)
Requirement already satisfied: jsonschema>=4.18.0 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from jupyterlab-server<3,>=2.19.0->jupyterlab->astrohack) (4.20.0)
Requirement already satisfied: requests>=2.31 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from jupyterlab-server<3,>=2.19.0->jupyterlab->astrohack) (2.31.0)
Requirement already satisfied: mdurl~=0.1 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from markdown-it-py>=2.2.0->rich->astrohack) (0.1.2)
Requirement already satisfied: pytz>=2017.3 in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from pandas>=1.3->xarray->astrohack) (2021.3)
Requirement already satisfied: pyarrow in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from graphviper->menrva->astrohack) (15.0.0)
Requirement already satisfied: graphviz in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from graphviper->menrva->astrohack) (0.20.1)
Requirement already satisfied: xradio in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from graphviper->menrva->astrohack) (0.0.16)
Requirement already satisfied: debugpy<2.0,>=1.0.0 in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from ipykernel->jupyterlab->astrohack) (1.5.1)
Requirement already satisfied: ipython>=7.23.1 in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from ipykernel->jupyterlab->astrohack) (7.30.1)
Requirement already satisfied: matplotlib-inline<0.2.0,>=0.1.0 in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from ipykernel->jupyterlab->astrohack) (0.1.3)
Requirement already satisfied: nest-asyncio in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from ipykernel->jupyterlab->astrohack) (1.5.4)
Requirement already satisfied: idna>=2.8 in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from anyio>=3.1.0->jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (3.3)
Requirement already satisfied: sniffio>=1.1 in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from anyio>=3.1.0->jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (1.2.0)
Requirement already satisfied: setuptools>=18.5 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from ipython>=7.23.1->ipykernel->jupyterlab->astrohack) (68.0.0)
Requirement already satisfied: jedi>=0.16 in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from ipython>=7.23.1->ipykernel->jupyterlab->astrohack) (0.18.1)
Requirement already satisfied: decorator in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from ipython>=7.23.1->ipykernel->jupyterlab->astrohack) (5.1.0)
Requirement already satisfied: pickleshare in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from ipython>=7.23.1->ipykernel->jupyterlab->astrohack) (0.7.5)
Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from ipython>=7.23.1->ipykernel->jupyterlab->astrohack) (3.0.24)
Requirement already satisfied: backcall in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from ipython>=7.23.1->ipykernel->jupyterlab->astrohack) (0.2.0)
Requirement already satisfied: pexpect>4.3 in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from ipython>=7.23.1->ipykernel->jupyterlab->astrohack) (4.8.0)
Requirement already satisfied: attrs>=22.2.0 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from jsonschema>=4.18.0->jupyterlab-server<3,>=2.19.0->jupyterlab->astrohack) (23.1.0)
Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from jsonschema>=4.18.0->jupyterlab-server<3,>=2.19.0->jupyterlab->astrohack) (2023.11.2)
Requirement already satisfied: pkgutil-resolve-name>=1.3.10 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from jsonschema>=4.18.0->jupyterlab-server<3,>=2.19.0->jupyterlab->astrohack) (1.3.10)
Requirement already satisfied: referencing>=0.28.4 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from jsonschema>=4.18.0->jupyterlab-server<3,>=2.19.0->jupyterlab->astrohack) (0.31.1)
Requirement already satisfied: rpds-py>=0.7.1 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from jsonschema>=4.18.0->jupyterlab-server<3,>=2.19.0->jupyterlab->astrohack) (0.13.2)
Requirement already satisfied: entrypoints in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from jupyter-client>=7.4.4->jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (0.3)
Requirement already satisfied: python-json-logger>=2.0.4 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (2.0.7)
Requirement already satisfied: rfc3339-validator in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (0.1.4)
Requirement already satisfied: rfc3986-validator>=0.1.1 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (0.1.1)
Requirement already satisfied: beautifulsoup4 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (4.12.2)
Requirement already satisfied: bleach!=5.0.0 in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (4.1.0)
Requirement already satisfied: defusedxml in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (0.7.1)
Requirement already satisfied: jupyterlab-pygments in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (0.1.2)
Requirement already satisfied: mistune<4,>=2.0.3 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (3.0.2)
Requirement already satisfied: nbclient>=0.5.0 in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (0.5.9)
Requirement already satisfied: pandocfilters>=1.4.1 in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (1.5.0)
Requirement already satisfied: tinycss2 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (1.2.1)
Requirement already satisfied: fastjsonschema in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from nbformat>=5.3.0->jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (2.19.0)
Requirement already satisfied: charset-normalizer<4,>=2 in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from requests>=2.31->jupyterlab-server<3,>=2.19.0->jupyterlab->astrohack) (2.0.9)
Requirement already satisfied: certifi>=2017.4.17 in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from requests>=2.31->jupyterlab-server<3,>=2.19.0->jupyterlab->astrohack) (2021.10.8)
Requirement already satisfied: ptyprocess in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from terminado>=0.8.3->jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (0.7.0)
Requirement already satisfied: argon2-cffi-bindings in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from argon2-cffi->jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (21.2.0)
Requirement already satisfied: casadata in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from xradio->graphviper->menrva->astrohack) (2024.1.22)
Requirement already satisfied: gdown in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from xradio->graphviper->menrva->astrohack) (4.7.1)
Requirement already satisfied: webencodings in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from bleach!=5.0.0->nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (0.5.1)
Requirement already satisfied: parso<0.9.0,>=0.8.0 in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from jedi>=0.16->ipython>=7.23.1->ipykernel->jupyterlab->astrohack) (0.8.3)
Requirement already satisfied: fqdn in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (1.5.1)
Requirement already satisfied: isoduration in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (20.11.0)
Requirement already satisfied: jsonpointer>1.13 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (2.4)
Requirement already satisfied: uri-template in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (1.3.0)
Requirement already satisfied: webcolors>=1.11 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (1.13)
Requirement already satisfied: cffi>=1.0.1 in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from argon2-cffi-bindings->argon2-cffi->jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (1.15.0)
Requirement already satisfied: soupsieve>1.2 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from beautifulsoup4->nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (2.5)
Requirement already satisfied: filelock in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from gdown->xradio->graphviper->menrva->astrohack) (3.13.1)
Requirement already satisfied: pycparser in /export/home/ajax/jhoskins/.local/lib/python3.8/site-packages (from cffi>=1.0.1->argon2-cffi-bindings->argon2-cffi->jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (2.21)
Requirement already satisfied: arrow>=0.15.0 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from isoduration->jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (1.3.0)
Requirement already satisfied: PySocks!=1.5.7,>=1.5.6 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from requests[socks]->gdown->xradio->graphviper->menrva->astrohack) (1.7.1)
Requirement already satisfied: types-python-dateutil>=2.8.10 in /export/home/ajax/jhoskins/.conda/envs/holo-3.8/lib/python3.8/site-packages (from arrow>=0.15.0->isoduration->jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->jupyterlab->astrohack) (2.8.19.14)
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
/tmp/ipykernel_1927434/3141342790.py in <module>
      3 try:
----> 4     import astrohack
      5

~/Development/astrohack/src/astrohack/__init__.py in <module>
      5
----> 6 from .extract_holog import *
      7 from .extract_holog import generate_holog_obs_dict

~/Development/astrohack/src/astrohack/extract_holog.py in <module>
     10
---> 11 import auror.parameter
     12 import dask

ModuleNotFoundError: No module named 'auror'

During handling of the above exception, another exception occurred:

ModuleNotFoundError                       Traceback (most recent call last)
/tmp/ipykernel_1927434/3141342790.py in <module>
     11     os.system("pip install astrohack")
     12
---> 13     import astrohack
     14     print('astrohack version', astrohack.__version__, ' installed.')

~/Development/astrohack/src/astrohack/__init__.py in <module>
      4 __version__ = version('astrohack')
      5
----> 6 from .extract_holog import *
      7 from .extract_holog import generate_holog_obs_dict
      8 from .extract_pointing import *

~/Development/astrohack/src/astrohack/extract_holog.py in <module>
      9 import multiprocessing
     10
---> 11 import auror.parameter
     12 import dask
     13 import numpy as np

ModuleNotFoundError: No module named 'auror'
[3]:
# Convenience function:
import glob
def list_directory_files(path):
    try:
        for entry in glob.glob(path):
            print(entry)
    except FileNotFoundError:
        print(f'{path} not found.')

Download Tutorial Data and spawning an Astrohack Client

If the VLA data cannot be found in the specified directory it will be downloaded. The Astrohack client is spawned so that parallel processing is possible further down.

[31]:
from graphviper.dask.client import local_client

ms_name = 'data/ea25_cal_small_after_fixed.split.ms'
graphviper.utils.data.download('ea25_cal_small_after_fixed.split.ms', folder='data')

client = local_client(cores=2, memory_limit='8GB')
client
[2024-01-12 12:31:10,862]     INFO   astrohack:  File exists: data/ea25_cal_small_after_fixed.split.ms
[31]:

Client

MenrvaClient-d81e0361-b180-11ee-9879-c858c0afdf93

Connection method: Cluster object Cluster type: distributed.LocalCluster
Dashboard: http://127.0.0.1:46711/status

Cluster Info

[5]:
client.dashboard_link
[5]:
'http://127.0.0.1:46711/status'

Extract_holog: checking data calibration

Astrohack requires the measurement set (MS) that is fed into extract_holog to be properly calibrated in CASA. To check that calibration is sound, a method has been implemented in the holog_mds class that plots the visibilities at the center of the beam.

Run extract_holog or open a holog file

Prior to plotting the diagnostic plots it is necessary to create a holog_mds object (holography Multi DataSet). This Object can be created by running extract_holog, or by opening the data products of extract_holog with the function open_holog. Here extract_holog is executed if a previously produced .holog.zarr file is not found.

[6]:
import os

from astrohack import extract_holog
from astrohack import extract_pointing

from astrohack.dio import open_holog

point_name = 'data/ea25_cal_small_after_fixed.split.point.zarr'
extract_pointing(
      ms_name=ms_name,
      point_name=point_name,
      parallel=True,
      overwrite=True
)

holog_file = 'data/ea25_cal_small_after_fixed.split.holog.zarr'

if os.path.exists(holog_file):
    holog_mds = open_holog(holog_file)
else:
    holog_mds = extract_holog(
        ms_name=ms_name,
        point_name=point_name,
        data_column='CORRECTED_DATA',
        parallel=True,
        overwrite=True
    )
[2024-01-12 12:29:03,573]     INFO   astrohack:  Checking parameter values for extract_pointing.extract_pointing
[2024-01-12 12:29:03,574]     INFO   astrohack:  Searching file system for configuration files, please wait ...
[2024-01-12 12:29:03,575]     INFO   astrohack:  Failed to find module configuration in environment ... attemping to check common directories ...
[2024-01-12 12:29:03,575]     INFO   astrohack:  Searching file system for configuration files, please wait ...
[2024-01-12 12:29:03,648]  WARNING   astrohack:  data/ea25_cal_small_after_fixed.split.point.zarr will be overwritten.
Successful readonly open of usernoread-locked table data/ea25_cal_small_after_fixed.split.ms/ANTENNA: 8 columns, 3 rows
[2024-01-12 12:29:09,717]     INFO    worker-0:  Writing pointing xds to data/ea25_cal_small_after_fixed.split.point.zarr/ant_ea06
[2024-01-12 12:29:09,720]     INFO    worker-1:  Writing pointing xds to data/ea25_cal_small_after_fixed.split.point.zarr/ant_ea25
[2024-01-12 12:29:10,012]     INFO    worker-1:  Writing pointing xds to data/ea25_cal_small_after_fixed.split.point.zarr/ant_ea04
[2024-01-12 12:29:10,635]     INFO   astrohack:  Finished processing

Generate holography dictionary

The function extract_holog creates a fully formed observation dictionary by default but can also take a user specified observation dictionary via the input parameter, holog_obs_dict. To help with this the user function generate_holo_obs_dict is provided to generate and return the full dictionary to the user for subselection and modification.

[7]:
from astrohack.extract_holog import generate_holog_obs_dict

holog_obs_dict = generate_holog_obs_dict(
    ms_name='data/ea25_cal_small_after_fixed.split.ms',
    point_name='data/ea25_cal_small_after_fixed.split.point.zarr',
    parallel=False
)
[2024-01-12 12:29:10,872]     INFO   astrohack:  Writing distance matrix to /export/home/ajax/jhoskins/Development/astrohack-docs-n-tutorials/docs/.baseline_distance_matrix.csv ...

Inspect holography dictionary

Generally the printing a nested dictionary such as the holog_obs_dict is a messy, ugly affair and for this reason an additional convenience ffunction has been added to inspect the output dictionary, inspect_holog_ocs_dict.

This function has two modes:

static mode - Static mode is a formatted string output and allows the user to define how the antenna dictionary list is handled. By adjusting the columns input variable the user can for instance take an scan list of length of 15 and display it as 3 rows of 5 columns (this would be columns=5). The reshaping code will look at the list and reshape it even if the length is not an exact split, ie. length =17 with columns=5 would give 4 rows as output with the last row being the remainders.

dynamic mode - Dynamic mode returns a collapsible json dictionary in the cell so that the user can look at only certain parts of large holog dictionaries.

The function accepts both json objects and json files as input.

[8]:
from astrohack.dio import inspect_holog_obs_dict

inspect_holog_obs_dict(file=holog_obs_dict, style='static')
[12:29:10] {                                                                                             dio.py:430
               'ddi_0': {                                                                                          
                   'map_0': {                                                                                      
                       'scans': [                                                                                  
                           8,                                                                                      
                           9,                                                                                      
                           10,                                                                                     
                           12,                                                                                     
                           13,                                                                                     
                           14,                                                                                     
                           16,                                                                                     
                           17,                                                                                     
                           18,                                                                                     
                           23,                                                                                     
                           24,                                                                                     
                           25,                                                                                     
                           27,                                                                                     
                           28,                                                                                     
                           29,                                                                                     
                           31,                                                                                     
                           32,                                                                                     
                           33,                                                                                     
                           38,                                                                                     
                           39,                                                                                     
                           40,                                                                                     
                           42,                                                                                     
                           43,                                                                                     
                           44,                                                                                     
                           46,                                                                                     
                           47,                                                                                     
                           48,                                                                                     
                           53,                                                                                     
                           54,                                                                                     
                           55,                                                                                     
                           57                                                                                      
                       ],                                                                                          
                       'ant': {'ea25': ['ea04'], 'ea06': ['ea04']}                                                 
                   }                                                                                               
               },                                                                                                  
               'ddi_1': {                                                                                          
                   'map_0': {                                                                                      
                       'scans': [                                                                                  
                           8,                                                                                      
                           9,                                                                                      
                           10,                                                                                     
                           12,                                                                                     
                           13,                                                                                     
                           14,                                                                                     
                           16,                                                                                     
                           17,                                                                                     
                           18,                                                                                     
                           23,                                                                                     
                           24,                                                                                     
                           25,                                                                                     
                           27,                                                                                     
                           28,                                                                                     
                           29,                                                                                     
                           31,                                                                                     
                           32,                                                                                     
                           33,                                                                                     
                           38,                                                                                     
                           39,                                                                                     
                           40,                                                                                     
                           42,                                                                                     
                           43,                                                                                     
                           44,                                                                                     
                           46,                                                                                     
                           47,                                                                                     
                           48,                                                                                     
                           53,                                                                                     
                           54,                                                                                     
                           55,                                                                                     
                           57                                                                                      
                       ],                                                                                          
                       'ant': {'ea25': ['ea04'], 'ea06': ['ea04']}                                                 
                   }                                                                                               
               }                                                                                                   
           }                                                                                                       
[9]:
inspect_holog_obs_dict(file=holog_obs_dict, style='dynamic')
[9]:
<IPython.core.display.JSON object>

Now that we have a holog_mds object we define a variable holog_exports with the name of the directory to contain our diagnostic plots. We can also inspect our holog_mds object by calling its summary method. This method lists the attributes of the holog_mds, such as the input MS and the inputs given by the user, but more important for us going forward, it also gives us a summary of the data contents in the holog_mds and its available methods, here we are going to use the plot_diagnostics and plot_lm_sky_coverage methods.

[10]:
holog_exports = 'holog_exports'
holog_mds.summary()
####################################################################################################
###                                         Summary for:                                         ###
###                       data/ea25_cal_small_after_fixed.split.holog.zarr                       ###
####################################################################################################

Full documentation for AstrohackHologFile objects' API at:
https://astrohack.readthedocs.io/en/stable/_api/autoapi/astrohack/mds/index.html#astrohack.mds.AstrohackHologFile

Input Parameters:
+---------------------------+--------------------------------------------------+
| Parameter                 | Value                                            |
+---------------------------+--------------------------------------------------+
| ms_name                   | data/ea25_cal_small_after_fixed.split.ms         |
| point_name                | data/ea25_cal_small_after_fixed.split.point.zarr |
| holog_name                | data/ea25_cal_small_after_fixed.split.holog.zarr |
| holog_obs_dict            | None                                             |
| ddi                       | all                                              |
| baseline_average_distance | all                                              |
| baseline_average_nearest  | all                                              |
| data_column               | CORRECTED_DATA                                   |
| parallel                  | True                                             |
| overwrite                 | True                                             |
| version                   | 0.4.2                                            |
| origin                    | extract_holog                                    |
+---------------------------+--------------------------------------------------+

Contents:
+-------+-------+--------------------------+
| DDI   | Map   | Antenna                  |
+-------+-------+--------------------------+
| ddi_0 | map_0 | ['ant_ea25', 'ant_ea06'] |
| ddi_1 | map_0 | ['ant_ea25', 'ant_ea06'] |
+-------+-------+--------------------------+

Available methods:
+----------------------+-----------------------------------------------------------------------+
| Methods              | Description                                                           |
+----------------------+-----------------------------------------------------------------------+
| summary              | Prints summary of the AstrohackHologFile object, with available data, |
|                      | attributes and available methods                                      |
| select               | Select data on the basis of ddi, scan, ant. This is a convenience     |
|                      | function.                                                             |
| plot_diagnostics     | Plot diagnostic calibration plots from the holography data file.      |
| plot_lm_sky_coverage | Plot directional cosine coverage.                                     |
+----------------------+-----------------------------------------------------------------------+

Calibration diagnostic plots

Below is a call to plot_diagnostics, we limit our plotting to only DDI 0 of antenna ea25 for simplicity. The plot shown here displays the Amplitudes and phases for RR and LL correlations at the beam center for all channels. With this plots we want to make sure that the Amplitudes remain close to 1, and that the phase remains close to 0. The data displayed here is well calibrated but displays the Gibbs phenomenon at the band edges which is normal.

[11]:
holog_mds.plot_diagnostics(
    holog_exports,         # Directory to contain the plots
    ant='ea25',            # Plotting antenna ea25
    ddi=0,                 # Plotting DDI 0
    map_id="all",          # Plotting all mappings
    complex_split='polar', # Split complex data to polar (amplitude + phase)
    display=True,          # Display results in Notebook cell
    parallel=False         # Don't plots in parallel
)
[2024-01-12 12:29:10,999]     INFO   astrohack:  Checking parameter values for mds.AstrohackHologFile.plot_diagnostics
[2024-01-12 12:29:11,005]     INFO   astrohack:  Searching file system for configuration files, please wait ...
[2024-01-12 12:29:11,006]     INFO   astrohack:  Failed to find module configuration in environment ... attemping to check common directories ...
[2024-01-12 12:29:11,009]     INFO   astrohack:  Searching file system for configuration files, please wait ...
[2024-01-12 12:29:11,063]  WARNING   astrohack:  Destination folder already exists, results may be overwritten
_images/visualization_tutorial_20_1.png

Below we call plot_diagnostics again but this time over all the antennas and DDIs in the holog_mds. As before the created plots are stored in holog_exports but this time they are not displayed for brevity. All the files created by plot_diagnostics can be seen just after its execution.

[12]:
holog_mds.plot_diagnostics(
    holog_exports,             # Directory to contain the plots
    ant="all",                 # Plotting all antennas
    ddi="all",                 # Plotting all DDIs
    map_id="all",              # Plotting all mappings
    complex_split='cartesian', # Split comples data to cartesian (real + imaginary)
    display=False,             # don't display results in Notebook cell
    parallel=True              # Do plots in parallel
)

# All exported files
print('\nCreated files:')

list_directory_files(holog_exports+'/holog_diagnostics*.png')
[2024-01-12 12:29:12,545]     INFO   astrohack:  Checking parameter values for mds.AstrohackHologFile.plot_diagnostics
[2024-01-12 12:29:12,546]     INFO   astrohack:  Searching file system for configuration files, please wait ...
[2024-01-12 12:29:12,547]     INFO   astrohack:  Failed to find module configuration in environment ... attemping to check common directories ...
[2024-01-12 12:29:12,547]     INFO   astrohack:  Searching file system for configuration files, please wait ...
[2024-01-12 12:29:12,600]  WARNING   astrohack:  Destination folder already exists, results may be overwritten

Created files:
holog_exports/holog_diagnostics_map_0_ant_ea06_ddi_0.png
holog_exports/holog_diagnostics_map_0_ant_ea25_ddi_0.png
holog_exports/holog_diagnostics_map_0_ant_ea06_ddi_1.png
holog_exports/holog_diagnostics_map_0_ant_ea25_ddi_1.png

Directional cosines sky coverage

Below is a call to plot_lm_sky_coverage, we limit our plotting to only DDI 0 of antenna ea25 for simplicity. The plot shown here displays the sky coverage of the L and M axes. Also displayed are the Amplitudes and phases for the RR correlation as a function of the L, M and time axes. These plots help us in identifying problems with the pointing data in the MS, and or problems in the visibility data that vary with the L, M or time axes.

[13]:
holog_mds.plot_lm_sky_coverage(
    holog_exports,          # Directory to contain the plots
    ant='ea25',             # Plotting antenna ea25
    ddi=0,                  # Plotting DDI 0
    map_id="all",           # Plotting all mappings
    angle_unit='deg',       # Unit for L and M axes
    time_unit='hour',       # Time unit
    plot_correlation='RR',  # Which correlation to be plotted
    complex_split='polar',  # Split comples data to polar (Amplitude + phase)
    phase_unit='deg',       # Unit for phase
    display=True,           # Display plots bellow
    parallel=False          # Do not do plots in parallel
)
[2024-01-12 12:29:14,795]     INFO   astrohack:  Checking parameter values for mds.AstrohackHologFile.plot_lm_sky_coverage
[2024-01-12 12:29:14,795]     INFO   astrohack:  Searching file system for configuration files, please wait ...
[2024-01-12 12:29:14,796]     INFO   astrohack:  Failed to find module configuration in environment ... attemping to check common directories ...
[2024-01-12 12:29:14,797]     INFO   astrohack:  Searching file system for configuration files, please wait ...
[2024-01-12 12:29:14,866]  WARNING   astrohack:  Destination folder already exists, results may be overwritten
_images/visualization_tutorial_24_1.png
_images/visualization_tutorial_24_2.png

Below we call plot_lm_sky_coverage again but this time over all the antennas and DDIs in the holog_mds. As before the created plots are stored in holog_exports but this time they are not displayed for brevity. All the files created by plot_lm_sky_coverage can be seen just after its execution.

[14]:
holog_mds.plot_lm_sky_coverage(
    holog_exports,          # Directory to contain the plots
    ant="all",              # Plotting all antennas
    ddi="all",              # Plotting all DDIs
    map_id="all",           # Plotting all mappings
    angle_unit='deg',       # Unit for L and M axes
    time_unit='hour',       # Time unit
    plot_correlation='all', # Plot all corellations
    complex_split='polar',  # Split comples data to cartesian (real + imaginaty)
    phase_unit='deg',       # Unit for phase
    display=False,          # Do not display plots bellow
    parallel=True           # Do plots in parallel
)

# All exported files
print('\nCreated files:')

list_directory_files(holog_exports+'/holog_directional_cosines*.png')
[2024-01-12 12:29:17,867]     INFO   astrohack:  Checking parameter values for mds.AstrohackHologFile.plot_lm_sky_coverage
[2024-01-12 12:29:17,868]     INFO   astrohack:  Searching file system for configuration files, please wait ...
[2024-01-12 12:29:17,868]     INFO   astrohack:  Failed to find module configuration in environment ... attemping to check common directories ...
[2024-01-12 12:29:17,868]     INFO   astrohack:  Searching file system for configuration files, please wait ...
[2024-01-12 12:29:17,905]  WARNING   astrohack:  Destination folder already exists, results may be overwritten

Created files:
holog_exports/holog_directional_cosines_LR_map_0_ant_ea25_ddi_0.png
holog_exports/holog_directional_cosines_RR_map_0_ant_ea06_ddi_0.png
holog_exports/holog_directional_cosines_LR_map_0_ant_ea06_ddi_1.png
holog_exports/holog_directional_cosines_RL_map_0_ant_ea06_ddi_0.png
holog_exports/holog_directional_cosines_map_0_ant_ea25_ddi_1.png
holog_exports/holog_directional_cosines_map_0_ant_ea06_ddi_0.png
holog_exports/holog_directional_cosines_RL_map_0_ant_ea06_ddi_1.png
holog_exports/holog_directional_cosines_map_0_ant_ea06_ddi_1.png
holog_exports/holog_directional_cosines_RL_map_0_ant_ea25_ddi_0.png
holog_exports/holog_directional_cosines_LR_map_0_ant_ea25_ddi_1.png
holog_exports/holog_directional_cosines_RR_map_0_ant_ea06_ddi_1.png
holog_exports/holog_directional_cosines_RL_map_0_ant_ea25_ddi_1.png
holog_exports/holog_directional_cosines_LL_map_0_ant_ea06_ddi_0.png
holog_exports/holog_directional_cosines_RR_map_0_ant_ea25_ddi_0.png
holog_exports/holog_directional_cosines_map_0_ant_ea25_ddi_0.png
holog_exports/holog_directional_cosines_LL_map_0_ant_ea06_ddi_1.png
holog_exports/holog_directional_cosines_LL_map_0_ant_ea25_ddi_0.png
holog_exports/holog_directional_cosines_RR_map_0_ant_ea25_ddi_1.png
holog_exports/holog_directional_cosines_LR_map_0_ant_ea06_ddi_0.png
holog_exports/holog_directional_cosines_LL_map_0_ant_ea25_ddi_1.png

Holog: Checking beam and aperture quality and exporting data to FITS files

After we are sure about the quality of the calibrated data in the MS we want to make sure that the beam is well sampled and behaved and that the apertures are well characterised and have enough resolution. For that we are going to use the methods of the image_mds object, i.e. the data product of the holog function.

Run holog or open image file

Like before with the .holog.zarr file, if the .image.zarr is available we simply open it with open_image, otherwise we run holog to obtain our image_mds object.

[15]:
import os
from astrohack import holog, open_image

image_file = 'data/ea25_cal_small_after_fixed.split.image.zarr'

if os.path.exists(image_file):
    image_mds = open_image(image_file)
else:
    image_mds = holog(
        holog_name=holog_file,
        overwrite=True,
        phase_fit=True,
        apply_mask=True,
        to_stokes=True,
        parallel=True
)

Now that we have a image_mds object we define a variable called image_exports with the name of the directory to contain our plots and exported FITS files. We can also inspect our image_mds object by calling its summary method. Like for the holog_mds object, this method lists the attributes of the image_mds, such as the input .holog.zarr file and the inputs given by the user, like before we are actually interested on the data contents and the available methods. For this tutorial the relevant methods are plot_beams, plot_apertures and export_to_fits.

[16]:
image_exports = 'image_exports'
image_mds.summary()
####################################################################################################
###                                         Summary for:                                         ###
###                       data/ea25_cal_small_after_fixed.split.image.zarr                       ###
####################################################################################################

Full documentation for AstrohackImageFile objects' API at:
https://astrohack.readthedocs.io/en/stable/_api/autoapi/astrohack/mds/index.html#astrohack.mds.AstrohackImageFile

Input Parameters:
+-------------------------+--------------------------------------------------+
| Parameter               | Value                                            |
+-------------------------+--------------------------------------------------+
| holog_name              | data/ea25_cal_small_after_fixed.split.holog.zarr |
| grid_size               | None                                             |
| cell_size               | None                                             |
| image_name              | data/ea25_cal_small_after_fixed.split.image.zarr |
| padding_factor          | 50                                               |
| grid_interpolation_mode | linear                                           |
| chan_average            | True                                             |
| chan_tolerance_factor   | 0.005                                            |
| scan_average            | True                                             |
| ant                     | all                                              |
| ddi                     | all                                              |
| to_stokes               | True                                             |
| apply_mask              | True                                             |
| phase_fit               | True                                             |
| overwrite               | True                                             |
| parallel                | True                                             |
| version                 | 0.4.2                                            |
| origin                  | holog                                            |
+-------------------------+--------------------------------------------------+

Contents:
+----------+--------------------+
| Antenna  | DDI                |
+----------+--------------------+
| ant_ea25 | ['ddi_0', 'ddi_1'] |
| ant_ea06 | ['ddi_0', 'ddi_1'] |
+----------+--------------------+

Available methods:
+----------------+------------------------------------------------------------------------------+
| Methods        | Description                                                                  |
+----------------+------------------------------------------------------------------------------+
| summary        | Prints summary of the AstrohackImageFile object, with available data,        |
|                | attributes and available methods                                             |
| select         | Select data on the basis of ddi, scan, ant. This is a convenience function.  |
| export_to_fits | Export contents of an AstrohackImageFile object to several FITS files in the |
|                | destination folder                                                           |
| plot_beams     | Beam plots from the data in an AstrohackImageFIle object.                    |
| plot_apertures | Aperture amplitude and phase plots from the data in an AstrohackImageFIle    |
|                | object.                                                                      |
+----------------+------------------------------------------------------------------------------+

Plotting beams

Here we make a call to plot_beams to plot the beam for a single antenna and DDI for brevity. These plots tell us about the shape of the beam, i.e. is it circular? is it smeared?

[17]:
image_mds.plot_beams(
    image_exports,         # Directory to contain the plots
    ant='ea25',            # Plotting antenna ea25
    ddi=0,                 # Plotting DDI 0
    display=True,          # Display plots below
    angle_unit='amin',     # Unit for L and M axes
    complex_split='polar', # Plot amplitude and phase
    phase_unit='deg',      # Unit for phase
    parallel=True,        # Don't do plots in parallel
)
[2024-01-12 12:29:28,006]     INFO   astrohack:  Checking parameter values for mds.AstrohackImageFile.plot_beams
[2024-01-12 12:29:28,010]     INFO   astrohack:  Searching file system for configuration files, please wait ...
[2024-01-12 12:29:28,014]     INFO   astrohack:  Failed to find module configuration in environment ... attemping to check common directories ...
[2024-01-12 12:29:28,015]     INFO   astrohack:  Searching file system for configuration files, please wait ...
[2024-01-12 12:29:28,083]  WARNING   astrohack:  Destination folder already exists, results may be overwritten

Here we call again plot_beams, this time over all the Antennas and the DDIs in the image_mds. For brevity the plots are not displayed, but a list of the files created is displayed just after the execution of plot_beams

[18]:
image_mds.plot_beams(
    image_exports,         # Directory to contain the plots
    ant="all",             # Plotting all antennas
    ddi="all",             # Plotting all DDIs
    display=False,         # Don't display plots below
    complex_split='polar', # Plot amplitude and phase
    parallel=True,         # Do plots in parallel
)

# All exported files
print('\nCreated files:')

list_directory_files(image_exports+'/image_beam*.png')
[2024-01-12 12:29:30,553]     INFO   astrohack:  Checking parameter values for mds.AstrohackImageFile.plot_beams
[2024-01-12 12:29:30,556]     INFO   astrohack:  Searching file system for configuration files, please wait ...
[2024-01-12 12:29:30,556]     INFO   astrohack:  Failed to find module configuration in environment ... attemping to check common directories ...
[2024-01-12 12:29:30,557]     INFO   astrohack:  Searching file system for configuration files, please wait ...
[2024-01-12 12:29:30,601]  WARNING   astrohack:  Destination folder already exists, results may be overwritten

Created files:
image_exports/image_beam_phase_ant_ea06_ddi_0.png
image_exports/image_beam_amplitude_ant_ea25_ddi_0.png
image_exports/image_beam_phase_ant_ea06_ddi_1.png
image_exports/image_beam_amplitude_ant_ea25_ddi_1.png
image_exports/image_beam_amplitude_ant_ea06_ddi_0.png
image_exports/image_beam_phase_ant_ea25_ddi_0.png
image_exports/image_beam_amplitude_ant_ea06_ddi_1.png
image_exports/image_beam_phase_ant_ea25_ddi_1.png

Plotting apertures

Apertures are the final product of holog and are the data that is used by panel to compute the screw adjustments. Before proceeding to panel we may want to inspect the amplitude and phase maps of the apertures. Specifically the amplitude map may be used to estimate the value of the cutoff parameter of panel. In our first call to plot_apertures we are going to use a single antenna and DDI for display, followed by a call that goes over all antennas and DDIs and lists the created files.

[19]:
import numpy as np

image_mds.plot_apertures(
    image_exports,                # Directory to contain the plots
    ant='ea25',                   # Plotting antenna ea25
    ddi=0,                        # Plotting DDI 0
    plot_screws=True,             # Plotting screw positions
    phase_unit='rad',             # Plotting phase as radians, degrees also possible (deg)
    phase_limits=[-np.pi, np.pi], # Plotting from -pi to pi
    deviation_unit='mm',          # Plotting deviation as mm, all length units available
    deviation_limits=[-2, 2],     # Plotting from -2 to 2 mm
    display=True,                 # Display plots below
    parallel=True,                # Don't do plots in parallel
)
[2024-01-12 12:29:35,878]     INFO   astrohack:  Checking parameter values for mds.AstrohackImageFile.plot_apertures
[2024-01-12 12:29:35,879]     INFO   astrohack:  Searching file system for configuration files, please wait ...
[2024-01-12 12:29:35,879]     INFO   astrohack:  Failed to find module configuration in environment ... attemping to check common directories ...
[2024-01-12 12:29:35,880]     INFO   astrohack:  Searching file system for configuration files, please wait ...
[2024-01-12 12:29:35,940]  WARNING   astrohack:  Destination folder already exists, results may be overwritten
[20]:
image_mds.plot_apertures(
    image_exports,       # Directory to contain the plots
    ant="all",           # Plotting all antennas
    ddi="all",           # Plotting all DDIs
    plot_screws=True,    # Plotting screw positions
    display=False,       # Don't display plots below
    parallel=True,       # Do plots in parallel
)

# List All exported files
print('\nCreated files:')

list_directory_files(image_exports+'/image_amplitude*.png')
list_directory_files(image_exports+'/image_corrected*.png')
[2024-01-12 12:29:48,441]     INFO   astrohack:  Checking parameter values for mds.AstrohackImageFile.plot_apertures
[2024-01-12 12:29:48,443]     INFO   astrohack:  Searching file system for configuration files, please wait ...
[2024-01-12 12:29:48,445]     INFO   astrohack:  Failed to find module configuration in environment ... attemping to check common directories ...
[2024-01-12 12:29:48,445]     INFO   astrohack:  Searching file system for configuration files, please wait ...
[2024-01-12 12:29:48,507]  WARNING   astrohack:  Destination folder already exists, results may be overwritten

Created files:

Exporting image data to FITS

Sometimes it can be interesting to work with the data produced by holog in another astronomical software package such as astropy or carta. For this purpose we have introduced the method export_to_fits to the image_mds object. The FITS created by this routine encompass all the data arrays contained in each xarray dataset of the image_mds. After the execution of export_to_fits we display the list of created files and the header of one of the created files.

[21]:
image_mds.export_to_fits(
    image_exports,             # Directory to contain FITS files
    complex_split='cartesian', # Data will be split into real and imaginary FITS files
    ant="all",                 # Export all antennas
    ddi="all",                 # Export all DDIs
    parallel=True              # Export FITS files in parallel
)

# All exported files
print('\nCreated files:')

list_directory_files(image_exports+'/image*.fits')
[2024-01-12 12:30:18,890]     INFO   astrohack:  Checking parameter values for mds.AstrohackImageFile.export_to_fits
[2024-01-12 12:30:18,891]     INFO   astrohack:  Searching file system for configuration files, please wait ...
[2024-01-12 12:30:18,893]     INFO   astrohack:  Failed to find module configuration in environment ... attemping to check common directories ...
[2024-01-12 12:30:18,893]     INFO   astrohack:  Searching file system for configuration files, please wait ...
[2024-01-12 12:30:18,930]  WARNING   astrohack:  Destination folder already exists, results may be overwritten
Figure(800x640)
Figure(800x640)
Figure(800x640)
Figure(800x640)
Figure(800x640)
[2024-01-12 12:30:19,191]     INFO    worker-1:  Exporting image contents of ant_ea25 ddi_1 to FITS files in image_exports
[2024-01-12 12:30:19,365]     INFO    worker-0:  Exporting image contents of ant_ea06 ddi_0 to FITS files in image_exports
[2024-01-12 12:30:19,594]     INFO    worker-0:  Exporting image contents of ant_ea25 ddi_0 to FITS files in image_exports
[2024-01-12 12:30:19,645]     INFO    worker-1:  Exporting image contents of ant_ea06 ddi_1 to FITS files in image_exports

Created files:
image_exports/image_corrected_phase_ant_ea06_ddi_1.fits
image_exports/image_aperture_real_ant_ea06_ddi_1.fits
image_exports/image_beam_imag_ant_ea06_ddi_0.fits
image_exports/image_corrected_phase_ant_ea25_ddi_0.fits
image_exports/image_beam_real_ant_ea06_ddi_0.fits
image_exports/image_beam_imag_ant_ea06_ddi_1.fits
image_exports/image_aperture_imag_ant_ea06_ddi_1.fits
image_exports/image_aperture_imag_ant_ea25_ddi_1.fits
image_exports/image_aperture_imag_ant_ea06_ddi_0.fits
image_exports/image_aperture_real_ant_ea25_ddi_1.fits
image_exports/image_aperture_imag_ant_ea25_ddi_0.fits
image_exports/image_aperture_real_ant_ea06_ddi_0.fits
image_exports/image_beam_imag_ant_ea25_ddi_0.fits
image_exports/image_corrected_phase_ant_ea25_ddi_1.fits
image_exports/image_beam_real_ant_ea25_ddi_0.fits
image_exports/image_beam_imag_ant_ea25_ddi_1.fits
image_exports/image_beam_real_ant_ea06_ddi_1.fits
image_exports/image_aperture_real_ant_ea25_ddi_0.fits
image_exports/image_beam_real_ant_ea25_ddi_1.fits
image_exports/image_corrected_phase_ant_ea06_ddi_0.fits
[22]:
# Antenna ea06 DDI 0 aperture real FITS header
from astropy.io import fits

hdul = fits.open(image_exports+'/image_aperture_real_ant_ea06_ddi_0.fits')
print(repr(hdul[0].header))
SIMPLE  =                    T / conforms to FITS standard
BITPIX  =                  -64 / array data type
NAXIS   =                    4 / number of array dimensions
NAXIS1  =                  529
NAXIS2  =                  529
NAXIS3  =                    1
NAXIS4  =                    4
EXTEND  =                    T
STOKES  = 'I, Q, U, V'
WAVELENG= 0.021161322651231735
FREQUENC=        14167000000.0
TELESCOP= 'ea06    '
INSTRUME= 'VLA     '
TIME_CEN=         5170359444.5
PADDING =                   50
GRD_INTR= 'linear  '
CHAN_AVE= 'yes     '
CHAN_TOL=                0.005
SCAN_AVE= 'yes     '
TO_STOKE= 'yes     '
WCSAXES =                    4
CRVAL3  =                  0.0
CDELT3  =        14167000000.0
CRPIX3  =                  0.0
CROTA3  =                  0.0
CTYPE3  = 'Frequency'
CUNIT3  = 'Hz      '
CRVAL4  =                  1.0
CDELT4  =                  1.0
CRPIX4  =                  1.0
CROTA4  =                  0.0
CTYPE4  = 'STOKES  '
CUNIT4  = ''
CRVAL1  =  0.06209255783318923
CDELT1  = -0.06209255783318923
CRPIX1  =                264.0
CROTA1  =                  0.0
CTYPE1  = 'X----LIN'
CUNIT1  = 'm       '
CRVAL2  =  0.06209255783318923
CDELT2  = -0.06209255783318923
CRPIX2  =                264.0
CROTA2  =                  0.0
CTYPE2  = 'Y----LIN'
CUNIT2  = 'm       '
BMAJ    =   1.3905214376357493
BMIN    =   1.3905214376357493
BPA     =                  0.0
BUNIT   = 'Normalized'
TYPE    = 'Complex aperture real part'
ORIGIN  = 'Astrohack v0.4.2: image'
DATE    = 'Jan 12 2024, 12:30:19'

Panel: screw adjustments, plotting residuals corrections and exporting data to FITS

If we are sure about the quality of the data we can now proceed to getting screw adjustments and evaluating the surface provided by these adjustments. For that we are going to use the methods of the panel_mds object, i.e. the data product of the panel function.

Run panel or open panel file

Here we check for the existence of a .panel.zarr file, if it does not exist we run panel, if it exists we open it with open_panel.

[23]:
import os
from astrohack import panel, open_panel

panel_file = 'data/ea25_cal_small_after_fixed.split.panel.zarr'

if os.path.exists(panel_file):
    panel_mds = open_panel(panel_file)

else:
    panel_mds = panel(
        image_name=image_file,
        panel_model='rigid',
        panel_margins=0.2,
        clip_type='relative',
        clip_level=0.2,
        overwrite=True,
        parallel=True
    )

With the panel_mds in hands we can now explore its contents. As before we define a variable, this time called panel_exports, with the name of the directory to contain the exported products and we call the summary method to see the list of contents and available methods. In this tutorial we will cover the methods: plot_antennas, export_screws and export_to_fits.

[24]:
panel_exports = 'panel_exports'
panel_mds.summary()
####################################################################################################
###                                         Summary for:                                         ###
###                       data/ea25_cal_small_after_fixed.split.panel.zarr                       ###
####################################################################################################

Full documentation for AstrohackPanelFile objects' API at:
https://astrohack.readthedocs.io/en/stable/_api/autoapi/astrohack/mds/index.html#astrohack.mds.AstrohackPanelFile

Input Parameters:
+--------------------+--------------------------------------------------+
| Parameter          | Value                                            |
+--------------------+--------------------------------------------------+
| image_name         | data/ea25_cal_small_after_fixed.split.image.zarr |
| panel_name         | data/ea25_cal_small_after_fixed.split.panel.zarr |
| clip_type          | relative                                         |
| clip_level         | 0.2                                              |
| panel_model        | rigid                                            |
| panel_margins      | 0.2                                              |
| polarization_state | I                                                |
| ant                | all                                              |
| ddi                | all                                              |
| parallel           | True                                             |
| overwrite          | True                                             |
| version            | 0.4.2                                            |
| origin             | panel                                            |
+--------------------+--------------------------------------------------+

Contents:
+----------+--------------------+
| Antenna  | DDI                |
+----------+--------------------+
| ant_ea25 | ['ddi_0', 'ddi_1'] |
| ant_ea06 | ['ddi_0', 'ddi_1'] |
+----------+--------------------+

Available methods:
+----------------+-----------------------------------------------------------------------+
| Methods        | Description                                                           |
+----------------+-----------------------------------------------------------------------+
| summary        | Prints summary of the AstrohackPanelFile object, with available data, |
|                | attributes and available methods                                      |
| get_antenna    | Retrieve an AntennaSurface object for interaction                     |
| export_screws  | Export screw adjustments to text files and optionally plots.          |
| export_to_fits | Export contents of an Astrohack MDS file to several FITS files in the |
|                | destination folder                                                    |
| plot_antennas  | Create diagnostic plots of antenna surfaces from panel data file.     |
+----------------+-----------------------------------------------------------------------+

Plotting antenna original deviation, residuals and corrections

Here we make a first call to plot_antennas to plot only the deviations for a single antenna and DDI for brevity, and then a second call to produce all possible plots for all the antennas and DDIs present in the panel_mds. The deviation plots shown below serve to ilustrate the current state of the antenna surface, the proposed corrections to it, and the estimated residuals after the correction is applied to the antenna.

[25]:
panel_mds.plot_antennas(
    panel_exports,           # Directory to contain the plot and text file
    ant='ea25',              # Plotting Antenna ea25
    ddi=0,                   # Plotting DDI 0
    plot_type='deviation',   # Do deviation plots only
    deviation_unit='mils',   #
    plot_screws=False,       # Not plotting screw positions
    parallel=False,          # Don't do plots in parallel
    display=True             # Display plots below
)
[2024-01-12 12:30:19,950]     INFO   astrohack:  Checking parameter values for mds.AstrohackPanelFile.plot_antennas
[2024-01-12 12:30:19,951]     INFO   astrohack:  Searching file system for configuration files, please wait ...
[2024-01-12 12:30:19,953]     INFO   astrohack:  Failed to find module configuration in environment ... attemping to check common directories ...
[2024-01-12 12:30:19,953]     INFO   astrohack:  Searching file system for configuration files, please wait ...
_images/visualization_tutorial_48_1.png
_images/visualization_tutorial_48_2.png
_images/visualization_tutorial_48_3.png
[26]:
panel_mds.plot_antennas(
    panel_exports,           # Directory to contain the plot and text file
    ant="all",               # Plotting all antennas
    ddi="all",               # Plotting all DDIs
    plot_type='all',         # Do all possible plots
    plot_screws=False,       # Not plotting screw positions
    parallel=True,           # Do plots in parallel
    display=False            # Don't Display plots below
)

# All exported files
print('\nCreated files:')

list_directory_files(panel_exports+'/panel_mask*.png')
list_directory_files(panel_exports+'/panel_amplitude*.png')
list_directory_files(panel_exports+'/panel_deviation*.png')
list_directory_files(panel_exports+'/panel_phase*.png')

[2024-01-12 12:30:24,353]     INFO   astrohack:  Checking parameter values for mds.AstrohackPanelFile.plot_antennas
[2024-01-12 12:30:24,355]     INFO   astrohack:  Searching file system for configuration files, please wait ...
[2024-01-12 12:30:24,356]     INFO   astrohack:  Failed to find module configuration in environment ... attemping to check common directories ...
[2024-01-12 12:30:24,357]     INFO   astrohack:  Searching file system for configuration files, please wait ...
[2024-01-12 12:30:24,411]  WARNING   astrohack:  Destination folder already exists, results may be overwritten

Created files:

Screw adjustments

If we are satisfied with the proposed corrections we can then export them as a txt file and an acompaining helper plot. This can be done with the panel_mds method export_screws. Here we cover a single antenna and DDI for brevity.

[27]:
panel_mds.export_screws(
    panel_exports,            # Directory to contain the plot and text file
    unit='mils',              # Unit to express screw adjustments in plots and texts
    threshold= 25,            # Threshold in mils for significant adjustments
    display=True,             # Display plot below
    ant='ea25',               # Export screw adjustments for antenna ea25
    ddi=0                     # Export screw adjustments for ddi 0
)
[2024-01-12 12:30:41,451]     INFO   astrohack:  Checking parameter values for mds.AstrohackPanelFile.export_screws
[2024-01-12 12:30:41,451]     INFO   astrohack:  Searching file system for configuration files, please wait ...
[2024-01-12 12:30:41,452]     INFO   astrohack:  Failed to find module configuration in environment ... attemping to check common directories ...
[2024-01-12 12:30:41,453]     INFO   astrohack:  Searching file system for configuration files, please wait ...
[2024-01-12 12:30:41,517]  WARNING   astrohack:  Destination folder already exists, results may be overwritten
_images/visualization_tutorial_51_1.png

Below we show an example of a txt file produced by export_screws

[28]:
with open(panel_exports+'/panel_screws_ant_ea25_ddi_0.txt', 'r') as file:
    for _ in range(30):
        print(file.readline()[:-1])
# Screw adjustments for VLA ea25 antenna
# Adjustments are in mils

# Lower means away from subreflector
# Raise means toward the subreflector
# LOWER the panel if the number is POSITIVE
# RAISE the panel if the number is NEGATIVE


Panel           il         ir         ol         or
1-1          -29.85      -5.25      -1.46      44.54
1-2          -15.11     -21.04      18.10       7.02
1-3           13.42      18.76       1.81      11.80
1-4          -10.19     -26.44     -10.86     -41.23
1-5          -17.62     -11.82     -17.76      -6.90
1-6          -39.25     -27.37       0.31      22.52
1-7          -44.24     -45.22      11.13       9.30
1-8          -58.86     -52.70      17.27      28.79
1-9           26.36       6.36       1.68     -35.72
1-10           5.66      24.91     -29.61       6.39
1-11          47.52      56.63     -19.14      -2.11
1-12          28.28       0.09      35.35     -17.36
2-1           25.96      31.18      12.84      20.74
2-2          -13.86     -18.61       6.18      -1.00
2-3            5.84       5.04      -6.09      -7.30
2-4            2.04      -5.49      -9.55     -20.93
2-5          -20.64       7.20     -21.55      20.52
2-6           10.95      -9.54      31.57       0.59
2-7          -38.10     -24.08     -14.66       6.53
2-8           29.94      23.74     -13.90     -23.28

Exporting panel data to FITS

As with the image_mds data it may be convenient to export the data arrays in a panel_mds to FITS files. This can be acomplished with the method export_to_fits. As before we export all the data in the panel_mds, display a list of the produced files and an example header of one of the created files.

[29]:
panel_mds.export_to_fits(
    panel_exports,             # Directory to contain FITS files
    ant="all",                 # Export all antennas
    ddi="all",                 # Export all DDIs
    parallel=True              # Export FITS files in parallel
)

# All exported files
print("\nCreated files:")

list_directory_files(panel_exports+'/panel*.fits')
[2024-01-12 12:30:44,359]     INFO   astrohack:  Checking parameter values for mds.AstrohackPanelFile.export_to_fits
[2024-01-12 12:30:44,361]     INFO   astrohack:  Searching file system for configuration files, please wait ...
[2024-01-12 12:30:44,361]     INFO   astrohack:  Failed to find module configuration in environment ... attemping to check common directories ...
[2024-01-12 12:30:44,362]     INFO   astrohack:  Searching file system for configuration files, please wait ...
[2024-01-12 12:30:44,414]  WARNING   astrohack:  Destination folder already exists, results may be overwritten
[2024-01-12 12:30:44,604]     INFO    worker-0:  Exporting panel contents of ant_ea25 ddi_1 to FITS files in panel_exports
[2024-01-12 12:30:44,714]     INFO    worker-1:  Exporting panel contents of ant_ea25 ddi_0 to FITS files in panel_exports
[2024-01-12 12:30:44,894]     INFO    worker-0:  Exporting panel contents of ant_ea06 ddi_1 to FITS files in panel_exports
[2024-01-12 12:30:45,078]     INFO    worker-1:  Exporting panel contents of ant_ea06 ddi_0 to FITS files in panel_exports

Created files:
panel_exports/panel_deviation_residual_ant_ea25_ddi_1.fits
panel_exports/panel_deviation_correction_ant_ea06_ddi_1.fits
panel_exports/panel_phase_correction_ant_ea06_ddi_1.fits
panel_exports/panel_phase_residual_ant_ea25_ddi_0.fits
panel_exports/panel_deviation_residual_ant_ea06_ddi_0.fits
panel_exports/panel_amplitude_ant_ea25_ddi_1.fits
panel_exports/panel_deviation_residual_ant_ea25_ddi_0.fits
panel_exports/panel_deviation_original_ant_ea25_ddi_0.fits
panel_exports/panel_mask_ant_ea06_ddi_1.fits
panel_exports/panel_phase_residual_ant_ea06_ddi_0.fits
panel_exports/panel_phase_correction_ant_ea06_ddi_0.fits
panel_exports/panel_deviation_correction_ant_ea25_ddi_1.fits
panel_exports/panel_phase_correction_ant_ea25_ddi_0.fits
panel_exports/panel_deviation_correction_ant_ea06_ddi_0.fits
panel_exports/panel_mask_ant_ea06_ddi_0.fits
panel_exports/panel_mask_ant_ea25_ddi_1.fits
panel_exports/panel_deviation_residual_ant_ea06_ddi_1.fits
panel_exports/panel_phase_original_ant_ea25_ddi_1.fits
panel_exports/panel_phase_correction_ant_ea25_ddi_1.fits
panel_exports/panel_mask_ant_ea25_ddi_0.fits
panel_exports/panel_deviation_original_ant_ea06_ddi_0.fits
panel_exports/panel_amplitude_ant_ea25_ddi_0.fits
panel_exports/panel_amplitude_ant_ea06_ddi_1.fits
panel_exports/panel_phase_original_ant_ea06_ddi_1.fits
panel_exports/panel_amplitude_ant_ea06_ddi_0.fits
panel_exports/panel_phase_original_ant_ea06_ddi_0.fits
panel_exports/panel_deviation_original_ant_ea06_ddi_1.fits
panel_exports/panel_phase_original_ant_ea25_ddi_0.fits
panel_exports/panel_phase_residual_ant_ea25_ddi_1.fits
panel_exports/panel_deviation_original_ant_ea25_ddi_1.fits
panel_exports/panel_phase_residual_ant_ea06_ddi_1.fits
panel_exports/panel_deviation_correction_ant_ea25_ddi_0.fits
[30]:
# Antenna ea06 DDI 0 deviation residual FITS header
from astropy.io import fits

hdul = fits.open(panel_exports+'/panel_deviation_residual_ant_ea06_ddi_0.fits')
print(repr(hdul[0].header))
SIMPLE  =                    T / conforms to FITS standard
BITPIX  =                  -64 / array data type
NAXIS   =                    2 / number of array dimensions
NAXIS1  =                  442
NAXIS2  =                  442
EXTEND  =                    T
PMODEL  = 'rigid   '
PMARGIN =                  0.2
CLIP    =   0.8942142937724326
TELESCOP= 'ea06    '
INSTRUME= 'VLA     '
WAVELENG= 0.021161322651231735
FREQUENC=        14167000000.0
WCSAXES =                    2
CRVAL1  =  0.06209255783318923
CDELT1  = -0.06209255783318923
CRPIX1  =                221.0
CROTA1  =                  0.0
CTYPE1  = 'X----LIN'
CUNIT1  = 'm       '
CRVAL2  =  0.06209255783318923
CDELT2  = -0.06209255783318923
CRPIX2  =                221.0
CROTA2  =                  0.0
CTYPE2  = 'Y----LIN'
CUNIT2  = 'm       '
BMAJ    =   1.3905214376357493
BMIN    =   1.3905214376357493
BPA     =                  0.0
BUNIT   = 'm       '
TYPE    = 'Deviation residuals'
ORIGIN  = 'Astrohack v0.4.2: panel'
DATE    = 'Jan 12 2024, 12:30:45'