Changeset 242 for trunk/python
- Timestamp:
- 01/21/05 12:31:45 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/asapmath.py
r229 r242 50 50 return scantable(_quot(source, reference)) 51 51 52 def b_operate(left, right, op='add'): 53 """ 54 Apply simple mathematical binary operations to two 55 scan tables, returning the result in a new scan table. 56 The operation is applied to both the correlations and the TSys data 57 Parameters: 58 left: the 'left' scan 59 right: the 'right' scan 60 op: the operation: 'add' (default), 'sub', 'mul', 'div' 61 """ 62 from asap._asap import b_operate as _bop 63 return scantable(_bop(left, right, op)) 64 52 65 def scale(scan, factor, insitu=False, all=True): 53 66 """ … … 110 123 return 111 124 112 def gain_el(scan, filename="gainel.txt", method="linear", insitu=False, all=True): 113 """ 114 Return a scan after applying a gain-elevation correction via interpolation 115 (and extrapolation if necessary) from values in an ascii file. 116 Parameters: 117 scan: a scantable 118 filename: The name of the ASCII file holding the data. The first row 119 must give the column names. These MUST include columns 120 "ELEVATION" (degrees) and "FACTOR" (multiply data by this) somewhere. 125 def gain_el(scan, poly=None, filename="", method="linear", insitu=False, all=True): 126 """ 127 Return a scan after applying a gain-elevation correction. The correction 128 can be made via either a polynomial or a table-based interpolation 129 (and extrapolation if necessary). 130 You specify polynomial coefficients, an ascii table or neither. 131 If you specify neither, then a polynomial correction will be made 132 with built in coefficients known for certain telescopes (an error will 133 occur if the instrument is not known). 134 Parameters: 135 scan: a scantable 136 poly: Polynomial coefficients (default None) to compute a gain-elevation 137 correction as a function of elevation (in degrees). 138 filename: The name of an ascii file holding correction factors. 139 The first row of the ascii file must give the column 140 names and these MUST include columns 141 "ELEVATION" (degrees) and "FACTOR" (multiply data by this) somewhere. 121 142 The second row must give the data type of the column. Use 'R' for 122 143 Real and 'I' for Integer. An example file would be: 123 144 124 ELEVATION FACTOR125 R R 126 0 1.5127 20 1.4128 40 1.3129 60 1.2130 80 1.1131 90 1.0132 method: Interpolation method . "nearest", "linear" (default),133 "cubic" and "spline"145 TIME ELEVATION FACTOR 146 R R R 147 0.1 0 1.5 148 0.2 20 1.4 149 0.3 40 1.3 150 0.4 60 1.2 151 0.5 80 1.1 152 0.6 90 1.0 153 method: Interpolation method when correcting from a table. Values 154 are "nearest", "linear" (default), "cubic" and "spline" 134 155 insitu: if False (default) a new scantable is returned. 135 156 Otherwise, the conversion is done in-situ … … 137 158 apply only to the selected (beam/pol/if)spectra only 138 159 """ 160 if poly is None: 161 poly = () 139 162 if not insitu: 140 163 from asap._asap import gainel as _gainEl 141 return scantable(_gainEl(scan, filename, method, all))164 return scantable(_gainEl(scan, poly, filename, method, all)) 142 165 else: 143 166 from asap._asap import gainel_insitu as _gainEl 144 _gainEl(scan, filename, method, all) 167 _gainEl(scan, poly, filename, method, all) 168 return 169 170 def opacity(scan, tau, insitu=False, all=True): 171 """ 172 Return a scan after applying an opacity correction. 173 Parameters: 174 scan: a scantable 175 tau: Opacity from which the correction factor is exp(tau*ZD) 176 where ZD is the zenith-distance 177 insitu: if False (default) a new scantable is returned. 178 Otherwise, the conversion is done in-situ 179 all: if True (default) apply to all spectra. Otherwise 180 apply only to the selected (beam/pol/if)spectra only 181 """ 182 if not insitu: 183 from asap._asap import opacity as _opacity 184 return scantable(_opacity(scan, tau, all)) 185 else: 186 from asap._asap import opacity_insitu as _opacity 187 _opacity(scan, tau, all) 145 188 return 146 189
Note:
See TracChangeset
for help on using the changeset viewer.