run
- trap.run.force_fit_null_detections(im_id: int, pyse_im: ImageData, source_list: DataFrame, null_detection_ids: ndarray, extracted_sources: DataFrame, monitor_coords: ndarray, latest_extracted_monitoring_ids: ndarray)[source]
Force fit locations of known sources that were not found in the
pyse_imcorresponding to image indexim_id.- Parameters:
im_id (int) – The index of the image in which the sources are to be force-fitted
pyse_im (sourcefinder.image.ImageData) – The PySE image in which to fit the sources
source_list (pandas.DataFrame) –
DataFrame with the known sources Columns used in this function:
”ra”: The Right Ascension of the source (most recent detection, barring force fits)
”dec”: The Declination of the source (most recent detection, barring force fits)
”latest_extracted_source_id”: The index of the last source in the lightcurve, matching the extracted sources database. # TODO: point to table in database description (yet to be documented)
null_detection_ids (list) – A list of indices matching the source_list indicating which known sources should be fitted in the supplied
pyse_im.extracted_sources (pandas.DataFrame) – A DataFrame containing the sources already extracted from the
pyse_imthat is to be updated with the sources fitted in this function (new fits are added to this DataFrame). # TODO: point to table in database description (yet to be documented)monitor_coords (np.ndarray) – The set of coordinates to monitor. These are not in the source list because they are not to be associated together with the naturally found sources. The parent ids are to be supplied through latest_extracted_monitoring_ids.
latest_extracted_monitoring_ids (np.ndarray) – A list of indices of the previous extracted monitoring sources. These are to serve as the parent of the new monitoring sources.
- Returns:
An updated
extracted_sourceswhere the sources fitted in this function have been added.- Return type:
pandas.DataFrame
- trap.run.update_source_list(nr_extracted_sources: int, pyse_im, im_id: int, source_list: DataFrame, new_sources: DataFrame, rejected: bool, max_nr_consecutive_force_fits: int, **association_kwargs) Tuple[DataFrame, ndarray, DataFrame, int][source]
Compare the
new_sourceswith thesource_listcontaining the known sources and update the list of known sources accordingly.Also updates the source list to include the sources that will be force-fit. This is a promise in some sense that we will force fit these and in the meantime we continue associating while we are force fitting in a separate task. We do this because the force fit can take a long time we cannot afford to wait on it.
Note
It is possible for PySE to fail on a force fit. The association could therefore match sources with a parent that does not exist because PySE did not find a fit. To prevent this we create a dummy row in the database that has the id of the failed source and it’s coordinates, but nan values for other source parameters. This way the lightcurve parent chain remains complete. The reconstructed lightcurves will then have nans at the locations where the force fit failed.
- Parameters:
nr_extracted_sources – The total number of extracted sources, which will be added to in this function and is used to determine the indices that are to be assigned to the new sources.
im_id (int) – The index of the image corresponding the the
new_sourcessource_list – A DataFrame containing the known sources before extracting the
new_sources. A copy of this dataframe will be modified to include the new sources and returned.new_sources (pd.DataFrame) – The sources extracted from the image with index
im_id**association_kwargs – The keyword arguments passed to
trap.association.associate()
- Returns:
pd.DataFrame – The updated
source_listlist – A list containing source indices matching the updated
source_listof sources that were already known but not found in the suppliednew_sourcesextracted_sources –
- An updated version of
new_sourceswhere the following columns were added: im_id
src_id
is_force_fit
is_duplicate
parent
- An updated version of
int – The updated total number of extracted sources, needed to determine the index of new extracted sources in the following iteration.
- trap.run.main(image_paths: List[Path], db_kwargs: dict, freq_bands: FrequencyBands, max_nr_consecutive_force_fits: int, monitor_coords: ndarray, max_concurrent_images: int | None = None, pyse_config: dict | None = None, association_kwargs: dict | None = None)[source]