aosss.filetypes package¶
Submodules¶
aosss.filetypes.filefullcube module¶
-
class
aosss.filetypes.filefullcube.
FileFullCube
¶ Bases:
f311.filetypes.datafile.DataFile
FITS WebSim Compass Data Cube
“full” opposed to “sparse”
Note normally, the DataFile classes load operation reads all contents and closes the file, however this class keeps the file open as an astropy.io.fits.HDUList object in self.hdulist, because apparently many HDUList methods need the file open to work, even after calling HDUList.readall()
-
attrs
= ['wcube']¶
-
default_filename
= 'default.fullcube'¶
-
description
= ''¶
-
editors
= ['cubeed.py']¶
-
flag_txt
= False¶
-
aosss.filetypes.filepar module¶
aosss.filetypes.filesparsecube module¶
aosss.filetypes.filesplist module¶
” List of spectra sharing same wavenumber axis. Uses FITS format
aosss.filetypes.fullcube module¶
-
class
aosss.filetypes.fullcube.
FullCube
(hdu=None)¶ Bases:
a99.parts.AttrsPart
X-Y-wavelength cube
Based on IDL source file chris_J4000.pro
Data is stored primarily in self.hdu, with a few other relevant attributes
- Notes on FITS HDU:
- data is stored in reverse dimensions, i.e., (z, y, x)
- CDELT1, CRVAL1 refer to x
- CDELT2, CRVAL2 refer to y
- CDELT3, CRVAL3 refer to z
-
attrs
= ['hdu']¶
-
create1
(R, dims, hr_pix_size, hrfactor)¶ Creates FITS HDU, including the cube full with zeros
dims: (nlambda, height, width)
-
flag_created
¶ Whether the data cube has already been created
-
flag_wavelengthed
¶ Whether wavelength information is already present
-
from_hdu
(hdu)¶ Sets self.hdu and with HDU object passed. Warning: may change HDU object.
Default HDU headers:
- CDELT1 defaults to 1
- CDELT2 defaults to CDELT1
- CRDELT3 defaults to 1
- CRVAL3 defaults to 0
-
get_spectrum
(x, y)¶ Returns spectrum at coordinate x, y (copied vectors)
Note coordinate (x=0, y=0) corresponds to lower left pixel of cube cross-section
-
set_wavelength
(w)¶
aosss.filetypes.sparsecube module¶
-
class
aosss.filetypes.sparsecube.
SparseCube
(hdu=None)¶ Bases:
aosss.filetypes.spcollection.SpectrumCollection
Spectral cube allocated in a way that will take less space.
Each spectrum has its (x, y, z) coordinate for placement inside the cube and is layed from this point along the z-axis (i.e., wavelength axis)
Saved in FITS format, as it is small and can be opened by other programs
-
R
¶
-
add_spectrum
(sp, default_pixel_x=None, default_pixel_y=None)¶ “Paints” pixel with given spectrum
Parameters: - sp – Spectrum instance
- default_pixel_x – pixel x-coordinate if sp.pixel_x is None
- default_pixel_y – pixel y-coordinate if sp.pixel_y is None
Note coordinate (x=0, y=0) corresponds to lower left pixel of cube cross-section
-
attrs
= ['fieldnames', 'more_headers', 'spectra', 'R', 'hrfactor', 'hr_pix_size']¶
-
crop
(x0=None, x1=None, y0=None, y1=None, lambda0=None, lambda1=None)¶ Reduces region, discards spectra, cuts remaining spectra
- intervals:
- X - [x0, x1] Y - [y0, y1] wavelength - [lambda0, lambda1]
Note x1, y1, lambda 1 included in interval (not pythonic).
-
delta_lambda
¶
-
enable_update
()¶
-
from_full_cube
(full_cube)¶
-
from_hdulist
(hdul)¶ Checks for required field names existence
Toad successfully, file must have the following field names: ‘PIXEL-X’, ‘PIXEL-Y’, ‘Z-START’
-
get_pixel
(x, y, flag_copy=True)¶ Creates spectrum on-the-fly containing all spectra merged for pixel (x, y)
Note if there is no spectra at point (x, y), returns an empty spectrum, for speed
Parameters: - x – 0-based pixel coordinate
- y – 0-based pixel coordinate
- flag_copy – disable vector copies to speed up but don’t the spectrum
-
height
¶
-
hr_pix_size
¶
-
hrfactor
¶
-
merge_with
(other, default_pixel_x=None, default_pixel_y=None)¶ Adds spectra from other SpectrumCollection to self
-
to_full_cube
()¶ Creates FullCube object
-
width
¶
-
aosss.filetypes.spcollection module¶
” List of spectra sharing same wavenumber axis. Uses FITS format
-
class
aosss.filetypes.spcollection.
SpectrumCollection
¶ Bases:
a99.parts.AttrsPart
Base class, maintains spectra with “more headers”; to/from HDU without much interpretation
-
add_spectrum
(sp)¶ Adds spectrum, no content check
Updates self.fieldnames to expose sp.more_headers
Nullifies spectrum filename and assigns the file basename to more_headers[“ORIGIN”]
-
attrs
= ['fieldnames', 'more_headers', 'spectra']¶
-
clear
()¶ Removes all spectra from the collection
-
collect_fieldnames
()¶ Returns a list of unique field names union’ing all spectra field names
-
delete_spectra
(indexes)¶ Deletes spectra given a list of 0-based indexes
-
from_hdulist
(hdul)¶
-
merge_with
(other, default_pixel_x=None, default_pixel_y=None)¶ Adds spectra from other SpectrumCollection to self
-
to_hdulist
()¶
-
aosss.filetypes.splist module¶
” List of spectra sharing same wavenumber axis. Uses FITS format
-
class
aosss.filetypes.splist.
SpectrumList
(hdulist=None)¶ Bases:
aosss.filetypes.spcollection.SpectrumCollection
-
add_spectrum
(sp)¶ Adds spectrum. Updates internal wavelength vector to maximum possible
If wavelength vectors do not match, it will resample the new spectrum, and may expand self.wavelength, but will not shift the x-position of existing points
-
attrs
= ['fieldnames', 'more_headers', 'spectra', 'wavelength']¶
-
delete_spectra
(indexes)¶
-
delta_lambda
¶
-
enable_update
()¶
-
flag_wled
¶ Wavelength problem already resolved?
-
from_full_cube
(full_cube)¶ Adds all cube “pixels” (i.e., spectra) that are not all zero
Very similar to SparseCube.from_full_cube() (bit simpler)
-
from_hdulist
(hdul)¶
-
matrix
()¶ Returns a (spectrum)x(wavelength) matrix of flux values
-
to_csv
(sep=', ')¶ Generates tabulated text
Returns list of strings
-