tkp.db.nulldetections – handling of null detections

A collection of back end subroutines (mostly SQL queries).

This module contains the routines to deal with null detections.


Increment the forcedfits count for every runningcatalog entry in the temprunningcatalog table.


The null detection forced fits are appended to the assocxtrsource (light-curve) table as a type = 7 datapoint. Subtable t1 has to take care of the cases where values and differences might get too small to cause divisions by zero.


Here the associations of forced fits and their runningcatalog counterparts are inserted into the temporary table.

We follow the analogies of the normal association procedure. The difference here is that we know what the runcat ids are for the extractedsource.extract_type = 1 (ff_nd) sources are, since these were inserted at the same time as well.

This is why subtable t0 looks simpler than in the normal case. We still have to do a left outer join with the runcat_flux table (rf), because fluxes might not be detected in other bands. Before being inserted the additional properties are calculated.


Associate the null detections (ie forced fits) of the current image.

They will be inserted in a temporary table, which contains the associations of the forced fits with the running catalog sources. Also, the forced fits are appended to the assocxtrsource (light-curve) table. The runcat_flux table is updated with the new datapoints if it already existed, otherwise it is inserted as a new datapoint. (We leave the runcat table unchanged.) After all this, the temporary table is emptied again.

tkp.db.nulldetections.get_nulldetections(image_id, expiration=10)[source]

Returns the runningcatalog sources which:

  • Are associated with the skyregion of the current image.
  • Do not have a counterpart in the extractedsources of the current image after source association has run.
  • Have been seen (in any band) at a timestamp earlier than that of the current image.

NB This runs after the source association.

We determine null detections only as those sources which have been seen at earlier times which don’t appear in the current image. Sources which have not been seen earlier, and which appear in different bands at the current timestep, are not null detections, but are considered as “new” sources.

  • image_id (int) – database ID of image
  • expiration (int) – number of forced fits performed after a blind fit):

Returns: list of tuples [(runcatid, ra, decl)]