Skip to content

Documentation for StarScene

scatterbrain.scene.StarScene dataclass

Class to remove stars and jitter noise from TESS images.

This class will take a stack of TESS FFIs, and will use the ScatteredLightBackground class to remove scattered light from the images. The ScatteredLightBackground also provides an estimate of the "jitter" in pixels as the top principal components of bright pixels in the dataset, and the average image. StarScene takes these components and fits each individual pixel time series

Parameters:

Name Type Description Default
sector int

TESS sector number

required
camera int

TESS camera number

required
ccd int

TESS CCD number

required
batch_size int

This will process the fits images in "batches". The larger the batch_size, the more memory fitting will take. 512 is a sane default.

'.'
spline bool

Whether to correct time with a spline. If False, will use a 2nd order polynomial. If True, will use a 40 knot spline for every pixel.

required
ncomps int

Number of components from the background model to use. Default is 15. Maximum is 20.

'15.'

locs property readonly

The locations of each of the cutouts. List of lists. Format is

[[mininmum row, maxmimum row], [minimum column, maximum column]]

__getitem__(self, key) special

Set indexing

fit_model(self, fnames, batch_size=512)

Fit a StarScene model to a set of TESS filenames

from_tess_images(fnames, sector=None, camera=None, ccd=None, batch_size=512, plot=False, dir=None) staticmethod

Class to remove stars from TESS images

Parameters:

Name Type Description Default
fnames list of str

File names to use to build the object

required
sector int

TESS sector number

None
camera int

TESS camera number

None
ccd int

TESS CCD number

None
batch_size int

This will process the fits images in "cutouts". The larger the cutout, the more memory fitting will take. 512 is a sane default.

512

get_images(self, fnames, loc, orbit=1)

Load the TESS FFIs, remove the best fitting scattered light model, and

the best "average" frame, and return as an array.

Parameters:

Name Type Description Default
fnames list of str

File names to use to build the object

required
loc list of lists

Location of the cut out in format [[min row, max row], [min col, max col]]

required
orbit int, [1 or 2]

Which orbit to get

1

load(self, input, dir=None)

Load a model fit from the data directory.

Parameters:

Name Type Description Default
input tuple or string

Either pass a tuple with (sector, camera, ccd) or pass a file name in dir to load

required
dir str

Optional tring with the directory name

None

model(self, row=None, column=None, time_indices=None, mask_bad_pixels=True, trend=True)

Returns a model for a given row and column.

Parameters:

Name Type Description Default
row np.ndarray

Row to evaluate at

None
column np.ndarray

Column to evaluate at

None
time_indices None, int, list of int

Which indices to evaluate the model at. If None will use all.

None

Returns:

Type Description
np.ndarray

Array of shape (time_indices, row, column) which has the full scene model, including scattered light.

save(self, output_dir=None, overwrite=False)

Save a StarScene