Getting Data

Helper functions for getting data from the database and loading it from files.

The methods below are available on the devkit package eg:

import antares.devkit as dk
locus_ids = dk.get_locus_ids(n=100)
get_locus(locus_id=None, alert_id=None, ztf_object_id=None, include_newer=False)

Load a Locus from the DB by locus_id, alert_id, or ztf_object_id.

If none of the above are specified, a random Locus from the DB will be selected.

Parameters
  • ztf_object_id

  • locus_id

  • alert_id

Returns

Locus

get_locus_ids(n)

Get n random locus_ids from the DB.

Parameters

n – number of locus_ids to get, up to max of 1000

Returns

list of locus_ids

get_sample_catalog_data(n=10)

Get a sample of catalog data from database for all catalogs.

Parameters

n – number of rows per catalog

Returns

dict

search_catalogs(ra, dec)

Cone-search ANTARES’ object catalogs at an (ra, dec) coordinate.

The result is the same data as would be available to a Filter processing an Alert at that (ra, dec) position.

Returned data structure is of form:

{
  catalog_name_x: [obj_x1, obj_x2, ...],
  catalog_name_y: [obj_y1, ...]
  ...
}

Where obj_* objects are dicts representing rows from the catalog tables.

Parameters
  • ra

  • dec

Returns

dict of lists

locus_from_dict(locus_dict)

Load a Locus from it’s to_dict() representation

Parameters

locus_dict – dict

Returns

Locus

locus_from_file(filename)

Load a LocusData from a file.

Parameters

filename

Returns

LocusData

get_crash_log(log_id)
print_crash_log(log_id)
locus_from_crash_log(crash_log_id)