Module: stamp_filters#
A series of Filter subclasses for processing basic stamp information.
The filters in this file all operate over simple statistics based on the stamp pixels.
- kbmod.filters.stamp_filters.append_all_stamps(result_data, im_stack, stamp_radius)[source]#
Get the stamps for the final results from a kbmod search. These are appended onto the corresponding entries in a Results.
- Parameters:
- result_dataResult
The current set of results. Modified directly.
- im_stackImageStackPy
The stack of images.
- stamp_radiusint
The radius of the stamps to create.
- kbmod.filters.stamp_filters.append_coadds(result_data, im_stack, coadd_types, radius, valid_only=True, nightly=False)[source]#
Append one or more stamp coadds to the results data without filtering.
- result_dataResults
The current set of results. Modified directly.
- im_stackImageStackPy
The images from which to build the co-added stamps.
- coadd_typeslist
A list of coadd types to generate. Can be “sum”, “mean”, and “median”.
- radiusint
The stamp radius to use.
- valid_onlybool
Only use stamps from the timesteps marked valid for each trajectory.
- nightlybool
Break up the stamps to a single coadd per-calendar day.
- kbmod.filters.stamp_filters.filter_stamps_by_cnn(result_data, model_path, model_type='resnet18', coadd_type='mean', stamp_radius=10, coadd_radius=11, verbose=False)[source]#
Given a set of results data, run the the requested coadded stamps through a provided convolutional neural network and assign a new column that contains the stamp classification, i.e. whether or not the result passed the CNN filter.
- Parameters:
- result_dataResult
The current set of results. Modified directly.
- model_pathstr
Path to the the pytorch model and weights file.
- model_typestr
The type of builtin torchvision model to use for the CNN. Default is ‘resnet18’.
- coadd_typestr
Which coadd type to use in the filtering. Depends on how the model was trained. Default is ‘mean’, will grab stamps from the ‘coadd_mean’ column.
- stamp_radiusint
The radius used to generate the training stamps. The dimension of the stamps should be (stamp_radius * 2) + 1.
- coadd_radiusint
The radius used to generate the coadded stamps. The dimension of the coadds should be (coadd_radius * 2) + 1. Must be >= stamp_radius.
- verbosebool
Verbosity option for the CNN predicition. Off by default.