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 ResultList.
- Parameters:
- result_dataResult
The current set of results. Modified directly.
- im_stackImageStack
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, chunk_size=100000)[source]#
Append one or more stamp coadds to the results data without filtering.
- result_dataResults
The current set of results. Modified directly.
- im_stackImageStack
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.
- chunk_sizeint
How many stamps to load and filter at a time. Used to control memory. Default: 100_000
- kbmod.filters.stamp_filters.extract_search_parameters_from_config(config)[source]#
Create an initialized StampParameters object from the configuration settings while doing some validity checking.
- Parameters:
- configSearchConfiguration
The configuration object.
- Returns:
- paramsStampParameters
The StampParameters object with all fields set.
- Raises:
- Raises a
ValueError
if parameter validation fails. - Raises a
KeyError
if a required parameter is not found.
- Raises a
- kbmod.filters.stamp_filters.filter_stamps_by_cnn(result_data, model_path, coadd_type='mean', stamp_radius=10, 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 tensorflow model and weights file.
- 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 stamps. The dimension of the stamps should be (stamp_radius * 2) + 1.
- verbosebool
Verbosity option for the CNN predicition. Off by default.
- kbmod.filters.stamp_filters.make_coadds(result_data, im_stack, stamp_params, chunk_size=1000000, colname='stamp')[source]#
- Create the co-added postage stamps and filter them based on their statistical
properties. Results with stamps that are similar to a Gaussian are kept.
- Parameters:
- result_dataResults
The current set of results. Modified directly.
- im_stackImageStack
The images from which to build the co-added stamps.
- stamp_paramsStampParameters or SearchConfiguration
The filtering parameters for the stamps.
- chunk_sizeint
How many stamps to load and filter at a time. Used to control memory. Default: 100_000
- colnamestr
The column in which to save the coadded stamp. Default: “stamp”