astrohack 0.10.1__tar.gz → 1.0.1__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 (133) hide show
  1. {astrohack-0.10.1/src/astrohack.egg-info → astrohack-1.0.1}/PKG-INFO +1 -2
  2. {astrohack-0.10.1 → astrohack-1.0.1}/pyproject.toml +2 -2
  3. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/__init__.py +1 -21
  4. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/antenna/antenna_surface.py +8 -9
  5. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/antenna/base_panel.py +2 -2
  6. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/antenna/panel_fitting.py +1 -2
  7. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/antenna/polygon_panel.py +0 -1
  8. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/antenna/ring_panel.py +2 -2
  9. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/antenna/telescope.py +12 -12
  10. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/beamcut.py +72 -54
  11. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/cassegrain_ray_tracing.py +1 -1
  12. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/combine.py +26 -40
  13. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/config/beamcut.param.json +21 -0
  14. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/config/beamcut_mds.param.json +82 -0
  15. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/config/extract_holog.param.json +7 -0
  16. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/config/extract_locit.param.json +2 -1
  17. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/config/extract_pointing.param.json +3 -2
  18. astrohack-1.0.1/src/astrohack/config/holog_mds.param.json +370 -0
  19. astrohack-1.0.1/src/astrohack/config/image_mds.param.json +570 -0
  20. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/config/locit.param.json +2 -1
  21. astrohack-1.0.1/src/astrohack/config/locit_mds.param.json +95 -0
  22. astrohack-1.0.1/src/astrohack/config/panel_mds.param.json +336 -0
  23. astrohack-1.0.1/src/astrohack/config/point_mds.param.json +154 -0
  24. astrohack-1.0.1/src/astrohack/config/position_mds.param.json +271 -0
  25. astrohack-1.0.1/src/astrohack/core/beamcut.py +529 -0
  26. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/core/cassegrain_ray_tracing.py +1 -1
  27. astrohack-1.0.1/src/astrohack/core/combine.py +211 -0
  28. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/core/extract_holog.py +294 -298
  29. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/core/extract_locit.py +50 -198
  30. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/core/extract_pointing.py +122 -98
  31. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/core/holog.py +28 -36
  32. astrohack-1.0.1/src/astrohack/core/holog_obs_dict.py +309 -0
  33. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/core/image_comparison_tool.py +103 -15
  34. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/core/locit.py +87 -49
  35. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/core/panel.py +17 -17
  36. astrohack-1.0.1/src/astrohack/extract_holog.py +366 -0
  37. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/extract_locit.py +25 -36
  38. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/extract_pointing.py +33 -37
  39. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/holog.py +27 -78
  40. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/image_comparison_tool.py +6 -4
  41. astrohack-1.0.1/src/astrohack/io/__init__.py +9 -0
  42. astrohack-1.0.1/src/astrohack/io/base_mds.py +372 -0
  43. astrohack-1.0.1/src/astrohack/io/beamcut_mds.py +1088 -0
  44. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/io/dio.py +24 -213
  45. astrohack-1.0.1/src/astrohack/io/holog_mds.py +678 -0
  46. astrohack-1.0.1/src/astrohack/io/image_mds.py +1020 -0
  47. astrohack-1.0.1/src/astrohack/io/locit_mds.py +328 -0
  48. astrohack-1.0.1/src/astrohack/io/panel_mds.py +534 -0
  49. astrohack-1.0.1/src/astrohack/io/point_mds.py +319 -0
  50. astrohack-1.0.1/src/astrohack/io/position_mds.py +961 -0
  51. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/locit.py +35 -43
  52. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/panel.py +21 -53
  53. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/utils/__init__.py +1 -1
  54. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/utils/algorithms.py +31 -13
  55. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/utils/constants.py +3 -0
  56. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/utils/conversion.py +2 -72
  57. astrohack-1.0.1/src/astrohack/utils/file.py +106 -0
  58. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/utils/fits.py +29 -81
  59. astrohack-1.0.1/src/astrohack/utils/graph.py +165 -0
  60. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/utils/gridding.py +32 -33
  61. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/utils/imaging.py +11 -8
  62. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/utils/phase_fitting.py +18 -23
  63. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/utils/ray_tracing_general.py +7 -6
  64. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/utils/text.py +133 -248
  65. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/utils/tools.py +1 -78
  66. astrohack-1.0.1/src/astrohack/utils/verification_tools.py +354 -0
  67. astrohack-1.0.1/src/astrohack/utils/veritas.py +160 -0
  68. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/utils/zernike_aperture_fitting.py +1 -1
  69. astrohack-1.0.1/src/astrohack/visualization/array_cfg_plot.py +95 -0
  70. astrohack-1.0.1/src/astrohack/visualization/observation_summary.py +44 -0
  71. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/visualization/plot_tools.py +36 -2
  72. {astrohack-0.10.1 → astrohack-1.0.1/src/astrohack.egg-info}/PKG-INFO +1 -2
  73. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack.egg-info/SOURCES.txt +18 -9
  74. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack.egg-info/requires.txt +0 -1
  75. astrohack-0.10.1/src/astrohack/config/mds.param.json +0 -1685
  76. astrohack-0.10.1/src/astrohack/core/__init__.py +0 -6
  77. astrohack-0.10.1/src/astrohack/core/beamcut.py +0 -1139
  78. astrohack-0.10.1/src/astrohack/core/combine.py +0 -116
  79. astrohack-0.10.1/src/astrohack/data/verification/holog_numerical_verification.json +0 -1
  80. astrohack-0.10.1/src/astrohack/extract_holog.py +0 -1028
  81. astrohack-0.10.1/src/astrohack/io/beamcut_mds.py +0 -433
  82. astrohack-0.10.1/src/astrohack/io/mds.py +0 -2011
  83. astrohack-0.10.1/src/astrohack/utils/data.py +0 -104
  84. astrohack-0.10.1/src/astrohack/utils/file.py +0 -663
  85. astrohack-0.10.1/src/astrohack/utils/gauss_fitter.py +0 -859
  86. astrohack-0.10.1/src/astrohack/utils/graph.py +0 -196
  87. astrohack-0.10.1/src/astrohack/utils/veritas.py +0 -365
  88. astrohack-0.10.1/src/astrohack/visualization/diagnostics.py +0 -1103
  89. astrohack-0.10.1/src/astrohack/visualization/fits.py +0 -199
  90. astrohack-0.10.1/src/astrohack/visualization/textual_data.py +0 -636
  91. {astrohack-0.10.1 → astrohack-1.0.1}/LICENSE +0 -0
  92. {astrohack-0.10.1 → astrohack-1.0.1}/MANIFEST.in +0 -0
  93. {astrohack-0.10.1 → astrohack-1.0.1}/README.rst +0 -0
  94. {astrohack-0.10.1 → astrohack-1.0.1}/setup.cfg +0 -0
  95. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/antenna/__init__.py +0 -0
  96. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/config/cassegrain_ray_tracing.param.json +0 -0
  97. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/config/combine.param.json +0 -0
  98. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/config/create_param_json.py +0 -0
  99. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/config/dask.config.yaml +0 -0
  100. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/config/holog.param.json +0 -0
  101. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/config/image_comparison_tool.param.json +0 -0
  102. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/config/panel.param.json +0 -0
  103. {astrohack-0.10.1/src/astrohack/io → astrohack-1.0.1/src/astrohack/core}/__init__.py +0 -0
  104. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/data/telescopes/aca_7m.zarr/.zattrs +0 -0
  105. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/data/telescopes/aca_7m.zarr/.zgroup +0 -0
  106. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/data/telescopes/aca_7m.zarr/.zmetadata +0 -0
  107. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/data/telescopes/alma_da.zarr/.zattrs +0 -0
  108. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/data/telescopes/alma_da.zarr/.zgroup +0 -0
  109. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/data/telescopes/alma_da.zarr/.zmetadata +0 -0
  110. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/data/telescopes/alma_dv.zarr/.zattrs +0 -0
  111. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/data/telescopes/alma_dv.zarr/.zgroup +0 -0
  112. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/data/telescopes/alma_dv.zarr/.zmetadata +0 -0
  113. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/data/telescopes/alma_tp.zarr/.zattrs +0 -0
  114. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/data/telescopes/alma_tp.zarr/.zgroup +0 -0
  115. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/data/telescopes/alma_tp.zarr/.zmetadata +0 -0
  116. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/data/telescopes/fix_telescope_files.bash +0 -0
  117. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/data/telescopes/ngvla_proto_2025.zarr/.zattrs +0 -0
  118. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/data/telescopes/ngvla_proto_2025.zarr/.zgroup +0 -0
  119. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/data/telescopes/ngvla_proto_2025.zarr/.zmetadata +0 -0
  120. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/data/telescopes/ngvla_proto_2025.zarr/point_cloud/.zarray +0 -0
  121. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/data/telescopes/ngvla_proto_2025.zarr/point_cloud/0.0 +0 -0
  122. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/data/telescopes/ngvla_proto_2025.zarr/qps_coefficients/.zarray +0 -0
  123. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/data/telescopes/ngvla_proto_2025.zarr/qps_coefficients/0 +0 -0
  124. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/data/telescopes/vla.zarr/.zattrs +0 -0
  125. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/data/telescopes/vla.zarr/.zgroup +0 -0
  126. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/data/telescopes/vla.zarr/.zmetadata +0 -0
  127. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/data/telescopes/vlba.zarr/.zattrs +0 -0
  128. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/data/telescopes/vlba.zarr/.zgroup +0 -0
  129. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/data/telescopes/vlba.zarr/.zmetadata +0 -0
  130. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/utils/validation.py +0 -0
  131. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack/visualization/__init__.py +0 -0
  132. {astrohack-0.10.1 → astrohack-1.0.1}/src/astrohack.egg-info/dependency_links.txt +0 -0
  133. {astrohack-0.10.1 → astrohack-1.0.1}/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: 0.10.1
3
+ Version: 1.0.1
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
@@ -10,7 +10,6 @@ Requires-Dist: astropy
10
10
  Requires-Dist: dask
11
11
  Requires-Dist: shapely
12
12
  Requires-Dist: distributed
13
- Requires-Dist: dropbox
14
13
  Requires-Dist: toolviper
15
14
  Requires-Dist: ipywidgets
16
15
  Requires-Dist: matplotlib
@@ -1,10 +1,10 @@
1
1
  [project]
2
2
  name = "astrohack"
3
- version = "0.10.1"
3
+ version = "1.0.1"
4
4
  description = "Holography Antenna Commissioning Kit"
5
5
  readme = "README.md"
6
6
  requires-python = ">= 3.11, < 3.14"
7
- dependencies = [ "astropy", "dask", "shapely", "distributed", "dropbox", "toolviper", "ipywidgets", "matplotlib", "numba>=0.57.0", "numpy<=2.2", "prettytable", "pycryptodome", "pytest", "pytest-cov", "pytest-html", "scikit_image", "scikit-learn", "scipy", "rich", "xarray", "zarr<3.0.0", "bokeh", "pillow", "jupyterlab", "python_casacore>=3.6.1; sys_platform != \"darwin\" ",]
7
+ dependencies = [ "astropy", "dask", "shapely", "distributed", "toolviper", "ipywidgets", "matplotlib", "numba>=0.57.0", "numpy<=2.2", "prettytable", "pycryptodome", "pytest", "pytest-cov", "pytest-html", "scikit_image", "scikit-learn", "scipy", "rich", "xarray", "zarr<3.0.0", "bokeh", "pillow", "jupyterlab", "python_casacore>=3.6.1; sys_platform != \"darwin\" ",]
8
8
  [[project.authors]]
9
9
  name = "Joshua Hoskins"
10
10
  email = "jhoskins@nrao.edu"
@@ -4,36 +4,16 @@ from importlib.metadata import version
4
4
  __version__ = version("astrohack")
5
5
 
6
6
  from .extract_holog import (
7
- HologObsDict,
8
7
  extract_holog,
9
8
  generate_holog_obs_dict,
10
- model_memory_usage,
11
9
  )
10
+ from .io import *
12
11
 
13
12
  from .beamcut import beamcut
14
- from astrohack.io.beamcut_mds import AstrohackBeamcutFile
15
-
16
13
  from .extract_pointing import extract_pointing
17
14
  from .holog import holog
18
- from astrohack.io.dio import (
19
- open_holog,
20
- open_image,
21
- open_pointing,
22
- open_panel,
23
- open_locit,
24
- open_position,
25
- open_beamcut,
26
- )
27
15
  from .panel import panel
28
16
  from .combine import combine
29
- from astrohack.io.mds import (
30
- AstrohackHologFile,
31
- AstrohackPointFile,
32
- AstrohackImageFile,
33
- AstrohackPanelFile,
34
- AstrohackLocitFile,
35
- AstrohackPositionFile,
36
- )
37
17
  from .locit import locit
38
18
  from .extract_locit import extract_locit
39
19
  from .cassegrain_ray_tracing import (
@@ -1,4 +1,3 @@
1
- import numpy as np
2
1
  import xarray as xr
3
2
 
4
3
  from matplotlib import patches
@@ -115,7 +114,7 @@ class AntennaSurface:
115
114
  def _read_holog_xds(self, inputxds):
116
115
  if "chan" in inputxds.dims:
117
116
  if inputxds.sizes["chan"] != 1:
118
- raise Exception("Only single channel holographies supported")
117
+ raise RuntimeError("Only single channel holographies supported")
119
118
  self.wavelength = clight / inputxds.chan.values[0]
120
119
  else:
121
120
  self.wavelength = inputxds.attrs["wavelength"]
@@ -126,7 +125,7 @@ class AntennaSurface:
126
125
  f'{inputxds.coords["pol"]})'
127
126
  )
128
127
  logger.error(msg)
129
- raise Exception(msg)
128
+ raise ValueError(msg)
130
129
 
131
130
  self.amplitude = (
132
131
  inputxds["AMPLITUDE"].sel(pol=self.pol_state).isel(time=0, chan=0).values
@@ -224,7 +223,7 @@ class AntennaSurface:
224
223
  clip = self._compute_noise_threshold_clip(clip_level)
225
224
  else:
226
225
  msg = f"Unrecognized clipping type: {clip_type}"
227
- raise Exception(msg)
226
+ raise ValueError(msg)
228
227
  return clip
229
228
 
230
229
  def _compute_noise_threshold_clip(self, threshold, step_multiplier=0.95):
@@ -315,7 +314,7 @@ class AntennaSurface:
315
314
  "Cannot computed gains for corrected dish if panels are not fitted."
316
315
  )
317
316
  logger.error(msg)
318
- raise Exception(msg)
317
+ raise RuntimeError(msg)
319
318
  else:
320
319
  scaled_phase = wavelength_scaling * self.phase
321
320
 
@@ -377,7 +376,7 @@ class AntennaSurface:
377
376
  Apply corrections determined by the panel surface fitting methods to the antenna surface
378
377
  """
379
378
  if not self.fitted:
380
- raise Exception("Panels must be fitted before atempting a correction")
379
+ raise RuntimeError("Panels must be fitted before atempting a correction")
381
380
  self.corrections = np.where(self.mask, 0, np.nan)
382
381
  for panel in self.panels:
383
382
  corrections = panel.get_corrections()
@@ -514,7 +513,7 @@ class AntennaSurface:
514
513
 
515
514
  def _multi_plot(self, maps, labels, prefix, basename, factor, parm_dict, caller):
516
515
  if len(maps) != len(labels):
517
- raise Exception("Map list and label list must be of the same size")
516
+ raise ValueError("Map list and label list must be of the same size")
518
517
  nplots = len(maps)
519
518
  if parm_dict["z_lim"] is None or parm_dict["z_lim"] == "None":
520
519
  vmax = np.nanmax(
@@ -663,8 +662,8 @@ class AntennaSurface:
663
662
 
664
663
  nscrews = self.panels[0].screws.shape[0]
665
664
 
666
- self.panel_labels = np.ndarray([npanels], dtype=object)
667
- self.panel_model_array = np.ndarray([npanels], dtype=object)
665
+ self.panel_labels = np.ndarray([npanels], dtype="U22")
666
+ self.panel_model_array = np.ndarray([npanels], dtype="U22")
668
667
  self.panel_pars = np.full((npanels, max_par), np.nan, dtype=float)
669
668
  self.screw_adjustments = np.ndarray((npanels, nscrews), dtype=float)
670
669
  self.panel_fallback = np.ndarray([npanels], dtype=bool)
@@ -76,7 +76,7 @@ class BasePanel:
76
76
  except KeyError:
77
77
  msg = f"Unknown model {self.model_name}"
78
78
  logger.error(msg)
79
- raise Exception(msg)
79
+ raise ValueError(msg)
80
80
 
81
81
  self.model = PanelModel(model_dict, self.zeta, self.ref_points, self.center)
82
82
 
@@ -130,7 +130,7 @@ class BasePanel:
130
130
  if not self.solved:
131
131
  msg = "Cannot correct a panel that is not solved"
132
132
  logger.error(msg)
133
- raise Exception(msg)
133
+ raise RuntimeError(msg)
134
134
  self.corr = self.model.correct(self.samples, self.margins)
135
135
  return self.corr
136
136
 
@@ -5,7 +5,6 @@ import toolviper.utils.logger as logger
5
5
 
6
6
  from astrohack.utils import gauss_elimination, least_squares_jit
7
7
 
8
-
9
8
  ###################################
10
9
  # General purpose #
11
10
  ###################################
@@ -630,7 +629,7 @@ class PanelModel:
630
629
  Array of corrections and the indices linking them to the aperture.
631
630
  """
632
631
  if not self.fitted:
633
- raise Exception("Cannot correct using a panel model that is not fitted")
632
+ raise RuntimeError("Cannot correct using a panel model that is not fitted")
634
633
 
635
634
  nsamp = len(samples)
636
635
  nmarg = len(margins)
@@ -2,7 +2,6 @@ from shapely import Polygon, Point
2
2
  from shapely.plotting import plot_polygon
3
3
 
4
4
  from astrohack.utils import markersize
5
- from astrohack.utils.ray_tracing_general import generalized_norm
6
5
  from astrohack.antenna.base_panel import BasePanel
7
6
  from astrohack.antenna.panel_fitting import PanelPoint
8
7
  import numpy as np
@@ -147,14 +147,14 @@ class RingPanel(BasePanel):
147
147
  print("{0:20s}={1:8.5f}".format("zeta", self.zeta))
148
148
  print()
149
149
 
150
- def plot(self, ax, screws=False, label=False, margins=False, samples=False):
150
+ def plot(self, ax, screws=False, label=False, _=False, samples=False):
151
151
  """
152
152
  Plot panel outline to ax
153
153
  Args:
154
154
  ax: matplotlib axes instance
155
155
  screws: Display screws in plot
156
156
  label: Add panel labels to plot
157
- margins: does nothing (interface compatibility)
157
+ _: does nothing (interface compatibility)
158
158
  samples: plot samples and margins
159
159
  """
160
160
  x1 = self.inrad * np.sin(self.theta1)
@@ -1,5 +1,3 @@
1
- import time
2
-
3
1
  from shapely.geometry.point import Point
4
2
  from shapely.geometry.polygon import Polygon
5
3
  from shapely.strtree import STRtree
@@ -195,7 +193,7 @@ class RingedCassegrain(Telescope):
195
193
  error = True
196
194
 
197
195
  if error:
198
- raise Exception("Failed Consistency check")
196
+ raise RuntimeError("Failed Consistency check")
199
197
  else:
200
198
  print("Consistency passed")
201
199
 
@@ -253,7 +251,9 @@ class RingedCassegrain(Telescope):
253
251
  elif "ALMA" in self.name or self.name == "ACA 7m":
254
252
  self._panel_label = self._alma_panel_labeling
255
253
  else:
256
- raise Exception(f"Don't know how to build panel list for {self.name}")
254
+ raise NotImplementedError(
255
+ f"Don't know how to build panel list for {self.name}"
256
+ )
257
257
 
258
258
  panel_list = []
259
259
  for iring in range(self.n_rings_of_panels):
@@ -371,7 +371,7 @@ class RingedCassegrain(Telescope):
371
371
  )
372
372
 
373
373
  else:
374
- raise Exception(
374
+ raise TypeError(
375
375
  f"Don't know how to handle an arm width of class {type(self.arm_shadow_width)}"
376
376
  )
377
377
 
@@ -380,13 +380,13 @@ class RingedCassegrain(Telescope):
380
380
  else:
381
381
  return mask
382
382
 
383
- def phase_to_deviation(self, u_axis, v_axis, mask, phase, wavelength):
383
+ def phase_to_deviation(self, u_axis, v_axis, _, phase, wavelength):
384
384
  """
385
385
  Transform phase image to physical deviation image based on wavelength.
386
386
  Args:
387
387
  u_axis: Aperture U axis
388
388
  v_axis: Aperture V axis
389
- mask: dummy argument for interface compatibility
389
+ _: dummy argument for interface compatibility
390
390
  phase: Phase image in Radians
391
391
  wavelength: Observation wavelength in meters
392
392
 
@@ -400,13 +400,13 @@ class RingedCassegrain(Telescope):
400
400
  bcoeff = 4 * self.focus**2
401
401
  return acoeff * phase * np.sqrt(radius**2 + bcoeff)
402
402
 
403
- def deviation_to_phase(self, u_axis, v_axis, mask, deviation, wavelength):
403
+ def deviation_to_phase(self, u_axis, v_axis, _, deviation, wavelength):
404
404
  """ "
405
405
  Transform deviation image to physical phase image based on wavelength.
406
406
  Args:
407
407
  u_axis: Aperture U axis
408
408
  v_axis: Aperture V axis
409
- mask: dummy argument for interface compatibility
409
+ _: dummy argument for interface compatibility
410
410
  deviation: Deviation image in meters
411
411
  wavelength: Observation wavelength in meters
412
412
 
@@ -551,14 +551,14 @@ def get_proper_telescope(name: str, antenna_name: str = None):
551
551
  elif "na" in antenna_name:
552
552
  return NgvlaPrototype.from_name("ngvla_proto_2025")
553
553
  else:
554
- raise Exception(f"Unsupported antenna type for the VLA: {antenna_name}")
554
+ raise ValueError(f"Unsupported antenna type for the VLA: {antenna_name}")
555
555
 
556
556
  elif "vlba" in name:
557
557
  return RingedCassegrain.from_name("vlba")
558
558
 
559
559
  elif "alma" in name:
560
560
  if antenna_name is None:
561
- raise Exception(
561
+ raise ValueError(
562
562
  "ALMA is an heterogenious array and hence an antenna name is needed"
563
563
  )
564
564
  elif "dv" in antenna_name:
@@ -568,7 +568,7 @@ def get_proper_telescope(name: str, antenna_name: str = None):
568
568
  elif "tp" in antenna_name:
569
569
  return RingedCassegrain.from_name("alma_tp")
570
570
  else:
571
- raise Exception(f"Unsupported antenna type for ALMA: {antenna_name}")
571
+ raise ValueError(f"Unsupported antenna type for ALMA: {antenna_name}")
572
572
 
573
573
  elif "aca" in name:
574
574
  return RingedCassegrain.from_name("aca_7m")
@@ -1,19 +1,17 @@
1
1
  import pathlib
2
- import json
3
- import xarray as xr
4
-
5
- import toolviper.utils.logger as logger
2
+ import numpy as np
6
3
 
7
4
  from toolviper.utils.parameter import validate
8
5
 
9
6
  from astrohack.core.beamcut import process_beamcut_chunk
10
- from astrohack.utils import get_default_file_name, add_caller_and_version_to_dict
11
- from astrohack.utils.file import overwrite_file, check_if_file_can_be_opened
12
- from astrohack.utils.graph import compute_graph
7
+ from astrohack.utils import get_default_file_name
8
+ from astrohack.utils.file import overwrite_file
9
+ from astrohack.utils.graph import create_and_execute_graph_from_dict
13
10
  from astrohack.io.beamcut_mds import AstrohackBeamcutFile
11
+ from astrohack.io.dio import open_holog
14
12
  from astrohack.utils.validation import custom_plots_checker
15
13
 
16
- from typing import Union, List
14
+ from typing import Union, List, Tuple
17
15
 
18
16
 
19
17
  @validate(custom_checker=custom_plots_checker)
@@ -21,13 +19,15 @@ def beamcut(
21
19
  holog_name: str,
22
20
  beamcut_name: str = None,
23
21
  ant: Union[str, List[str]] = "all",
24
- ddi: Union[int, List[str]] = "all",
22
+ ddi: Union[int, List[int], str] = "all",
25
23
  destination: str = None,
26
24
  lm_unit: str = "amin",
27
25
  azel_unit: str = "deg",
26
+ phase_unit: str = "deg",
27
+ phase_scale: Union[List[float], Tuple[float], np.array] = None,
28
+ y_scale: list[float] = None,
28
29
  dpi: int = 300,
29
30
  display: bool = False,
30
- y_scale: list[float] = None,
31
31
  parallel: bool = False,
32
32
  overwrite: bool = False,
33
33
  ):
@@ -55,6 +55,12 @@ def beamcut(
55
55
  :param azel_unit: Unit for Az/El information in plots and report, default is "deg".
56
56
  :type azel_unit: str, optional
57
57
 
58
+ :param phase_unit: Unit for phase plots, default is "deg".
59
+ :type phase_unit: str, optional
60
+
61
+ :param phase_scale: Scale for the phase plots, in phase_unit, default is None, meaning 1 full cycle.
62
+ :type phase_scale: Union[List[float], Tuple[float], np.array], optional
63
+
58
64
  :param dpi: Resolution in pixels, defaults to 300.
59
65
  :type dpi: int, optional
60
66
 
@@ -113,61 +119,73 @@ def beamcut(
113
119
  )
114
120
  """
115
121
 
116
- check_if_file_can_be_opened(holog_name, "0.9.5")
122
+ beamcut_name = get_default_file_name(holog_name, ".beamcut.zarr", beamcut_name)
117
123
 
118
- if beamcut_name is None:
119
- beamcut_name = get_default_file_name(
120
- input_file=holog_name, output_type=".beamcut.zarr"
121
- )
124
+ beamcut_params = locals()
122
125
 
123
126
  if destination is not None:
124
127
  pathlib.Path(destination).mkdir(exist_ok=True)
125
128
 
126
- beamcut_params = locals()
129
+ overwrite_file(beamcut_name, overwrite)
127
130
 
128
- input_params = beamcut_params.copy()
129
- assert pathlib.Path(beamcut_params["holog_name"]).exists() is True, logger.error(
130
- f"File {beamcut_params['holog_name']} does not exists."
131
+ beamcut_mds = AstrohackBeamcutFile.create_from_input_parameters(
132
+ beamcut_params["beamcut_name"], beamcut_params
131
133
  )
132
134
 
133
- json_data = "/".join((beamcut_params["holog_name"], ".holog_json"))
134
-
135
- with open(json_data, "r") as json_file:
136
- holog_json = json.load(json_file)
137
-
138
- overwrite_file(beamcut_params["beamcut_name"], beamcut_params["overwrite"])
139
-
140
- executed_graph, graph_results = compute_graph(
141
- holog_json,
142
- process_beamcut_chunk,
143
- beamcut_params,
144
- ["ant", "ddi"],
135
+ holog_mds = open_holog(holog_name)
136
+ executed_graph = create_and_execute_graph_from_dict(
137
+ looping_dict=holog_mds,
138
+ chunk_function=process_beamcut_chunk,
139
+ param_dict=beamcut_params,
140
+ key_order=["ant", "ddi"],
141
+ output_mds=beamcut_mds,
145
142
  parallel=parallel,
146
- fetch_returns=True,
147
143
  )
148
-
149
144
  if executed_graph:
150
- logger.info("Finished processing")
151
- output_attr_file = "{name}/{ext}".format(
152
- name=beamcut_params["beamcut_name"], ext=".beamcut_input"
153
- )
154
- root = xr.DataTree(name="root")
155
- root.attrs.update(beamcut_params)
156
- add_caller_and_version_to_dict(root.attrs, direct_call=True)
157
-
158
- for xdtree in graph_results:
159
- ant, ddi = xdtree.name.split("-")
160
- if ant in root.keys():
161
- ant = root.children[ant].update({ddi: xdtree})
162
- else:
163
- ant_tree = xr.DataTree(name=ant, children={ddi: xdtree})
164
- root = root.assign({ant: ant_tree})
165
-
166
- root.to_zarr(beamcut_params["beamcut_name"], mode="w", consolidated=True)
167
-
168
- beamcut_mds = AstrohackBeamcutFile(beamcut_params["beamcut_name"])
169
- beamcut_mds.open()
145
+ if destination is not None:
146
+ beamcut_mds.plot_beamcut_in_amplitude(
147
+ destination,
148
+ lm_unit=lm_unit,
149
+ azel_unit=azel_unit,
150
+ y_scale=y_scale,
151
+ display=display,
152
+ dpi=dpi,
153
+ parallel=parallel,
154
+ )
155
+ beamcut_mds.plot_beamcut_in_attenuation(
156
+ destination,
157
+ lm_unit=lm_unit,
158
+ azel_unit=azel_unit,
159
+ y_scale=y_scale,
160
+ display=display,
161
+ dpi=dpi,
162
+ parallel=parallel,
163
+ )
164
+ beamcut_mds.plot_beamcut_in_phase(
165
+ destination,
166
+ lm_unit=lm_unit,
167
+ azel_unit=azel_unit,
168
+ phase_unit=phase_unit,
169
+ phase_scale=phase_scale,
170
+ display=display,
171
+ dpi=dpi,
172
+ parallel=parallel,
173
+ )
174
+ beamcut_mds.plot_beam_cuts_over_sky(
175
+ destination,
176
+ lm_unit=lm_unit,
177
+ azel_unit=azel_unit,
178
+ display=display,
179
+ dpi=dpi,
180
+ parallel=parallel,
181
+ )
182
+ beamcut_mds.create_beam_fit_report(
183
+ destination,
184
+ lm_unit=lm_unit,
185
+ azel_unit=azel_unit,
186
+ parallel=parallel,
187
+ )
188
+
170
189
  return beamcut_mds
171
190
  else:
172
- logger.warning("No data to process")
173
191
  return None
@@ -6,9 +6,9 @@ from astrohack.core.cassegrain_ray_tracing import *
6
6
  from astrohack.utils import (
7
7
  convert_unit,
8
8
  clight,
9
- add_caller_and_version_to_dict,
10
9
  regrid_data_onto_2d_grid,
11
10
  )
11
+ from astrohack.utils.file import add_caller_and_version_to_dict
12
12
  from astrohack.utils.phase_fitting import aips_like_phase_fitting
13
13
  from astrohack.visualization.plot_tools import create_figure_and_axes, close_figure
14
14
  from typing import Union
@@ -1,17 +1,13 @@
1
- import pathlib
2
- import toolviper.utils.parameter
3
- import toolviper.utils.logger as logger
4
-
5
1
  from typing import Union, List
6
2
 
7
- from astrohack.core.combine import process_combine_chunk
3
+ import toolviper.utils.parameter
8
4
 
9
- from astrohack.utils.graph import compute_graph
5
+ from astrohack import open_image
6
+ from astrohack.core.combine import process_combine_chunk
7
+ from astrohack.utils.graph import create_and_execute_graph_from_dict
10
8
  from astrohack.utils.file import overwrite_file
11
- from astrohack.utils.data import write_meta_data
12
9
  from astrohack.utils.text import get_default_file_name
13
-
14
- from astrohack.io.mds import AstrohackImageFile
10
+ from astrohack.io.image_mds import AstrohackImageFile
15
11
 
16
12
 
17
13
  @toolviper.utils.parameter.validate()
@@ -52,6 +48,13 @@ def combine(
52
48
  :rtype: AstrohackImageFile
53
49
 
54
50
  .. _Description:
51
+ **combine**
52
+
53
+ Combine combines the amplitude and corrected_phase members of the selected DDIs in the input image file. Currently, \
54
+ combine only supports the combination of these two quantities to avoid long regridding times. Hence, the output \
55
+ image file (.combine.zarr file name) contains the combined amplitude and corrected_phase images, but the aperture \
56
+ and beam images present in this file will be those present in the DDI with the lowest frequency.
57
+
55
58
  **AstrohackImageFile**
56
59
 
57
60
  Image object allows the user to access image data via compound dictionary keys with values, in order of depth, \
@@ -81,45 +84,28 @@ def combine(
81
84
  )
82
85
  """
83
86
 
84
- if combine_name is None:
85
- combine_name = get_default_file_name(
86
- input_file=image_name, output_type=".image.zarr"
87
- )
87
+ combine_name = get_default_file_name(image_name, ".combine.zarr", combine_name)
88
88
 
89
89
  combine_params = locals()
90
90
 
91
- input_params = combine_params.copy()
92
-
93
- assert pathlib.Path(combine_params["image_name"]).exists() is True, logger.error(
94
- f'File {combine_params["image_name"]} does not exists.'
95
- )
96
-
97
91
  overwrite_file(combine_params["combine_name"], combine_params["overwrite"])
98
92
 
99
- image_mds = AstrohackImageFile(combine_params["image_name"])
100
- image_mds.open()
101
-
102
- combine_params["image_mds"] = image_mds
103
- image_attr = image_mds._meta_data
104
-
105
- if compute_graph(
106
- image_mds, process_combine_chunk, combine_params, ["ant"], parallel=parallel
107
- ):
108
- logger.info("Finished processing")
93
+ image_mds = open_image(image_name)
109
94
 
110
- output_attr_file = "{name}/{ext}".format(
111
- name=combine_params["combine_name"], ext=".image_attr"
112
- )
113
- write_meta_data(output_attr_file, image_attr)
95
+ combine_mds = AstrohackImageFile.create_from_input_parameters(
96
+ combine_name, combine_params
97
+ )
114
98
 
115
- output_attr_file = "{name}/{ext}".format(
116
- name=combine_params["combine_name"], ext=".image_input"
117
- )
118
- write_meta_data(output_attr_file, input_params)
99
+ executed_graph = create_and_execute_graph_from_dict(
100
+ looping_dict=image_mds,
101
+ chunk_function=process_combine_chunk,
102
+ param_dict=combine_params,
103
+ key_order=["ant"],
104
+ output_mds=combine_mds,
105
+ )
119
106
 
120
- combine_mds = AstrohackImageFile(combine_params["combine_name"])
121
- combine_mds.open()
107
+ if executed_graph:
108
+ combine_mds.write(mode="a")
122
109
  return combine_mds
123
110
  else:
124
- logger.warning("No data to process")
125
111
  return None
@@ -38,6 +38,12 @@
38
38
  "type": ["string"],
39
39
  "check allowed with": "units.trig"
40
40
  },
41
+ "phase_unit":{
42
+ "nullable": false,
43
+ "required": false,
44
+ "type": ["string"],
45
+ "check allowed with": "units.trig"
46
+ },
41
47
  "dpi":{
42
48
  "nullable": false,
43
49
  "required": false,
@@ -65,6 +71,21 @@
65
71
  "ndarray"
66
72
  ]
67
73
  },
74
+ "phase_scale":{
75
+ "nullable": true,
76
+ "required": false,
77
+ "struct_type": [
78
+ "float",
79
+ "int"
80
+ ],
81
+ "minlength": 2,
82
+ "maxlength": 2,
83
+ "type": [
84
+ "list",
85
+ "tuple",
86
+ "ndarray"
87
+ ]
88
+ },
68
89
  "parallel":{
69
90
  "nullable": false,
70
91
  "required": false,