API Reference

class alerce.core.Alerce(**kwargs)[source]

The main client class that has all the methods for accessing the different services.

Parameters:
**kwargs

Keyword arguments used for setting the configuration of each service

Attributes:
ztf_url

The url of the ZTF API

Methods

catshtm_conesearch(ra, dec, radius[, …]) catsHTM conesearch given an object and catalog_name.
catshtm_crossmatch(ra, dec, radius[, …]) catsHTM crossmatch given an object and catalog_name.
catshtm_redshift(ra, dec, radius[, format, …]) Get redshift given an object.
get_avro(oid[, candid]) Download avro of some alert.
get_stamps(oid[, candid, format]) Download Stamps for an specific alert.
load_config_from_object(object) Sets configuration parameters from a dictionary object.
plot_stamps(oid[, candid]) Plot stamp in a notebook given oid.
query_classes(classifier_name, …[, format]) Gets classes from a specified classifier
query_classifiers([format]) Gets all classifiers and their classes
query_detections(oid[, format, index, sort]) Gets all detections of a given object
query_feature(oid, name[, format]) Gets a single feature of a specified object id
query_features(oid[, format, index, sort]) Gets features of a given object
query_lightcurve(oid[, format]) Gets the lightcurve (detections and non_detections) of a given object
query_magstats(oid[, format, index, sort]) Gets magnitude statistics of a given object
query_non_detections(oid[, format, index, sort]) Gets all non detections of a given object
query_object(oid[, format]) Gets a single object by object id
query_objects([format, index, sort]) Gets a list of objects filtered by specified parameters.
query_probabilities(oid[, format, index, sort]) Gets probabilities of a given object
catshtm_catalog_translator  
load_config_from_file  
catshtm_conesearch(ra, dec, radius, catalog_name='all', format='pandas')

catsHTM conesearch given an object and catalog_name.

Parameters:
ra : float

Right ascension in Degrees.

def : float

Declination in Degrees.

catalog_name : str

catsHTM Catalog name, “all” can be used to query all available catalogs. List of available catalogs can be found in here.

radius : float

Conesearch radius in arcsec.

format : str

Output format [votable|pandas]

Returns:
dict

Dictionary with the following structure: {

}

catshtm_crossmatch(ra, dec, radius, catalog_name='all', format='pandas')

catsHTM crossmatch given an object and catalog_name.

Parameters:
ra : float

Right ascension in Degrees.

def: : py:class:float

Declination in Degrees.

catalog_name : str

catsHTM Catalog name, “all” can be used to query all available catalogs. List of available catalogs can be found in here.

radius : float

Crossmatch radius in arcsec. (Default 100 arcsec)

format : str

Output format [votable|pandas]

Returns:
dict

Dictionary with the following structure: {

}

catshtm_redshift(ra, dec, radius, format='votable', verbose=False)

Get redshift given an object.

Parameters:
oid : str

object ID in ALeRCE DBs.

radius : float

catsHTM conesearch radius in arcsec.

format : str

Output format [votable|pandas]

Returns:
float

Check if redshift is in a catsHTM xmatch response.

get_avro(oid, candid=None)

Download avro of some alert.

Parameters:
oid : str

object ID in ALeRCE DBs.

candid : int

Candid of the avro to be downloaded.

Returns:
Avro of a given alert.
get_stamps(oid, candid=None, format='HDUList')

Download Stamps for an specific alert.

Parameters:
oid : str

object ID in ALeRCE DBs.

candid : int

Candid of the stamp to be displayed.

format : :py:class: str

Output format [HDUList|numpy]

Returns:
Science, Template and Difference stamps for an specific alert.
load_config_from_object(object)[source]

Sets configuration parameters from a dictionary object.

Parameters:
object : dict

The dictionary containing the config.

plot_stamps(oid, candid=None)

Plot stamp in a notebook given oid. It uses IPython HTML.

Parameters:
oid : str

object ID in ALeRCE DBs.

candid : int

Candid of the stamp to be displayed.

Returns:
Display the stamps on a jupyter notebook.
query_classes(classifier_name, classifier_version, format='json')

Gets classes from a specified classifier

Parameters:
classifier_name : str

The classifier unique name

classifier_version : str

The classifier’s version

query_classifiers(format='json')

Gets all classifiers and their classes

query_detections(oid, format='json', index=None, sort=None)

Gets all detections of a given object

Parameters:
oid : str

The object identifier

format : str

Return format. Can be one of ‘pandas’ | ‘votable’ | ‘json’

index : str

The name of the column to use as index when format is ‘pandas’

sort : str

The name of the column to sort when format is ‘pandas’

query_feature(oid, name, format='json')

Gets a single feature of a specified object id

Parameters:
oid : str

The object identifier

name : str

The feature’s name

format : str

Return format. Can be one of ‘pandas’ | ‘votable’ | ‘json’

query_features(oid, format='json', index=None, sort=None)

Gets features of a given object

Parameters:
oid : str

The object identifier

format : str

Return format. Can be one of ‘pandas’ | ‘votable’ | ‘json’

query_lightcurve(oid, format='json')

Gets the lightcurve (detections and non_detections) of a given object

Parameters:
oid : str

The object identifier

format : str

Return format. Can be one of ‘pandas’ | ‘votable’ | ‘json’

query_magstats(oid, format='json', index=None, sort=None)

Gets magnitude statistics of a given object

Parameters:
oid : str

The object identifier

format : str

Return format. Can be one of ‘pandas’ | ‘votable’ | ‘json’

query_non_detections(oid, format='json', index=None, sort=None)

Gets all non detections of a given object

Parameters:
oid : str

The object identifier

format : str

Return format. Can be one of ‘pandas’ | ‘votable’ | ‘json’

query_object(oid, format='json')

Gets a single object by object id

Parameters:
oid : str

The object identifier

format : str

Return format. Can be one of ‘pandas’ | ‘votable’ | ‘json’

query_objects(format='pandas', index=None, sort=None, **kwargs)

Gets a list of objects filtered by specified parameters. It is strongly advised to look at the documentation of `ALERCE ZTF API`_

Parameters:
format : str

Return format. Can be one of ‘pandas’ | ‘votable’ | ‘json’

index : str

Name of the column to use as index when format is ‘pandas’

sort : str

Name of the column to sort when format is ‘pandas’

**kwargs

Keyword arguments. Each argument can be one of the `ALERCE ZTF API`_ object query parameters.

  • classifier : str
    classifier name
  • class_name : str
    class name
  • ndet : int[]
    Range of detections.
  • probability : float
    Minimum probability.
  • firstmjd : float[]
    First detection date range in mjd.
  • lastmjd : float[]
    Last detection date range in mjd.
  • ra : float
    Ra in degrees for conesearch.
  • dec : float
    Dec in degrees for conesearch.
  • radius : float
    Radius in arcsec for conesearch.
  • page : int
    Page or offset to retrieve. Default value : 1
  • page_size : int
    Number of objects to retrieve in each page. Default value: 10
  • count : str (bool like)
    Whether to count total objects or not. Can be a string representation of boolean like “True”, “true”, “yes”, “false”, …
  • order_by : str
    Column used for ordering. Available values : oid, ndethist, ncovhist, mjdstarthist, mjdendhist, corrected, stellar, ndet, g_r_max, g_r_max_corr, g_r_mean, g_r_mean_corr, meanra, meandec, sigmara, sigmadec, deltamjd, firstmjd, lastmjd, step_id_corr, object, classifier_name, class_name, probability, probabilities
  • order_mode : str
    Ordering could be ascendent or descendent. Available values : ASC, DESC
query_probabilities(oid, format='json', index=None, sort=None)

Gets probabilities of a given object

Parameters:
oid : str

The object identifier

format : str

Return format. Can be one of ‘pandas’ | ‘votable’ | ‘json’