Skip to main content

Plan observations with the Zwicky Transient Facility

Project description

planobs

Toolset for planning and triggering observations with ZTF. GCN parsing is currently only implemented for IceCube alerts.

It checks if the object is observable with a maximum airmass on a given date, plots the airmass vs. time, computes two optimal (minimal airmass at night) observations of 300s in g- and r and generate the ZTF field plots for all fields having a reference. There is also the option to create a longer (multiday) observation plan.

CI Coverage Status PyPI version DOI

Requirements

ztfquery for checking if fields have a reference.

planobs requires Python 3.10.

Installation

Using Pip: pip install planobs.

Otherwise, you can clone the repository: git clone https://github.com/simeonreusch/planobs, followed by poetry install This also gives you access to the Slackbot. Note for ARM-based macs: The install of fiona might fail. In that case, consider using a conda and issuing conda install -c conda-forge fiona before running poetry.

General usage

from planobs.plan import PlanObservation

name = "testalert" # Name of the alert object
date = "2020-05-05" #This is optional, defaults to today
ra = 133.7
dec = 13.37

plan = PlanObservation(name=name, date=date, ra=ra, dec=dec)
plan.plot_target() # Plots the observing conditions
plan.request_ztf_fields() # Checks in which ZTF fields this 
# object is observable and generates plots for them.

The observation plot and the ZTF field plots will be located in the current directory/[name]

Note: Checking if fields have references requires ztfquery, which needs IPAC credentials.

Usage for IceCube alerts

from planobs.plan import PlanObservation

name = "IC201007A" # Name of the alert object
date = "2020-10-08" #This is optional, defaults to today

# No RA and Dec values are given, because we set alertsource to icecube, which leads to automatic GCN parsing.

plan = PlanObservation(name=name, date=date, alertsource="icecube")
plan.plot_target() # Plots the observing conditions.
plan.request_ztf_fields() # Checks which ZTF fields cover the target (and have references).
print(plan.recommended_field) # This give you the field with the most overlap.

Triggering ZTF

planobs can be used to schedule ToO observations with ZTF. This is done through API calls to the Kowalski system, managed by the Kowalski Python API penquins.

To use this functionality, you must first configure the connection details. You need both an API token, and to know the address of the Kowalski host address. You can then set these as environment variables:

export KOWALSKI_HOST=something
export KOWALSKI_API_TOKEN=somethingelse

You can then import the Queue class for querying, submitting and deleting ToO triggers:

Querying

from planobs.api import Queue

q = Queue(user="yourname")

existing_too_requests = get_too_queues(names_only=True)
print(existing_too_requests)

Submitting

from planobs.api import Queue

trigger_name = "ToO_IC220513A_test"

# Instantiate the API connection
q = Queue(user="yourname")

# Add a trigger to the internal submission queue. Filter ID is 1 for r-, 2 for g- and 3 for i-band. Exposure time is given in seconds.
q.add_trigger_to_queue(
    trigger_name=trigger_name,
    validity_window_start_mjd=59719.309333333334,
    field_id=427,
    filter_id=1,
    exposure_time=300,
)

q.submit_queue()

# Now we verify that our trigger has been successfully submitted
existing_too_requests = get_too_queues(names_only=True)
print(existing_too_requests)
assert trigger_name in existing_too_requests

Deleting

from planobs.api import Queue

q = Queue(user="yourname")

trigger_name = "ToO_IC220513A_test"

res = q.delete_trigger(trigger_name=trigger_name)

Citing the code

If you use this code, please cite it! A DOI is provided by Zenodo, which can reference both the code repository and specific releases:

DOI

Contributors

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

planobs-0.6.1.tar.gz (17.9 MB view details)

Uploaded Source

Built Distribution

planobs-0.6.1-py3-none-any.whl (18.5 MB view details)

Uploaded Python 3

File details

Details for the file planobs-0.6.1.tar.gz.

File metadata

  • Download URL: planobs-0.6.1.tar.gz
  • Upload date:
  • Size: 17.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.11.1 Linux/5.15.0-1030-azure

File hashes

Hashes for planobs-0.6.1.tar.gz
Algorithm Hash digest
SHA256 7bf9ae3c243277db0beb820c4d116e86680b650e3da06d523ac98a2bf3db664f
MD5 e5b06a2b6b783fd9d356b9adc4dfdc06
BLAKE2b-256 4b9324e4ae9bd2d0653197568dcd6b1046f10e07f2cdbc121da4df58e12617cd

See more details on using hashes here.

File details

Details for the file planobs-0.6.1-py3-none-any.whl.

File metadata

  • Download URL: planobs-0.6.1-py3-none-any.whl
  • Upload date:
  • Size: 18.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.11.1 Linux/5.15.0-1030-azure

File hashes

Hashes for planobs-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 29501877fe0af7889263e3fbbb715e5d25a2b47ea3dd86fa40e7b68c31cb3971
MD5 ec3aadc5b7422a6fc702335c140c9f26
BLAKE2b-256 3485f26a6a37d3d8fc24e3ee4d2a7c99f518460ec8abac6cece66f0f99b8e673

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page