Skip to content

Commit fa31795

Browse files
authored
Merge pull request #355 from nrao/354-add-phase-to-beamcut-mds-and-also-a-function-to-plot-it
354 add phase to beamcut mds and also a function to plot it
2 parents 45e1b7e + 1b4219c commit fa31795

8 files changed

Lines changed: 528 additions & 340 deletions

File tree

docs/tutorials/beamcut_tutorial.ipynb

Lines changed: 188 additions & 331 deletions
Large diffs are not rendered by default.

src/astrohack/beamcut.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import pathlib
2+
import numpy as np
23

34
from toolviper.utils.parameter import validate
45

@@ -10,7 +11,7 @@
1011
from astrohack.io.dio import open_holog
1112
from astrohack.utils.validation import custom_plots_checker
1213

13-
from typing import Union, List
14+
from typing import Union, List, Tuple
1415

1516

1617
@validate(custom_checker=custom_plots_checker)
@@ -22,9 +23,11 @@ def beamcut(
2223
destination: str = None,
2324
lm_unit: str = "amin",
2425
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,
2529
dpi: int = 300,
2630
display: bool = False,
27-
y_scale: list[float] = None,
2831
parallel: bool = False,
2932
overwrite: bool = False,
3033
):
@@ -52,6 +55,12 @@ def beamcut(
5255
:param azel_unit: Unit for Az/El information in plots and report, default is "deg".
5356
:type azel_unit: str, optional
5457
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+
5564
:param dpi: Resolution in pixels, defaults to 300.
5665
:type dpi: int, optional
5766
@@ -152,6 +161,16 @@ def beamcut(
152161
dpi=dpi,
153162
parallel=parallel,
154163
)
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+
)
155174
beamcut_mds.plot_beam_cuts_over_sky(
156175
destination,
157176
lm_unit=lm_unit,

src/astrohack/config/beamcut.param.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@
3838
"type": ["string"],
3939
"check allowed with": "units.trig"
4040
},
41+
"phase_unit":{
42+
"nullable": false,
43+
"required": false,
44+
"type": ["string"],
45+
"check allowed with": "units.trig"
46+
},
4147
"dpi":{
4248
"nullable": false,
4349
"required": false,
@@ -65,6 +71,21 @@
6571
"ndarray"
6672
]
6773
},
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+
},
6889
"parallel":{
6990
"nullable": false,
7091
"required": false,

src/astrohack/config/beamcut_mds.param.json

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,88 @@
287287
"type": ["boolean"]
288288
}
289289
},
290+
"AstrohackBeamcutFile.plot_beamcut_in_phase":{
291+
"destination":{
292+
"nullable": false,
293+
"required": true,
294+
"type": ["string"]
295+
},
296+
"ant": {
297+
"nullable": false,
298+
"required": false,
299+
"struct_type": [
300+
"str"
301+
],
302+
"minlength": 1,
303+
"type": [
304+
"string",
305+
"list"
306+
]
307+
},
308+
"ddi": {
309+
"nullable": false,
310+
"required": false,
311+
"struct_type": [
312+
"int"
313+
],
314+
"minlength": 1,
315+
"type": [
316+
"int",
317+
"list",
318+
"string"
319+
]
320+
},
321+
"lm_unit":{
322+
"nullable": false,
323+
"required": false,
324+
"type": ["string"],
325+
"check allowed with": "units.trig"
326+
},
327+
"azel_unit":{
328+
"nullable": false,
329+
"required": false,
330+
"type": ["string"],
331+
"check allowed with": "units.trig"
332+
},
333+
"phase_unit":{
334+
"nullable": false,
335+
"required": false,
336+
"type": ["string"],
337+
"check allowed with": "units.trig"
338+
},
339+
"dpi":{
340+
"nullable": false,
341+
"required": false,
342+
"type": ["int"],
343+
"min": 1,
344+
"max": 1200
345+
},
346+
"display":{
347+
"nullable": false,
348+
"required": false,
349+
"type": ["boolean"]
350+
},
351+
"phase_scale":{
352+
"nullable": true,
353+
"required": false,
354+
"struct_type": [
355+
"float",
356+
"int"
357+
],
358+
"minlength": 2,
359+
"maxlength": 2,
360+
"type": [
361+
"list",
362+
"tuple",
363+
"ndarray"
364+
]
365+
},
366+
"parallel":{
367+
"nullable": false,
368+
"required": false,
369+
"type": ["boolean"]
370+
}
371+
},
290372
"AstrohackBeamcutFile.create_beam_fit_report":{
291373
"destination":{
292374
"nullable": false,

src/astrohack/io/base_mds.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ def summary(self) -> None:
204204
outstr += get_method_list_string(self)
205205
outstr += get_data_content_string(self.root)
206206
print(outstr)
207-
return outstr
208207

209208
@classmethod
210209
def create_from_input_parameters(cls, file_name: str, input_parameters: dict):

0 commit comments

Comments
 (0)