PSF Photometry (photometry.PSFPhotometry)
PSF Photometry.
Code author: Rasmus Handberg <rasmush@phys.au.dk>
- class photometry.PSFPhotometry(*args, **kwargs)[source]
- Bases: - BasePhotometry- __init__(*args, **kwargs)[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)
- 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 
 - clear_cache()
- Clear internal cache 
 - close()
- Close photometry object and close all associated open file handles. 
 - default_stamp()
- 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()
- 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. 
 - get_pixel_grid()
- 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)
- 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)
- 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)
- 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)
- 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