Package: planobs
planobsToolset 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.Requirementsztfqueryfor checking if fields have a reference.planobs requires Python 3.10.InstallationUsing Pip:pip install planobs.Otherwise, you can clone the repository:git clone https://github.com/simeonreusch/planobs, followed bypoetry installThis also gives you access to the Slackbot.Note for ARM-based macs: The install offionamight fail if you do not havegdalinstalled. In that case, consider using acondaand runningconda install -c conda-forge gdalbefore runningpoetry install.General usagefromplanobs.planimportPlanObservationname="testalert"# Name of the alert objectdate="2020-05-05"#This is optional, defaults to todayra=133.7dec=13.37plan=PlanObservation(name=name,date=date,ra=ra,dec=dec)plan.plot_target()# Plots the observing conditionsplan.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 alertsfromplanobs.planimportPlanObservationname="IC201007A"# Name of the alert objectdate="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 ZTFplanobscan be used to schedule ToO observations with ZTF.
This is done through API calls to theKowalskisystem, managed by the Kowalski Python APIpenquins.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:exportKOWALSKI_HOST=somethingexportKOWALSKI_API_TOKEN=somethingelseYou can then import the Queue class for querying, submitting and deleting ToO triggers:Queryingfromplanobs.apiimportQueueq=Queue(user="yourname")existing_too_requests=get_too_queues(names_only=True)print(existing_too_requests)Submittingfromplanobs.apiimportQueue,get_too_queuesfromplanobs.modelsimportTooTargettrigger_name="ToO_IC220513A_test"# Instantiate the API connectionq=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,targets=[TooTarget(field_id=427,filter_id=1,exposure_time=300,)],)q.submit_queue()# Now we verify that our trigger has been successfully submittedexisting_too_requests=get_too_queues(names_only=True)print(existing_too_requests)asserttrigger_nameinexisting_too_requestsDeletingfromplanobs.apiimportQueueq=Queue(user="yourname")trigger_name="ToO_IC220513A_test"res=q.delete_trigger(trigger_name=trigger_name)Citing the codeIf you use this code, please cite it! A DOI is provided by Zenodo, which can reference both the code repository and specific releases:ContributorsSimeon Reusch@simeonreuschRobert Stein@robertdstein