CubeFactory
- class astrocut.CubeFactory(max_memory: int = 50)[source]
Bases:
objectClass for creating image cubes. This class is built to accept TESS SPOC FFI files, but can be extended to work with other types of image files.
- Parameters
- max_memoryint
The maximum amount of memory to make available for building the data cube in GB. Note, this is the maximum amount of space to be used for the cube array only, so should not be set to the full amount of memory on the system.
Methods
make_cube(file_list, cube_file, sector, max_memory, verbose)
Turns a list of FITS image files into one large data cube.
update_cube(file_list, cube_file, sector, max_memory, verbose)
Updates an existing cube file with new FITS images.
Setting up the class members
Attributes Summary
Methods Summary
make_cube(file_list[, cube_file, sector, ...])Turns a list of FITS image files into one large data cube.
update_cube(file_list, cube_file[, sector, ...])Updates an existing cube file with new FITS images.
Attributes Documentation
- ERROR_MSG = 'One or more incorrect file types were input. Please input TICA FFI files when using ``TicaCubeFactory``, and SPOC FFI files when using ``CubeFactory``.'
Methods Documentation
- make_cube(file_list: List[str], cube_file: str = 'img-cube.fits', sector: Optional[int] = None, max_memory: int = 50, verbose: bool = True)[source]
Turns a list of FITS image files into one large data cube. Input images must all have the same footprint and resolution. The resulting data cube is transposed for quicker cutouts. This function can take some time to run, exactly how much time will depend on the number of input files and the maximum allowed memory. The runtime will be fastest if the entire data cube can be held in memory, however that can be quite large (~40GB for a full TESS main mission sector, 3 times that for a TESS extended mission sector).
- Parameters
- file_listarray
The list of FITS image files to cube.
- cube_filestr
Optional. The filename/path to save the output cube in.
- sectorint
Optional. TESS sector to add as header keyword (not present in FFI files).
- max_memoryfloat
Optional, default is 50. The maximum amount of memory to make available for building the data cube in GB. Note, this is the maximum amount of space to be used for the cube array only, so should not be set to the full amount of memory on the system.
- verbosebool
Optional. If True, intermediate information is printed.
- Returns
- response: string or None
If successful, returns the path to the cube FITS file, if unsuccessful returns None.
- update_cube(file_list: List[str], cube_file: str, sector: Optional[int] = None, max_memory: int = 50, verbose: bool = True)[source]
Updates an existing cube file with new FITS images. Same functionality as
CutoutFactory.make_cube, but working on an already existing file rather than building a new one. This function will:Create a new cube consisting of the new images that will be appended to the existing cube
Update primary header keywords to reflect the update to the file
Expand the file size of the FITS file containing the cube, to accomodate for the updated one
- Parameters
- file_listlist
The list of FITS image files to add to the cube.
- cube_filestr
The filename/path to the existing cube FITS file.
- sectorint
Optional. TESS sector to add as header keyword (not present in FFI files).
- max_memoryfloat
Optional, default is 50. The maximum amount of memory to make available for building the data cube in GB. Note, this is the maximum amount of space to be used for the cube array only, so should not be set to the full amount of memory on the system.
- verbosebool
Optional. If True, intermediate information is printed.
- Returns
- response: string or None
If successful, returns the path to the updated cube FITS file, if unsuccessful returns None.