Skip to content

Documentation for SSMachine

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, rmin=1, rmax=16, cut_r=6, pos_corr1=None, pos_corr2=None, meta=None) special

Class to work with K2 Supersampts produced by

Cody et al. 2018

Parameters and sttributes are the same as FFIMachine.

build_frame_shape_model(self, plot=False, **kwargs)

Compute shape model for every cadence (frame) using Machine.build_shape_model()

Parameters:

Name Type Description Default
plot boolean

If True will create a video file in the working directory with the PSF model at each frame. It uses imageio and imageio-ffmpeg.

False
**kwargs None

Keyword arguments to be passed to build_shape_model()

{}

fit_frame_model(self)

Fits shape model per frame (cadence). It creates 3 attributes:

  • self.model_flux_frame has the scene model at every cadence.
  • self.ws_frame and self.werrs_frame have the flux values of all sources at every cadence.

fit_lightcurves(self, plot=False, iter_negative=False, fit_mean_shape_model=False, fit_va=False, sap=False)

Fit the sources in the data to get its light curves.

By default it only uses the per cadence PSF model to do the photometry. Alternatively it can fit the mean-PSF and the mean-PSF with time model to the data, this is the original method implemented in PSFmachine and described in the paper. Aperture Photometry is also available by creating aperture masks that follow the mean-PSF shape.

This function creates the lcs attribuite that contains a collection of light curves in the form of lightkurve.LightCurveCollection. Each entry in the collection is a lightkurve.KeplerLightCurve object with the different type of photometry (PSF per cadence, SAP, mean-PSF, and mean-PSF velocity-aberration corrected). Also each lightkurve.KeplerLightCurve object includes its asociated metadata.

The photometry can also be accessed independently from the following attribuites that fit_lightcurves create: * ws and werrs have the uncorrected PSF flux and flux errors. * ws_va and werrs_va have the PSF flux and flux errors corrected by velocity aberration. * sap_flux and sap_flux_err have the flux and flux errors computed using aperture mask. * ws_frame and werrs_frame have the flux from PSF at each cadence.

Parameters:

Name Type Description Default
plot bool

Whether or not to show some diagnostic plots. These can be helpful for a user to see if the PRF and time dependent models are being calculated correctly.

False
iter_negative bool

When fitting light curves, it isn't possible to force the flux to be positive. As such, when we find there are light curves that deviate into negative flux values, we can clip these targets out of the analysis and rerun the model. If iter_negative is True, PSFmachine will run up to 3 times, clipping out any negative targets each round. This is used when fit_mean_shape_model is True.

False
fit_mean_shape_model bool

Will do PSF photmetry using the mean-PSF.

False
fit_va bool

Whether or not to fit Velocity Aberration (which implicitly will try to fit other kinds of time variability). fit_mean_shape_model must set to True ortherwise will be ignored. This will try to fit the "long term" trends in the dataset. If True, this will take slightly longer to fit. If you are interested in short term phenomena, like transits, you may find you do not need this to be set to True. If you have the time, it is recommended to run it.

False
sap boolean

Compute or not Simple Aperture Photometry. See Machine.compute_aperture_photometry() for details.

False

from_file(fname, magnitude_limit=18, dr=2, sources=None, cutout_size=None, cutout_origin=[0, 0], **kwargs) staticmethod

Reads data from files and initiates a new SSMachine class. SuperStamp file

paths are passed as a string (single frame) or a list of paths (multiple frames). A samaller cutout of the full SuperSatamp can also be loaded by passing argumnts cutout_size and cutout_origin.

Parameters:

Name Type Description Default
fname string or list of strings

Path to the FITS files to be parsed. For only one frame, pass a string, for multiple frames pass a list of paths.

required
magnitude_limit float

Limiting magnitude to query Gaia catalog.

18
dr int

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

2
sources pandas.DataFrame

DataFrame with sources present in the images, optional. If None, then guery Gaia.

None
cutout_size int

Size in pixels of the cutout, assumed to be squared. Default is 100.

None
cutout_origin tuple of ints

Origin of the cutout following matrix indexing. Default is [0 ,0].

[0, 0]
**kwargs dictionary

Keyword arguments that defines shape model in a Machine object.

{}

Returns:

Type Description
Machine object

A Machine class object built from the SuperStamps files.

plot_image_interactive(self, ax=None, sources=False)

Function to plot the super stamp and Gaia Sources and interact by changing the

cadence.

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

Returns:

Type Description
matplotlib.axes

Matlotlib axis with the figure