astrohack 0.3.2__tar.gz → 0.3.3__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.
- {astrohack-0.3.2/src/astrohack.egg-info → astrohack-0.3.3}/PKG-INFO +1 -1
- astrohack-0.3.3/pyproject.toml +24 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/_utils/_algorithms.py +18 -11
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/_utils/_locit.py +7 -7
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/_utils/_panel_classes/antenna_surface.py +6 -3
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/_utils/_plot_commons.py +21 -3
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/combine.py +3 -4
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/extract_locit.py +3 -4
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/extract_pointing.py +0 -24
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/holog.py +3 -6
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/locit.py +3 -4
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/mds.py +74 -74
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/panel.py +5 -6
- {astrohack-0.3.2 → astrohack-0.3.3/src/astrohack.egg-info}/PKG-INFO +1 -1
- astrohack-0.3.2/pyproject.toml +0 -51
- {astrohack-0.3.2 → astrohack-0.3.3}/LICENSE +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/MANIFEST.in +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/README.md +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/README.rst +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/setup.cfg +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/__init__.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/_utils/__init__.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/_utils/_combine.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/_utils/_constants.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/_utils/_conversion.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/_utils/_dask_graph_tools.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/_utils/_dask_plugins/__init__.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/_utils/_dask_plugins/_astrohack_scheduler.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/_utils/_dask_plugins/_astrohack_worker.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/_utils/_diagnostics.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/_utils/_dio.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/_utils/_extract_holog.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/_utils/_extract_locit.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/_utils/_extract_point.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/_utils/_gaussfitter.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/_utils/_holog.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/_utils/_imaging.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/_utils/_locit_commons.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/_utils/_logger/__init__.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/_utils/_logger/_astrohack_logger.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/_utils/_panel.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/_utils/_panel_classes/base_panel.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/_utils/_panel_classes/polygon_panel.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/_utils/_panel_classes/ring_panel.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/_utils/_panel_classes/telescope.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/_utils/_param_utils/__init__.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/_utils/_param_utils/_check_logger_parms.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/_utils/_param_utils/_check_parms.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/_utils/_phase_fitting.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/_utils/_tools.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/client.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/data/.file_meta_data/J1924-2914.ms.calibrated.split.SPW3.json +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/data/.file_meta_data/ea25_cal_small_spw1_4_60_ea04_after_fixed.split.json +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/data/.file_meta_data/ea25_cal_small_spw1_4_60_ea04_before_fixed_split.json +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/data/__init__.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/data/_dropbox.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/data/_google_drive.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/data/datasets.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/data/telescopes/__init__.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/data/telescopes/aca_7m.zarr/.zattrs +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/data/telescopes/aca_7m.zarr/.zgroup +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/data/telescopes/aca_7m.zarr/.zmetadata +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/data/telescopes/alma_da.zarr/.zattrs +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/data/telescopes/alma_da.zarr/.zgroup +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/data/telescopes/alma_da.zarr/.zmetadata +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/data/telescopes/alma_dv.zarr/.zattrs +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/data/telescopes/alma_dv.zarr/.zgroup +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/data/telescopes/alma_dv.zarr/.zmetadata +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/data/telescopes/alma_tp.zarr/.zattrs +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/data/telescopes/alma_tp.zarr/.zgroup +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/data/telescopes/alma_tp.zarr/.zmetadata +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/data/telescopes/vla.zarr/.zattrs +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/data/telescopes/vla.zarr/.zgroup +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/data/telescopes/vla.zarr/.zmetadata +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/data/telescopes/vlba.zarr/.zattrs +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/data/telescopes/vlba.zarr/.zgroup +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/data/telescopes/vlba.zarr/.zmetadata +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/dio.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/extract_holog.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/visualization/__init__.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/visualization/viewer.py +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack.egg-info/SOURCES.txt +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack.egg-info/dependency_links.txt +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack.egg-info/requires.txt +0 -0
- {astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: astrohack
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.3
|
|
4
4
|
Summary: Holography Antenna Commissioning Kit
|
|
5
5
|
Author-email: Jan-Willem Steeb <jsteeb@nrao.edu>, Joshua Hoskins <jhoskins@nrao.edu>, Victor de Souza Magalhaes <vdesouza@nrao.edu>
|
|
6
6
|
Requires-Python: <3.12,>=3.8
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "astrohack"
|
|
3
|
+
version = "0.3.3"
|
|
4
|
+
description = "Holography Antenna Commissioning Kit"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">= 3.8, < 3.12"
|
|
7
|
+
dependencies = [ "astropy", "dask", "distributed", "gdown", "matplotlib", "memory_profiler", "numba>=0.57.0", "numpy", "prettytable", "pytest", "pytest-cov", "pytest-html", "scikit_image", "scipy", "xarray", "zarr", "bokeh", "jupyterlab", "python_casacore>=3.5.2; sys_platform != \"darwin\" ",]
|
|
8
|
+
[[project.authors]]
|
|
9
|
+
name = "Jan-Willem Steeb"
|
|
10
|
+
email = "jsteeb@nrao.edu"
|
|
11
|
+
|
|
12
|
+
[[project.authors]]
|
|
13
|
+
name = "Joshua Hoskins"
|
|
14
|
+
email = "jhoskins@nrao.edu"
|
|
15
|
+
|
|
16
|
+
[[project.authors]]
|
|
17
|
+
name = "Victor de Souza Magalhaes"
|
|
18
|
+
email = "vdesouza@nrao.edu"
|
|
19
|
+
|
|
20
|
+
[project.license]
|
|
21
|
+
file = "LICENSE.txt"
|
|
22
|
+
|
|
23
|
+
[project.optional-dependencies]
|
|
24
|
+
docs = [ "ipykernel", "ipympl", "ipython", "jupyter-client", "nbsphinx", "recommonmark", "scanpydoc", "sphinx-autoapi", "sphinx-autosummary-accessors", "sphinx_rtd_theme", "twine", "pandoc",]
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import scipy
|
|
2
1
|
import scipy.signal as scisig
|
|
3
|
-
import numba
|
|
4
|
-
|
|
5
2
|
import numpy as np
|
|
6
3
|
|
|
7
4
|
from astrohack._utils._logger._astrohack_logger import _get_astrohack_logger
|
|
8
5
|
|
|
6
|
+
|
|
9
7
|
def _calculate_suggested_grid_paramater(parameter, quantile=0.01):
|
|
10
8
|
import scipy
|
|
11
9
|
|
|
@@ -33,6 +31,7 @@ def _calculate_suggested_grid_paramater(parameter, quantile=0.01):
|
|
|
33
31
|
|
|
34
32
|
return np.mean(parameter)
|
|
35
33
|
|
|
34
|
+
|
|
36
35
|
def _apply_mask(data, scaling=0.5):
|
|
37
36
|
""" Applies a cropping mask to the input data according to the scale factor
|
|
38
37
|
|
|
@@ -59,6 +58,7 @@ def _apply_mask(data, scaling=0.5):
|
|
|
59
58
|
start = int(x // 2 - mask // 2)
|
|
60
59
|
return data[start : (start + mask), start : (start + mask)]
|
|
61
60
|
|
|
61
|
+
|
|
62
62
|
def _calc_coords(image_size, cell_size):
|
|
63
63
|
"""Calculate the center pixel of the image given a cell and image size
|
|
64
64
|
|
|
@@ -95,7 +95,7 @@ def _find_nearest(array, value):
|
|
|
95
95
|
return idx, array[idx]
|
|
96
96
|
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
# @njit(cache=False, nogil=True)
|
|
99
99
|
def _chunked_average(data, weight, avg_map, avg_freq):
|
|
100
100
|
|
|
101
101
|
avg_chan_index = np.arange(avg_freq.shape[0])
|
|
@@ -133,6 +133,7 @@ def _chunked_average(data, weight, avg_map, avg_freq):
|
|
|
133
133
|
|
|
134
134
|
return data_avg, weight_sum
|
|
135
135
|
|
|
136
|
+
|
|
136
137
|
def _calculate_euclidean_distance(x, y, center):
|
|
137
138
|
""" Calculates the euclidean distance between a pair of pair of input points.
|
|
138
139
|
|
|
@@ -175,6 +176,7 @@ def _find_peak_beam_value(data, height=0.5, scaling=0.5):
|
|
|
175
176
|
|
|
176
177
|
return masked_data[x[index], y[index]]
|
|
177
178
|
|
|
179
|
+
|
|
178
180
|
def _gauss_elimination_numpy(system, vector):
|
|
179
181
|
"""
|
|
180
182
|
Gauss elimination solving of a system using numpy
|
|
@@ -188,6 +190,7 @@ def _gauss_elimination_numpy(system, vector):
|
|
|
188
190
|
inverse = np.linalg.inv(system)
|
|
189
191
|
return np.dot(inverse, vector)
|
|
190
192
|
|
|
193
|
+
|
|
191
194
|
def _least_squares_fit(system, vector):
|
|
192
195
|
"""
|
|
193
196
|
Least squares fitting of a system of linear equations
|
|
@@ -204,14 +207,17 @@ def _least_squares_fit(system, vector):
|
|
|
204
207
|
if system.shape[0] < system.shape[1]:
|
|
205
208
|
raise Exception('System must have at least the same number of rows as it has of columns')
|
|
206
209
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
210
|
+
result, residuals, _, _ = np.linalg.lstsq(system, vector, rcond=None)
|
|
211
|
+
dof = len(vector)-len(result)
|
|
212
|
+
if dof > 0:
|
|
213
|
+
errs = (vector - np.dot(system, result))/dof
|
|
214
|
+
else:
|
|
215
|
+
errs = (vector - np.dot(system, result))
|
|
216
|
+
sigma2 = np.sum(errs**2)
|
|
211
217
|
covar = np.linalg.inv(np.dot(system.T, system))
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
218
|
+
variance = np.diagonal(sigma2*covar)
|
|
219
|
+
return result, variance, residuals
|
|
220
|
+
|
|
215
221
|
|
|
216
222
|
def _least_squares_fit_block(system, vector):
|
|
217
223
|
"""
|
|
@@ -270,6 +276,7 @@ def _get_grid_parms(vis_map_dict, pnt_map_dict, ant_names):
|
|
|
270
276
|
|
|
271
277
|
return grid_parms
|
|
272
278
|
|
|
279
|
+
|
|
273
280
|
def _significant_digits(x, digits):
|
|
274
281
|
if np.isscalar(x):
|
|
275
282
|
return _significant_digits_scalar(x, digits)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import numpy as np
|
|
2
1
|
from prettytable import PrettyTable
|
|
3
2
|
from astropy.coordinates import EarthLocation
|
|
4
3
|
from astropy.time import Time
|
|
@@ -306,29 +305,30 @@ def _create_output_xds(coordinates, lst, delays, fit, variance, chi_squared, mod
|
|
|
306
305
|
fit_kterm = locit_parms['fit_kterm']
|
|
307
306
|
fit_rate = locit_parms['fit_rate']
|
|
308
307
|
antenna = locit_parms['ant_info'][locit_parms['this_ant']]
|
|
308
|
+
error = np.sqrt(variance)
|
|
309
309
|
|
|
310
310
|
output_xds = xr.Dataset()
|
|
311
311
|
output_xds.attrs['polarization'] = locit_parms['polarization']
|
|
312
312
|
output_xds.attrs['frequency'] = frequency
|
|
313
313
|
output_xds.attrs['position_fit'] = fit[1:4]
|
|
314
|
-
output_xds.attrs['position_error'] =
|
|
314
|
+
output_xds.attrs['position_error'] = error[1:4]
|
|
315
315
|
output_xds.attrs['fixed_delay_fit'] = fit[0]
|
|
316
|
-
output_xds.attrs['fixed_delay_error'] =
|
|
316
|
+
output_xds.attrs['fixed_delay_error'] = error[0]
|
|
317
317
|
output_xds.attrs['antenna_info'] = antenna
|
|
318
318
|
output_xds.attrs['elevation_limit'] = elevation_limit
|
|
319
319
|
output_xds.attrs['chi_squared'] = chi_squared
|
|
320
320
|
|
|
321
321
|
if fit_kterm and fit_rate:
|
|
322
322
|
output_xds.attrs['koff_fit'] = fit[4]
|
|
323
|
-
output_xds.attrs['koff_error'] =
|
|
323
|
+
output_xds.attrs['koff_error'] = error[4]
|
|
324
324
|
output_xds.attrs['rate_fit'] = fit[5]
|
|
325
|
-
output_xds.attrs['rate_error'] =
|
|
325
|
+
output_xds.attrs['rate_error'] = error[5]
|
|
326
326
|
elif fit_kterm and not fit_rate:
|
|
327
327
|
output_xds.attrs['koff_fit'] = fit[4]
|
|
328
|
-
output_xds.attrs['koff_error'] =
|
|
328
|
+
output_xds.attrs['koff_error'] = error[4]
|
|
329
329
|
elif not fit_kterm and fit_rate:
|
|
330
330
|
output_xds.attrs['rate_fit'] = fit[4]
|
|
331
|
-
output_xds.attrs['rate_error'] =
|
|
331
|
+
output_xds.attrs['rate_error'] = error[4]
|
|
332
332
|
else:
|
|
333
333
|
pass # Nothing to be added to the attributes
|
|
334
334
|
|
|
@@ -495,10 +495,13 @@ class AntennaSurface:
|
|
|
495
495
|
basename: basename for the plot, the prefix 'ancillary_amplitude' will be added to it
|
|
496
496
|
parm_dict: dictionary with plotting parameters
|
|
497
497
|
"""
|
|
498
|
-
|
|
499
|
-
|
|
498
|
+
if parm_dict['amplitude_limits'] is None or parm_dict['amplitude_limits'] == "None":
|
|
499
|
+
parm_dict['z_lim'] = np.nanmin(self.amplitude), np.nanmax(self.amplitude)
|
|
500
|
+
else:
|
|
501
|
+
parm_dict['z_lim'] = parm_dict['amplitude_limits']
|
|
502
|
+
|
|
503
|
+
title = "Amplitude, min={0:.5f}, max ={1:.5f} V".format(parm_dict['z_lim'][0], parm_dict['z_lim'][1])
|
|
500
504
|
plotname = _add_prefix(basename, 'amplitude')
|
|
501
|
-
parm_dict['z_lim'] = [vmin, vmax]
|
|
502
505
|
parm_dict['unit'] = self.amp_unit
|
|
503
506
|
self._plot_map(plotname, self.amplitude, title, parm_dict)
|
|
504
507
|
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
from matplotlib import pyplot as plt
|
|
2
2
|
from mpl_toolkits.axes_grid1 import make_axes_locatable
|
|
3
|
-
from matplotlib import colormaps as
|
|
3
|
+
from matplotlib import colormaps as matplotlib_cmaps
|
|
4
|
+
from matplotlib.colors import ListedColormap
|
|
4
5
|
from astrohack._utils import figsize, fontsize
|
|
5
6
|
|
|
6
7
|
|
|
8
|
+
astrohack_cmaps = list(matplotlib_cmaps.keys())
|
|
9
|
+
astrohack_cmaps.append('AIPS')
|
|
10
|
+
|
|
11
|
+
|
|
7
12
|
def _create_figure_and_axes(figure_size, boxes, default_figsize=figsize, sharex=False, sharey=False):
|
|
8
13
|
"""
|
|
9
14
|
Create a figures and plotting axes within according to a desired figure size and number of boxes
|
|
@@ -110,6 +115,19 @@ def _well_positioned_colorbar(ax, fig, image, label, location='right', size='5%'
|
|
|
110
115
|
|
|
111
116
|
def _get_proper_color_map(user_cmap, default_cmap='viridis'):
|
|
112
117
|
if user_cmap is None or user_cmap == 'None':
|
|
113
|
-
return
|
|
118
|
+
return matplotlib_cmaps[default_cmap]
|
|
119
|
+
elif user_cmap == 'AIPS':
|
|
120
|
+
# 8 bit color values picked from AIPS plots using GIMP
|
|
121
|
+
cmap = ListedColormap([[ 71/255., 71/255., 71/255., 1], # Grey
|
|
122
|
+
[104/255., 0/255., 142/255., 1], # Purple/ dark blue?
|
|
123
|
+
[ 0/255., 0/255., 186/255., 1], # Blue
|
|
124
|
+
[ 71/255., 147/255., 230/255., 1], # Pink
|
|
125
|
+
[ 0/255., 130/255., 0/255., 1], # Green
|
|
126
|
+
[ 0/255., 243/255., 0/255., 1], # Light Green
|
|
127
|
+
[255/255., 255/255., 0/255., 1], # Yellow
|
|
128
|
+
[255/255., 158/255., 0/255., 1], # Orange
|
|
129
|
+
[255/255., 0/255., 0/255., 1] # Red
|
|
130
|
+
])
|
|
131
|
+
return cmap
|
|
114
132
|
else:
|
|
115
|
-
return
|
|
133
|
+
return matplotlib_cmaps[user_cmap]
|
|
@@ -9,7 +9,7 @@ from astrohack.mds import AstrohackImageFile
|
|
|
9
9
|
from astrohack._utils._dask_graph_tools import _dask_general_compute
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
def combine(image_name, combine_name=None,
|
|
12
|
+
def combine(image_name, combine_name=None, ant=None, ddi=None, weighted=False, parallel=False, overwrite=False):
|
|
13
13
|
"""Combine DDIs in a Holography image to increase SNR
|
|
14
14
|
|
|
15
15
|
:param image_name: Input holography data file name. Accepted data format is the output from ``astrohack.holog.holog``
|
|
@@ -17,8 +17,8 @@ def combine(image_name, combine_name=None, ant_id=None, ddi=None, weighted=False
|
|
|
17
17
|
:param combine_name: Name of output file; File name will be appended with suffix *.combine.zarr*. Defaults to \
|
|
18
18
|
*basename* of input file plus holography panel file suffix.
|
|
19
19
|
:type combine_name: str, optional
|
|
20
|
-
:param
|
|
21
|
-
:type
|
|
20
|
+
:param ant: List of antennas to be processed. None will use all antennas. Defaults to None, ex. ea25.
|
|
21
|
+
:type ant: list or str, optional
|
|
22
22
|
:param ddi: List of DDIs to be combined. None will use all DDIs. Defaults to None, ex. [0, ..., 8].
|
|
23
23
|
:type ddi: list of int, optional
|
|
24
24
|
:param weighted: Weight phases by the corresponding amplitudes.
|
|
@@ -52,7 +52,6 @@ def combine(image_name, combine_name=None, ant_id=None, ddi=None, weighted=False
|
|
|
52
52
|
"""
|
|
53
53
|
|
|
54
54
|
combine_params = locals()
|
|
55
|
-
combine_params['ant'] = ant_id
|
|
56
55
|
logger = _get_astrohack_logger()
|
|
57
56
|
fname = 'combine'
|
|
58
57
|
combine_params = _check_combine_parms(fname, combine_params)
|
|
@@ -8,7 +8,7 @@ from astrohack._utils._extract_locit import _extract_source_and_telescope, _extr
|
|
|
8
8
|
from astrohack.mds import AstrohackLocitFile
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
def extract_locit(cal_table, locit_name=None,
|
|
11
|
+
def extract_locit(cal_table, locit_name=None, ant=None, ddi=None, overwrite=False):
|
|
12
12
|
"""
|
|
13
13
|
Extract Antenna position determination data from an MS and stores it in a locit output file.
|
|
14
14
|
|
|
@@ -16,8 +16,8 @@ def extract_locit(cal_table, locit_name=None, ant_id=None, ddi=None, overwrite=F
|
|
|
16
16
|
:type cal_table: str
|
|
17
17
|
:param locit_name: Name of *<locit_name>.locit.zarr* file to create. Defaults to measurement set name with *locit.zarr* extension.
|
|
18
18
|
:type locit_name: str, optional
|
|
19
|
-
:param
|
|
20
|
-
:type
|
|
19
|
+
:param ant: List of antennas/antenna to be extracted, defaults to "all" when None, ex. ea25
|
|
20
|
+
:type ant: list or str, optional
|
|
21
21
|
:param ddi: List of ddis/ddi to be extracted, defaults to "all" when None, ex. 0
|
|
22
22
|
:type ddi: list or int, optional
|
|
23
23
|
:param overwrite: Boolean for whether to overwrite current locit.zarr file, defaults to False.
|
|
@@ -35,7 +35,6 @@ def extract_locit(cal_table, locit_name=None, ant_id=None, ddi=None, overwrite=F
|
|
|
35
35
|
|
|
36
36
|
"""
|
|
37
37
|
extract_locit_parms = locals()
|
|
38
|
-
extract_locit_parms['ant'] = ant_id
|
|
39
38
|
logger = _get_astrohack_logger()
|
|
40
39
|
|
|
41
40
|
fname = 'extract_locit'
|
|
@@ -1,37 +1,13 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import dask
|
|
3
|
-
import json
|
|
4
|
-
import copy
|
|
5
1
|
import inspect
|
|
6
|
-
import numbers
|
|
7
2
|
|
|
8
|
-
import numpy as np
|
|
9
|
-
|
|
10
|
-
from astropy.time import Time
|
|
11
|
-
|
|
12
|
-
from pprint import pformat
|
|
13
|
-
|
|
14
|
-
from casacore import tables as ctables
|
|
15
|
-
|
|
16
|
-
from astrohack._utils._constants import pol_str
|
|
17
|
-
|
|
18
|
-
from astrohack._utils._conversion import _convert_ant_name_to_id
|
|
19
|
-
from astrohack._utils._extract_holog import _create_holog_meta_data
|
|
20
3
|
from astrohack._utils._extract_point import _extract_pointing
|
|
21
4
|
|
|
22
5
|
from astrohack._utils._dio import _load_point_file
|
|
23
6
|
from astrohack._utils._dio import _check_if_file_will_be_overwritten, _check_if_file_exists
|
|
24
|
-
from astrohack._utils._dio import _load_holog_file
|
|
25
7
|
from astrohack._utils._dio import _write_meta_data
|
|
26
|
-
|
|
27
|
-
from astrohack._utils._extract_holog import _extract_holog_chunk
|
|
28
|
-
|
|
29
8
|
from astrohack._utils._logger._astrohack_logger import _get_astrohack_logger
|
|
30
|
-
|
|
31
9
|
from astrohack._utils._param_utils._check_parms import _check_parms, _parm_check_passed
|
|
32
|
-
|
|
33
10
|
from astrohack._utils._tools import _remove_suffix
|
|
34
|
-
from astrohack._utils._tools import _jsonify
|
|
35
11
|
|
|
36
12
|
from astrohack.mds import AstrohackPointFile
|
|
37
13
|
|
|
@@ -26,7 +26,7 @@ def holog(
|
|
|
26
26
|
chan_average=True,
|
|
27
27
|
chan_tolerance_factor=0.005,
|
|
28
28
|
scan_average=True,
|
|
29
|
-
|
|
29
|
+
ant=None,
|
|
30
30
|
ddi=None,
|
|
31
31
|
to_stokes=True,
|
|
32
32
|
apply_mask=True,
|
|
@@ -66,8 +66,8 @@ def holog(
|
|
|
66
66
|
:type chan_tolerance_factor: float, optional
|
|
67
67
|
:param scan_average: Boolean dicating whether averagin is done over scan., defaults to True
|
|
68
68
|
:type scan_average: bool, optional
|
|
69
|
-
:param
|
|
70
|
-
:type
|
|
69
|
+
:param ant: List of antennas/antenna to be processed, defaults to "all" when None, ex. ea25
|
|
70
|
+
:type ant: list or str, optional
|
|
71
71
|
:param ddi: List of ddis/ddi to be processed, defaults to "all" when None, ex. 0
|
|
72
72
|
:type ddi: list or int, optional
|
|
73
73
|
:param to_stokes: Dictates whether polarization is computed according to stokes values., defaults to True
|
|
@@ -136,9 +136,6 @@ def holog(
|
|
|
136
136
|
|
|
137
137
|
function_name = inspect.stack()[CURRENT_FUNCTION].function
|
|
138
138
|
|
|
139
|
-
# Shouldn't have to do this but the name changes ant_id->ant for some reason. Fix later.
|
|
140
|
-
holog_params['ant'] = ant_id
|
|
141
|
-
|
|
142
139
|
######### Parameter Checking #########
|
|
143
140
|
holog_params = _check_holog_params(function_name=function_name, holog_params=holog_params)
|
|
144
141
|
input_parms = holog_params.copy()
|
|
@@ -8,7 +8,7 @@ from astrohack._utils._dask_graph_tools import _dask_general_compute
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
def locit(locit_name, position_name=None, elevation_limit=10.0, polarization='both', fit_engine='linear algebra',
|
|
11
|
-
fit_kterm=False, fit_delay_rate=True,
|
|
11
|
+
fit_kterm=False, fit_delay_rate=True, ant=None, ddi=None, combine_ddis='simple', parallel=False,
|
|
12
12
|
overwrite=False):
|
|
13
13
|
"""
|
|
14
14
|
Extract Antenna position determination data from an MS and stores it in a locit output file.
|
|
@@ -27,8 +27,8 @@ def locit(locit_name, position_name=None, elevation_limit=10.0, polarization='bo
|
|
|
27
27
|
:type fit_delay_rate: bool, optional
|
|
28
28
|
:param fit_engine: What engine to use on fitting, default is linear algebra
|
|
29
29
|
:type fit_engine: str, optional
|
|
30
|
-
:param
|
|
31
|
-
:type
|
|
30
|
+
:param ant: List of antennas/antenna to be processed, defaults to "all" when None, ex. ea25
|
|
31
|
+
:type ant: list or str, optional
|
|
32
32
|
:param ddi: List of ddis/ddi to be processed, defaults to "all" when None, ex. 0
|
|
33
33
|
:type ddi: list or int, optional
|
|
34
34
|
:param combine_ddis: Type of DDI combination, if desired, defaults to simple
|
|
@@ -104,7 +104,6 @@ def locit(locit_name, position_name=None, elevation_limit=10.0, polarization='bo
|
|
|
104
104
|
delays.
|
|
105
105
|
"""
|
|
106
106
|
locit_parms = locals()
|
|
107
|
-
locit_parms['ant'] = ant_id
|
|
108
107
|
logger = _get_astrohack_logger()
|
|
109
108
|
|
|
110
109
|
fname = 'locit'
|
|
@@ -6,7 +6,6 @@ import distributed
|
|
|
6
6
|
import numpy as np
|
|
7
7
|
|
|
8
8
|
from prettytable import PrettyTable
|
|
9
|
-
from matplotlib import colormaps as cmaps
|
|
10
9
|
|
|
11
10
|
from astrohack._utils._logger._astrohack_logger import _get_astrohack_logger
|
|
12
11
|
from astrohack._utils._dio import _read_meta_data
|
|
@@ -33,6 +32,7 @@ from astrohack._utils._locit import _plot_delays_chunk, _plot_position_correctio
|
|
|
33
32
|
|
|
34
33
|
from astrohack._utils._panel_classes.antenna_surface import AntennaSurface
|
|
35
34
|
from astrohack._utils._panel_classes.telescope import Telescope
|
|
35
|
+
from astrohack._utils._plot_commons import astrohack_cmaps as cmaps
|
|
36
36
|
|
|
37
37
|
CURRENT_FUNCTION = 0
|
|
38
38
|
|
|
@@ -160,13 +160,13 @@ class AstrohackImageFile(dict):
|
|
|
160
160
|
_print_data_contents(self, ["Antenna", "DDI"])
|
|
161
161
|
_print_method_list([self.summary, self.select, self.export_to_fits, self.plot_beams, self.plot_apertures])
|
|
162
162
|
|
|
163
|
-
def select(self,
|
|
163
|
+
def select(self, ant, ddi, complex_split='cartesian'):
|
|
164
164
|
""" Select data on the basis of ddi, scan, ant. This is a convenience function.
|
|
165
165
|
|
|
166
166
|
:param ddi: Data description ID, ex. 0.
|
|
167
167
|
:type ddi: int
|
|
168
|
-
:param
|
|
169
|
-
:type
|
|
168
|
+
:param ant: Antenna ID, ex. ea25.
|
|
169
|
+
:type ant: str
|
|
170
170
|
:param complex_split: Is the data to b left as is (Real + imag: cartesian, default) or split into Amplitude and Phase (polar)
|
|
171
171
|
:type complex_split: str, optional
|
|
172
172
|
|
|
@@ -175,27 +175,27 @@ class AstrohackImageFile(dict):
|
|
|
175
175
|
"""
|
|
176
176
|
logger = _get_astrohack_logger()
|
|
177
177
|
|
|
178
|
-
|
|
178
|
+
ant = 'ant_' + ant
|
|
179
179
|
ddi = f'ddi_{ddi}'
|
|
180
180
|
|
|
181
|
-
if
|
|
181
|
+
if ant is None or ddi is None:
|
|
182
182
|
logger.info("[select]: No selections made ...")
|
|
183
183
|
return self
|
|
184
184
|
else:
|
|
185
185
|
if complex_split == 'polar':
|
|
186
|
-
return self[
|
|
186
|
+
return self[ant][ddi].apply(np.absolute), self[ant][ddi].apply(np.angle, deg=True)
|
|
187
187
|
else:
|
|
188
|
-
return self[
|
|
188
|
+
return self[ant][ddi]
|
|
189
189
|
|
|
190
|
-
def export_to_fits(self, destination, complex_split='cartesian',
|
|
190
|
+
def export_to_fits(self, destination, complex_split='cartesian', ant=None, ddi=None, parallel=False):
|
|
191
191
|
""" Export contents of an AstrohackImageFile object to several FITS files in the destination folder
|
|
192
192
|
|
|
193
193
|
:param destination: Name of the destination folder to contain plots
|
|
194
194
|
:type destination: str
|
|
195
195
|
:param complex_split: How to split complex data, cartesian (real + imag, default) or polar (amplitude + phase)
|
|
196
196
|
:type complex_split: str, optional
|
|
197
|
-
:param
|
|
198
|
-
:type
|
|
197
|
+
:param ant: List of antennas/antenna to be plotted, defaults to "all" when None, ex. ea25
|
|
198
|
+
:type ant: list or str, optional
|
|
199
199
|
:param ddi: List of ddis/ddi to be plotted, defaults to "all" when None, ex. 0
|
|
200
200
|
:type ddi: list or int, optional
|
|
201
201
|
:param parallel: If True will use an existing astrohack client to export FITS in parallel, default is False
|
|
@@ -218,7 +218,6 @@ class AstrohackImageFile(dict):
|
|
|
218
218
|
"""
|
|
219
219
|
|
|
220
220
|
parm_dict = locals()
|
|
221
|
-
parm_dict['ant'] = ant_id
|
|
222
221
|
function_name = inspect.stack()[CURRENT_FUNCTION].function
|
|
223
222
|
|
|
224
223
|
parms_passed = _check_parms(function_name, parm_dict, 'complex_split', [str], acceptable_data=possible_splits,
|
|
@@ -242,20 +241,22 @@ class AstrohackImageFile(dict):
|
|
|
242
241
|
parallel=parallel
|
|
243
242
|
)
|
|
244
243
|
|
|
245
|
-
def plot_apertures(self, destination,
|
|
246
|
-
|
|
247
|
-
colormap='viridis',
|
|
248
|
-
|
|
244
|
+
def plot_apertures(self, destination, ant=None, ddi=None, plot_screws=False, amplitude_limits=None,
|
|
245
|
+
phase_unit='deg', phase_limits=None, deviation_unit='mm', deviation_limits=None,
|
|
246
|
+
panel_labels=False, display=False, colormap='viridis', figure_size=None, dpi=300,
|
|
247
|
+
parallel=False):
|
|
249
248
|
""" Aperture amplitude and phase plots from the data in an AstrohackImageFIle object.
|
|
250
249
|
|
|
251
250
|
:param destination: Name of the destination folder to contain plots
|
|
252
251
|
:type destination: str
|
|
253
|
-
:param
|
|
254
|
-
:type
|
|
252
|
+
:param ant: List of antennas/antenna to be plotted, defaults to "all" when None, ex. ea25
|
|
253
|
+
:type ant: list or str, optional
|
|
255
254
|
:param ddi: List of ddis/ddi to be plotted, defaults to "all" when None, ex. 0
|
|
256
255
|
:type ddi: list or int, optional
|
|
257
256
|
:param plot_screws: Add screw positions to plot, default is False
|
|
258
257
|
:type plot_screws: bool, optional
|
|
258
|
+
:param amplitude_limits: Lower then Upper limit for amplitude in volts default is None (Guess from data)
|
|
259
|
+
:type amplitude_limits: numpy.ndarray, list, tuple, optional
|
|
259
260
|
:param phase_unit: Unit for phase plots, defaults is 'deg'
|
|
260
261
|
:type phase_unit: str, optional
|
|
261
262
|
:param phase_limits: Lower then Upper limit for phase, value in phase_unit, default is None (Guess from data)
|
|
@@ -282,7 +283,6 @@ class AstrohackImageFile(dict):
|
|
|
282
283
|
Produce plots from ``astrohack.holog`` results for analysis
|
|
283
284
|
"""
|
|
284
285
|
parm_dict = locals()
|
|
285
|
-
parm_dict['ant'] = ant_id
|
|
286
286
|
function_name = inspect.stack()[CURRENT_FUNCTION].function
|
|
287
287
|
|
|
288
288
|
parms_passed = _check_parms(function_name, parm_dict, 'ant', [str, list], list_acceptable_data_types=[str],
|
|
@@ -290,6 +290,9 @@ class AstrohackImageFile(dict):
|
|
|
290
290
|
parms_passed = parms_passed and _check_parms(function_name, parm_dict, 'ddi', [int, list],
|
|
291
291
|
list_acceptable_data_types=[int], default='all')
|
|
292
292
|
parms_passed = parms_passed and _check_parms(function_name, parm_dict, 'destination', [str], default=None)
|
|
293
|
+
parms_passed = parms_passed and _check_parms(function_name, parm_dict, 'amplitude_limits', [list, np.ndarray],
|
|
294
|
+
list_acceptable_data_types=[numbers.Number], list_len=2,
|
|
295
|
+
default='None', log_default_setting=False)
|
|
293
296
|
parms_passed = parms_passed and _check_parms(function_name, parm_dict, 'phase_unit', [str], acceptable_data=trigo_units,
|
|
294
297
|
default='deg')
|
|
295
298
|
parms_passed = parms_passed and _check_parms(function_name, parm_dict, 'phase_limits', [list, np.ndarray],
|
|
@@ -315,14 +318,14 @@ class AstrohackImageFile(dict):
|
|
|
315
318
|
_create_destination_folder(parm_dict['destination'])
|
|
316
319
|
_dask_general_compute(function_name, self, _plot_aperture_chunk, parm_dict, ['ant', 'ddi'], parallel=parallel)
|
|
317
320
|
|
|
318
|
-
def plot_beams(self, destination,
|
|
321
|
+
def plot_beams(self, destination, ant=None, ddi=None, complex_split='polar', display=False, colormap='viridis',
|
|
319
322
|
figure_size=None, dpi=300, parallel=False):
|
|
320
323
|
""" Beam plots from the data in an AstrohackImageFIle object.
|
|
321
324
|
|
|
322
325
|
:param destination: Name of the destination folder to contain plots
|
|
323
326
|
:type destination: str
|
|
324
|
-
:param
|
|
325
|
-
:type
|
|
327
|
+
:param ant: List of antennas/antenna to be plotted, defaults to "all" when None, ex. ea25
|
|
328
|
+
:type ant: list or str, optional
|
|
326
329
|
:param ddi: List of ddis/ddi to be plotted, defaults to "all" when None, ex. 0
|
|
327
330
|
:type ddi: list or int, optional
|
|
328
331
|
:param complex_split: How to split complex beam data, cartesian (real + imag) or polar (amplitude + phase, default)
|
|
@@ -343,7 +346,6 @@ class AstrohackImageFile(dict):
|
|
|
343
346
|
Produce plots from ``astrohack.holog`` results for analysis
|
|
344
347
|
"""
|
|
345
348
|
parm_dict = locals()
|
|
346
|
-
parm_dict['ant'] = ant_id
|
|
347
349
|
|
|
348
350
|
function_name = inspect.stack()[CURRENT_FUNCTION].function
|
|
349
351
|
parms_passed = _check_parms(function_name, parm_dict, 'ant', [str, list], list_acceptable_data_types=[str],
|
|
@@ -438,29 +440,29 @@ class AstrohackHologFile(dict):
|
|
|
438
440
|
_print_data_contents(self, ["DDI", "Map", "Antenna"])
|
|
439
441
|
_print_method_list([self.summary, self.select, self.plot_diagnostics])
|
|
440
442
|
|
|
441
|
-
def select(self, ddi=None, map_id=None,
|
|
443
|
+
def select(self, ddi=None, map_id=None, ant=None):
|
|
442
444
|
""" Select data on the basis of ddi, scan, ant. This is a convenience function.
|
|
443
445
|
|
|
444
446
|
:param ddi: Data description ID, ex. 0.
|
|
445
447
|
:type ddi: int
|
|
446
448
|
:param map_id: Mapping ID, ex. 0.
|
|
447
449
|
:type map_id: int
|
|
448
|
-
:param
|
|
449
|
-
:type
|
|
450
|
+
:param ant: Antenna ID, ex. ea25.
|
|
451
|
+
:type ant: str
|
|
450
452
|
|
|
451
453
|
:return: Corresponding xarray dataset, or self if selection is None
|
|
452
454
|
:rtype: xarray.Dataset or AstrohackHologFile
|
|
453
455
|
"""
|
|
454
456
|
logger = _get_astrohack_logger()
|
|
455
|
-
|
|
457
|
+
ant = 'ant_' + ant
|
|
456
458
|
ddi = f'ddi_{ddi}'
|
|
457
459
|
map_id = f'map_{map_id}'
|
|
458
460
|
|
|
459
|
-
if
|
|
461
|
+
if ant is None or ddi is None or map_id is None:
|
|
460
462
|
logger.info("[select]: No selection made ...")
|
|
461
463
|
return self
|
|
462
464
|
else:
|
|
463
|
-
return self[ddi][map_id][
|
|
465
|
+
return self[ddi][map_id][ant]
|
|
464
466
|
|
|
465
467
|
@property
|
|
466
468
|
def meta_data(self):
|
|
@@ -472,7 +474,7 @@ class AstrohackHologFile(dict):
|
|
|
472
474
|
|
|
473
475
|
return self._meta_data
|
|
474
476
|
|
|
475
|
-
def plot_diagnostics(self, destination, delta=0.01,
|
|
477
|
+
def plot_diagnostics(self, destination, delta=0.01, ant=None, ddi=None, map_id=None, complex_split='polar',
|
|
476
478
|
display=False, figure_size=None, dpi=300, parallel=False):
|
|
477
479
|
""" Plot diagnostic calibration plots from the holography data file.
|
|
478
480
|
|
|
@@ -480,8 +482,8 @@ class AstrohackHologFile(dict):
|
|
|
480
482
|
:type destination: str
|
|
481
483
|
:param delta: Defines a fraction of cell_size around which to look for peaks., defaults to 0.01
|
|
482
484
|
:type delta: float, optional
|
|
483
|
-
:param
|
|
484
|
-
:type
|
|
485
|
+
:param ant: antenna ID to use in subselection, defaults to "all" when None, ex. ea25
|
|
486
|
+
:type ant: list or str, optional
|
|
485
487
|
:param ddi: data description ID to use in subselection, defaults to "all" when None, ex. 0
|
|
486
488
|
:type ddi: list or int, optional
|
|
487
489
|
:param map_id: map ID to use in subselection. This relates to which antenna are in the mapping vs. scanning \
|
|
@@ -519,7 +521,6 @@ class AstrohackHologFile(dict):
|
|
|
519
521
|
logger = _get_astrohack_logger()
|
|
520
522
|
|
|
521
523
|
parm_dict = locals()
|
|
522
|
-
parm_dict['ant'] = ant_id
|
|
523
524
|
if parallel:
|
|
524
525
|
if not distributed.client._get_global_client():
|
|
525
526
|
try:
|
|
@@ -626,31 +627,31 @@ class AstrohackPanelFile(dict):
|
|
|
626
627
|
_print_method_list([self.summary, self.get_antenna, self.export_screws, self.export_to_fits,
|
|
627
628
|
self.plot_antennas])
|
|
628
629
|
|
|
629
|
-
def get_antenna(self,
|
|
630
|
+
def get_antenna(self, ant, ddi):
|
|
630
631
|
""" Retrieve an AntennaSurface object for interaction
|
|
631
632
|
|
|
632
|
-
:param
|
|
633
|
-
:type
|
|
633
|
+
:param ant: Antenna to be retrieved, ex. ea25.
|
|
634
|
+
:type ant: str
|
|
634
635
|
:param ddi: DDI to be retrieved for ant_id, ex. 0
|
|
635
636
|
:type ddi: int
|
|
636
637
|
|
|
637
638
|
:return: AntennaSurface object describing for further interaction
|
|
638
639
|
:rtype: AntennaSurface
|
|
639
640
|
"""
|
|
640
|
-
|
|
641
|
+
ant = 'ant_' + ant
|
|
641
642
|
ddi = f'ddi_{ddi}'
|
|
642
|
-
xds = self[
|
|
643
|
+
xds = self[ant][ddi]
|
|
643
644
|
telescope = Telescope(xds.attrs['telescope_name'])
|
|
644
645
|
return AntennaSurface(xds, telescope, reread=True)
|
|
645
646
|
|
|
646
|
-
def export_screws(self, destination,
|
|
647
|
+
def export_screws(self, destination, ant=None, ddi=None, unit='mm', threshold=None, panel_labels=True,
|
|
647
648
|
display=False, colormap='RdBu_r', figure_size=None, dpi=300):
|
|
648
649
|
""" Export screw adjustments to text files and optionally plots.
|
|
649
650
|
|
|
650
651
|
:param destination: Name of the destination folder to contain exported screw adjustments
|
|
651
652
|
:type destination: str
|
|
652
|
-
:param
|
|
653
|
-
:type
|
|
653
|
+
:param ant: List of antennas/antenna to be exported, defaults to "all" when None, ex. ea25
|
|
654
|
+
:type ant: list or str, optional
|
|
654
655
|
:param ddi: List of ddis/ddi to be exported, defaults to "all" when None, ex. 0
|
|
655
656
|
:type ddi: list or int, optional
|
|
656
657
|
:param unit: Unit for screws adjustments, most length units supported, defaults to "mm"
|
|
@@ -676,7 +677,6 @@ class AstrohackPanelFile(dict):
|
|
|
676
677
|
|
|
677
678
|
"""
|
|
678
679
|
parm_dict = locals()
|
|
679
|
-
parm_dict['ant'] = ant_id
|
|
680
680
|
|
|
681
681
|
function_name = inspect.stack()[CURRENT_FUNCTION].function
|
|
682
682
|
parms_passed = _check_parms(function_name, parm_dict, 'ant', [str, list], list_acceptable_data_types=[str],
|
|
@@ -684,8 +684,8 @@ class AstrohackPanelFile(dict):
|
|
|
684
684
|
parms_passed = parms_passed and _check_parms(function_name, parm_dict, 'ddi', [int, list],
|
|
685
685
|
list_acceptable_data_types=[int], default='all')
|
|
686
686
|
parms_passed = parms_passed and _check_parms(function_name, parm_dict, 'destination', [str], default=None)
|
|
687
|
-
parms_passed = parms_passed and _check_parms(function_name, parm_dict, 'unit', [str],
|
|
688
|
-
default='mm')
|
|
687
|
+
parms_passed = parms_passed and _check_parms(function_name, parm_dict, 'unit', [str],
|
|
688
|
+
acceptable_data=length_units, default='mm')
|
|
689
689
|
parms_passed = parms_passed and _check_parms(function_name, parm_dict, 'threshold', [int, float], default='None')
|
|
690
690
|
parms_passed = parms_passed and _check_parms(function_name, parm_dict, 'panel_labels', [bool], default=True)
|
|
691
691
|
parms_passed = parms_passed and _check_parms(function_name, parm_dict, 'display', [bool], default=True)
|
|
@@ -700,21 +700,24 @@ class AstrohackPanelFile(dict):
|
|
|
700
700
|
_create_destination_folder(parm_dict['destination'])
|
|
701
701
|
_dask_general_compute(function_name, self, _export_screws_chunk, parm_dict, ['ant', 'ddi'], parallel=False)
|
|
702
702
|
|
|
703
|
-
def plot_antennas(self, destination,
|
|
704
|
-
phase_unit='deg', phase_limits=None, deviation_unit='mm',
|
|
705
|
-
panel_labels=False, display=False, colormap='viridis', figure_size=None,
|
|
703
|
+
def plot_antennas(self, destination, ant=None, ddi=None, plot_type='deviation', plot_screws=False,
|
|
704
|
+
amplitude_limits=None, phase_unit='deg', phase_limits=None, deviation_unit='mm',
|
|
705
|
+
deviation_limits=None, panel_labels=False, display=False, colormap='viridis', figure_size=None,
|
|
706
|
+
dpi=300, parallel=False):
|
|
706
707
|
""" Create diagnostic plots of antenna surfaces from panel data file.
|
|
707
708
|
|
|
708
709
|
:param destination: Name of the destination folder to contain plots
|
|
709
710
|
:type destination: str
|
|
710
|
-
:param
|
|
711
|
-
:type
|
|
711
|
+
:param ant: List of antennas/antenna to be plotted, defaults to "all" when None, ex. ea25
|
|
712
|
+
:type ant: list or str, optional
|
|
712
713
|
:param ddi: List of ddis/ddi to be plotted, defaults to "all" when None, ex. 0
|
|
713
714
|
:type ddi: list or int, optional
|
|
714
715
|
:param plot_type: type of plot to be produced, deviation, phase, ancillary or all, default is deviation
|
|
715
716
|
:type plot_type: str, optional
|
|
716
717
|
:param plot_screws: Add screw positions to plot
|
|
717
718
|
:type plot_screws: bool, optional
|
|
719
|
+
:param amplitude_limits: Lower then Upper limit for amplitude in volts default is None (Guess from data)
|
|
720
|
+
:type amplitude_limits: numpy.ndarray, list, tuple, optional
|
|
718
721
|
:param phase_unit: Unit for phase plots, defaults is 'deg'
|
|
719
722
|
:type phase_unit: str, optional
|
|
720
723
|
:param phase_limits: Lower then Upper limit for phase, value in phase_unit, default is None (Guess from data)
|
|
@@ -755,7 +758,6 @@ class AstrohackPanelFile(dict):
|
|
|
755
758
|
"""
|
|
756
759
|
logger = _get_astrohack_logger()
|
|
757
760
|
parm_dict = locals()
|
|
758
|
-
parm_dict['ant'] = ant_id
|
|
759
761
|
|
|
760
762
|
function_name = inspect.stack()[CURRENT_FUNCTION].function
|
|
761
763
|
parms_passed = _check_parms(function_name, parm_dict, 'ant', [str, list], list_acceptable_data_types=[str],
|
|
@@ -765,6 +767,9 @@ class AstrohackPanelFile(dict):
|
|
|
765
767
|
parms_passed = parms_passed and _check_parms(function_name, parm_dict, 'destination', [str], default=None)
|
|
766
768
|
parms_passed = parms_passed and _check_parms(function_name, parm_dict, 'plot_type', [str], acceptable_data=plot_types,
|
|
767
769
|
default=plot_types[0])
|
|
770
|
+
parms_passed = parms_passed and _check_parms(function_name, parm_dict, 'amplitude_limits', [list, np.ndarray],
|
|
771
|
+
list_acceptable_data_types=[numbers.Number], list_len=2,
|
|
772
|
+
default='None', log_default_setting=False)
|
|
768
773
|
parms_passed = parms_passed and _check_parms(function_name, parm_dict, 'phase_unit', [str], acceptable_data=trigo_units,
|
|
769
774
|
default='deg')
|
|
770
775
|
parms_passed = parms_passed and _check_parms(function_name, parm_dict, 'phase_limits', [list, np.ndarray],
|
|
@@ -790,13 +795,13 @@ class AstrohackPanelFile(dict):
|
|
|
790
795
|
_create_destination_folder(parm_dict['destination'])
|
|
791
796
|
_dask_general_compute(function_name, self, _plot_antenna_chunk, parm_dict, ['ant', 'ddi'], parallel=parallel)
|
|
792
797
|
|
|
793
|
-
def export_to_fits(self, destination,
|
|
798
|
+
def export_to_fits(self, destination, ant=None, ddi=None, parallel=False):
|
|
794
799
|
""" Export contents of an Astrohack MDS file to several FITS files in the destination folder
|
|
795
800
|
|
|
796
801
|
:param destination: Name of the destination folder to contain plots
|
|
797
802
|
:type destination: str
|
|
798
|
-
:param
|
|
799
|
-
:type
|
|
803
|
+
:param ant: List of antennas/antenna to be plotted, defaults to "all" when None, ex. ea25
|
|
804
|
+
:type ant: list or str, optional
|
|
800
805
|
:param ddi: List of ddis/ddi to be plotted, defaults to "all" when None, ex. 0
|
|
801
806
|
:type ddi: list or int, optional
|
|
802
807
|
:param parallel: If True will use an existing astrohack client to export FITS in parallel, default is False
|
|
@@ -810,10 +815,7 @@ class AstrohackPanelFile(dict):
|
|
|
810
815
|
The FITS fils produced by this method have been tested and are known to work with CARTA and DS9
|
|
811
816
|
"""
|
|
812
817
|
|
|
813
|
-
parm_dict =
|
|
814
|
-
'ddi': ddi,
|
|
815
|
-
'destination': destination,
|
|
816
|
-
'parallel': parallel}
|
|
818
|
+
parm_dict = locals()
|
|
817
819
|
|
|
818
820
|
function_name = inspect.stack()[CURRENT_FUNCTION].function
|
|
819
821
|
parms_passed = _check_parms(function_name, parm_dict, 'ant', [str, list], list_acceptable_data_types=[str],
|
|
@@ -825,7 +827,8 @@ class AstrohackPanelFile(dict):
|
|
|
825
827
|
|
|
826
828
|
_parm_check_passed(function_name, parms_passed)
|
|
827
829
|
_create_destination_folder(parm_dict['destination'])
|
|
828
|
-
_dask_general_compute(function_name, self, _export_to_fits_panel_chunk, parm_dict, ['ant', 'ddi'],
|
|
830
|
+
_dask_general_compute(function_name, self, _export_to_fits_panel_chunk, parm_dict, ['ant', 'ddi'],
|
|
831
|
+
parallel=parallel)
|
|
829
832
|
|
|
830
833
|
|
|
831
834
|
class AstrohackPointFile(dict):
|
|
@@ -1162,14 +1165,14 @@ class AstrohackPositionFile(dict):
|
|
|
1162
1165
|
|
|
1163
1166
|
return self._file_is_open
|
|
1164
1167
|
|
|
1165
|
-
def export_fit_results(self, destination,
|
|
1168
|
+
def export_fit_results(self, destination, ant=None, ddi=None, position_unit='m', time_unit='hour',
|
|
1166
1169
|
delay_unit='nsec'):
|
|
1167
1170
|
""" Export antenna position fit results to a text file.
|
|
1168
1171
|
|
|
1169
1172
|
:param destination: Name of the destination folder to contain exported fit results
|
|
1170
1173
|
:type destination: str
|
|
1171
|
-
:param
|
|
1172
|
-
:type
|
|
1174
|
+
:param ant: List of antennas/antenna to be exported, defaults to "all" when None, ex. ea25
|
|
1175
|
+
:type ant: list or str, optional
|
|
1173
1176
|
:param ddi: List of ddis/ddi to be exported, defaults to "all" when None, ex. 0
|
|
1174
1177
|
:type ddi: list or int, optional
|
|
1175
1178
|
:param position_unit: Unit to list position fit results, defaults to 'm'
|
|
@@ -1185,7 +1188,6 @@ class AstrohackPositionFile(dict):
|
|
|
1185
1188
|
"""
|
|
1186
1189
|
|
|
1187
1190
|
parm_dict = locals()
|
|
1188
|
-
parm_dict['ant'] = ant_id
|
|
1189
1191
|
function_name = inspect.stack()[CURRENT_FUNCTION].function
|
|
1190
1192
|
parms_passed = _check_parms(function_name, parm_dict, 'ant', [str, list],
|
|
1191
1193
|
list_acceptable_data_types=[str], default='all')
|
|
@@ -1204,14 +1206,14 @@ class AstrohackPositionFile(dict):
|
|
|
1204
1206
|
parm_dict['combined'] = self.combined
|
|
1205
1207
|
_export_fit_results(self, parm_dict)
|
|
1206
1208
|
|
|
1207
|
-
def plot_sky_coverage(self, destination,
|
|
1209
|
+
def plot_sky_coverage(self, destination, ant=None, ddi=None, time_unit='hour', angle_unit='deg', display=False,
|
|
1208
1210
|
figure_size=None, dpi=300, parallel=False):
|
|
1209
1211
|
""" Plot the sky coverage of the data used for antenna position fitting
|
|
1210
1212
|
|
|
1211
1213
|
:param destination: Name of the destination folder to contain the plots
|
|
1212
1214
|
:type destination: str
|
|
1213
|
-
:param
|
|
1214
|
-
:type
|
|
1215
|
+
:param ant: List of antennas/antenna to be plotted, defaults to "all" when None, ex. ea25
|
|
1216
|
+
:type ant: list or str, optional
|
|
1215
1217
|
:param ddi: List of ddis/ddi to be plotted, defaults to "all" when None, ex. 0
|
|
1216
1218
|
:type ddi: list or int, optional
|
|
1217
1219
|
:param angle_unit: Unit for angle in plots, defaults to 'deg'
|
|
@@ -1240,7 +1242,7 @@ class AstrohackPositionFile(dict):
|
|
|
1240
1242
|
"""
|
|
1241
1243
|
|
|
1242
1244
|
parm_dict = locals()
|
|
1243
|
-
|
|
1245
|
+
|
|
1244
1246
|
function_name = inspect.stack()[CURRENT_FUNCTION].function
|
|
1245
1247
|
parms_passed = _check_parms(function_name, parm_dict, 'ant', [str, list],
|
|
1246
1248
|
list_acceptable_data_types=[str], default='all')
|
|
@@ -1268,14 +1270,14 @@ class AstrohackPositionFile(dict):
|
|
|
1268
1270
|
else:
|
|
1269
1271
|
_dask_general_compute(function_name, self, _plot_sky_coverage_chunk, parm_dict, ['ant', 'ddi'], parallel=parallel)
|
|
1270
1272
|
|
|
1271
|
-
def plot_delays(self, destination,
|
|
1273
|
+
def plot_delays(self, destination, ant=None, ddi=None, time_unit='hour', angle_unit='deg', delay_unit='nsec',
|
|
1272
1274
|
plot_model=True, display=False, figure_size=None, dpi=300, parallel=False):
|
|
1273
1275
|
""" Plot the delays used for antenna position fitting and optionally the resulting fit.
|
|
1274
1276
|
|
|
1275
1277
|
:param destination: Name of the destination folder to contain the plots
|
|
1276
1278
|
:type destination: str
|
|
1277
|
-
:param
|
|
1278
|
-
:type
|
|
1279
|
+
:param ant: List of antennas/antenna to be plotted, defaults to "all" when None, ex. ea25
|
|
1280
|
+
:type ant: list or str, optional
|
|
1279
1281
|
:param ddi: List of ddis/ddi to be plotted, defaults to "all" when None, ex. 0
|
|
1280
1282
|
:type ddi: list or int, optional
|
|
1281
1283
|
:param angle_unit: Unit for angle in plots, defaults to 'deg'
|
|
@@ -1309,7 +1311,6 @@ class AstrohackPositionFile(dict):
|
|
|
1309
1311
|
"""
|
|
1310
1312
|
|
|
1311
1313
|
parm_dict = locals()
|
|
1312
|
-
parm_dict['ant'] = ant_id
|
|
1313
1314
|
|
|
1314
1315
|
function_name = inspect.stack()[CURRENT_FUNCTION].function
|
|
1315
1316
|
parms_passed = _check_parms(function_name, parm_dict, 'ant', [str, list],
|
|
@@ -1343,14 +1344,14 @@ class AstrohackPositionFile(dict):
|
|
|
1343
1344
|
else:
|
|
1344
1345
|
_dask_general_compute(function_name, self, _plot_delays_chunk, parm_dict, ['ant', 'ddi'], parallel=parallel)
|
|
1345
1346
|
|
|
1346
|
-
def plot_position_corrections(self, destination,
|
|
1347
|
+
def plot_position_corrections(self, destination, ant=None, ddi=None, unit='km', box_size=5, scaling=250,
|
|
1347
1348
|
display=False, figure_size=None, dpi=300):
|
|
1348
1349
|
""" Plot Antenna position corrections on an array configuration plot
|
|
1349
1350
|
|
|
1350
1351
|
:param destination: Name of the destination folder to contain plot
|
|
1351
1352
|
:type destination: str
|
|
1352
|
-
:param
|
|
1353
|
-
:type
|
|
1353
|
+
:param ant: Select which antennas are to be plotted, defaults to all when None, ex. ea25
|
|
1354
|
+
:type ant: list or str, optional
|
|
1354
1355
|
:param ddi: List of ddis/ddi to be plotted, defaults to "all" when None, ex. 0
|
|
1355
1356
|
:type ddi: list or int, optional
|
|
1356
1357
|
:param unit: Unit for the plot, valid values are length units, default is km
|
|
@@ -1377,7 +1378,6 @@ class AstrohackPositionFile(dict):
|
|
|
1377
1378
|
"""
|
|
1378
1379
|
|
|
1379
1380
|
parm_dict = locals()
|
|
1380
|
-
parm_dict['ant'] = ant_id
|
|
1381
1381
|
|
|
1382
1382
|
function_name = inspect.stack()[CURRENT_FUNCTION].function
|
|
1383
1383
|
parms_passed = _check_parms(function_name, parm_dict, 'destination', [str], default=None)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import numbers
|
|
2
1
|
import os
|
|
3
2
|
import shutil
|
|
4
3
|
|
|
@@ -13,8 +12,8 @@ from astrohack._utils._dask_graph_tools import _dask_general_compute
|
|
|
13
12
|
from astrohack.mds import AstrohackPanelFile, AstrohackImageFile
|
|
14
13
|
|
|
15
14
|
|
|
16
|
-
def panel(image_name, panel_name=None, clip_type='sigma', clip_level=3, panel_model=None, panel_margins=0.05,
|
|
17
|
-
parallel=False, overwrite=False):
|
|
15
|
+
def panel(image_name, panel_name=None, clip_type='sigma', clip_level=3, panel_model=None, panel_margins=0.05, ant=None,
|
|
16
|
+
ddi=None, parallel=False, overwrite=False):
|
|
18
17
|
"""Analyze holography images to derive panel adjustments
|
|
19
18
|
|
|
20
19
|
:param image_name: Input holography data file name. Accepted data formats are the output from ``astrohack.holog.holog`` and AIPS holography data prepackaged using ``astrohack.panel.aips_holog_to_astrohack``.
|
|
@@ -29,8 +28,8 @@ def panel(image_name, panel_name=None, clip_type='sigma', clip_level=3, panel_mo
|
|
|
29
28
|
:type panel_model: str, optional
|
|
30
29
|
:param panel_margins: Relative margin from the edge of the panel used to decide which points are margin points or internal points of each panel. Defaults to 0.05.
|
|
31
30
|
:type panel_margins: float, optional
|
|
32
|
-
:param
|
|
33
|
-
:type
|
|
31
|
+
:param ant: List of antennas/antenna to be processed, defaults to "all" when None, ex. ea25
|
|
32
|
+
:type ant: list or str, optional
|
|
34
33
|
:param ddi: List of ddis/ddi to be processed, defaults to "all" when None, ex. 0
|
|
35
34
|
:type ddi: list or int, optional
|
|
36
35
|
:param parallel: Run in parallel. Defaults to False.
|
|
@@ -111,7 +110,7 @@ def panel(image_name, panel_name=None, clip_type='sigma', clip_level=3, panel_mo
|
|
|
111
110
|
"""
|
|
112
111
|
|
|
113
112
|
panel_params = locals()
|
|
114
|
-
panel_params['ant'] =
|
|
113
|
+
panel_params['ant'] = ant
|
|
115
114
|
logger = _get_astrohack_logger()
|
|
116
115
|
fname = 'panel'
|
|
117
116
|
panel_params = _check_panel_parms(fname, panel_params)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: astrohack
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.3
|
|
4
4
|
Summary: Holography Antenna Commissioning Kit
|
|
5
5
|
Author-email: Jan-Willem Steeb <jsteeb@nrao.edu>, Joshua Hoskins <jhoskins@nrao.edu>, Victor de Souza Magalhaes <vdesouza@nrao.edu>
|
|
6
6
|
Requires-Python: <3.12,>=3.8
|
astrohack-0.3.2/pyproject.toml
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
[project]
|
|
2
|
-
name = "astrohack"
|
|
3
|
-
version = "0.3.2"
|
|
4
|
-
description = "Holography Antenna Commissioning Kit"
|
|
5
|
-
authors = [
|
|
6
|
-
{name = "Jan-Willem Steeb", email="jsteeb@nrao.edu"},
|
|
7
|
-
{name = "Joshua Hoskins", email="jhoskins@nrao.edu"},
|
|
8
|
-
{name = "Victor de Souza Magalhaes", email="vdesouza@nrao.edu"}
|
|
9
|
-
]
|
|
10
|
-
license = {file = "LICENSE.txt"}
|
|
11
|
-
readme = "README.md"
|
|
12
|
-
requires-python = ">= 3.8, < 3.12"
|
|
13
|
-
|
|
14
|
-
dependencies = [
|
|
15
|
-
'astropy',
|
|
16
|
-
'dask',
|
|
17
|
-
'distributed',
|
|
18
|
-
'gdown',
|
|
19
|
-
'matplotlib',
|
|
20
|
-
'memory_profiler',
|
|
21
|
-
'numba>=0.57.0',
|
|
22
|
-
'numpy',
|
|
23
|
-
'prettytable',
|
|
24
|
-
'pytest',
|
|
25
|
-
'pytest-cov',
|
|
26
|
-
'pytest-html',
|
|
27
|
-
'scikit_image',
|
|
28
|
-
'scipy',
|
|
29
|
-
'xarray',
|
|
30
|
-
'zarr',
|
|
31
|
-
'bokeh',
|
|
32
|
-
'jupyterlab',
|
|
33
|
-
'python_casacore>=3.5.2; sys_platform != "darwin" '
|
|
34
|
-
]
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
[project.optional-dependencies]
|
|
38
|
-
docs = [
|
|
39
|
-
'ipykernel',
|
|
40
|
-
'ipympl',
|
|
41
|
-
'ipython',
|
|
42
|
-
'jupyter-client',
|
|
43
|
-
'nbsphinx',
|
|
44
|
-
'recommonmark',
|
|
45
|
-
'scanpydoc',
|
|
46
|
-
'sphinx-autoapi',
|
|
47
|
-
'sphinx-autosummary-accessors',
|
|
48
|
-
'sphinx_rtd_theme',
|
|
49
|
-
'twine',
|
|
50
|
-
'pandoc'
|
|
51
|
-
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/_utils/_dask_plugins/_astrohack_scheduler.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{astrohack-0.3.2 → astrohack-0.3.3}/src/astrohack/_utils/_param_utils/_check_logger_parms.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|