scopesim.effects.data_container.DataContainer#
- class scopesim.effects.data_container.DataContainer(filename: Path | str | None = None, table: Table | None = None, array_dict: Mapping | None = None, cmds: UserCommands | None = None, **kwargs)#
Bases:
objectA class to hold data (file(s)) needed by some Effects objects.
- Parameters:
filename (str, optional) – Path to file containing data. Accepted formats: ASCII table, FITS table, FITS image
table (astropy.Table, optional) – An astropy Table containing data
array_dict (dict, optional) – 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.- data#
A generic property method which returns the data from the file. Any function calling this should be prepared to handle both data formats
- Type:
astropy.Table, fits.HDUList
- table#
If the file has a table format (ASCII of FITS) it is read in immediately and stored in .table
- Type:
astropy.Table
- _file#
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.
- Type:
HDUList pointer
- __init__(filename: Path | str | None = None, table: Table | None = None, array_dict: Mapping | None = None, cmds: UserCommands | None = None, **kwargs)#
Methods
__init__([filename, table, array_dict, cmds])get_data([ext, layer])Return either a table or a ImageHDU object.
validate(etype)Attributes