Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.mso.anu.edu.au/~mwhite/pynifs-doc/pynifs.nifscube-class.html
Дата изменения: Unknown Дата индексирования: Fri Feb 28 01:50:45 2014 Кодировка: Поисковые слова: vallis |
Home | Trees | Indices | Help |
---|
|
A class to hold all the information from a NIFS-produced data cube. The class is capable of handling both single- and multie-extension FITS files. Attributes: scidata - A three-dimensional masked array containing the science data. This has been loaded from either the PRIMARY header (for a single-extension FITS file) or the science header (for a multi- extenstion file.) scidata follows the Python convetion for reference indices, that is, if x and y are the spatial dimensions, and z is the spectral dimension, then data values can be found using scidata[z][y][x]. vars - A three-dimensional masked array containing the variances of the data points. dq - A three-dimensional array holding the pixel quality flags for the data. Follows the NIFS convention of 0 = good pixel, 1 = bad (flagged) pixel) xs, dx - The first pixel value, and pixel increment, in the first spatial direction (x). These are simply the values of CRVAL1 and CDELT1 from the FITS header, respectively. ys, dy, - As above, but for the second spatial dimension (y) and spectral zs, dz - dimension (z) respectively. They are the values of CRVAL2/CDELT2 and CRVAL3/CDELT3, respectively. xpts - A single-dimensional numpy array containing the list of x- values for this data. These values are computed from the CRVAL1 and CDELT1 in the FITS file header, and are stored in the same values as used in the header. ypts, zpts- As above, but for the second spatial dimension (y) and the spectral dimension (z). Computed from CRVAL2/CDELT2 and CRVAL3/CDELT3 respectively. nz,ny,nz - Number of pixels in each dimension. xu, yu - Strings denoting the units of the spatial values. Almost always 'arcsec'. zu - String denoting the units of the spectral values. Generally 'A' (angstroms) or 'um' (microns). pxoff - Pixel coordinate offset (for use in plotting) pyoff - Pixel coordinate offset (for use in plotting) xptsoff - List of offset pixel coordinates (for use in plotting) yptsoff - List of offset pixel coordinates (for use in plotting) du - Units of the data Methods: getdata(self) - Returns the data portion of the fitscube as a masked array. save(self) - Saves a copy of the current nifscube object to disk, using Python's pickle module. This is not the fastest or most memory efficient method of doing this (writing a long function to write a text file would be faster), but is the simplest and less prone to read/write errors.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|
Returns the data content of scidata as a numpy array. Inputs: filename - File to save to. Defaults to None, in which case a filename based on a date/time stamp will be used. Returns: nscidata - The scidata from the cube, as an (unasked) numpy array. |
Save the current fits cube to file. Will be saved using a datetime stamp as the file identifier. Inputs: filename - File to save to. Defaults to None, in which case a filename based on a date/time stamp will be used. Returns: Nil. A file is saved to the current working directory containing this fitscube instance. |
Mask any pixels in the 3D data structure that are assigned negative variance values (this will occur occasionally, if the DQ pixel array hasn't caught all the bad pixels.) Inputs: Nil. Returns: Nil. The fitscube instance is updated in-situ. |
Returns a spectrum from the specified spaxel, over the designated wavelength or velocity range. Inputs: i, j - Spaxel x- and y-indices, respectively. wrange - A two-component array, giving the start and end wavelengths to be plotted. Wavelengths must be passed in the same units as used in the fitscube instance. If set to None, plotSpaxSpec will then look for a designated velocity range and rest wavelength to plot. Can also be passed a special argument, 'all', in which case the entire recorded spectrum of the spaxel will be shown. Defaults to 'all'. vrange - A two-component array, giving the start and end radial velocities to plot. Must be passed in conjunction with a restwavl. If both a wrange and vrange are passed, the wrange will take precendence. Defaults to None. restwavl - The rest wavelength to be used in determination of radial velocities, in m. Will not be considered if a wavelength range is provided instead. Must be passed in conjunction with a velocity range - if no rest wavelength is specified, plotSpaxSpec will return an error. Defaults to None. Returns: spec - A one-dimensional masked array, containing the data values for this spaxel spectrum. specvars - The corresponding one-dimensional variance array for this spaxel spectrum. specwavl - A one-dimensional array, holding the wavelength markers (i.e. the x-axis values) for this spaxel spectrum. specwavl will be returned in the same units as the fitscube instance. |
Plots the spectrum from the selected spaxel over the designated wavelength or velocity range. Inputs: i, j - Spaxel x- and y-indices, respectively. wrange - A two-component array, giving the start and end wavelengths to be plotted. Wavelengths must be passed in the same units as used in the fitscube instance. If set to None, plotSpaxSpec will then look for a designated velocity range and rest wavelength to plot. Can also be passed a special argument, 'all', in which case the entire recorded spectrum of the spaxel will be shown. Defaults to 'all'. vrange - A two-component array, giving the start and end radial velocities to plot. Must be passed in conjunction with a restwavl. If both a wrange and vrange are passed, the wrange will take precendence. Defaults to None. restwavl - The rest wavelength to be used in determination of radial velocities, in m. Will not be considered if a wavelength range is provided instead. Must be passed in conjunction with a velocity range - if no rest wavelength is specified, plotSpaxSpec will return an error. Defaults to None. linewidth - The line width to be used in the resulting plots. Defaults to 2. Returns: Nil. A plot is made to the current figure. |
Extract an average spectrum from a circular aperture of radius r centered on coordinates (x,y). Spaxels are included inside the aperture based on their centre position. No checking is done on the coordinate inputs. This means that you can specify an aperture outside the extent of the cube. If the aperture does not include any spaxel centres, an array of zeros will be returned. Inputs: x, y - The x- and y-coordinates of the aperture centre, in units of fitscube.xu and fitscube.yu. r - The aperture radius, in units fitscube.zu. useoffsets - Optional. Boolean value specifying whether to use the offset coordinates (True) or not (False). Defaults to False. Returns: spec - The average spectrum in the aperture. This is determined by summing together the spectra from the selected spaxels, and then dividing by the number of selected spaxels. Will be returned in units of fitscube.zu. This will be a one-dimensional array with the same dimensions as fitscube.zpts. |
Subtract a continuum spectrum from every spaxel in the data cube. Continuum spectrum is formed by averaging over a number of circular apertures, scaling the continuum spectrum to match the science spectrum over the region of interest, then subtracting. Inputs: restwavl - The rest wavelength for determining the continuum windows. Must be given in units of m. v1, v2 - The start velocity of the velocity slices. Given in units of km/s. vdelt - The width of the velocity slices. Given in km/s. apers - List of tuples describing each aperture to be used. Should be given as [(x1, y1, r1), (x2, y2, r2), ...]. useoffsets -Optional. Boolean value specifying whether to use the offset coordinates (True) or not (False). Defaults to True. Returns: Nil. scidata array of fitscube instance is modified in place. Nothing is done to the vars or dq arrays, as it is assumed that the continuum is perfectly known from this procedure. |
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Fri Jan 3 16:10:27 2014 | http://epydoc.sourceforge.net |