Go to the documentation of this file.00001 import sys
00002 import inspect
00003
00004 from asap.parameters import rcParams
00005 from asap.scantable import scantable
00006
00007
00008
00009
00010
00011
00012 def version():
00013 print "ASAP %s(%s)"% (__version__, __date__)
00014
00015 def list_scans(t = scantable):
00016 print "The user created scantables are: ",
00017 globs=inspect.currentframe().f_back.f_locals.copy()
00018 out = [ k for k,v in globs.iteritems() \
00019 if isinstance(v, scantable) and not k.startswith("_") ]
00020 print out
00021 return out
00022
00023 def commands():
00024 x = """\
00025 [The scan container]
00026 scantable - a container for integrations/scans
00027 (can open asap/rpfits/sdfits and ms files)
00028 copy - returns a copy of a scan
00029 get_scan - gets a specific scan out of a scantable
00030 (by name or number)
00031 drop_scan - drops a specific scan out of a scantable
00032 (by number)
00033 set_selection - set a new subselection of the data
00034 get_selection - get the current selection object
00035 summary - print info about the scantable contents
00036 stats - get specified statistic of the spectra in
00037 the scantable
00038 stddev - get the standard deviation of the spectra
00039 in the scantable
00040 get_tsys - get the TSys
00041 get_time - get the timestamps of the integrations
00042 get_inttime - get the integration time
00043 get_sourcename - get the source names of the scans
00044 get_azimuth - get the azimuth of the scans
00045 get_elevation - get the elevation of the scans
00046 get_parangle - get the parallactic angle of the scans
00047 get_coordinate - get the spectral coordinate for the given row,
00048 which can be used for coordinate conversions
00049 get_weather - get the weather condition parameters
00050 get_unit - get the current unit
00051 set_unit - set the abcissa unit to be used from this
00052 point on
00053 get_abcissa - get the abcissa values and name for a given
00054 row (time)
00055 get_column_names - get the names of the columns in the scantable
00056 for use with selector.set_query
00057 set_freqframe - set the frame info for the Spectral Axis
00058 (e.g. 'LSRK')
00059 set_doppler - set the doppler to be used from this point on
00060 set_dirframe - set the frame for the direction on the sky
00061 set_instrument - set the instrument name
00062 set_feedtype - set the feed type
00063 get_fluxunit - get the brightness flux unit
00064 set_fluxunit - set the brightness flux unit
00065 set_sourcetype - set the type of the source - source or reference
00066 create_mask - return an mask in the current unit
00067 for the given region. The specified regions
00068 are NOT masked
00069 get_restfreqs - get the current list of rest frequencies
00070 set_restfreqs - set a list of rest frequencies
00071 shift_refpix - shift the reference pixel of the IFs
00072 set_spectrum - overwrite the spectrum for a given row
00073 get_spectrum - retrieve the spectrum for a given
00074 get_mask - retrieve the mask for a given
00075 flag - flag selected channels in the data
00076 lag_flag - flag specified frequency in the data
00077 save - save the scantable to disk as either 'ASAP',
00078 'SDFITS' or 'ASCII'
00079 nbeam,nif,nchan,npol - the number of beams/IFs/Pols/Chans
00080 nscan - the number of scans in the scantable
00081 nrow - the number of spectra in the scantable
00082 history - print the history of the scantable
00083 get_fit - get a fit which has been stored witnh the data
00084 average_time - return the (weighted) time average of a scan
00085 or a list of scans
00086 average_pol - average the polarisations together.
00087 average_beam - average the beams together.
00088 convert_pol - convert to a different polarisation type
00089 auto_quotient - return the on/off quotient with
00090 automatic detection of the on/off scans (closest
00091 in time off is selected)
00092 mx_quotient - Form a quotient using MX data (off beams)
00093 scale, *, / - return a scan scaled by a given factor
00094 add, + - return a scan with given value added
00095 sub, - - return a scan with given value subtracted
00096 bin - return a scan with binned channels
00097 resample - return a scan with resampled channels
00098 smooth - return the spectrally smoothed scan
00099 reshape - cut out channel range
00100 poly_baseline - fit a polynomial baseline to all Beams/IFs/Pols
00101 auto_poly_baseline - automatically fit a polynomial baseline
00102 recalc_azel - recalculate azimuth and elevation based on
00103 the pointing
00104 gain_el - apply gain-elevation correction
00105 opacity - apply opacity correction
00106 convert_flux - convert to and from Jy and Kelvin brightness
00107 units
00108 freq_align - align spectra in frequency frame
00109 invert_phase - Invert the phase of the cross-correlation
00110 swap_linears - Swap XX and YY (or RR LL)
00111 rotate_xyphase - rotate XY phase of cross correlation
00112 rotate_linpolphase - rotate the phase of the complex
00113 polarization O=Q+iU correlation
00114 freq_switch - perform frequency switching on the data
00115 stats - Determine the specified statistic, e.g. 'min'
00116 'max', 'rms' etc.
00117 stddev - Determine the standard deviation of the current
00118 beam/if/pol
00119 get_row_selector - get the selection object for a specified row
00120 number
00121 [Selection]
00122 selector - a selection object to set a subset of a scantable
00123 set_scans - set (a list of) scans by index
00124 set_cycles - set (a list of) cycles by index
00125 set_beams - set (a list of) beamss by index
00126 set_ifs - set (a list of) ifs by index
00127 set_polarisations - set (a list of) polarisations by name
00128 or by index
00129 set_names - set a selection by name (wildcards allowed)
00130 set_tsys - set a selection by tsys thresholds
00131 set_query - set a selection by SQL-like query, e.g. BEAMNO==1
00132 ( also get_ functions for all these )
00133 reset - unset all selections
00134 + - merge two selections
00135
00136 [Math] Mainly functions which operate on more than one scantable
00137
00138 average_time - return the (weighted) time average
00139 of a list of scans
00140 quotient - return the on/off quotient
00141 simple_math - simple mathematical operations on two scantables,
00142 'add', 'sub', 'mul', 'div'
00143 quotient - build quotient of the given on and off scans
00144 (matched pairs and 1 off - n on are valid)
00145 merge - merge a list of scantables
00146
00147 [Line Catalog]
00148 linecatalog - a linecatalog wrapper, taking an ASCII or
00149 internal format table
00150 summary - print a summary of the current selection
00151 set_name - select a subset by name pattern, e.g. '*OH*'
00152 set_strength_limits - select a subset by line strength limits
00153 set_frequency_limits - select a subset by frequency limits
00154 reset - unset all selections
00155 save - save the current subset to a table (internal
00156 format)
00157 get_row - get the name and frequency from a specific
00158 row in the table
00159 [Fitting]
00160 fitter
00161 auto_fit - return a scan where the function is
00162 applied to all Beams/IFs/Pols.
00163 commit - return a new scan where the fits have been
00164 commited.
00165 fit - execute the actual fitting process
00166 store_fit - store the fit parameters in the data (scantable)
00167 get_chi2 - get the Chi^2
00168 set_scan - set the scantable to be fit
00169 set_function - set the fitting function
00170 set_parameters - set the parameters for the function(s), and
00171 set if they should be held fixed during fitting
00172 set_gauss_parameters - same as above but specialised for individual
00173 gaussian components
00174 get_parameters - get the fitted parameters
00175 plot - plot the resulting fit and/or components and
00176 residual
00177 [Plotter]
00178 asapplotter - a plotter for asap, default plotter is
00179 called 'plotter'
00180 plot - plot a scantable
00181 plot_lines - plot a linecatalog overlay
00182 plotazel - plot azimuth and elevation versus time
00183 plotpointing - plot telescope pointings
00184 save - save the plot to a file ('png' ,'ps' or 'eps')
00185 set_mode - set the state of the plotter, i.e.
00186 what is to be plotted 'colour stacked'
00187 and what 'panelled'
00188 set_selection - only plot a selected part of the data
00189 set_range - set a 'zoom' window [xmin,xmax,ymin,ymax]
00190 set_legend - specify user labels for the legend indeces
00191 set_title - specify user labels for the panel indeces
00192 set_abcissa - specify a user label for the abcissa
00193 set_ordinate - specify a user label for the ordinate
00194 set_layout - specify the multi-panel layout (rows,cols)
00195 set_colors - specify a set of colours to use
00196 set_linestyles - specify a set of linestyles to use if only
00197 using one color
00198 set_font - set general font properties, e.g. 'family'
00199 set_histogram - plot in historam style
00200 set_mask - set a plotting mask for a specific polarization
00201 text - draw text annotations either in data or relative
00202 coordinates
00203 arrow - draw arrow annotations either in data or relative
00204 coordinates
00205 axhline,axvline - draw horizontal/vertical lines
00206 axhspan,axvspan - draw horizontal/vertical regions
00207 annotate - draw an arrow with label
00208 create_mask - create a scnatble mask interactively
00209
00210 xyplotter - matplotlib/pylab plotting functions
00211
00212 [General]
00213 commands - this command
00214 print - print details about a variable
00215 list_scans - list all scantables created by the user
00216 list_files - list all files readable by asap (default rpf)
00217 del - delete the given variable from memory
00218 range - create a list of values, e.g.
00219 range(3) = [0,1,2], range(2,5) = [2,3,4]
00220 help - print help for one of the listed functions
00221 execfile - execute an asap script, e.g. execfile('myscript')
00222 list_rcparameters - print out a list of possible values to be
00223 put into $HOME/.asaprc
00224 rc - set rc parameters from within asap
00225 mask_and,mask_or,
00226 mask_not - boolean operations on masks created with
00227 scantable.create_mask
00228 skydip - gain opacity values from a sky dip observation
00229 opacity_model - compute opacities fro given frequencies based on
00230 atmospheric model
00231
00232 Note:
00233 How to use this with help:
00234 # function 'summary'
00235 [xxx] is just a category
00236 Every 'sub-level' in this list should be replaces by a '.' Period when
00237 using help
00238 Example:
00239 ASAP> help scantable # to get info on ths scantable
00240 ASAP> help scantable.summary # to get help on the scantable's
00241 ASAP> help average_time
00242
00243 """
00244 if rcParams['verbose']:
00245 try:
00246 from IPython.genutils import page as pager
00247 except ImportError:
00248 from pydoc import pager
00249 pager(x)
00250 else:
00251 print x
00252 return