Inherits Scantable.
\ The ASAP container for scans (single-dish data).
Definition at line 175 of file scantable.py.
def asap.scantable.scantable.__init__ | ( | self, | |
filename, | |||
average = None , |
|||
unit = None , |
|||
parallactify = None , |
|||
args | |||
) |
\ Create a scantable from a saved one or make a reference Parameters: filename: the name of an asap table on disk or the name of a rpfits/sdfits/ms file (integrations within scans are auto averaged and the whole file is read) or [advanced] a reference to an existing scantable average: average all integrations withinb a scan on read. The default (True) is taken from .asaprc. unit: brightness unit; must be consistent with K or Jy. Over-rides the default selected by the filler (input rpfits/sdfits/ms) or replaces the value in existing scantables antenna: for MeasurementSet input data only: Antenna selection. integer (id) or string (name or id). parallactify: Indicate that the data had been parallactified. Default (false) is taken from rc file.
Definition at line 182 of file scantable.py.
def asap.scantable.scantable.__add__ | ( | self, | |
other | |||
) |
implicit on all axes and on Tsys
Definition at line 3839 of file scantable.py.
References asap.scantable.scantable.__op().
def asap.scantable.scantable.__div__ | ( | self, | |
other | |||
) |
implicit on all axes and on Tsys
Definition at line 3870 of file scantable.py.
References asap.scantable.scantable.__op().
def asap.scantable.scantable.__getitem__ | ( | self, | |
key | |||
) |
Definition at line 4067 of file scantable.py.
References tests.test_sdsave.sdsave_unittest_base.nrow, __casac__.ms.ms.nrow(), asap.asapgrid._SDGridPlotter.nrow, and tests.test_sdbaseline.BlparamFileParser.nrow().
def asap.scantable.scantable.__iter__ | ( | self | ) |
Definition at line 4087 of file scantable.py.
def asap.scantable.scantable.__len__ | ( | self | ) |
Definition at line 4084 of file scantable.py.
References tests.test_sdsave.sdsave_unittest_base.nrow, __casac__.ms.ms.nrow(), asap.asapgrid._SDGridPlotter.nrow, and tests.test_sdbaseline.BlparamFileParser.nrow().
def asap.scantable.scantable.__mul__ | ( | self, | |
other | |||
) |
implicit on all axes and on Tsys
Definition at line 3859 of file scantable.py.
References asap.scantable.scantable.__op().
def asap.scantable.scantable.__op | ( | self, | |
other, | |||
mode | |||
) | [private] |
Definition at line 3880 of file scantable.py.
References asap.asapmath._array2dOp().
Referenced by asap.scantable.scantable.__add__(), asap.scantable.scantable.__div__(), asap.scantable.scantable.__mul__(), and asap.scantable.scantable.__sub__().
def asap.scantable.scantable.__setitem__ | ( | self, | |
key, | |||
value | |||
) |
Definition at line 4074 of file scantable.py.
References tests.test_cleanhelper.cleanhelper_test.nchan, asap.sbseparator.sbseparator.nchan, task_sdimaging.sdimaging_worker.nchan, asap.asapgrid._SDGridPlotter.nchan, parameter_dictionary.par.nchan(), tests.test_sdsave.sdsave_unittest_base.nrow, __casac__.ms.ms.nrow(), asap.asapgrid._SDGridPlotter.nrow, and tests.test_sdbaseline.BlparamFileParser.nrow().
def asap.scantable.scantable.__str__ | ( | self | ) |
Definition at line 408 of file scantable.py.
def asap.scantable.scantable.__sub__ | ( | self, | |
other | |||
) |
implicit on all axes and on Tsys
Definition at line 3849 of file scantable.py.
References asap.scantable.scantable.__op().
def asap.scantable.scantable._add_history | ( | self, | |
funcname, | |||
parameters | |||
) | [private] |
Definition at line 3935 of file scantable.py.
References asap.scantable.scantable._zip_mask().
Referenced by asap.scantable.scantable.clip(), asap.scantable.scantable.flag(), asap.scantable.scantable.flag_row(), asap.scantable.scantable.invert_phase(), asap.scantable.scantable.recalc_azel(), asap.scantable.scantable.rotate_linpolphase(), asap.scantable.scantable.rotate_xyphase(), asap.scantable.scantable.set_dirframe(), asap.scantable.scantable.set_doppler(), asap.scantable.scantable.set_feedtype(), asap.scantable.scantable.set_freqframe(), asap.scantable.scantable.set_instrument(), asap.scantable.scantable.set_restfreqs(), asap.scantable.scantable.set_sourcetype(), asap.scantable.scantable.set_unit(), and asap.scantable.scantable.swap_linears().
def asap.scantable.scantable._append_blinfo | ( | self, | |
data_blpars, | |||
data_masklists, | |||
data_actualmask | |||
) | [private] |
\ Append baseline-fitting related info to blpars, masklist and actualmask.
Definition at line 3554 of file scantable.py.
def asap.scantable.scantable._check_ifs | ( | self | ) | [private] |
Definition at line 4001 of file scantable.py.
References tests.test_cleanhelper.cleanhelper_test.nchan, asap.sbseparator.sbseparator.nchan, task_sdimaging.sdimaging_worker.nchan, asap.asapgrid._SDGridPlotter.nchan, parameter_dictionary.par.nchan(), and irc_cs_task_regression.sum.
Referenced by asap.scantable.scantable.create_mask(), asap.scantable.scantable.get_masklist(), and asap.scantable.scantable.stats().
def asap.scantable.scantable._fill | ( | self, | |
names, | |||
unit, | |||
average, | |||
opts = {} |
|||
) | [private] |
Definition at line 4008 of file scantable.py.
References asap.env.is_casapy(), asap.scantable.is_ms(), and asap.scantable.scantable.set_freqframe().
def asap.scantable.scantable._get_column | ( | self, | |
callback, | |||
row = -1 , |
|||
args | |||
) | [private] |
Definition at line 819 of file scantable.py.
References tests.test_sdsave.sdsave_unittest_base.nrow, __casac__.ms.ms.nrow(), asap.asapgrid._SDGridPlotter.nrow, and tests.test_sdbaseline.BlparamFileParser.nrow().
Referenced by asap.scantable.scantable.get_azimuth(), asap.scantable.scantable.get_direction(), asap.scantable.scantable.get_directionval(), asap.scantable.scantable.get_elevation(), asap.scantable.scantable.get_inttime(), asap.scantable.scantable.get_parangle(), asap.scantable.scantable.get_sourcename(), asap.scantable.scantable.get_time(), asap.scantable.scantable.get_tsys(), asap.scantable.scantable.get_tsysspectrum(), and asap.scantable.scantable.get_weather().
def asap.scantable.scantable._get_ordinate_label | ( | self | ) | [private] |
Definition at line 3991 of file scantable.py.
def asap.scantable.scantable._get_verify_action | ( | self, | |
msg, | |||
action = None |
|||
) | [private] |
Definition at line 4048 of file scantable.py.
References asap.scantable.scantable._get_verify_action().
Referenced by asap.scantable.scantable._get_verify_action(), asap.scantable.scantable.auto_poly_baseline(), and asap.scantable.scantable.poly_baseline().
def asap.scantable.scantable._init_blinfo | ( | self | ) | [private] |
\ Initialise the following three auxiliary members: blpars : parameters of the best-fit baseline, masklists : mask data (edge positions of masked channels) and actualmask : mask data (in boolean list), to keep for use later (including output to logger/text files). Used by poly_baseline() and auto_poly_baseline() in case of 'plot=True'.
Definition at line 3539 of file scantable.py.
def asap.scantable.scantable._parse_selection | ( | self, | |
selstr, | |||
typestr = 'float' , |
|||
offset = 0. , |
|||
minval = None , |
|||
maxval = None |
|||
) | [private] |
Parameters: selstr : The Selection string, e.g., '<3;5~7;100~103;9' typestr : The type of the values in returned list ('integer' or 'float') offset : The offset value to subtract from or add to the boundary value if the selection string includes '<' or '>' [Valid only for typestr='float'] minval, maxval : The minimum/maximum values to set if the selection string includes '<' or '>'. The list element is filled with None by default. Returns: A list of min/max pair of selections. Example: _parse_selection('<3;5~7;9',typestr='int',minval=0) --> returns [[0,2],[5,7],[9,9]] _parse_selection('<3;5~7;9',typestr='float',offset=0.5,minval=0) --> returns [[0.,2.5],[5.0,7.0],[9.,9.]]
Definition at line 1656 of file scantable.py.
Referenced by asap.scantable.scantable.parse_idx_selection(), and asap.scantable.scantable.parse_maskexpr().
def asap.scantable.scantable._parse_wn | ( | self, | |
wn | |||
) | [private] |
Definition at line 2482 of file scantable.py.
References asap.scantable.scantable.sinusoid_baseline().
def asap.scantable.scantable._row_callback | ( | self, | |
callback, | |||
label | |||
) | [private] |
Definition at line 795 of file scantable.py.
References tests.test_sdsave.sdsave_unittest_base.npol, asap.asapgrid._SDGridPlotter.npol, task_sdtpimaging.sdtpimaging_worker.npol, tests.test_sdsave.sdsave_unittest_base.nrow, __casac__.ms.ms.nrow(), asap.asapgrid._SDGridPlotter.nrow, and tests.test_sdbaseline.BlparamFileParser.nrow().
Referenced by asap.scantable.scantable.get_tsys().
def asap.scantable.scantable._select_copy | ( | self, | |
selection | |||
) | [private] |
Definition at line 355 of file scantable.py.
References __casac__.table.table.copy(), __casac__.coordsys.coordsys.copy(), asap.scantable.scantable.copy(), asap.scantable.scantable.get_selection(), asap.scantable.scantable.set_selection(), and asap.asapplotter.asapplotter.set_selection().
Referenced by asap.scantable.scantable.drop_scan(), and asap.scantable.scantable.get_scan().
def asap.scantable.scantable._zip_mask | ( | self, | |
mask | |||
) | [private] |
Definition at line 3977 of file scantable.py.
References tests.test_imcontsub.list.
Referenced by asap.scantable.scantable._add_history().
def asap.scantable.scantable.add | ( | self, | |
offset, | |||
insitu = None |
|||
) |
\ Return a scan where all spectra have the offset added Parameters: offset: the offset insitu: if False a new scantable is returned. Otherwise, the scaling is done in-situ The default is taken from .asaprc (False)
Definition at line 3628 of file scantable.py.
def asap.scantable.scantable.auto_chebyshev_baseline | ( | self, | |
insitu = None , |
|||
mask = None , |
|||
order = None , |
|||
clipthresh = None , |
|||
clipniter = None , |
|||
edge = None , |
|||
threshold = None , |
|||
chan_avg_limit = None , |
|||
getresidual = None , |
|||
plot = None , |
|||
showprogress = None , |
|||
minnrow = None , |
|||
outlog = None , |
|||
blfile = None , |
|||
csvformat = None |
|||
) |
\ Return a scan which has been baselined (all rows) by Chebyshev polynomials. Spectral lines are detected first using linefinder and masked out to avoid them affecting the baseline solution. Parameters: insitu: if False a new scantable is returned. Otherwise, the scaling is done in-situ The default is taken from .asaprc (False) mask: an optional mask retreived from scantable order: the maximum order of Chebyshev polynomial (default is 5) clipthresh: Clipping threshold. (default is 3.0, unit: sigma) clipniter: maximum number of iteration of 'clipthresh'-sigma clipping (default is 0) edge: an optional number of channel to drop at the edge of spectrum. If only one value is specified, the same number will be dropped from both sides of the spectrum. Default is to keep all channels. Nested tuples represent individual edge selection for different IFs (a number of spectral channels can be different) threshold: the threshold used by line finder. It is better to keep it large as only strong lines affect the baseline solution. chan_avg_limit: a maximum number of consequtive spectral channels to average during the search of weak and broad lines. The default is no averaging (and no search for weak lines). If such lines can affect the fitted baseline (e.g. a high order polynomial is fitted), increase this parameter (usually values up to 8 are reasonable). Most users of this method should find the default value sufficient. plot: *** CURRENTLY UNAVAILABLE, ALWAYS FALSE *** plot the fit and the residual. In this each indivual fit has to be approved, by typing 'y' or 'n' getresidual: if False, returns best-fit values instead of residual. (default is True) showprogress: show progress status for large data. default is True. minnrow: minimum number of input spectra to show. default is 1000. outlog: Output the coefficients of the best-fit function to logger (default is False) blfile: Name of a text file in which the best-fit parameter values to be written (default is "": no file/logger output) csvformat: if True blfile is csv-formatted, default is False. Example: bscan = scan.auto_cspline_baseline(npiece=3, insitu=False) Note: The best-fit parameter values output in logger and/or blfile are now based on specunit of 'channel'.
Definition at line 3122 of file scantable.py.
References __casac__.table.table.copy(), __casac__.coordsys.coordsys.copy(), asap.scantable.scantable.copy(), asap.scantable.normalise_edge_param(), asap.scantable.pack_progress_params(), asap.scantable.scantable.poly_baseline(), and asap.scantable.raise_fitting_failure_exception().
Referenced by asap.scantable.scantable.chebyshev_baseline().
def asap.scantable.scantable.auto_cspline_baseline | ( | self, | |
insitu = None , |
|||
mask = None , |
|||
npiece = None , |
|||
clipthresh = None , |
|||
clipniter = None , |
|||
edge = None , |
|||
threshold = None , |
|||
chan_avg_limit = None , |
|||
getresidual = None , |
|||
plot = None , |
|||
showprogress = None , |
|||
minnrow = None , |
|||
outlog = None , |
|||
blfile = None , |
|||
csvformat = None |
|||
) |
\ Return a scan which has been baselined (all rows) by cubic spline function (piecewise cubic polynomial). Spectral lines are detected first using linefinder and masked out to avoid them affecting the baseline solution. Parameters: insitu: if False a new scantable is returned. Otherwise, the scaling is done in-situ The default is taken from .asaprc (False) mask: an optional mask retreived from scantable npiece: Number of pieces. (default is 2) clipthresh: Clipping threshold. (default is 3.0, unit: sigma) clipniter: maximum number of iteration of 'clipthresh'-sigma clipping (default is 0) edge: an optional number of channel to drop at the edge of spectrum. If only one value is specified, the same number will be dropped from both sides of the spectrum. Default is to keep all channels. Nested tuples represent individual edge selection for different IFs (a number of spectral channels can be different) threshold: the threshold used by line finder. It is better to keep it large as only strong lines affect the baseline solution. chan_avg_limit: a maximum number of consequtive spectral channels to average during the search of weak and broad lines. The default is no averaging (and no search for weak lines). If such lines can affect the fitted baseline (e.g. a high order polynomial is fitted), increase this parameter (usually values up to 8 are reasonable). Most users of this method should find the default value sufficient. plot: *** CURRENTLY UNAVAILABLE, ALWAYS FALSE *** plot the fit and the residual. In this each indivual fit has to be approved, by typing 'y' or 'n' getresidual: if False, returns best-fit values instead of residual. (default is True) showprogress: show progress status for large data. default is True. minnrow: minimum number of input spectra to show. default is 1000. outlog: Output the coefficients of the best-fit function to logger (default is False) blfile: Name of a text file in which the best-fit parameter values to be written (default is "": no file/logger output) csvformat: if True blfile is csv-formatted, default is False. Example: bscan = scan.auto_cspline_baseline(npiece=3, insitu=False) Note: The best-fit parameter values output in logger and/or blfile are now based on specunit of 'channel'.
Definition at line 2918 of file scantable.py.
References asap.scantable.scantable.chebyshev_baseline(), __casac__.table.table.copy(), __casac__.coordsys.coordsys.copy(), asap.scantable.scantable.copy(), asap.scantable.normalise_edge_param(), asap.scantable.pack_progress_params(), and asap.scantable.raise_fitting_failure_exception().
Referenced by asap.scantable.scantable.cspline_baseline().
def asap.scantable.scantable.auto_poly_baseline | ( | self, | |
mask = None , |
|||
order = None , |
|||
edge = None , |
|||
threshold = None , |
|||
chan_avg_limit = None , |
|||
plot = None , |
|||
insitu = None , |
|||
getresidual = None , |
|||
showprogress = None , |
|||
minnrow = None , |
|||
outlog = None , |
|||
blfile = None , |
|||
csvformat = None |
|||
) |
\ Return a scan which has been baselined (all rows) by a polynomial. Spectral lines are detected first using linefinder and masked out to avoid them affecting the baseline solution. Parameters: insitu: if False a new scantable is returned. Otherwise, the scaling is done in-situ The default is taken from .asaprc (False) mask: an optional mask retreived from scantable order: the order of the polynomial (default is 0) edge: an optional number of channel to drop at the edge of spectrum. If only one value is specified, the same number will be dropped from both sides of the spectrum. Default is to keep all channels. Nested tuples represent individual edge selection for different IFs (a number of spectral channels can be different) threshold: the threshold used by line finder. It is better to keep it large as only strong lines affect the baseline solution. chan_avg_limit: a maximum number of consequtive spectral channels to average during the search of weak and broad lines. The default is no averaging (and no search for weak lines). If such lines can affect the fitted baseline (e.g. a high order polynomial is fitted), increase this parameter (usually values up to 8 are reasonable). Most users of this method should find the default value sufficient. plot: plot the fit and the residual. In this each indivual fit has to be approved, by typing 'y' or 'n' getresidual: if False, returns best-fit values instead of residual. (default is True) showprogress: show progress status for large data. default is True. minnrow: minimum number of input spectra to show. default is 1000. outlog: Output the coefficients of the best-fit function to logger (default is False) blfile: Name of a text file in which the best-fit parameter values to be written (default is "": no file/logger output) csvformat: if True blfile is csv-formatted, default is False. Example: bscan = scan.auto_poly_baseline(order=7, insitu=False)
Definition at line 3374 of file scantable.py.
References asap.scantable.scantable._get_verify_action(), __casac__.table.table.copy(), __casac__.coordsys.coordsys.copy(), asap.scantable.scantable.copy(), asap.utils.mask_and(), asap.scantable.normalise_edge_param(), asap.scantable.pack_progress_params(), and asap.scantable.raise_fitting_failure_exception().
Referenced by asap.scantable.scantable.poly_baseline().
def asap.scantable.scantable.auto_quotient | ( | self, | |
preserve = True , |
|||
mode = 'paired' , |
|||
verify = False |
|||
) |
\ This function allows to build quotients automatically. It assumes the observation to have the same number of "ons" and "offs" Parameters: preserve: you can preserve (default) the continuum or remove it. The equations used are preserve: Output = Toff * (on/off) - Toff remove: Output = Toff * (on/off) - Ton mode: the on/off detection mode 'paired' (default) identifies 'off' scans by the trailing '_R' (Mopra/Parkes) or '_e'/'_w' (Tid) and matches on/off pairs from the observing pattern 'time' finds the closest off in time .. todo:: verify argument is not implemented
Definition at line 3732 of file scantable.py.
References __casac__.table.table.copy(), __casac__.coordsys.coordsys.copy(), asap.scantable.scantable.copy(), asap.scantable.scantable.get_selection(), asap.scantable.scantable.set_selection(), and asap.asapplotter.asapplotter.set_selection().
def asap.scantable.scantable.auto_sinusoid_baseline | ( | self, | |
insitu = None , |
|||
mask = None , |
|||
applyfft = None , |
|||
fftmethod = None , |
|||
fftthresh = None , |
|||
addwn = None , |
|||
rejwn = None , |
|||
clipthresh = None , |
|||
clipniter = None , |
|||
edge = None , |
|||
threshold = None , |
|||
chan_avg_limit = None , |
|||
plot = None , |
|||
getresidual = None , |
|||
showprogress = None , |
|||
minnrow = None , |
|||
outlog = None , |
|||
blfile = None , |
|||
csvformat = None |
|||
) |
\ Return a scan which has been baselined (all rows) with sinusoidal functions. Spectral lines are detected first using linefinder and masked out to avoid them affecting the baseline solution. Parameters: insitu: if False a new scantable is returned. Otherwise, the scaling is done in-situ The default is taken from .asaprc (False) mask: an optional mask retreived from scantable applyfft: if True use some method, such as FFT, to find strongest sinusoidal components in the wavenumber domain to be used for baseline fitting. default is True. fftmethod: method to find the strong sinusoidal components. now only 'fft' is available and it is the default. fftthresh: the threshold to select wave numbers to be used for fitting from the distribution of amplitudes in the wavenumber domain. both float and string values accepted. given a float value, the unit is set to sigma. for string values, allowed formats include: 'xsigma' or 'x' (= x-sigma level. e.g., '3sigma'), or 'topx' (= the x strongest ones, e.g. 'top5'). default is 3.0 (unit: sigma). addwn: the additional wave numbers to be used for fitting. list or integer value is accepted to specify every wave numbers. also string value can be used in case you need to specify wave numbers in a certain range, e.g., 'a-b' (= a, a+1, a+2, ..., b-1, b), '<a' (= 0,1,...,a-2,a-1), '>=a' (= a, a+1, ... up to the maximum wave number corresponding to the Nyquist frequency for the case of FFT). default is [0]. rejwn: the wave numbers NOT to be used for fitting. can be set just as addwn but has higher priority: wave numbers which are specified both in addwn and rejwn will NOT be used. default is []. clipthresh: Clipping threshold. (default is 3.0, unit: sigma) clipniter: maximum number of iteration of 'clipthresh'-sigma clipping (default is 0) edge: an optional number of channel to drop at the edge of spectrum. If only one value is specified, the same number will be dropped from both sides of the spectrum. Default is to keep all channels. Nested tuples represent individual edge selection for different IFs (a number of spectral channels can be different) threshold: the threshold used by line finder. It is better to keep it large as only strong lines affect the baseline solution. chan_avg_limit: a maximum number of consequtive spectral channels to average during the search of weak and broad lines. The default is no averaging (and no search for weak lines). If such lines can affect the fitted baseline (e.g. a high order polynomial is fitted), increase this parameter (usually values up to 8 are reasonable). Most users of this method should find the default value sufficient. plot: *** CURRENTLY UNAVAILABLE, ALWAYS FALSE *** plot the fit and the residual. In this each indivual fit has to be approved, by typing 'y' or 'n' getresidual: if False, returns best-fit values instead of residual. (default is True) showprogress: show progress status for large data. default is True. minnrow: minimum number of input spectra to show. default is 1000. outlog: Output the coefficients of the best-fit function to logger (default is False) blfile: Name of a text file in which the best-fit parameter values to be written (default is "": no file/logger output) csvformat: if True blfile is csv-formatted, default is False. Example: bscan = scan.auto_sinusoid_baseline(addwn='<=10', insitu=False) Note: The best-fit parameter values output in logger and/or blfile are now based on specunit of 'channel'.
Definition at line 2676 of file scantable.py.
References __casac__.table.table.copy(), __casac__.coordsys.coordsys.copy(), asap.scantable.scantable.copy(), asap.scantable.scantable.cspline_baseline(), asap.scantable.normalise_edge_param(), asap.scantable.pack_progress_params(), and asap.scantable.raise_fitting_failure_exception().
Referenced by asap.scantable.scantable.sinusoid_baseline().
def asap.scantable.scantable.average_beam | ( | self, | |
mask = None , |
|||
weight = 'none' |
|||
) |
\ Average the Beams together. Parameters: mask: An optional mask defining the region, where the averaging will be applied. The output will have all specified points masked. weight: Weighting scheme. 'none' (default), 'var' (1/var(spec) weighted), or 'tsys' (1/Tsys**2 weighted)
Definition at line 2264 of file scantable.py.
def asap.scantable.scantable.average_pol | ( | self, | |
mask = None , |
|||
weight = 'none' |
|||
) |
\ Average the Polarisations together. Parameters: mask: An optional mask defining the region, where the averaging will be applied. The output will have all specified points masked. weight: Weighting scheme. 'none' (default), 'var' (1/var(spec) weighted), or 'tsys' (1/Tsys**2 weighted)
Definition at line 2243 of file scantable.py.
def asap.scantable.scantable.average_time | ( | self, | |
mask = None , |
|||
scanav = False , |
|||
weight = 'tint' , |
|||
align = False |
|||
) |
\ Return the (time) weighted average of a scan. Scans will be averaged only if the source direction (RA/DEC) is within 1' otherwise *Note*: in channels only - align if necessary Parameters: mask: an optional mask (only used for 'var' and 'tsys' weighting) scanav: True averages each scan separately False (default) averages all scans together, weight: Weighting scheme. 'none' (mean no weight) 'var' (1/var(spec) weighted) 'tsys' (1/Tsys**2 weighted) 'tint' (integration time weighted) 'tintsys' (Tint/Tsys**2) 'median' ( median averaging) The default is 'tint' align: align the spectra in velocity before averaging. It takes the time of the first spectrum as reference time. Example:: # time average the scantable without using a mask newscan = scan.average_time()
Definition at line 1952 of file scantable.py.
References asap.scantable.scantable.freq_align().
def asap.scantable.scantable.bin | ( | self, | |
width = 5 , |
|||
insitu = None |
|||
) |
\ Return a scan where all spectra have been binned up. Parameters: width: The bin width (default=5) in pixels insitu: if False a new scantable is returned. Otherwise, the scaling is done in-situ The default is taken from .asaprc (False)
Definition at line 2169 of file scantable.py.
def asap.scantable.scantable.chan2data | ( | self, | |
rowno = 0 , |
|||
chan = 0 |
|||
) |
\ Returns channel/frequency/velocity and spectral value at an arbitrary row and channel in the scantable. Parameters: rowno: a row number in the scantable. Default is the first row, i.e. rowno=0 chan: a channel in the scantable. Default is the first channel, i.e. pos=0
Definition at line 685 of file scantable.py.
References asap.scantable.scantable.get_unit().
Referenced by asap.scantable.scantable.stats().
def asap.scantable.scantable.chebyshev_baseline | ( | self, | |
insitu = None , |
|||
mask = None , |
|||
order = None , |
|||
clipthresh = None , |
|||
clipniter = None , |
|||
plot = None , |
|||
getresidual = None , |
|||
showprogress = None , |
|||
minnrow = None , |
|||
outlog = None , |
|||
blfile = None , |
|||
csvformat = None |
|||
) |
\ Return a scan which has been baselined (all rows) by Chebyshev polynomials. Parameters: insitu: If False a new scantable is returned. Otherwise, the scaling is done in-situ The default is taken from .asaprc (False) mask: An optional mask order: the maximum order of Chebyshev polynomial (default is 5) clipthresh: Clipping threshold. (default is 3.0, unit: sigma) clipniter: maximum number of iteration of 'clipthresh'-sigma clipping (default is 0) plot: *** CURRENTLY UNAVAILABLE, ALWAYS FALSE *** plot the fit and the residual. In this each indivual fit has to be approved, by typing 'y' or 'n' getresidual: if False, returns best-fit values instead of residual. (default is True) showprogress: show progress status for large data. default is True. minnrow: minimum number of input spectra to show. default is 1000. outlog: Output the coefficients of the best-fit function to logger (default is False) blfile: Name of a text file in which the best-fit parameter values to be written (default is "": no file/logger output) csvformat: if True blfile is csv-formatted, default is False. Example: # return a scan baselined by a cubic spline consisting of 2 pieces # (i.e., 1 internal knot), # also with 3-sigma clipping, iteration up to 4 times bscan = scan.cspline_baseline(npiece=2,clipthresh=3.0,clipniter=4) Note: The best-fit parameter values output in logger and/or blfile are now based on specunit of 'channel'.
Definition at line 3032 of file scantable.py.
References asap.scantable.scantable.auto_chebyshev_baseline(), __casac__.table.table.copy(), __casac__.coordsys.coordsys.copy(), asap.scantable.scantable.copy(), asap.scantable.pack_progress_params(), and asap.scantable.raise_fitting_failure_exception().
Referenced by asap.scantable.scantable.auto_cspline_baseline().
def asap.scantable.scantable.clip | ( | self, | |
uthres = None , |
|||
dthres = None , |
|||
clipoutside = True , |
|||
unflag = False |
|||
) |
\ Flag the selected data outside a specified range (in channel-base) Parameters: uthres: upper threshold. dthres: lower threshold clipoutside: True for flagging data outside the range [dthres:uthres]. False for flagging data inside the range. unflag: if True, unflag the data.
Definition at line 1149 of file scantable.py.
References asap.scantable.scantable._add_history().
Referenced by task_sdflag.sdflag_worker.command_flag(), and task_sdflag.sdflag_worker.prior_plot().
def asap.scantable.scantable.convert_flux | ( | self, | |
jyperk = None , |
|||
eta = None , |
|||
d = None , |
|||
insitu = None |
|||
) |
\ Return a scan where all spectra are converted to either Jansky or Kelvin depending upon the flux units of the scan table. By default the function tries to look the values up internally. If it can't find them (or if you want to over-ride), you must specify EITHER jyperk OR eta (and D which it will try to look up also if you don't set it). jyperk takes precedence if you set both. Parameters: jyperk: the Jy / K conversion factor eta: the aperture efficiency d: the geometric diameter (metres) insitu: if False a new scantable is returned. Otherwise, the scaling is done in-situ The default is taken from .asaprc (False)
Definition at line 2006 of file scantable.py.
def asap.scantable.scantable.convert_pol | ( | self, | |
poltype = None |
|||
) |
\ Convert the data to a different polarisation type. Note that you will need cross-polarisation terms for most conversions. Parameters: poltype: The new polarisation type. Valid types are: 'linear', 'circular', 'stokes' and 'linpol'
Definition at line 2299 of file scantable.py.
def asap.scantable.scantable.copy | ( | self | ) |
Return a copy of this scantable. *Note*: This makes a full (deep) copy. scan2 = scan1 makes a reference. Example:: copiedscan = scan.copy()
Definition at line 316 of file scantable.py.
Referenced by asap.scantable.scantable._select_copy(), asap.scantable.scantable.auto_chebyshev_baseline(), asap.scantable.scantable.auto_cspline_baseline(), asap.scantable.scantable.auto_poly_baseline(), asap.scantable.scantable.auto_quotient(), asap.scantable.scantable.auto_sinusoid_baseline(), asap.scantable.scantable.chebyshev_baseline(), asap.scantable.scantable.cspline_baseline(), asap.scantable.scantable.get_row(), asap.scantable.scantable.poly_baseline(), asap.scantable.scantable.regrid_channel(), and asap.scantable.scantable.sinusoid_baseline().
def asap.scantable.scantable.create_mask | ( | self, | |
args, | |||
kwargs | |||
) |
\ Compute and return a mask based on [min, max] windows. The specified windows are to be INCLUDED, when the mask is applied. Parameters: [min, max], [min2, max2], ... Pairs of start/end points (inclusive)specifying the regions to be masked invert: optional argument. If specified as True, return an inverted mask, i.e. the regions specified are EXCLUDED row: create the mask using the specified row for unit conversions, default is row=0 only necessary if frequency varies over rows. Examples:: scan.set_unit('channel') # a) msk = scan.create_mask([400, 500], [800, 900]) # masks everything outside 400 and 500 # and 800 and 900 in the unit 'channel' # b) msk = scan.create_mask([400, 500], [800, 900], invert=True) # masks the regions between 400 and 500 # and 800 and 900 in the unit 'channel' # c) #mask only channel 400 msk = scan.create_mask([400])
Definition at line 1315 of file scantable.py.
References asap.scantable.scantable._check_ifs(), asap.utils._n_bools(), and asap.utils.mask_not().
def asap.scantable.scantable.cspline_baseline | ( | self, | |
insitu = None , |
|||
mask = None , |
|||
npiece = None , |
|||
clipthresh = None , |
|||
clipniter = None , |
|||
plot = None , |
|||
getresidual = None , |
|||
showprogress = None , |
|||
minnrow = None , |
|||
outlog = None , |
|||
blfile = None , |
|||
csvformat = None |
|||
) |
\ Return a scan which has been baselined (all rows) by cubic spline function (piecewise cubic polynomial). Parameters: insitu: If False a new scantable is returned. Otherwise, the scaling is done in-situ The default is taken from .asaprc (False) mask: An optional mask npiece: Number of pieces. (default is 2) clipthresh: Clipping threshold. (default is 3.0, unit: sigma) clipniter: maximum number of iteration of 'clipthresh'-sigma clipping (default is 0) plot: *** CURRENTLY UNAVAILABLE, ALWAYS FALSE *** plot the fit and the residual. In this each indivual fit has to be approved, by typing 'y' or 'n' getresidual: if False, returns best-fit values instead of residual. (default is True) showprogress: show progress status for large data. default is True. minnrow: minimum number of input spectra to show. default is 1000. outlog: Output the coefficients of the best-fit function to logger (default is False) blfile: Name of a text file in which the best-fit parameter values to be written (default is "": no file/logger output) csvformat: if True blfile is csv-formatted, default is False. Example: # return a scan baselined by a cubic spline consisting of 2 pieces # (i.e., 1 internal knot), # also with 3-sigma clipping, iteration up to 4 times bscan = scan.cspline_baseline(npiece=2,clipthresh=3.0,clipniter=4) Note: The best-fit parameter values output in logger and/or blfile are now based on specunit of 'channel'.
Definition at line 2827 of file scantable.py.
References asap.scantable.scantable.auto_cspline_baseline(), __casac__.table.table.copy(), __casac__.coordsys.coordsys.copy(), asap.scantable.scantable.copy(), asap.scantable.pack_progress_params(), and asap.scantable.raise_fitting_failure_exception().
Referenced by asap.scantable.scantable.auto_sinusoid_baseline().
def asap.scantable.scantable.drop_scan | ( | self, | |
scanid = None |
|||
) |
\ Return a new scantable where the specified scan number(s) has(have) been dropped. Parameters: scanid: a (list of) scan number(s)
Definition at line 331 of file scantable.py.
References asap.scantable.scantable._select_copy(), asap.utils._to_list(), tests.test_sdsave.sdsave_unittest_base.nrow, __casac__.ms.ms.nrow(), asap.asapgrid._SDGridPlotter.nrow, tests.test_sdbaseline.BlparamFileParser.nrow(), and asap.utils.unique().
def asap.scantable.scantable.fft | ( | self, | |
rowno = None , |
|||
mask = None , |
|||
getrealimag = False |
|||
) |
\ Apply FFT to the spectra. Flagged data in the scantable get interpolated over the region. Parameters: rowno: The row number(s) to be processed. int, list and tuple are accepted. By default (None), FFT is applied to the whole data. mask: Auxiliary channel mask(s). Given as a boolean list, it is applied to all specified rows. A list of boolean lists can also be used to apply different masks. In the latter case, the length of 'mask' must be the same as that of 'rowno'. The default is None. getrealimag: If True, returns the real and imaginary part values of the complex results. If False (the default), returns the amplitude (absolute value) normalised with Ndata/2 and phase (argument, in unit of radian). Returns: A list of dictionaries containing the results for each spectrum. Each dictionary contains two values, the real and the imaginary parts when getrealimag = True, or the amplitude(absolute value) and the phase(argument) when getrealimag = False. The key for these values are 'real' and 'imag', or 'ampl' and 'phase', respectively.
Definition at line 1211 of file scantable.py.
References tests.test_cleanhelper.cleanhelper_test.nchan, asap.sbseparator.sbseparator.nchan, task_sdimaging.sdimaging_worker.nchan, asap.asapgrid._SDGridPlotter.nchan, parameter_dictionary.par.nchan(), tests.test_sdsave.sdsave_unittest_base.nrow, __casac__.ms.ms.nrow(), asap.asapgrid._SDGridPlotter.nrow, and tests.test_sdbaseline.BlparamFileParser.nrow().
def asap.scantable.scantable.flag | ( | self, | |
mask = None , |
|||
unflag = False , |
|||
row = -1 |
|||
) |
\ Flag the selected data using an optional channel mask. Parameters: mask: an optional channel mask, created with create_mask. Default (no mask) is all channels. unflag: if True, unflag the data row: an optional row number in the scantable. Default -1 flags all rows
Definition at line 1108 of file scantable.py.
References asap.scantable.scantable._add_history().
Referenced by TablePlotTkAgg.PlotFlag.configure_buttons(), and asap.scantable.scantable.flag_nans().
def asap.scantable.scantable.flag_nans | ( | self | ) |
\ Utility function to flag NaN values in the scantable.
Definition at line 3918 of file scantable.py.
References regressframe.regressionframe.flag, asap.lagflagger.lagplotter.flag(), asap.customgui_base.CustomFlagToolbarCommon.flag(), asap.scantable.scantable.flag(), asap.scantable.scantable.get_row_selector(), asap.scantable.scantable.get_selection(), tests.test_sdsave.sdsave_unittest_base.nrow, __casac__.ms.ms.nrow(), asap.asapgrid._SDGridPlotter.nrow, tests.test_sdbaseline.BlparamFileParser.nrow(), asap.scantable.scantable.set_selection(), and asap.asapplotter.asapplotter.set_selection().
def asap.scantable.scantable.flag_row | ( | self, | |
rows = None , |
|||
unflag = False |
|||
) |
\ Flag the selected data in row-based manner. Parameters: rows: list of row numbers to be flagged. Default is no row (must be explicitly specified to execute row-based flagging). unflag: if True, unflag the data.
Definition at line 1129 of file scantable.py.
References asap.scantable.scantable._add_history().
def asap.scantable.scantable.freq_align | ( | self, | |
reftime = None , |
|||
method = 'cubic' , |
|||
insitu = None |
|||
) |
\ Return a scan where all rows have been aligned in frequency/velocity. The alignment frequency frame (e.g. LSRK) is that set by function set_freqframe. Parameters: reftime: reference time to align at. By default, the time of the first row of data is used. method: Interpolation method for regridding the spectra. Choose from 'nearest', 'linear', 'cubic' (default) and 'spline' insitu: if False a new scantable is returned. Otherwise, the scaling is done in-situ The default is taken from .asaprc (False)
Definition at line 2100 of file scantable.py.
Referenced by asap.scantable.scantable.average_time().
def asap.scantable.scantable.freq_switch | ( | self, | |
insitu = None |
|||
) |
\ Apply frequency switching to the data. Parameters: insitu: if False a new scantable is returned. Otherwise, the swictching is done in-situ The default is taken from .asaprc (False)
Definition at line 3809 of file scantable.py.
def asap.scantable.scantable.gain_el | ( | self, | |
poly = None , |
|||
filename = "" , |
|||
method = "linear" , |
|||
insitu = None |
|||
) |
\ Return a scan after applying a gain-elevation correction. The correction can be made via either a polynomial or a table-based interpolation (and extrapolation if necessary). You specify polynomial coefficients, an ascii table or neither. If you specify neither, then a polynomial correction will be made with built in coefficients known for certain telescopes (an error will occur if the instrument is not known). The data and Tsys are *divided* by the scaling factors. Parameters: poly: Polynomial coefficients (default None) to compute a gain-elevation correction as a function of elevation (in degrees). filename: The name of an ascii file holding correction factors. The first row of the ascii file must give the column names and these MUST include columns 'ELEVATION' (degrees) and 'FACTOR' (multiply data by this) somewhere. The second row must give the data type of the column. Use 'R' for Real and 'I' for Integer. An example file would be (actual factors are arbitrary) : TIME ELEVATION FACTOR R R R 0.1 0 0.8 0.2 20 0.85 0.3 40 0.9 0.4 60 0.85 0.5 80 0.8 0.6 90 0.75 method: Interpolation method when correcting from a table. Values are 'nearest', 'linear' (default), 'cubic' and 'spline' insitu: if False a new scantable is returned. Otherwise, the scaling is done in-situ The default is taken from .asaprc (False)
Definition at line 2040 of file scantable.py.
def asap.scantable.scantable.get_abcissa | ( | self, | |
rowno = 0 |
|||
) |
\ Get the abcissa in the current coordinate setup for the currently selected Beam/IF/Pol Parameters: rowno: an optional row number in the scantable. Default is the first row, i.e. rowno=0 Returns: The abcissa values and the format string (as a dictionary)
Definition at line 1088 of file scantable.py.
def asap.scantable.scantable.get_azimuth | ( | self, | |
row = -1 |
|||
) |
\ Get a list of azimuths for the observations. Return a float for each integration in the scantable. Parameters: row: row no of integration. Default -1 return all rows.
Definition at line 912 of file scantable.py.
References asap.scantable.scantable._get_column().
def asap.scantable.scantable.get_column_names | ( | self | ) |
\ Return a list of column names, which can be used for selection.
Definition at line 727 of file scantable.py.
References tests.test_imcontsub.list.
def asap.scantable.scantable.get_coordinate | ( | self, | |
rowno | |||
) |
Return the (spectral) coordinate for a a given 'rowno'. *Note*: * This coordinate is only valid until a scantable method modifies the frequency axis. * This coordinate does contain the original frequency set-up NOT the new frame. The conversions however are done using the user specified frame (e.g. LSRK/TOPO). To get the 'real' coordinate, use scantable.freq_align first. Without it there is no closure, i.e.:: c = myscan.get_coordinate(0) c.to_frequency(c.get_reference_pixel()) != c.get_reference_value() Parameters: rowno: the row number for the spectral coordinate
Definition at line 471 of file scantable.py.
Referenced by asap.scantable.scantable.parse_maskexpr().
def asap.scantable.scantable.get_direction | ( | self, | |
row = -1 |
|||
) |
Get a list of Positions on the sky (direction) for the observations. Return a string for each integration in the scantable. Parameters: row: row no of integration. Default -1 return all rows
Definition at line 935 of file scantable.py.
References asap.scantable.scantable._get_column().
def asap.scantable.scantable.get_directionval | ( | self, | |
row = -1 |
|||
) |
\ Get a list of Positions on the sky (direction) for the observations. Return a float for each integration in the scantable. Parameters: row: row no of integration. Default -1 return all rows
Definition at line 947 of file scantable.py.
References asap.scantable.scantable._get_column().
def asap.scantable.scantable.get_elevation | ( | self, | |
row = -1 |
|||
) |
\ Get a list of elevations for the observations. Return a float for each integration in the scantable. Parameters: row: row no of integration. Default -1 return all rows.
Definition at line 900 of file scantable.py.
References asap.scantable.scantable._get_column().
def asap.scantable.scantable.get_fit | ( | self, | |
row = 0 |
|||
) |
\ Print or return the stored fits for a row in the scantable Parameters: row: the row which the fit has been applied to.
Definition at line 3901 of file scantable.py.
References tests.test_sdsave.sdsave_unittest_base.nrow, __casac__.ms.ms.nrow(), asap.asapgrid._SDGridPlotter.nrow, and tests.test_sdbaseline.BlparamFileParser.nrow().
def asap.scantable.scantable.get_inttime | ( | self, | |
row = -1 |
|||
) |
\ Get a list of integration times for the observations. Return a time in seconds for each integration in the scantable. Parameters: row: row no of integration. Default -1 return all rows.
Definition at line 876 of file scantable.py.
References asap.scantable.scantable._get_column().
Referenced by asap.scantable.scantable.get_time().
def asap.scantable.scantable.get_mask | ( | self, | |
rowno | |||
) |
Return the mask for the current row in the scantable as a list. Parameters: rowno: the row number to retrieve the mask from
Definition at line 448 of file scantable.py.
def asap.scantable.scantable.get_mask_indices | ( | self, | |
mask = None |
|||
) |
\ Compute and Return lists of mask start indices and mask end indices. Parameters: mask: channel mask, created with create_mask. Returns: List of mask start indices and that of mask end indices, i.e., [istart1,istart2,....], [iend1,iend2,....].
Definition at line 1433 of file scantable.py.
Referenced by asap.scantable.scantable.get_masklist().
def asap.scantable.scantable.get_masklist | ( | self, | |
mask = None , |
|||
row = 0 , |
|||
silent = False |
|||
) |
\ Compute and return a list of mask windows, [min, max]. Parameters: mask: channel mask, created with create_mask. row: calcutate the masklist using the specified row for unit conversions, default is row=0 only necessary if frequency varies over rows. Returns: [min, max], [min2, max2], ... Pairs of start/end points (inclusive)specifying the masked regions
Definition at line 1387 of file scantable.py.
References asap.scantable.scantable._check_ifs(), and asap.scantable.scantable.get_mask_indices().
def asap.scantable.scantable.get_parangle | ( | self, | |
row = -1 |
|||
) |
\ Get a list of parallactic angles for the observations. Return a float for each integration in the scantable. Parameters: row: row no of integration. Default -1 return all rows.
Definition at line 923 of file scantable.py.
References asap.scantable.scantable._get_column().
def asap.scantable.scantable.get_restfreqs | ( | self, | |
ids = None |
|||
) |
\ Get the restfrequency(s) stored in this scantable. The return value(s) are always of unit 'Hz' Parameters: ids: (optional) a list of MOLECULE_ID for that restfrequency(s) to be retrieved Returns: dictionary containing ids and a list of doubles for each id
Definition at line 1742 of file scantable.py.
References tests.test_imcontsub.list.
def asap.scantable.scantable.get_row | ( | self, | |
row = 0 , |
|||
insitu = None |
|||
) |
\ Select a row in the scantable. Return a scantable with single row. Parameters: row: row no of integration, default is 0. insitu: if False a new scantable is returned. Otherwise, the scaling is done in-situ. The default is taken from .asaprc (False)
Definition at line 545 of file scantable.py.
References __casac__.table.table.copy(), __casac__.coordsys.coordsys.copy(), and asap.scantable.scantable.copy().
def asap.scantable.scantable.get_row_selector | ( | self, | |
rowno | |||
) |
Definition at line 3932 of file scantable.py.
Referenced by asap.scantable.scantable.flag_nans().
def asap.scantable.scantable.get_scan | ( | self, | |
scanid = None |
|||
) |
\ Return a specific scan (by scanno) or collection of scans (by source name) in a new scantable. *Note*: See scantable.drop_scan() for the inverse operation. Parameters: scanid: a (list of) scanno or a source name, unix-style patterns are accepted for source name matching, e.g. '*_R' gets all 'ref scans Example:: # get all scans containing the source '323p459' newscan = scan.get_scan('323p459') # get all 'off' scans refscans = scan.get_scan('*_R') # get a susbset of scans by scanno (as listed in scan.summary()) newscan = scan.get_scan([0, 2, 7, 10])
Definition at line 362 of file scantable.py.
References asap.scantable.scantable._select_copy(), and asap.scantable.scantable.get_selection().
def asap.scantable.scantable.get_selection | ( | self | ) |
\ Get the selection object currently set on this scantable. Example:: sel = scan.get_selection() sel.set_ifs(0) # select IF 0 scan.set_selection(sel) # apply modified selection
Definition at line 494 of file scantable.py.
Referenced by asap.scantable.scantable._select_copy(), asap.scantable.scantable.auto_quotient(), asap.scantable.scantable.flag_nans(), asap.scantable.scantable.get_scan(), and asap.scantable.scantable.set_restfreqs().
def asap.scantable.scantable.get_sourcename | ( | self, | |
row = -1 |
|||
) |
\ Get a list source names for the observations. Return a string for each integration in the scantable. Parameters: row: row no of integration. Default -1 return all rows.
Definition at line 889 of file scantable.py.
References asap.scantable.scantable._get_column().
def asap.scantable.scantable.get_spectrum | ( | self, | |
rowno | |||
) |
Return the spectrum for the current row in the scantable as a list. Parameters: rowno: the row number to retrieve the spectrum from
Definition at line 438 of file scantable.py.
def asap.scantable.scantable.get_time | ( | self, | |
row = -1 , |
|||
asdatetime = False , |
|||
prec = -1 |
|||
) |
\ Get a list of time stamps for the observations. Return a datetime object or a string (default) for each integration time stamp in the scantable. Parameters: row: row no of integration. Default -1 return all rows asdatetime: return values as datetime objects rather than strings prec: number of digits shown. Default -1 to automatic calculation. Note this number is equals to the digits of MVTime, i.e., 0<prec<3: dates with hh:: only, <5: with hh:mm:, <7 or 0: with hh:mm:ss, and 6> : with hh:mm:ss.tt... (prec-6 t's added)
Definition at line 829 of file scantable.py.
References asap.scantable.scantable._get_column(), asap.scantable.scantable.get_inttime(), and irc_cs_task_regression.max.
def asap.scantable.scantable.get_tsys | ( | self, | |
row = -1 |
|||
) |
\ Return the System temperatures. Parameters: row: the rowno to get the information for. (default all rows) Returns: a list of Tsys values for the current selection
Definition at line 733 of file scantable.py.
References asap.scantable.scantable._get_column(), and asap.scantable.scantable._row_callback().
def asap.scantable.scantable.get_tsysspectrum | ( | self, | |
row = -1 |
|||
) |
\ Return the channel dependent system temperatures. Parameters: row: the rowno to get the information for. (default all rows) Returns: a list of Tsys values for the current selection
Definition at line 750 of file scantable.py.
References asap.scantable.scantable._get_column().
def asap.scantable.scantable.get_unit | ( | self | ) |
\ Get the default unit set in this scantable Returns: A unit string
Definition at line 1073 of file scantable.py.
Referenced by asap.scantable.scantable.chan2data(), and asap.scantable.scantable.parse_maskexpr().
def asap.scantable.scantable.get_weather | ( | self, | |
row = -1 |
|||
) |
\ Return the weather informations. Parameters: row: the rowno to get the information for. (default all rows) Returns: a dict or list of of dicts of values for the current selection
Definition at line 765 of file scantable.py.
References asap.scantable.scantable._get_column().
def asap.scantable.scantable.history | ( | self, | |
filename = None |
|||
) |
\ Print the history. Optionally to a file. Parameters: filename: The name of the file to save the history to.
Definition at line 1907 of file scantable.py.
References tests.test_imcontsub.list, and asap.utils.page().
def asap.scantable.scantable.invert_phase | ( | self | ) |
\ Invert the phase of the complex polarisation
Definition at line 3618 of file scantable.py.
References asap.scantable.scantable._add_history().
def asap.scantable.scantable.lag_flag | ( | self, | |
start, | |||
end, | |||
unit = "MHz" , |
|||
insitu = None |
|||
) |
\ Flag the data in 'lag' space by providing a frequency to remove. Flagged data in the scantable get interpolated over the region. No taper is applied. Parameters: start: the start frequency (really a period within the bandwidth) or period to remove end: the end frequency or period to remove unit: the frequency unit (default 'MHz') or '' for explicit lag channels *Notes*: It is recommended to flag edges of the band or strong signals beforehand.
Definition at line 1171 of file scantable.py.
def asap.scantable.scantable.mx_quotient | ( | self, | |
mask = None , |
|||
weight = 'median' , |
|||
preserve = True |
|||
) |
\ Form a quotient using "off" beams when observing in "MX" mode. Parameters: mask: an optional mask to be used when weight == 'stddev' weight: How to average the off beams. Default is 'median'. preserve: you can preserve (default) the continuum or remove it. The equations used are: preserve: Output = Toff * (on/off) - Toff remove: Output = Toff * (on/off) - Ton
Definition at line 3780 of file scantable.py.
References asap.asapmath.quotient().
def asap.scantable.scantable.opacity | ( | self, | |
tau = None , |
|||
insitu = None |
|||
) |
\ Apply an opacity correction. The data and Tsys are multiplied by the correction factor. Parameters: tau: (list of) opacity from which the correction factor is exp(tau*ZD) where ZD is the zenith-distance. If a list is provided, it has to be of length nIF, nIF*nPol or 1 and in order of IF/POL, e.g. [opif0pol0, opif0pol1, opif1pol0 ...] if tau is `None` the opacities are determined from a model. insitu: if False a new scantable is returned. Otherwise, the scaling is done in-situ The default is taken from .asaprc (False)
Definition at line 2134 of file scantable.py.
def asap.scantable.scantable.parallactify | ( | self, | |
pflag | |||
) |
\ Set a flag to indicate whether this data should be treated as having been 'parallactified' (total phase == 0.0) Parameters: pflag: Bool indicating whether to turn this on (True) or off (False)
Definition at line 2283 of file scantable.py.
def asap.scantable.scantable.parse_idx_selection | ( | self, | |
mode, | |||
selexpr | |||
) |
Parse CASA type mask selection syntax of SCANNO, IFNO, POLNO, BEAMNO, and row number Parameters: mode : which column to select. ['scan',|'if'|'pol'|'beam'|'row'] selexpr : A comma separated selection expression. examples: '' = all (returns []) '<2,4~6,9' = indices less than 2, 4 to 6 and 9 (returns [0,1,4,5,6,9]) Returns: A List of selected indices
Definition at line 1605 of file scantable.py.
References asap.scantable.scantable._parse_selection(), irc_cs_task_regression.max, tests.test_sdsave.sdsave_unittest_base.nrow, __casac__.ms.ms.nrow(), asap.asapgrid._SDGridPlotter.nrow, and tests.test_sdbaseline.BlparamFileParser.nrow().
def asap.scantable.scantable.parse_maskexpr | ( | self, | |
maskstring | |||
) |
Parse CASA type mask selection syntax (IF dependent). Parameters: maskstring : A string mask selection expression. A comma separated selections mean different IF - channel combinations. IFs and channel selections are partitioned by a colon, ':'. examples: '' = all IFs (all channels) '<2,4~6,9' = IFs 0,1,4,5,6,9 (all channels) '3:3~45;60' = channels 3 to 45 and 60 in IF 3 '0~1:2~6,8' = channels 2 to 6 in IFs 0,1, and all channels in IF8 Returns: A dictionary of selected (valid) IF and masklist pairs, e.g. {'0': [[50,250],[350,462]], '2': [[100,400],[550,974]]}
Definition at line 1471 of file scantable.py.
References asap.scantable.scantable._parse_selection(), asap.scantable.scantable.get_coordinate(), asap.scantable.scantable.get_unit(), irc_cs_task_regression.max, tests.test_cleanhelper.cleanhelper_test.nchan, asap.sbseparator.sbseparator.nchan, task_sdimaging.sdimaging_worker.nchan, asap.asapgrid._SDGridPlotter.nchan, parameter_dictionary.par.nchan(), tests.test_sdsave.sdsave_unittest_base.nrow, __casac__.ms.ms.nrow(), asap.asapgrid._SDGridPlotter.nrow, and tests.test_sdbaseline.BlparamFileParser.nrow().
def asap.scantable.scantable.poly_baseline | ( | self, | |
mask = None , |
|||
order = None , |
|||
insitu = None , |
|||
plot = None , |
|||
getresidual = None , |
|||
showprogress = None , |
|||
minnrow = None , |
|||
outlog = None , |
|||
blfile = None , |
|||
csvformat = None |
|||
) |
\ Return a scan which has been baselined (all rows) by a polynomial. Parameters: insitu: if False a new scantable is returned. Otherwise, the scaling is done in-situ The default is taken from .asaprc (False) mask: an optional mask order: the order of the polynomial (default is 0) plot: plot the fit and the residual. In this each indivual fit has to be approved, by typing 'y' or 'n' getresidual: if False, returns best-fit values instead of residual. (default is True) showprogress: show progress status for large data. default is True. minnrow: minimum number of input spectra to show. default is 1000. outlog: Output the coefficients of the best-fit function to logger (default is False) blfile: Name of a text file in which the best-fit parameter values to be written (default is "": no file/logger output) csvformat: if True blfile is csv-formatted, default is False. Example: # return a scan baselined by a third order polynomial, # not using a mask bscan = scan.poly_baseline(order=3)
Definition at line 3234 of file scantable.py.
References asap.scantable.scantable._get_verify_action(), asap.scantable.scantable.auto_poly_baseline(), __casac__.table.table.copy(), __casac__.coordsys.coordsys.copy(), asap.scantable.scantable.copy(), asap.utils.mask_and(), asap.scantable.pack_progress_params(), and asap.scantable.raise_fitting_failure_exception().
Referenced by asap.scantable.scantable.auto_chebyshev_baseline().
def asap.scantable.scantable.recalc_azel | ( | self | ) |
Recalculate the azimuth and elevation for each position.
Definition at line 3831 of file scantable.py.
References asap.scantable.scantable._add_history().
def asap.scantable.scantable.regrid_channel | ( | self, | |
width = 5 , |
|||
plot = False , |
|||
insitu = None |
|||
) |
\ Regrid the spectra by the specified channel width Parameters: width: The channel width (float) of regridded spectra in the current spectral unit. plot: [NOT IMPLEMENTED YET] plot the original and the regridded spectra. In this each indivual fit has to be approved, by typing 'y' or 'n' insitu: if False a new scantable is returned. Otherwise, the scaling is done in-situ The default is taken from .asaprc (False)
Definition at line 2409 of file scantable.py.
References __casac__.table.table.copy(), __casac__.coordsys.coordsys.copy(), and asap.scantable.scantable.copy().
def asap.scantable.scantable.resample | ( | self, | |
width = 5 , |
|||
method = 'cubic' , |
|||
insitu = None |
|||
) |
\ Return a scan where all spectra have been binned up. Parameters: width: The bin width (default=5) in pixels method: Interpolation method when correcting from a table. Values are 'nearest', 'linear', 'cubic' (default) and 'spline' insitu: if False a new scantable is returned. Otherwise, the scaling is done in-situ The default is taken from .asaprc (False)
Definition at line 2214 of file scantable.py.
def asap.scantable.scantable.reshape | ( | self, | |
first, | |||
last, | |||
insitu = None |
|||
) |
Resize the band by providing first and last channel. This will cut off all channels outside [first, last].
Definition at line 2194 of file scantable.py.
def asap.scantable.scantable.rotate_linpolphase | ( | self, | |
angle | |||
) |
\ Rotate the phase of the complex polarization O=Q+iU correlation. This is always done in situ in the raw data. So if you call this function more than once then each call rotates the phase further. Parameters: angle: The angle (degrees) to rotate (add) by. Example:: scan.rotate_linpolphase(2.3)
Definition at line 3565 of file scantable.py.
References asap.scantable.scantable._add_history().
def asap.scantable.scantable.rotate_xyphase | ( | self, | |
angle | |||
) |
\ Rotate the phase of the XY correlation. This is always done in situ in the data. So if you call this function more than once then each call rotates the phase further. Parameters: angle: The angle (degrees) to rotate (add) by. Example:: scan.rotate_xyphase(2.3)
Definition at line 3586 of file scantable.py.
References asap.scantable.scantable._add_history().
def asap.scantable.scantable.save | ( | self, | |
name = None , |
|||
format = None , |
|||
overwrite = False |
|||
) |
\ Store the scantable on disk. This can be an asap (aips++) Table, SDFITS or MS2 format. Parameters: name: the name of the outputfile. For format 'ASCII' this is the root file name (data in 'name'.txt and header in 'name'_header.txt) format: an optional file format. Default is ASAP. Allowed are: * 'ASAP' (save as ASAP [aips++] Table), * 'SDFITS' (save as SDFITS file) * 'ASCII' (saves as ascii text file) * 'MS2' (saves as an casacore MeasurementSet V2) * 'FITS' (save as image FITS - not readable by class) * 'CLASS' (save as FITS readable by CLASS) overwrite: If the file should be overwritten if it exists. The default False is to return with warning without writing the output. USE WITH CARE. Example:: scan.save('myscan.asap') scan.save('myscan.sdfits', 'SDFITS')
Definition at line 258 of file scantable.py.
def asap.scantable.scantable.scale | ( | self, | |
factor, | |||
tsys = True , |
|||
insitu = None |
|||
) |
\ Return a scan where all spectra are scaled by the given 'factor' Parameters: factor: the scaling factor (float or 1D float list) insitu: if False a new scantable is returned. Otherwise, the scaling is done in-situ The default is taken from .asaprc (False) tsys: if True (default) then apply the operation to Tsys as well as the data
Definition at line 3652 of file scantable.py.
References asap.asapmath._array2dOp(), and asap.scantable.scantable.set_sourcetype().
def asap.scantable.scantable.set_dirframe | ( | self, | |
frame = "" |
|||
) |
\ Set the frame type of the Direction on the sky. Parameters: frame: an optional frame type, default ''. Valid frames are: 'J2000', 'B1950', 'GALACTIC' Example: scan.set_dirframe('GALACTIC')
Definition at line 1055 of file scantable.py.
References asap.scantable.scantable._add_history().
def asap.scantable.scantable.set_doppler | ( | self, | |
doppler = 'RADIO' |
|||
) |
\ Set the doppler for all following operations on this scantable. Parameters: doppler: One of 'RADIO', 'OPTICAL', 'Z', 'BETA', 'GAMMA'
Definition at line 1006 of file scantable.py.
References asap.scantable.scantable._add_history(), and tests.test_imcontsub.list.
def asap.scantable.scantable.set_feedtype | ( | self, | |
feedtype | |||
) |
\ Overwrite the feed type, which might not be set correctly. Parameters: feedtype: 'linear' or 'circular'
Definition at line 993 of file scantable.py.
References asap.scantable.scantable._add_history().
def asap.scantable.scantable.set_freqframe | ( | self, | |
frame = None |
|||
) |
\ Set the frame type of the Spectral Axis. Parameters: frame: an optional frame type, default 'LSRK'. Valid frames are: 'TOPO', 'LSRD', 'LSRK', 'BARY', 'GEO', 'GALACTO', 'LGROUP', 'CMB' Example:: scan.set_freqframe('BARY')
Definition at line 1022 of file scantable.py.
References asap.scantable.scantable._add_history(), and tests.test_imcontsub.list.
Referenced by asap.scantable.scantable._fill().
def asap.scantable.scantable.set_instrument | ( | self, | |
instr | |||
) |
\ Set the instrument for subsequent processing. Parameters: instr: Select from 'ATPKSMB', 'ATPKSHOH', 'ATMOPRA', 'DSS-43' (Tid), 'CEDUNA', and 'HOBART'
Definition at line 979 of file scantable.py.
References asap.scantable.scantable._add_history().
def asap.scantable.scantable.set_restfreqs | ( | self, | |
freqs = None , |
|||
unit = 'Hz' |
|||
) |
\ Set or replace the restfrequency specified and if the 'freqs' argument holds a scalar, then that rest frequency will be applied to all the selected data. If the 'freqs' argument holds a vector, then it MUST be of equal or smaller length than the number of IFs (and the available restfrequencies will be replaced by this vector). In this case, *all* data have the restfrequency set per IF according to the corresponding value you give in the 'freqs' vector. E.g. 'freqs=[1e9, 2e9]' would mean IF 0 gets restfreq 1e9 and IF 1 gets restfreq 2e9. You can also specify the frequencies via a linecatalog. Parameters: freqs: list of rest frequency values or string idenitfiers unit: unit for rest frequency (default 'Hz') Example:: # set the given restfrequency for the all currently selected IFs scan.set_restfreqs(freqs=1.4e9) # set restfrequencies for the n IFs (n > 1) in the order of the # list, i.e # IF0 -> 1.4e9, IF1 -> 1.41e9, IF3 -> 1.42e9 # len(list_of_restfreqs) == nIF # for nIF == 1 the following will set multiple restfrequency for # that IF scan.set_restfreqs(freqs=[1.4e9, 1.41e9, 1.42e9]) # set multiple restfrequencies per IF. as a list of lists where # the outer list has nIF elements, the inner s arbitrary scan.set_restfreqs(freqs=[[1.4e9, 1.41e9], [1.67e9]]) *Note*: To do more sophisticate Restfrequency setting, e.g. on a source and IF basis, use scantable.set_selection() before using this function:: # provided your scantable is called scan selection = selector() selection.set_name('ORION*') selection.set_ifs([1]) scan.set_selection(selection) scan.set_restfreqs(freqs=86.6e9)
Definition at line 1773 of file scantable.py.
References asap.scantable.scantable._add_history(), and asap.scantable.scantable.get_selection().
def asap.scantable.scantable.set_selection | ( | self, | |
selection = None , |
|||
kw | |||
) |
\ Select a subset of the data. All following operations on this scantable are only applied to thi selection. Parameters: selection: a selector object (default unset the selection), or any combination of 'pols', 'ifs', 'beams', 'scans', 'cycles', 'name', 'query' Examples:: sel = selector() # create a selection object self.set_scans([0, 3]) # select SCANNO 0 and 3 scan.set_selection(sel) # set the selection scan.summary() # will only print summary of scanno 0 an 3 scan.set_selection() # unset the selection # or the equivalent scan.set_selection(scans=[0,3]) scan.summary() # will only print summary of scanno 0 an 3 scan.set_selection() # unset the selection
Definition at line 507 of file scantable.py.
Referenced by asap.scantable.scantable._select_copy(), asap.scantable.scantable.auto_quotient(), asap.scantable.scantable.flag_nans(), and asap.scantable.scantable.set_sourcetype().
def asap.scantable.scantable.set_sourcetype | ( | self, | |
match, | |||
matchtype = "pattern" , |
|||
sourcetype = "reference" |
|||
) |
\ Set the type of the source to be an source or reference scan using the provided pattern. Parameters: match: a Unix style pattern, regular expression or selector matchtype: 'pattern' (default) UNIX style pattern or 'regex' regular expression sourcetype: the type of the source to use (source/reference)
Definition at line 3692 of file scantable.py.
References asap.scantable.scantable._add_history(), asap.scantable.scantable.set_selection(), and asap.asapplotter.asapplotter.set_selection().
Referenced by asap.scantable.scantable.scale().
def asap.scantable.scantable.set_spectrum | ( | self, | |
spec, | |||
rowno | |||
) |
Set the spectrum for the current row in the scantable. Parameters: spec: the new spectrum rowno: the row number to set the spectrum for
Definition at line 458 of file scantable.py.
References tests.test_cleanhelper.cleanhelper_test.nchan, asap.sbseparator.sbseparator.nchan, task_sdimaging.sdimaging_worker.nchan, asap.asapgrid._SDGridPlotter.nchan, and parameter_dictionary.par.nchan().
def asap.scantable.scantable.set_unit | ( | self, | |
unit = 'channel' |
|||
) |
\ Set the unit for all following operations on this scantable Parameters: unit: optional unit, default is 'channel'. Use one of '*Hz', 'km/s', 'channel' or equivalent ''
Definition at line 960 of file scantable.py.
References asap.scantable.scantable._add_history(), and tests.test_imcontsub.list.
def asap.scantable.scantable.shift_refpix | ( | self, | |
delta | |||
) |
\ Shift the reference pixel of the Spectra Coordinate by an integer amount. Parameters: delta: the amount to shift by *Note*: Be careful using this with broadband data.
Definition at line 1888 of file scantable.py.
def asap.scantable.scantable.sinusoid_baseline | ( | self, | |
insitu = None , |
|||
mask = None , |
|||
applyfft = None , |
|||
fftmethod = None , |
|||
fftthresh = None , |
|||
addwn = None , |
|||
rejwn = None , |
|||
clipthresh = None , |
|||
clipniter = None , |
|||
plot = None , |
|||
getresidual = None , |
|||
showprogress = None , |
|||
minnrow = None , |
|||
outlog = None , |
|||
blfile = None , |
|||
csvformat = None |
|||
) |
\ Return a scan which has been baselined (all rows) with sinusoidal functions. Parameters: insitu: if False a new scantable is returned. Otherwise, the scaling is done in-situ The default is taken from .asaprc (False) mask: an optional mask applyfft: if True use some method, such as FFT, to find strongest sinusoidal components in the wavenumber domain to be used for baseline fitting. default is True. fftmethod: method to find the strong sinusoidal components. now only 'fft' is available and it is the default. fftthresh: the threshold to select wave numbers to be used for fitting from the distribution of amplitudes in the wavenumber domain. both float and string values accepted. given a float value, the unit is set to sigma. for string values, allowed formats include: 'xsigma' or 'x' (= x-sigma level. e.g., '3sigma'), or 'topx' (= the x strongest ones, e.g. 'top5'). default is 3.0 (unit: sigma). addwn: the additional wave numbers to be used for fitting. list or integer value is accepted to specify every wave numbers. also string value can be used in case you need to specify wave numbers in a certain range, e.g., 'a-b' (= a, a+1, a+2, ..., b-1, b), '<a' (= 0,1,...,a-2,a-1), '>=a' (= a, a+1, ... up to the maximum wave number corresponding to the Nyquist frequency for the case of FFT). default is [0]. rejwn: the wave numbers NOT to be used for fitting. can be set just as addwn but has higher priority: wave numbers which are specified both in addwn and rejwn will NOT be used. default is []. clipthresh: Clipping threshold. (default is 3.0, unit: sigma) clipniter: maximum number of iteration of 'clipthresh'-sigma clipping (default is 0) plot: *** CURRENTLY UNAVAILABLE, ALWAYS FALSE *** plot the fit and the residual. In this each indivual fit has to be approved, by typing 'y' or 'n' getresidual: if False, returns best-fit values instead of residual. (default is True) showprogress: show progress status for large data. default is True. minnrow: minimum number of input spectra to show. default is 1000. outlog: Output the coefficients of the best-fit function to logger (default is False) blfile: Name of a text file in which the best-fit parameter values to be written (default is '': no file/logger output) csvformat: if True blfile is csv-formatted, default is False. Example: # return a scan baselined by a combination of sinusoidal curves # having wave numbers in spectral window up to 10, # also with 3-sigma clipping, iteration up to 4 times bscan = scan.sinusoid_baseline(addwn='<=10',clipthresh=3.0,clipniter=4) Note: The best-fit parameter values output in logger and/or blfile are now based on specunit of 'channel'.
Definition at line 2546 of file scantable.py.
References asap.scantable.scantable.auto_sinusoid_baseline(), __casac__.table.table.copy(), __casac__.coordsys.coordsys.copy(), asap.scantable.scantable.copy(), asap.scantable.pack_progress_params(), and asap.scantable.raise_fitting_failure_exception().
Referenced by asap.scantable.scantable._parse_wn().
def asap.scantable.scantable.smooth | ( | self, | |
kernel = "hanning" , |
|||
width = 5.0 , |
|||
order = 2 , |
|||
plot = False , |
|||
insitu = None |
|||
) |
\ Smooth the spectrum by the specified kernel (conserving flux). Parameters: kernel: The type of smoothing kernel. Select from 'hanning' (default), 'gaussian', 'boxcar', 'rmedian' or 'poly' width: The width of the kernel in pixels. For hanning this is ignored otherwise it defauls to 5 pixels. For 'gaussian' it is the Full Width Half Maximum. For 'boxcar' it is the full width. For 'rmedian' and 'poly' it is the half width. order: Optional parameter for 'poly' kernel (default is 2), to specify the order of the polnomial. Ignored by all other kernels. plot: plot the original and the smoothed spectra. In this each indivual fit has to be approved, by typing 'y' or 'n' insitu: if False a new scantable is returned. Otherwise, the scaling is done in-situ The default is taken from .asaprc (False)
Definition at line 2317 of file scantable.py.
def asap.scantable.scantable.stats | ( | self, | |
stat = 'stddev' , |
|||
mask = None , |
|||
form = '3.3f' , |
|||
row = None |
|||
) |
\ Determine the specified statistic of the current beam/if/pol Takes a 'mask' as an optional parameter to specify which channels should be excluded. Parameters: stat: 'min', 'max', 'min_abc', 'max_abc', 'sumsq', 'sum', 'mean', 'var', 'stddev', 'avdev', 'rms', 'median' mask: an optional mask specifying where the statistic should be determined. form: format string to print statistic values row: row number of spectrum to process. (default is None: for all rows) Example: scan.set_unit('channel') msk = scan.create_mask([100, 200], [500, 600]) scan.stats(stat='mean', mask=m)
Definition at line 578 of file scantable.py.
References asap.scantable.scantable._check_ifs(), asap.scantable.scantable.chan2data(), tests.test_sdsave.sdsave_unittest_base.npol, asap.asapgrid._SDGridPlotter.npol, task_sdtpimaging.sdtpimaging_worker.npol, tests.test_sdsave.sdsave_unittest_base.nrow, __casac__.ms.ms.nrow(), asap.asapgrid._SDGridPlotter.nrow, and tests.test_sdbaseline.BlparamFileParser.nrow().
Referenced by memTest.MemTest.addError(), memTest.MemTest.addFailure(), memTest.MemTest.addSuccess(), memTest.MemTest.report(), and asap.scantable.scantable.stddev().
def asap.scantable.scantable.stddev | ( | self, | |
mask = None |
|||
) |
\ Determine the standard deviation of the current beam/if/pol Takes a 'mask' as an optional parameter to specify which channels should be excluded. Parameters: mask: an optional mask specifying where the standard deviation should be determined. Example:: scan.set_unit('channel') msk = scan.create_mask([100, 200], [500, 600]) scan.stddev(mask=m)
Definition at line 706 of file scantable.py.
References asap.scantable.scantable.stats(), and gprof2dot.PstatsParser.stats.
def asap.scantable.scantable.summary | ( | self, | |
filename = None |
|||
) |
\ Print a summary of the contents of this scantable. Parameters: filename: the name of a file to write the putput to Default - no file output
Definition at line 416 of file scantable.py.
def asap.scantable.scantable.swap_linears | ( | self | ) |
\ Swap the linear polarisations XX and YY, or better the first two polarisations as this also works for ciculars.
Definition at line 3607 of file scantable.py.
References asap.scantable.scantable._add_history().
asap.scantable.scantable._math [private] |
Definition at line 216 of file scantable.py.
Definition at line 3551 of file scantable.py.
Definition at line 3549 of file scantable.py.
Definition at line 3550 of file scantable.py.