astrohack 1.0.3__tar.gz → 1.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. {astrohack-1.0.3/src/astrohack.egg-info → astrohack-1.1.0}/PKG-INFO +1 -1
  2. {astrohack-1.0.3 → astrohack-1.1.0}/README.rst +4 -4
  3. {astrohack-1.0.3 → astrohack-1.1.0}/pyproject.toml +1 -1
  4. astrohack-1.1.0/src/astrohack/__init__.py +66 -0
  5. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/antenna/antenna_surface.py +6 -24
  6. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/antenna/base_panel.py +2 -1
  7. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/antenna/panel_fitting.py +0 -3
  8. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/antenna/telescope.py +2 -2
  9. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/cassegrain_ray_tracing.py +18 -3
  10. astrohack-1.1.0/src/astrohack/config/fringefit_locit.param.json +51 -0
  11. astrohack-1.1.0/src/astrohack/config/locit_mds.param.json +212 -0
  12. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/core/beamcut.py +49 -8
  13. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/core/cassegrain_ray_tracing.py +1 -1
  14. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/core/combine.py +2 -2
  15. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/core/extract_holog.py +78 -101
  16. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/core/extract_locit.py +25 -8
  17. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/core/extract_pointing.py +11 -8
  18. astrohack-1.1.0/src/astrohack/core/fringefit_locit.py +260 -0
  19. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/core/holog_obs_dict.py +3 -1
  20. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/core/image_comparison_tool.py +3 -3
  21. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/core/locit.py +21 -7
  22. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/data/telescopes/vla.zarr/.zattrs +18 -11
  23. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/data/telescopes/vla.zarr/.zmetadata +18 -11
  24. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/extract_locit.py +2 -2
  25. astrohack-1.1.0/src/astrohack/fringefit_locit.py +152 -0
  26. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/io/base_mds.py +14 -0
  27. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/io/beamcut_mds.py +14 -9
  28. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/io/dio.py +3 -1
  29. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/io/holog_mds.py +2 -2
  30. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/io/image_mds.py +1 -2
  31. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/io/locit_mds.py +25 -10
  32. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/io/point_mds.py +2 -2
  33. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/io/position_mds.py +7 -7
  34. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/locit.py +6 -3
  35. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/panel.py +0 -1
  36. astrohack-1.1.0/src/astrohack/scripts/baseline/baseline_reduction_pipeline.py +818 -0
  37. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/scripts/beamcuts/beamcut_reduction_pipeline.py +25 -13
  38. astrohack-1.1.0/src/astrohack/scripts/verification/execute-and-upload-tests.py +260 -0
  39. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/scripts/verification/file_uploader.py +1 -1
  40. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/utils/algorithms.py +1 -2
  41. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/utils/conversion.py +3 -1
  42. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/utils/fits.py +2 -2
  43. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/utils/graph.py +1 -1
  44. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/utils/gridding.py +2 -2
  45. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/utils/pipeline_support.py +35 -13
  46. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/utils/ray_tracing_general.py +6 -1
  47. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/utils/text.py +21 -8
  48. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/utils/verification_tools.py +2 -6
  49. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/visualization/plot_tools.py +14 -3
  50. {astrohack-1.0.3 → astrohack-1.1.0/src/astrohack.egg-info}/PKG-INFO +1 -1
  51. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack.egg-info/SOURCES.txt +3 -2
  52. astrohack-1.0.3/src/astrohack/__init__.py +0 -58
  53. astrohack-1.0.3/src/astrohack/config/locit_mds.param.json +0 -95
  54. astrohack-1.0.3/src/astrohack/scripts/baseline/baseline_reduction_pipeline.py +0 -588
  55. astrohack-1.0.3/src/astrohack/scripts/verification/execute-and-upload-tests.py +0 -144
  56. astrohack-1.0.3/src/astrohack/utils/veritas.py +0 -160
  57. astrohack-1.0.3/src/astrohack/visualization/__init__.py +0 -10
  58. {astrohack-1.0.3 → astrohack-1.1.0}/LICENSE +0 -0
  59. {astrohack-1.0.3 → astrohack-1.1.0}/MANIFEST.in +0 -0
  60. {astrohack-1.0.3 → astrohack-1.1.0}/setup.cfg +0 -0
  61. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/antenna/__init__.py +0 -0
  62. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/antenna/polygon_panel.py +0 -0
  63. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/antenna/ring_panel.py +0 -0
  64. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/beamcut.py +0 -0
  65. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/combine.py +0 -0
  66. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/config/beamcut.param.json +0 -0
  67. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/config/beamcut_mds.param.json +0 -0
  68. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/config/cassegrain_ray_tracing.param.json +0 -0
  69. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/config/combine.param.json +0 -0
  70. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/config/create_param_json.py +0 -0
  71. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/config/dask.config.yaml +0 -0
  72. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/config/extract_holog.param.json +0 -0
  73. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/config/extract_locit.param.json +0 -0
  74. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/config/extract_pointing.param.json +0 -0
  75. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/config/holog.param.json +0 -0
  76. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/config/holog_mds.param.json +0 -0
  77. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/config/image_comparison_tool.param.json +0 -0
  78. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/config/image_mds.param.json +0 -0
  79. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/config/locit.param.json +0 -0
  80. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/config/panel.param.json +0 -0
  81. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/config/panel_mds.param.json +0 -0
  82. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/config/point_mds.param.json +0 -0
  83. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/config/position_mds.param.json +0 -0
  84. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/core/__init__.py +0 -0
  85. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/core/holog.py +0 -0
  86. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/core/panel.py +0 -0
  87. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/data/telescopes/aca_7m.zarr/.zattrs +0 -0
  88. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/data/telescopes/aca_7m.zarr/.zgroup +0 -0
  89. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/data/telescopes/aca_7m.zarr/.zmetadata +0 -0
  90. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/data/telescopes/alma_da.zarr/.zattrs +0 -0
  91. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/data/telescopes/alma_da.zarr/.zgroup +0 -0
  92. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/data/telescopes/alma_da.zarr/.zmetadata +0 -0
  93. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/data/telescopes/alma_dv.zarr/.zattrs +0 -0
  94. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/data/telescopes/alma_dv.zarr/.zgroup +0 -0
  95. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/data/telescopes/alma_dv.zarr/.zmetadata +0 -0
  96. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/data/telescopes/alma_tp.zarr/.zattrs +0 -0
  97. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/data/telescopes/alma_tp.zarr/.zgroup +0 -0
  98. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/data/telescopes/alma_tp.zarr/.zmetadata +0 -0
  99. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/data/telescopes/fix_telescope_files.bash +0 -0
  100. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/data/telescopes/ngvla_proto_2025.zarr/.zattrs +0 -0
  101. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/data/telescopes/ngvla_proto_2025.zarr/.zgroup +0 -0
  102. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/data/telescopes/ngvla_proto_2025.zarr/.zmetadata +0 -0
  103. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/data/telescopes/ngvla_proto_2025.zarr/point_cloud/.zarray +0 -0
  104. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/data/telescopes/ngvla_proto_2025.zarr/point_cloud/0.0 +0 -0
  105. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/data/telescopes/ngvla_proto_2025.zarr/qps_coefficients/.zarray +0 -0
  106. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/data/telescopes/ngvla_proto_2025.zarr/qps_coefficients/0 +0 -0
  107. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/data/telescopes/vla.zarr/.zgroup +0 -0
  108. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/data/telescopes/vlba.zarr/.zattrs +0 -0
  109. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/data/telescopes/vlba.zarr/.zgroup +0 -0
  110. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/data/telescopes/vlba.zarr/.zmetadata +0 -0
  111. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/extract_holog.py +0 -0
  112. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/extract_pointing.py +0 -0
  113. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/holog.py +0 -0
  114. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/image_comparison_tool.py +0 -0
  115. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/io/__init__.py +0 -0
  116. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/io/panel_mds.py +0 -0
  117. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/scripts/__init__.py +0 -0
  118. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/scripts/baseline/__init__.py +0 -0
  119. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/scripts/beamcuts/__init__.py +0 -0
  120. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/scripts/verification/__init__.py +0 -0
  121. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/utils/__init__.py +0 -0
  122. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/utils/constants.py +0 -0
  123. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/utils/file.py +0 -0
  124. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/utils/imaging.py +0 -0
  125. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/utils/package_info.py +0 -0
  126. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/utils/phase_fitting.py +0 -0
  127. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/utils/tools.py +0 -0
  128. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/utils/validation.py +0 -0
  129. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/utils/zernike_aperture_fitting.py +0 -0
  130. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/visualization/array_cfg_plot.py +0 -0
  131. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack/visualization/observation_summary.py +0 -0
  132. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack.egg-info/dependency_links.txt +0 -0
  133. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack.egg-info/entry_points.txt +0 -0
  134. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack.egg-info/requires.txt +0 -0
  135. {astrohack-1.0.3 → astrohack-1.1.0}/src/astrohack.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: astrohack
3
- Version: 1.0.3
3
+ Version: 1.1.0
4
4
  Summary: Holography Antenna Commissioning Kit
5
5
  Author-email: Joshua Hoskins <jhoskins@nrao.edu>, Victor de Souza Magalhaes <vdesouza@nrao.edu>, Jan-Willem Steeb <jsteeb@nrao.edu>
6
6
  Requires-Python: <3.14,>=3.11
@@ -33,16 +33,16 @@ holography and antenna position corrections.
33
33
 
34
34
  Currently AstroHACK supports:
35
35
 
36
- - `Astronomical holographies from the VLA <https://astrohack.readthedocs.io/en/stable/tutorial_vla.html>`_.
36
+ - `Astronomical holographies from the VLA <https://astrohack.readthedocs.io/en/stable/tutorials/vla_holography_tutorial.html>`_.
37
37
  - Astronomical holographies from ALMA.
38
- - `Antenna position corrections for the VLA <https://astrohack.readthedocs.io/en/stable/locit_tutorial>`_.
39
- - `Near-field ALMA holographies <./https://astrohack.readthedocs.io/en/stable/AstroHACK-for-NF-ALMA.html>`_ have
38
+ - `Antenna position corrections for the VLA <https://astrohack.readthedocs.io/en/stable/tutorials/locit_tutorial.html>`_.
39
+ - `Near-field ALMA holographies <https://astrohack.readthedocs.io/en/stable/online_pages/AstroHACK-for-NF-ALMA.html>`_ have
40
40
  basic support, such as the creation of Aperture images, but the
41
41
  correction of near-field effects is not yet supported.
42
42
 
43
43
  In the near term we are working to support the `ngVLA antenna
44
44
  prototype <https://public.nrao.edu/ngvla/>`_ comissioning activities.
45
- The prototype antenna is currently (March 2025) under construction at
45
+ The prototype antenna is currently (August 2026) under imital testing at
46
46
  the VLA site.
47
47
 
48
48
  The holography tasks in AstroHACK port much of the functionality of
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "astrohack"
3
- version = "1.0.3"
3
+ version = "1.1.0"
4
4
  description = "Holography Antenna Commissioning Kit"
5
5
  readme = "README.md"
6
6
  requires-python = ">= 3.11, < 3.14"
@@ -0,0 +1,66 @@
1
+ import os
2
+ from importlib.metadata import version
3
+
4
+ __version__ = version("astrohack")
5
+
6
+ from astrohack.io.dio import open_beamcut as open_beamcut
7
+ from astrohack.io.dio import open_position as open_position
8
+ from astrohack.io.dio import open_image as open_image
9
+ from astrohack.io.dio import open_locit as open_locit
10
+ from astrohack.io.dio import open_panel as open_panel
11
+ from astrohack.io.dio import open_pointing as open_pointing
12
+ from astrohack.io.dio import open_holog as open_holog
13
+
14
+ from astrohack.io.point_mds import AstrohackPointFile as AstrohackPointFile
15
+ from astrohack.io.locit_mds import AstrohackLocitFile as AstrohackLocitFile
16
+ from astrohack.io.holog_mds import AstrohackHologFile as AstrohackHologFile
17
+ from astrohack.io.panel_mds import AstrohackPanelFile as AstrohackPanelFile
18
+ from astrohack.io.beamcut_mds import AstrohackBeamcutFile as AstrohackBeamcutFile
19
+ from astrohack.io.position_mds import AstrohackPositionFile as AstrohackPositionFile
20
+ from astrohack.io.image_mds import AstrohackImageFile as AstrohackImageFile
21
+
22
+ from .extract_holog import extract_holog as extract_holog
23
+ from .extract_holog import generate_holog_obs_dict as generate_holog_obs_dict
24
+ from .beamcut import beamcut as beamcut
25
+ from .extract_pointing import extract_pointing as extract_pointing
26
+ from .holog import holog as holog
27
+ from .panel import panel as panel
28
+ from .combine import combine as combine
29
+ from .locit import locit as locit
30
+ from .extract_locit import extract_locit as extract_locit
31
+ from .fringefit_locit import fringefit_locit as fringefit_locit
32
+ from .cassegrain_ray_tracing import (
33
+ cassegrain_ray_tracing_pipeline as cassegrain_ray_tracing_pipeline,
34
+ )
35
+ from .cassegrain_ray_tracing import (
36
+ create_ray_tracing_telescope_parameter_dict as create_ray_tracing_telescope_parameter_dict,
37
+ )
38
+ from .cassegrain_ray_tracing import plot_2d_maps_from_rt_xds as plot_2d_maps_from_rt_xds
39
+ from .cassegrain_ray_tracing import (
40
+ plot_radial_projection_from_rt_xds as plot_radial_projection_from_rt_xds,
41
+ )
42
+ from .cassegrain_ray_tracing import (
43
+ apply_holog_phase_fitting_to_rt_xds as apply_holog_phase_fitting_to_rt_xds,
44
+ )
45
+
46
+ from .image_comparison_tool import compare_fits_images as compare_fits_images
47
+ from .image_comparison_tool import (
48
+ rms_table_from_zarr_datatree as rms_table_from_zarr_datatree,
49
+ )
50
+ from .antenna.telescope import get_proper_telescope as get_proper_telescope
51
+
52
+ # This installs a slick, informational tracebacks logger
53
+ from rich.traceback import install
54
+ from toolviper.utils.logger import setup_logger
55
+
56
+ install(show_locals=False)
57
+
58
+ if not os.getenv("LOGGER_NAME"):
59
+ os.environ["LOGGER_NAME"] = "astrohack"
60
+ setup_logger(
61
+ logger_name="astrohack",
62
+ log_to_term=True,
63
+ log_to_file=False,
64
+ log_file="astrohack-logfile",
65
+ log_level="INFO",
66
+ )
@@ -1,4 +1,5 @@
1
1
  import xarray as xr
2
+ import numpy as np
2
3
 
3
4
  from matplotlib import patches
4
5
 
@@ -9,7 +10,7 @@ from astrohack.utils.algorithms import (
9
10
  data_statistics,
10
11
  phase_wrapping,
11
12
  )
12
- from astrohack.utils.constants import *
13
+ from astrohack.utils.constants import clight, fourpi
13
14
  from astrohack.utils.conversion import to_db
14
15
  from astrohack.utils.conversion import convert_unit
15
16
  from astrohack.utils.text import (
@@ -139,11 +140,9 @@ class AntennaSurface:
139
140
  .values
140
141
  )
141
142
 
142
- self.npoint = np.sqrt(inputxds.sizes["l"] ** 2 + inputxds.sizes["m"] ** 2)
143
143
  self.amp_unit = "V"
144
144
  self.u_axis = inputxds.u_prime.values
145
145
  self.v_axis = inputxds.v_prime.values
146
- self.computephase = False
147
146
 
148
147
  def _read_panel_xds(self, inputxds):
149
148
  self.wavelength = inputxds.attrs["wavelength"]
@@ -244,7 +243,7 @@ class AntennaSurface:
244
243
  while fraction_in < threshold:
245
244
  clip *= multiplier
246
245
  data_in = np.where(in_disk_amp > clip, 1.0, 0.0)
247
- fraction_in = np.sum(data_in) / n_in_disk
246
+ fraction_in = float(np.sum(data_in)) / n_in_disk
248
247
  multiplier *= step_multiplier
249
248
 
250
249
  return clip
@@ -271,23 +270,6 @@ class AntennaSurface:
271
270
  self.amplitude = np.where(self.base_mask, self.amplitude, np.nan)
272
271
  self.deviation = np.where(self.base_mask, self.deviation, np.nan)
273
272
 
274
- def _fetch_panel_ringed(self, ring, panel):
275
- """
276
- Fetch a panel object from the panel list using its ring and panel numbers,
277
- specific for circular antennas with panels arranged in rings
278
- Args:
279
- ring: Ring number
280
- panel: Panel number
281
-
282
- Returns:
283
- Panel object
284
- """
285
- if ring == 1:
286
- ipanel = panel - 1
287
- else:
288
- ipanel = np.sum(self.telescope.n_panel_per_ring[: ring - 1]) + panel - 1
289
- return self.panels[ipanel]
290
-
291
273
  def gains(self):
292
274
  """
293
275
  Computes antenna gains in decibels before and after panel surface fitting
@@ -518,8 +500,8 @@ class AntennaSurface:
518
500
  raise ValueError("Map list and label list must be of the same size")
519
501
  nplots = len(maps)
520
502
  if parm_dict["z_lim"] is None or parm_dict["z_lim"] == "None":
521
- vmax = np.nanmax(
522
- np.abs(factor * maps[0])
503
+ vmax = float(
504
+ np.nanmax(np.abs(factor * maps[0]))
523
505
  ) # Gotten from the original map (displays the biggest variation)
524
506
  parm_dict["z_lim"] = [-vmax, vmax]
525
507
  for iplot in range(nplots):
@@ -606,7 +588,7 @@ class AntennaSurface:
606
588
  fig, ax = create_figure_and_axes(parm_dict["figure_size"], [1, 1])
607
589
 
608
590
  fac = convert_unit("m", unit, "length")
609
- vmax = np.nanmax(np.abs(fac * self.screw_adjustments))
591
+ vmax = float(np.nanmax(np.abs(fac * self.screw_adjustments)))
610
592
  vmin = -vmax
611
593
  if threshold is None or threshold == "None":
612
594
  threshold = 0.1 * vmax
@@ -4,8 +4,9 @@ from matplotlib import pyplot as plt
4
4
  from matplotlib.colors import Normalize
5
5
 
6
6
  from astrohack.antenna.panel_fitting import PANEL_MODEL_DICT, PanelPoint, PanelModel
7
- from astrohack.utils.constants import *
7
+ from astrohack.utils.constants import pi, fontsize, markersize
8
8
  from astrohack.utils.conversion import convert_unit
9
+ import numpy as np
9
10
 
10
11
 
11
12
  class BasePanel:
@@ -694,6 +694,3 @@ class PanelPoint:
694
694
 
695
695
  def __repr__(self):
696
696
  return f"{self.xc}, {self.yc}, {self.ix}, {self.iy}, {self.value}"
697
-
698
- def get_array(self):
699
- return np.array([self.xc, self.yc, self.ix, self.iy, self.value])
@@ -1,14 +1,14 @@
1
1
  from shapely.geometry.point import Point
2
2
  from shapely.geometry.polygon import Polygon
3
3
  from shapely.strtree import STRtree
4
-
4
+ import numpy as np
5
5
  import pathlib
6
6
 
7
7
  import xarray as xr
8
8
  import toolviper.utils.logger as logger
9
9
 
10
10
  from astrohack.antenna.polygon_panel import PolygonPanel
11
- from astrohack.utils.constants import *
11
+ from astrohack.utils.constants import twopi, fourpi
12
12
  from astrohack.antenna.ring_panel import RingPanel
13
13
  from astrohack.utils.algorithms import create_coordinate_images, arm_shadow_masking
14
14
  from astrohack.utils.ray_tracing_general import GlobalQPS
@@ -1,15 +1,30 @@
1
1
  import toolviper
2
- import xarray as xr
2
+ import toolviper.utils.logger as logger
3
+ import numpy as np
3
4
 
4
5
  from astrohack.utils.validation import custom_unit_checker, custom_plots_checker
5
- from astrohack.core.cassegrain_ray_tracing import *
6
- from astrohack.utils.conversion import convert_unit, clight
6
+ from astrohack.core.cassegrain_ray_tracing import (
7
+ make_gridded_cassegrain_primary,
8
+ reflect_off_primary,
9
+ reflect_off_analytical_secondary,
10
+ detect_light,
11
+ compute_phase,
12
+ write_rt_xds_to_zarr,
13
+ open_rt_zarr,
14
+ title_from_input_parameters,
15
+ plot_2d_map,
16
+ add_rz_ray_to_plot,
17
+ compare_ray_tracing_to_phase_fit_results,
18
+ )
19
+ from astrohack.utils.constants import clight
20
+ from astrohack.utils.conversion import convert_unit
7
21
  from astrohack.utils.algorithms import regrid_data_onto_2d_grid
8
22
  from astrohack.utils.file import add_caller_and_version_to_dict
9
23
  from astrohack.utils.phase_fitting import aips_like_phase_fitting
10
24
  from astrohack.visualization.plot_tools import create_figure_and_axes, close_figure
11
25
  from typing import Union
12
26
  from astrohack.utils.text import spc, undscr
27
+ from astrohack.antenna.telescope import get_proper_telescope
13
28
 
14
29
 
15
30
  @toolviper.utils.parameter.validate(custom_checker=custom_unit_checker)
@@ -0,0 +1,51 @@
1
+ {
2
+ "fringefit_locit":{
3
+ "fringefit_caltable":{
4
+ "type":["str"],
5
+ "required": true
6
+ },
7
+ "position_name":{
8
+ "type":["str"],
9
+ "required": false,
10
+ "nullable": true
11
+ },
12
+ "elevation_limit":{
13
+ "type":["float"],
14
+ "required": false
15
+ },
16
+ "polarization": {
17
+ "type": ["str"],
18
+ "nullable": false,
19
+ "allowed": ["R", "L", "X", "Y", "both", "RL", "LR", "XY", "YX"]
20
+ },
21
+ "fit_engine": {
22
+ "type": ["str"],
23
+ "nullable": false,
24
+ "allowed": ["linear algebra", "scipy"]
25
+ },
26
+ "fit_kterm":{
27
+ "type":["boolean"],
28
+ "nullable": false
29
+ },
30
+ "fit_delay_rate":{
31
+ "type":["boolean"],
32
+ "nullable": false
33
+ },
34
+ "ant":{
35
+ "type":["list", "str"],
36
+ "struct type": ["str"],
37
+ "nullable": false
38
+ },
39
+ "ddi":{
40
+ "type":["ndarray", "int", "list", "str"],
41
+ "struct type": ["int", "str"],
42
+ "nullable": false
43
+ },
44
+ "parallel":{
45
+ "type":["boolean"]
46
+ },
47
+ "overwrite":{
48
+ "type":["boolean"]
49
+ }
50
+ }
51
+ }
@@ -0,0 +1,212 @@
1
+ {
2
+ "AstrohackLocitFile.print_source_table": {
3
+ "save_to": {
4
+ "nullable": true,
5
+ "required": false,
6
+ "type": ["string"]
7
+ }
8
+ },
9
+ "AstrohackLocitFile.print_array_configuration":{
10
+ "relative":{
11
+ "nullable": false,
12
+ "required": false,
13
+ "type": ["boolean"]
14
+ },
15
+ "save_to": {
16
+ "nullable": true,
17
+ "required": false,
18
+ "type": ["string"]
19
+ }
20
+ },
21
+ "AstrohackLocitFile.plot_source_positions":{
22
+ "destination":{
23
+ "nullable": false,
24
+ "required": true,
25
+ "type": ["string"]
26
+ },
27
+ "labels":{
28
+ "nullable": false,
29
+ "required": false,
30
+ "type": ["boolean"]
31
+ },
32
+ "precessed":{
33
+ "nullable": false,
34
+ "required": false,
35
+ "type": ["boolean"]
36
+ },
37
+ "display":{
38
+ "nullable": false,
39
+ "required": false,
40
+ "type": ["boolean"]
41
+ },
42
+ "figure_size":{
43
+ "nullable": true,
44
+ "required": false,
45
+ "struct_type": ["float"],
46
+ "minlength": 2,
47
+ "maxlength": 2,
48
+ "type": ["list", "tuple", "ndarray"]
49
+ },
50
+ "dpi":{
51
+ "nullable": false,
52
+ "required": false,
53
+ "type": ["int"],
54
+ "min": 1,
55
+ "max": 1200
56
+ }
57
+ },
58
+ "AstrohackLocitFile.plot_array_configuration":{
59
+ "destination":{
60
+ "nullable": false,
61
+ "required": true,
62
+ "type": ["string"]
63
+ },
64
+ "stations":{
65
+ "nullable": false,
66
+ "required": false,
67
+ "type": ["boolean"]
68
+ },
69
+ "zoff":{
70
+ "nullable": false,
71
+ "required": false,
72
+ "type": ["boolean"]
73
+ },
74
+ "unit":{
75
+ "nullable": false,
76
+ "required": false,
77
+ "type": ["string"],
78
+ "check allowed with": "units.length"
79
+ },
80
+ "box_size":{
81
+ "nullable": true,
82
+ "required": false,
83
+ "type": ["int", "float"],
84
+ "min": 0
85
+ },
86
+ "display":{
87
+ "nullable": false,
88
+ "required": false,
89
+ "type": ["boolean"]
90
+ },
91
+ "figure_size":{
92
+ "nullable": true,
93
+ "required": false,
94
+ "struct_type": ["float"],
95
+ "minlength": 2,
96
+ "maxlength": 2,
97
+ "type": ["list", "tuple", "ndarray"]
98
+ },
99
+ "dpi": {
100
+ "nullable": false,
101
+ "required": false,
102
+ "type": ["int"],
103
+ "min": 1,
104
+ "max": 1200
105
+ }
106
+ },
107
+ "AstrohackPositionFile.print_source_table": {
108
+ "save_to": {
109
+ "nullable": true,
110
+ "required": false,
111
+ "type": ["string"]
112
+ }
113
+ },
114
+ "AstrohackPositionFile.print_array_configuration":{
115
+ "relative":{
116
+ "nullable": false,
117
+ "required": false,
118
+ "type": ["boolean"]
119
+ },
120
+ "save_to": {
121
+ "nullable": true,
122
+ "required": false,
123
+ "type": ["string"]
124
+ }
125
+ },
126
+ "AstrohackPositionFile.plot_source_positions":{
127
+ "destination":{
128
+ "nullable": false,
129
+ "required": true,
130
+ "type": ["string"]
131
+ },
132
+ "labels":{
133
+ "nullable": false,
134
+ "required": false,
135
+ "type": ["boolean"]
136
+ },
137
+ "precessed":{
138
+ "nullable": false,
139
+ "required": false,
140
+ "type": ["boolean"]
141
+ },
142
+ "display":{
143
+ "nullable": false,
144
+ "required": false,
145
+ "type": ["boolean"]
146
+ },
147
+ "figure_size":{
148
+ "nullable": true,
149
+ "required": false,
150
+ "struct_type": ["float"],
151
+ "minlength": 2,
152
+ "maxlength": 2,
153
+ "type": ["list", "tuple", "ndarray"]
154
+ },
155
+ "dpi":{
156
+ "nullable": false,
157
+ "required": false,
158
+ "type": ["int"],
159
+ "min": 1,
160
+ "max": 1200
161
+ }
162
+ },
163
+ "AstrohackPositionFile.plot_array_configuration":{
164
+ "destination":{
165
+ "nullable": false,
166
+ "required": true,
167
+ "type": ["string"]
168
+ },
169
+ "stations":{
170
+ "nullable": false,
171
+ "required": false,
172
+ "type": ["boolean"]
173
+ },
174
+ "zoff":{
175
+ "nullable": false,
176
+ "required": false,
177
+ "type": ["boolean"]
178
+ },
179
+ "unit":{
180
+ "nullable": false,
181
+ "required": false,
182
+ "type": ["string"],
183
+ "check allowed with": "units.length"
184
+ },
185
+ "box_size":{
186
+ "nullable": true,
187
+ "required": false,
188
+ "type": ["int", "float"],
189
+ "min": 0
190
+ },
191
+ "display":{
192
+ "nullable": false,
193
+ "required": false,
194
+ "type": ["boolean"]
195
+ },
196
+ "figure_size":{
197
+ "nullable": true,
198
+ "required": false,
199
+ "struct_type": ["float"],
200
+ "minlength": 2,
201
+ "maxlength": 2,
202
+ "type": ["list", "tuple", "ndarray"]
203
+ },
204
+ "dpi": {
205
+ "nullable": false,
206
+ "required": false,
207
+ "type": ["int"],
208
+ "min": 1,
209
+ "max": 1200
210
+ }
211
+ }
212
+ }
@@ -1,6 +1,5 @@
1
1
  from copy import deepcopy
2
2
 
3
- import numpy
4
3
  import toolviper.utils.logger as logger
5
4
  import numpy as np
6
5
  from scipy.optimize import curve_fit
@@ -18,8 +17,6 @@ from astrohack.utils.text import (
18
17
  )
19
18
  from astrohack.utils.constants import sig_2_fwhm
20
19
 
21
- quack_chans = 4
22
-
23
20
 
24
21
  ###########################################################
25
22
  ### Working Chunks
@@ -40,11 +37,15 @@ def process_beamcut_chunk(beamcut_chunk_params: dict, output_mds: AstrohackBeamc
40
37
  ddi_key = beamcut_chunk_params["this_ddi"]
41
38
  ant_key = beamcut_chunk_params["this_ant"]
42
39
  xdt_data = beamcut_chunk_params["xdt_data"]
40
+ datalabel = create_dataset_label(ant_key, ddi_key)
43
41
 
44
42
  # This assumes that there will be no more than one mapping
45
- input_xds = xdt_data["map_0"]
43
+ try:
44
+ input_xds = xdt_data["map_0"]
45
+ except KeyError:
46
+ logger.warning(f"No beamcut data for {datalabel}")
47
+ return
46
48
 
47
- datalabel = create_dataset_label(ant_key, ddi_key)
48
49
  logger.info(f"processing {datalabel}")
49
50
 
50
51
  cut_xdtree = _extract_cuts_from_visibilities(input_xds, ant_key, ddi_key)
@@ -378,7 +379,7 @@ def _multi_gaussian(xdata, *args):
378
379
  """
379
380
  nargs = len(args)
380
381
  if nargs % 3 != 0:
381
- raise ValueError("Number of arguments should be multiple of 3")
382
+ raise ValueError(f"Number of arguments should be multiple of 3, (got {nargs})")
382
383
  y_values = np.zeros_like(xdata)
383
384
  for iarg in range(0, nargs, 3):
384
385
  y_values += _fwhm_gaussian(xdata, args[iarg], args[iarg + 1], args[iarg + 2])
@@ -516,6 +517,38 @@ def _identify_pb_and_sidelobes_in_fit(
516
517
  return n_peaks, fit_pars, pb_center, pb_fwhm, first_side_lobe_ratio
517
518
 
518
519
 
520
+ def estimate_pb_center_and_fwhm_from_data(x_data, y_data, datalabel):
521
+ """
522
+ Estimate primary beam parameters forcefully from data
523
+ :param x_data: Cut X data
524
+ :param y_data: Cut Y data
525
+ :param datalabel: Data label
526
+ :return: estimated primary beam center, fwhm and amplitude.
527
+ """
528
+ logger.info(
529
+ f"Estimating primary beam center and fwhm from maximum amplitude for {datalabel}"
530
+ )
531
+ i_max = np.argmax(y_data.values)
532
+ amp_max = y_data.values[i_max]
533
+ pb_center = x_data[i_max]
534
+ n_pnt = x_data.shape[0]
535
+
536
+ hw_plus = np.nan
537
+ for i_pnt in range(i_max, n_pnt):
538
+ if y_data[i_pnt] <= amp_max / 2:
539
+ hw_plus = x_data[i_pnt]
540
+ break
541
+ hw_minus = np.nan
542
+ for i_pnt in range(i_max, 0, -1):
543
+ if y_data[i_pnt] <= amp_max / 2:
544
+ hw_minus = x_data[i_pnt]
545
+ break
546
+ pb_fwhm = hw_plus - hw_minus
547
+ fslr = np.nan
548
+
549
+ return pb_center, pb_fwhm, fslr, amp_max
550
+
551
+
519
552
  def _beamcut_multi_lobes_gaussian_fit(cut_xdtree, datalabel):
520
553
  """
521
554
  Execute multi gaussian fit to beam cut data.
@@ -573,8 +606,16 @@ def _beamcut_multi_lobes_gaussian_fit(cut_xdtree, datalabel):
573
606
  )
574
607
  )
575
608
  else:
576
- pb_center, pb_fwhm, first_side_lobe_ratio = np.nan, np.nan, np.nan
577
- fit = np.full_like(y_data, np.nan)
609
+ pb_center, pb_fwhm, first_side_lobe_ratio, amp_max = (
610
+ estimate_pb_center_and_fwhm_from_data(
611
+ x_data, y_data, this_corr_data_label
612
+ )
613
+ )
614
+ fit = _multi_gaussian(x_data, pb_center, amp_max, pb_fwhm)
615
+ n_peaks = 1
616
+ fit_pars = [pb_center, amp_max, pb_fwhm]
617
+ if np.all(np.isfinite(fit_pars)):
618
+ fit_succeeded = True
578
619
 
579
620
  cut_xds.attrs[f"{parallel_hand}_amp_fit_pars"] = fit_pars
580
621
  cut_xds.attrs[f"{parallel_hand}_n_peaks"] = n_peaks
@@ -637,7 +637,7 @@ def compare_ray_tracing_to_phase_fit_results(
637
637
  ax[1],
638
638
  fig,
639
639
  fac * correction,
640
- f"Fitted correction",
640
+ "Fitted correction",
641
641
  extent,
642
642
  f"Phase [{phase_unit}]",
643
643
  colormap,
@@ -67,13 +67,13 @@ def process_combine_chunk(combine_chunk_params: dict, output_mds: AstrohackImage
67
67
  out_xds = deepcopy(ant_xdt[ddi_ref_key].dataset)
68
68
  shape = list(out_xds["CORRECTED_PHASE"].values.shape)
69
69
  if out_xds.sizes["chan"] != 1:
70
- msg = f"Only single channel holographies supported"
70
+ msg = "Only single channel holographies supported"
71
71
  logger.error(msg)
72
72
  raise RuntimeError(msg)
73
73
 
74
74
  nmap = shape[0]
75
75
  if nmap != 1:
76
- msg = f"Only single mapping holographies supported"
76
+ msg = "Only single mapping holographies supported"
77
77
  logger.error(msg)
78
78
  raise RuntimeError(msg)
79
79