Set-up#

First you need to install the package, you can either use pip

pip install --user atlasapiclient

or clone the repository from github:

git clone git@github.com:HeloiseS/atlasapiclient.git

Config file#

The client requires a config ile that contains the base url of the ATLAS transient web servers and your token for the ATLAS API. In the directory atlasapiclient/config_files you will find the api_config_template.yaml file.

    1. Copy it in the same directory to a file named api_config_MINE.yaml.

cd atlasapiclient/config_files
cp api_config_template.yaml api_config_MINE.yaml

Warning

The name of that file matters immensly. Unless you know what you’re doing DON’T CHANGE IT

Note

How do I get a token? For now, you ask Ken, the wizard in charge the ATLAS transient servers. Email: k.w.smith@qub.ac.uk

Quick Recipes#

Get data for one or more ATLAS_IDs#

Get a Single object data#

from atlasapiclient import client as atlaspaiclient

atlas_id = '1121846241331952000'
client = atlaspaiclient.RequestSingleSourceData(atlas_id=atlas_id, get_response=True)

Note: Here we don’t parse the config file because we assume you have named yours api_config_MINE.yaml. The path to that file is encoded in the API_CONFIG_FILE variable in the atlasapiclient/utils.py file and parsed by default to the classes.

If you feel fancy and want to name your config file differently you have to keep track of its location and parse it with the argument api_config_file.

Your data can be found in the client.response attribute. Note that it is a list so if you only have one object you want to do client.response[0] to get the JSON data.

Get Multiple objects#

If you want to query the ATLAS API for multiple objects you’re going to encounter the rate limit, which is 100 per query. To handle this, there is a class to chunk stuff for you:

from atlasapiclient import client as atlaspaiclient

client = RequestMultipleSourceData(atlas_ids=MY_LIST_OF_IDS, mjdthreshold = LOWER_MJD_THRESHOLD)
client.chunk_get_response() # Chunks the list of IDs into a bunch of payloads and colates the responses.

You can then get the data just as you would for a single object.

Data Structure#

The ATLAS API gives you back everything (or nearly). You can check out the json`schema`_ if you want to navigate the key structure and what they mean. If anything is not clear please add an issue to the GH. Here is a couple of handy recipes…

The detections and non-detections are in separate dictionaries with different columns names so we put them in two separate dictionaries.

import pandas as pd
detections = pd.DataFrame(client.response[0]['lc'])
non_detections = pd.DataFrame(client.response[0]['lcnondets'])

If concatenate them together we recommend ordering by mjd .

[Should the JsonData object from atlasvras actually live in this package so people cna use it?]

The first crossmatch (if any) is a merged entry which cherry picks the best information from all catalogues (so if a galaxy has info in 3 catalogues it will be cross matched 3 times and the info from these catalogues will appear as separate entries in our list of dictionaries - the first entry in the list will be the combination of all the best info in those 3 entries) The following entries are the individual crossmatches.

summary_crossmatch = client.response[0]['sherlock_crossmatches'][0]

You can check the crossmatches using:

client.response[0]['tns_crossmatches']