BasePhotometry (photometry.BasePhotometry)
- class photometry.BasePhotometry(starid, input_folder, output_folder, datasource='ffi', sector=None, camera=None, ccd=None, cadence=None, plot=False, cache='basic', version=6)[source]
- The basic photometry class for the TASOC Photometry pipeline. All other specific photometric algorithms will inherit from this. - starid
- TIC number of star being processed. - Type:
- int 
 
 - input_folder
- Root directory where files are loaded from. - Type:
- str 
 
 - output_folder
- Root directory where output files are saved. - Type:
- str 
 
 - plot
- Indicates wheter plots should be created as part of the output. - Type:
- bool 
 
 - plot_folder
- Directory where plots are saved to. - Type:
- str 
 
 - method
- String indication the method of photometry. - Type:
- str 
 
 - sector
- TESS observing sector. - Type:
- int 
 
 - camera
- TESS camera (1-4). - Type:
- int 
 
 - ccd
- TESS CCD (1-4). - Type:
- int 
 
 - data_rel
- Data release number. - Type:
- int 
 
 - n_readout
- Number of frames co-added in each timestamp. - Type:
- int 
 
 - header
- Primary header, either from TPF or HDF5 files. - Type:
- dict-like 
 
 - target
- Catalog information about the main target. - Type:
- dict 
 
 - target_pos_column
- Main target CCD column position. - Type:
- float 
 
 - target_pos_row
- Main target CCD row position. - Type:
- float 
 
 - target_pos_column_stamp
- Main target CCD column position in stamp. - Type:
- float 
 
 - target_pos_row_stamp
- Main target CCD row position in stamp. - Type:
- float 
 
 - wcs
- World Coordinate system solution. - Type:
- astropy.wcs.WCS
 
 - lightcurve
- Table to be filled with an extracted lightcurve. - Type:
- astropy.table.Table
 
 - final_phot_mask
- Mask indicating which pixels were used in extraction of lightcurve. - Trueif used,- Falseotherwise.- Type:
- numpy.ndarray 
 
 - final_position_mask
- Mask indicating which pixels were used in extraction of positions. - Trueif used,- Falseotherwise.- Type:
- numpy.ndarray 
 
 - additional_headers
- Additional headers to be included in FITS files. - Type:
- dict 
 
 - Code author: Rasmus Handberg <rasmush@phys.au.dk> - __init__(starid, input_folder, output_folder, datasource='ffi', sector=None, camera=None, ccd=None, cadence=None, plot=False, cache='basic', version=6)[source]
- Initialize the photometry object. - Parameters:
- starid (int) – TIC number of star to be processed. 
- input_folder (str) – Root directory where files are loaded from. 
- output_folder (str) – Root directory where output files are saved. 
- datasource (str) – Source of the data. Options are - 'ffi'or- 'tpf'. Default is- 'ffi'.
- plot (bool) – Create plots as part of the output. Default is - False.
- camera (int) – TESS camera (1-4) to load target from (Only used for FFIs). 
- ccd (int) – TESS CCD (1-4) to load target from (Only used for FFIs). 
- cadence (int, optional) – Not used for - datasource='ffi'.
- cache (str) – Optional values are - 'none',- 'full'or- 'basic'(Default).
- version (int) – Data release number to be added to headers. Default=6. 
 
- Raises:
- Exception – If starid could not be found in catalog. 
- FileNotFoundError – If input file (HDF5, TPF, Catalog) could not be found. 
- ValueError – On invalid datasource. 
- ValueError – If - cameraand- ccdis not provided together with- datasource='ffi'.
 
 
 - catalog_attime(time)[source]
- Catalog of stars, calculated at a given time-stamp, so CCD positions are modified according to the measured spacecraft jitter. - Parameters:
- time (float) – Time in MJD when to calculate catalog. 
- Returns:
- Table with the same columns as catalog(),
- but with - column,- row,- column_stampand- row_stampcalculated at the given timestamp.
 
- Table with the same columns as 
- Return type:
- astropy.table.Table 
 - See also 
 - default_stamp()[source]
- The default size of the stamp to use. - The stamp will be centered on the target star position, with a width and height specified by this function. The stamp can later be resized using - resize_stamp().- Returns:
- Number of rows int: Number of columns 
- Return type:
- int 
 - Note - This function is only used for FFIs. For postage stamps the default stamp is the entire available postage stamp. - See also 
 - delete_plots()[source]
- Delete all files in - plot_folder.- If plotting is not enabled, this method does nothing and will therefore leave any existing files in the plot folder, should it already exists. 
 - do_photometry()[source]
- Run photometry algorithm. - This should fill the - lightcurvetable with all relevant parameters.- Returns:
- The status of the photometry. 
- Raises:
- NotImplementedError – 
 
 - get_pixel_grid()[source]
- Returns mesh-grid of the pixels (1-based) in the stamp. - Returns:
- Meshgrid of pixel coordinates in the current stamp. 
- Return type:
- tuple(cols, rows) 
 
 - photometry(*args, **kwargs)[source]
- Run photometry. - Will run the - do_photometry()method and check some of the output and calculate various performance metrics.- See also 
 - report_details(error=None, skip_targets=None)[source]
- Report details of the processing back to the overlying scheduler system. - Parameters:
- error (string) – Error message the be logged with the results. 
- skip_targets (list) – List of starids that can be safely skipped. 
 
 
 - resize_stamp(down=None, up=None, left=None, right=None, width=None, height=None)[source]
- Resize the stamp in a given direction. - Parameters:
- down (int, optional) – Number of pixels to extend downwards. 
- up (int, optional) – Number of pixels to extend upwards. 
- left (int, optional) – Number of pixels to extend left. 
- right (int, optional) – Number of pixels to extend right. 
- width (int, optional) – Set the width of the stamp to this number of pixels. This takes presendence over - leftand- rightif they are also provided.
- height (int, optional) – Set the height of the stamp to this number of pixels. This takes presendence over - upand- downif they are also provided.
 
- Returns:
- True if the stamp could be resized, False otherwise. 
- Return type:
- bool 
 
 - save_lightcurve(output_folder=None, version=None)[source]
- Save generated lightcurve to file. - Parameters:
- output_folder (string, optional) – Path to directory where to save lightcurve. If - Nonethe directory specified in the attribute- output_folderis used.
- version (integer, optional) – Version number to add to the FITS header and file name. If not set, the - versionis used.
 
- Returns:
- Path to the generated file. 
- Return type:
- string 
 
 - property MovementKernel
- Movement Kernel which allows calculation of positions on the focal plane as a function of time. Instance of - image_motion.ImageMovementKernel.
 - property aperture
- Flags for each pixel, as defined by the TESS data product manual. - Returns:
- 2D array of flags for each pixel. 
- Return type:
- numpy.array 
 
 - property backgrounds
- Iterator that will loop through the background-image stamps. - Returns:
- Iterator which can be used to loop through the background-image stamps. 
- Return type:
- iterator 
 - Note - For each image, this function will actually load the necessary data from disk, so don’t loop through it more than you absolutely have to to save I/O. - Example - >>> pho = BasePhotometry(starid) >>> for img in pho.backgrounds: >>> print(img) - See also 
 - property backgrounds_cube
- Image cube containing all the background images as a function of time. - Returns:
- Three dimentional array with shape (rows, cols, times), where
- rowsis the number of rows in the image,- colsis the number of columns and- timesis the number of timestamps.
 
- Three dimentional array with shape 
- Return type:
- ndarray 
 - Example - >>> pho = BasePhotometry(starid) >>> print(pho.backgrounds_cube.shape): >>> (10, 10, 1399) - See also 
 - property catalog
- Catalog of stars in the current stamp. - The table contains the following columns: * - starid: TIC identifier. *- tmag: TESS magnitude. *- ra: Right ascension in degrees at time of observation. *- dec: Declination in degrees at time of observation. *- row: Pixel row on CCD. *- column: Pixel column on CCD. *- row_stamp: Pixel row relative to the stamp. *- column_stamp: Pixel column relative to the stamp.- Returns:
- Table with all known stars falling within the current stamp. 
- Return type:
- astropy.table.Table
 - Example - If - phois an instance of- BasePhotometry:- >>> pho.catalog['tmag'] >>> pho.catalog[('starid', 'tmag', 'row', 'column')] - See also 
 - property images
- Iterator that will loop through the image stamps. - Returns:
- Iterator which can be used to loop through the image stamps. 
- Return type:
- iterator 
 - Note - The images has had the large-scale background subtracted. If needed the backgrounds can be added again from - backgrounds().- Note - For each image, this function will actually load the necessary data from disk, so don’t loop through it more than you absolutely have to to save I/O. - Example - >>> pho = BasePhotometry(starid) >>> for img in pho.images: >>> print(img) - See also 
 - property images_cube
- Image cube containing all the images as a function of time. - Returns:
- Three dimentional array with shape (rows, cols, times), where
- rowsis the number of rows in the image,- colsis the number of columns and- timesis the number of timestamps.
 
- Three dimentional array with shape 
- Return type:
- ndarray 
 - Note - The images has had the large-scale background subtracted. If needed the backgrounds can be added again from - backgrounds()or- backgrounds_cube().- Example - >>> pho = BasePhotometry(starid) >>> print(pho.images_cube.shape) >>> (10, 10, 1399) - See also 
 - property images_err
- Iterator that will loop through the uncertainty image stamps. - Returns:
- Iterator which can be used to loop through the uncertainty image stamps. 
- Return type:
- iterator 
 - Example - >>> pho = BasePhotometry(starid) >>> for imgerr in pho.images_err: >>> print(imgerr) - See also 
 - property images_err_cube
- Image cube containing all the uncertainty images as a function of time. - Returns:
- Three dimentional array with shape (rows, cols, times), where
- rowsis the number of rows in the image,- colsis the number of columns and- timesis the number of timestamps.
 
- Three dimentional array with shape 
- Return type:
- ndarray 
 - Example - >>> pho = BasePhotometry(starid) >>> print(pho.images_err_cube.shape) >>> (10, 10, 1399) - See also 
 - property pixelflags
- Iterator that will loop through the pixel flag images. - Returns:
- Iterator which can be used to loop through the pixel flags images. 
- Return type:
- iterator 
 - Example - >>> pho = BasePhotometry(starid) >>> for img in pho.pixelflags: >>> print(img) - See also 
 - property pixelflags_cube
- Cube containing all pixel flag images as a function of time. - Returns:
- Three dimentional array with shape (rows, cols, ffi_times), where
- rowsis the number of rows in the image,- colsis the number of columns and- ffi_timesis the number of timestamps in the FFIs.
 
- Three dimentional array with shape 
- Return type:
- ndarray 
 - Note - This function will only return flags on the timestamps of the FFIs, even though an TPF is being processed. - Example - >>> pho = BasePhotometry(starid) >>> print(pho.pixelflags_cube.shape): >>> (10, 10, 1399) - See also 
 - property psf
- Point Spread Function. - Returns:
- PSF object for the given target position. 
- Return type:
 - See also 
 - property settings
- Pipeline settings and constants. - Returns:
- Pipeline settings, loaded from settings file. 
- Return type:
- configparser.ConfigParser
 - See also - load_settings().
 - property stamp
- Tuple indicating the stamps position within the larger image. - Returns:
- Tuple of (row_min, row_max, col_min, col_max). 
- Return type:
- tuple 
 
 - property sumimage
- Average image. - Calculated as the mean of all good images (quality=0) as a function of time. For FFIs this has been pre-calculated and for postage-stamps it is calculated on-the-fly when needed. - Returns:
- Summed image across all valid timestamps. 
- Return type:
- numpy.array 
 
 
Photometry Status (photometry.STATUS)
- class photometry.STATUS(value)[source]
- Status indicator of the status of the photometry. - ABORT = 4
- The calculation was aborted. 
 - ERROR = 2
- Encountered a catastrophic error that I could not recover from. 
 - OK = 1
- Everything has gone well. 
 - SKIPPED = 5
- The target was skipped because the algorithm found that to be the best solution. 
 - STARTED = 6
- The calculation has started, but not yet finished. 
 - UNKNOWN = 0
- The status is unknown. The actual calculation has not started yet. 
 - WARNING = 3
- Something is a bit fishy. Maybe we should try again with a different algorithm?