Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatasks/predictcomp.py: 56%

27 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-10-31 19:10 +0000

1##################### generated by xml-casa (v2) from predictcomp.xml ############### 

2##################### 72a05d658fe103e7f240bb1a6f564f30 ############################## 

3from __future__ import absolute_import 

4import numpy 

5from casatools.typecheck import CasaValidator as _val_ctor 

6_pc = _val_ctor( ) 

7from casatools.coercetype import coerce as _coerce 

8from casatools.errors import create_error_string 

9from .private.task_predictcomp import predictcomp as _predictcomp_t 

10from casatasks.private.task_logging import start_log as _start_log 

11from casatasks.private.task_logging import end_log as _end_log 

12from casatasks.private.task_logging import except_log as _except_log 

13 

14class _predictcomp: 

15 """ 

16 predictcomp ---- Make a component list for a known calibrator 

17 

18  

19 Writes a component list named clist to disk and returns a dict of 

20 {'clist': clist, 

21 'objname': objname, 

22 'standard': standard, 

23 'epoch': epoch, 

24 'freqs': pl.array of frequencies, in GHz, 

25 'antennalist': a simdata type configuration file, 

26 'amps': pl.array of predicted visibility amplitudes, in Jy, 

27 'savedfig': False or, if made, the filename of a plot.} 

28 or False on error. 

29  

30 

31 --------- parameter descriptions --------------------------------------------- 

32 

33 objname Object name 

34 standard Flux density standard 

35 epoch Epoch 

36 minfreq Minimum frequency 

37 maxfreq Maximum frequency 

38 nfreqs Number of frequencies 

39 prefix Prefix for the component list directory name. 

40 antennalist Plot for this configuration 

41 showplot Plot S vs \|u\| to the screen? 

42 savefig Save a plot of S vs \|u\| to this filename 

43 symb A matplotlib plot symbol code 

44 include0amp Force the amplitude axis to start at 0? 

45 include0bl Force the baseline axis to start at 0? 

46 blunit unit of the baseline axis 

47 showbl0flux Print the zero baseline flux ? 

48 RETURNS record 

49 

50 --------- examples ----------------------------------------------------------- 

51 

52  

53  

54 Writes a component list to disk and returns a dict of 

55 {'clist': filename of the component list, 

56 'objname': objname, 

57 'angdiam': angular diameter in radians (if used in clist), 

58 'standard': standard, 

59 'epoch': epoch, 

60 'freqs': pl.array of frequencies, in GHz, 

61 'antennalist': pl.array of baseline lengths, in m, 

62 'amps': pl.array of predicted visibility amplitudes, in Jy, 

63 'savedfig': False or, if made, the filename of a plot.} 

64 or False on error. 

65  

66 objname: An object supported by standard. 

67 standard: A standard for calculating flux densities, as in setjy. 

68 Default: 'Butler-JPL-Horizons 2010' 

69 epoch: The epoch to use for the calculations. Irrelevant for 

70 extrasolar standards. (Uses UTC) 

71 Examples: '2011-12-31/5:34:12', '2011-12-31-5:34:12' 

72 minfreq: The minimum frequency to use. 

73 Example: '342.0GHz' 

74 maxfreq: The maximum frequency to use. 

75 Default: minfreq 

76 Example: '346.0GHz' 

77 Example: '', anything <= 0, or None: use minfreq. 

78 nfreqs: The number of frequencies to use. 

79 Default: 1 if minfreq == maxfreq, 

80 2 otherwise. 

81 prefix: The component list will be saved to 

82 prefix + 'spw0_<objname>_<minfreq><epoch>.cl' 

83 Default: '' 

84 Example: "Bands3to7_" 

85 (which could produce 'Bands3to7_Uranus_spw0_100GHz55877d.cl', 

86 depending on the other parameters) 

87 antennalist: 'Observe' and plot the visibility amplitudes for this 

88 antenna configuration. The file should be in a format usable 

89 by simdata. The search path is: 

90 .:casa['dirs']['data'] + '/alma/simmos/' 

91 Default: '' (None, just make clist.) 

92 Example: 'alma.cycle0.extended.cfg' 

93  

94 Subparameters of antennalist: 

95 showplot: Whether or not to show a plot of S vs. |u| on screen. 

96 Subparameter of antennalist. 

97 Default: Necessarily False if antennalist is not specified. 

98 True otherwise. 

99 savefig: Filename for saving a plot of S vs. |u|. 

100 Subparameter of antennalist. 

101 Default: '' 

102 Examples: '' (do not save the plot) 

103 'myplot.png' (save to myplot.png) 

104 symb: One of matplotlib's codes for plot symbols: .:,o^v<>s+xDd234hH|_ 

105 Default: '.' 

106 include0amp: Force the amplitude axis to start at 0? 

107 Default: False 

108 include0bl: Force the baseline axis to start at 0? 

109 Default: False 

110 blunit: unit of the baseline axis ('' or 'klambda') 

111 Default:''=use a unit in the data 

112 showbl0flux: Print the zero baseline flux? 

113 Default: False 

114  

115  

116 

117 

118 """ 

119 

120 _info_group_ = """imaging, calibration""" 

121 _info_desc_ = """Make a component list for a known calibrator""" 

122 

123 def __call__( self, objname='', standard='Butler-JPL-Horizons 2010', epoch='', minfreq='', maxfreq='', nfreqs=int(2), prefix='', antennalist='', showplot=False, savefig='', symb='.', include0amp=False, include0bl=False, blunit='', showbl0flux=False ): 

124 schema = {'objname': {'type': 'cStr', 'coerce': _coerce.to_str}, 'standard': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'Perley-Taylor 95', 'Butler-JPL-Horizons 2010', 'Perley-Butler 2010', 'Perley-Taylor 99', 'Perley-Butler 2013', 'Perley 90', 'Butler-JPL-Horizons 2012', 'Perley-Butler 2017', 'Baars' ]}, 'epoch': {'type': 'cStr', 'coerce': _coerce.to_str}, 'minfreq': {'type': 'cStr', 'coerce': _coerce.to_str}, 'maxfreq': {'type': 'cStr', 'coerce': _coerce.to_str}, 'nfreqs': {'type': 'cInt'}, 'prefix': {'type': 'cPath', 'coerce': _coerce.expand_path}, 'antennalist': {'type': 'cStr', 'coerce': _coerce.to_str}, 'showplot': {'type': 'cBool'}, 'savefig': {'type': 'cStr', 'coerce': _coerce.to_str}, 'symb': {'type': 'cStr', 'coerce': _coerce.to_str}, 'include0amp': {'type': 'cBool'}, 'include0bl': {'type': 'cBool'}, 'blunit': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ '', 'klambda' ]}, 'showbl0flux': {'type': 'cBool'}} 

125 doc = {'objname': objname, 'standard': standard, 'epoch': epoch, 'minfreq': minfreq, 'maxfreq': maxfreq, 'nfreqs': nfreqs, 'prefix': prefix, 'antennalist': antennalist, 'showplot': showplot, 'savefig': savefig, 'symb': symb, 'include0amp': include0amp, 'include0bl': include0bl, 'blunit': blunit, 'showbl0flux': showbl0flux} 

126 assert _pc.validate(doc,schema), create_error_string(_pc.errors) 

127 _logging_state_ = _start_log( 'predictcomp', [ 'objname=' + repr(_pc.document['objname']), 'standard=' + repr(_pc.document['standard']), 'epoch=' + repr(_pc.document['epoch']), 'minfreq=' + repr(_pc.document['minfreq']), 'maxfreq=' + repr(_pc.document['maxfreq']), 'nfreqs=' + repr(_pc.document['nfreqs']), 'prefix=' + repr(_pc.document['prefix']), 'antennalist=' + repr(_pc.document['antennalist']), 'showplot=' + repr(_pc.document['showplot']), 'savefig=' + repr(_pc.document['savefig']), 'symb=' + repr(_pc.document['symb']), 'include0amp=' + repr(_pc.document['include0amp']), 'include0bl=' + repr(_pc.document['include0bl']), 'blunit=' + repr(_pc.document['blunit']), 'showbl0flux=' + repr(_pc.document['showbl0flux']) ] ) 

128 task_result = None 

129 try: 

130 task_result = _predictcomp_t( _pc.document['objname'], _pc.document['standard'], _pc.document['epoch'], _pc.document['minfreq'], _pc.document['maxfreq'], _pc.document['nfreqs'], _pc.document['prefix'], _pc.document['antennalist'], _pc.document['showplot'], _pc.document['savefig'], _pc.document['symb'], _pc.document['include0amp'], _pc.document['include0bl'], _pc.document['blunit'], _pc.document['showbl0flux'] ) 

131 except Exception as exc: 

132 _except_log('predictcomp', exc) 

133 raise 

134 finally: 

135 task_result = _end_log( _logging_state_, 'predictcomp', task_result ) 

136 return task_result 

137 

138predictcomp = _predictcomp( ) 

139