Changeset 513 for trunk/python/__init__.py
- Timestamp:
- 02/28/05 15:28:33 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/__init__.py
r510 r513 5 5 import os,sys 6 6 7 def validate_bool(b):7 def _validate_bool(b): 8 8 'Convert b to a boolean or raise' 9 9 bl = b.lower() … … 13 13 raise ValueError('Could not convert "%s" to boolean' % b) 14 14 15 def validate_int(s):15 def _validate_int(s): 16 16 'convert s to int or raise' 17 17 try: return int(s) … … 19 19 raise ValueError('Could not convert "%s" to int' % s) 20 20 21 def asap_fname():21 def _asap_fname(): 22 22 """ 23 23 Return the path to the rc file … … 51 51 defaultParams = { 52 52 # general 53 'verbose' : [True, validate_bool],54 'useplotter' : [True, validate_bool],55 'insitu' : [False, validate_bool],53 'verbose' : [True, _validate_bool], 54 'useplotter' : [True, _validate_bool], 55 'insitu' : [False, _validate_bool], 56 56 57 57 # plotting … … 61 61 # scantable 62 62 'scantable.save' : ['ASAP', str], 63 'scantable.autoaverage' : [True, validate_bool],63 'scantable.autoaverage' : [True, _validate_bool], 64 64 'scantable.freqframe' : ['LSRK', str], #default frequency frame 65 'scantable.allaxes' : [True, validate_bool], # apply action to all axes66 'scantable.plotter' : [True, validate_bool], # use internal plotter67 'scantable.verbosesummary' : [False, validate_bool]65 'scantable.allaxes' : [True, _validate_bool], # apply action to all axes 66 'scantable.plotter' : [True, _validate_bool], # use internal plotter 67 'scantable.verbosesummary' : [False, _validate_bool] 68 68 69 69 # fitter … … 115 115 'Return the default params updated from the values in the rc file' 116 116 117 fname = asap_fname()117 fname = _asap_fname() 118 118 119 119 if fname is None or not os.path.exists(fname): … … 199 199 rcParams.update(rcParamsDefault) 200 200 201 202 def _is_sequence_or_number(param, ptype=int): 203 if isinstance(param,tuple) or isinstance(param,list): 204 out = True 205 for p in param: 206 out &= isinstance(p,ptype) 207 return out 208 elif isinstance(param, ptype): 209 return True 210 return False 211 201 212 from asapfitter import * 202 213 from asapreader import reader … … 221 232 222 233 __date__ = '$Date$' 223 __version__ = '0. 2'234 __version__ = '0.9' 224 235 225 236 def list_scans(t = scantable): … … 253 264 get_time - get the timestamps of the integrations 254 265 get_unit - get the currnt unit 255 set_unit - set the abcissa unit to be used from this point on 266 set_unit - set the abcissa unit to be used from this 267 point on 256 268 get_abcissa - get the abcissa values and name for a given 257 269 row (time) … … 273 285 nbeam,nif,nchan,npol - the number of beams/IFs/Pols/Chans 274 286 history - print the history of the scantable 275 [Math] 276 average_time- return the (weighted) time average of a scan277 or a list of scans278 average_pol- average the polarisations together.287 288 average_time - return the (weighted) time average of a scan 289 or a list of scans 290 average_pol - average the polarisations together. 279 291 The dimension won't be reduced and 280 292 all polarisations will contain the 281 293 averaged spectrum. 282 quotient - return the on/off quotient 283 simple_math - simple mathematical operations on two scantables, 294 quotient - return the on/off quotient 295 scale - return a scan scaled by a given factor 296 add - return a scan with given value added 297 bin - return a scan with binned channels 298 resample - return a scan with resampled channels 299 smooth - return the spectrally smoothed scan 300 poly_baseline - fit a polynomial baseline to all Beams/IFs/Pols 301 gain_el - apply gain-elevation correction 302 opacity - apply opacity correction 303 convert_flux - convert to and from Jy and Kelvin brightness 304 units 305 freq_align - align spectra in frequency frame 306 rotate_xyphase - rotate XY phase of cross correlation 307 rotate_linpolphase - rotate the phase of the complex 308 polarization O=Q+iU correlation 309 [Math] Mainly functions which operate on more than one scantable 310 311 average_time - return the (weighted) time average 312 of a list of scans 313 quotient - return the on/off quotient 314 simple_math - simple mathematical operations on two scantables, 284 315 'add', 'sub', 'mul', 'div' 285 scale - return a scan scaled by a given factor 286 add - return a scan with given value added 287 bin - return a scan with binned channels 288 resample - return a scan with resampled channels 289 smooth - return the spectrally smoothed scan 290 poly_baseline - fit a polynomial baseline to all Beams/IFs/Pols 291 auto_poly_baseline - automatically fit a polynomial baseline 292 gain_el - apply gain-elevation correction 293 opacity - apply opacity correction 294 convert_flux - convert to and from Jy and Kelvin brightness 295 units 296 freq_align - align spectra in frequency frame 297 rotate_xyphase - rotate XY phase of cross correlation 298 316 [Fitting] 299 317 fitter 300 318 auto_fit - return a scan where the function is … … 308 326 set_parameters - set the parameters for the function(s), and 309 327 set if they should be held fixed during fitting 328 set_gauss_parameters - same as above but specialised for individual 329 gaussian components 310 330 get_parameters - get the fitted parameters 331 plot - plot the resulting fit and/or components and 332 residual 311 333 [Plotter] 312 334 asapplotter - a plotter for asap, default plotter is
Note: See TracChangeset
for help on using the changeset viewer.