Skip to content

Documentation for FFIMachine

Subclass of Machine for working with FFI data. It is a subclass of Machine

__init__(self, time, flux, flux_err, ra, dec, sources, column, row, wcs=None, limit_radius=32.0, n_r_knots=10, n_phi_knots=15, time_nknots=10, time_resolution=200, time_radius=8, cut_r=6, rmin=1, rmax=16, sparse_dist_lim=40, quality_mask=None, meta=None) special

Repeated optional parameters are described in Machine.

Parameters:

Name Type Description Default
time numpy.ndarray

Time values in JD

required
flux numpy.ndarray

Flux values at each pixels and times in units of electrons / sec. Has shape [n_times, n_rows, n_columns]

required
flux_err numpy.ndarray

Flux error values at each pixels and times in units of electrons / sec. Has shape [n_times, n_rows, n_columns]

required
ra numpy.ndarray

Right Ascension coordinate of each pixel

required
dec numpy.ndarray

Declination coordinate of each pixel

required
sources pandas.DataFrame

DataFrame with source present in the images

required
column np.ndarray

Data array containing the "columns" of the detector that each pixel is on.

required
row np.ndarray

Data array containing the "columns" of the detector that each pixel is on.

required
wcs astropy.wcs

World coordinates system solution for the FFI. Used for plotting.

None
quality_mask np.ndarray or booleans

Boolean array of shape time indicating cadences with bad quality.

None
meta dictionary

Meta data information related to the FFI

None

Attributes:

Name Type Description
meta dictionary

Meta data information related to the FFI

wcs astropy.wcs

World coordinates system solution for the FFI. Used for plotting.

flux_2d numpy.ndarray

2D image representation of the FFI, used for plotting. Has shape [n_times, image_height, image_width]

image_shape tuple

Shape of 2D image

from_file(fname, extension=1, cutout_size=None, cutout_origin=[0, 0], correct_offsets=False, plot_offsets=False, magnitude_limit=18, dr=3, sources=None, **kwargs) staticmethod

Reads data from files and initiates a new object of FFIMachine class.

Parameters:

Name Type Description Default
fname str or list of strings

File name or list of file names of the FFI files.

required
extension int

Number of HDU extension to be used, for Kepler FFIs this corresponds to the channel number. For TESS FFIs, it correspond to the HDU extension containing the image data (1).

1
cutout_size int

Size of the cutout in pixels, assumed to be squared

None
cutout_origin tuple of ints

Origin pixel coordinates where to start the cut out. Follows matrix indexing

[0, 0]
correct_offsets boolean

Check and correct for coordinate offset due to wrong WCS. It is off by default.

False
plot_offsets boolean

Create diagnostic plot for oordinate offset correction.

False
magnitude_limit float

Limiting magnitude to query Gaia catalog.

18
dr int

Gaia data release to be use, default is 3, options are DR2 and EDR3

3
sources pandas.DataFrame

Catalog with sources to be extracted by PSFMachine

None
**kwargs dictionary

Keyword arguments that defines shape model in a machine class object. See psfmachine.Machine for details.

{}

Returns:

Type Description
Machine object

A Machine class object built from the FFI.

load_shape_model(self, input=None, plot=False)

Loads a PRF model from disk.

Parameters:

Name Type Description Default
input str, None

Input file name. If None, one will be generated.

None
plot boolean

Plot the PRF mean model loaded from disk

False

plot_image(self, ax=None, sources=False, frame_index=0)

Function to plot the Full Frame Image and Gaia sources.

Parameters:

Name Type Description Default
ax matplotlib.axes

Matlotlib axis can be provided, if not one will be created and returned.

None
sources boolean

Whether to overplot or not the source catalog.

False
frame_index int

Time index used to plot the image data.

0

Returns:

Type Description
matplotlib.axes

Matlotlib axis with the figure.

plot_pixel_masks(self, ax=None)

Function to plot the mask used to reject saturated and bright pixels.

Parameters:

Name Type Description Default
ax matplotlib.axes

Matlotlib axis can be provided, if not one will be created and returned.

None

Returns:

Type Description
matplotlib.axes

Matlotlib axis with the figure.

residuals(self, plot=False, zoom=False, metric='residuals')

Get the residuals (model - image) and compute statistics. It creates a model

of the full image using the mean_model and the weights computed when fitting the shape model.

Parameters:

Name Type Description Default
plot bool

Do plotting.

False
zoom bool

If plot is True then zoom into a section of the image for better visualization.

False
metric string

Type of metric used to plot. Default is "residuals", "chi2" is also available.

'residuals'

Returns:

Type Description
matplotlib figure

Figure.

save_flux_values(self, output=None, format='fits')

Saves the flux values of all sources to a file. For FITS output files a multi-

extension file is created with each extension containing a single cadence/frame.

Parameters:

Name Type Description Default
output str, None

Output file name. If None, one will be generated.

None
format str

Format of the output file. Only FITS is supported for now.

'fits'

save_shape_model(self, output=None)

Saves the weights of a PRF fit to disk.

Parameters:

Name Type Description Default
output str, None

Output file name. If None, one will be generated.

None