scopesim.effects.data_container module¶
- class scopesim.effects.data_container.DataContainer(filename=None, table=None, array_dict=None, cmds=None, **kwargs)[source]¶
Bases:
object
A class to hold data files needed by all Effects objects.
- Parameters:
- filenamestr
Path to file containing data. Accepted formats: ASCII table, FITS table, FITS image
- tableastropy.Table
An astropy Table containing data
- array_dictdict
A dictionary out of which an astropy.Table object can be constructed.
- kwargs
addition meta data
Notes
If a table is to be generated from an
array_dict
parameter, column units can be passed as keyword arguments (kwargs) using the following format:Datacontainer(... , <column name>_unit="<unit string>")
where unit string is a string recognised by
astropy.units
. Any additional table meta-data can also be passed using this format.- Attributes:
- dataastropy.Table, fits.HDUList
A generic property method which returns the data from the file. Any function calling this should be prepared to handle both data formats
- metadict
Contains all meta data read in from the file’s header, and/or passed via kwargs.
- tableastropy.Table
If the file has a table format (ASCII of FITS) it is read in immediately and stored in
.table
- _fileHDUList pointer
If the file is a FITS image or cube, the data is only read in when needed in order to save on memory usage.
._file
contains a pointer to the data open FITS file.
- property data¶
- get_data(ext=0, layer=None)[source]¶
Return either a table or a ImageHDU object.
Note
Use this call for reading in individual FITS extensions.
The
.data
handle will read in all extensions and return an HDUList object- Parameters:
- extint
- layerint
If the FITS extension is a data cube, layer corresponds to a slice from this cube of
<ImageHDU>.data[layer, :, :]
- Returns:
- data_setastropy.Table, fits.ImageHDU
- property is_fits¶
- meta = None¶