Swift TOO API
Swift MOC

swift_too module

Swift_TOO_Requests example - querying planned Swift observations

API version = 1.2, swifttools version = 2.4

Author: Jamie A. Kennea (Penn State)

The Swift_TOO_Requests (or shorthand as of swifttools 2.3, TOORequests) allows the user to query submitted Swift TOO requests. This can be used either to retrieve detail on requests that you have submitted, or details on all TOO requests.

Two important caveats:

  1. Detailed information on TOOs, including Science Justification text are only retrievable if you are the TOO submitter.

  2. Only details of approved TOO requests are available. TOOs that have been rejected cannot be fetched.

This is therefore useful if you wish to retrieve what you have previously submitted, or see what the current active TOOs are, so you can see if someone has already submitted a TOO for the target you are interested in.

from swifttools.swift_too import TOORequests

First example - the 20 most recent Swift TOO requests

In this example we request information on the last 20 TOO requests approved for observation by Swift. No username or shared_secret needs to be submitted for this request, however if you do submit them the result will be no different.

toos = TOORequests(limit=20)
if toos.submit():
    print("Success!")
else:
    print("Failure: {toos.status.errors}")
Success!

That should have worked, so we can now display the 20 most recent approved Swift TOOs by simply display

toos
ToO IDObject NameInstrumentRight Ascenscion (J2000)Declination (J2000)UVOT Mode (Approved)XRT Mode (Approved)Time SubmittedRequesterUrgencyBegin dateEnd datePrimary Target ID
170892MASS J10225172-3226044XRT155.71545833333-32.4346388888890x9999PC2022-03-27 17:16:57de Martino42022-04-042022-04-0415103
17088AT2022ffvUVOT54.1236583-35.289350x223fPC2022-03-27 17:04:44Jacobson-Galan22022-03-282022-04-0515102
17087AT2022ffgUVOT153.4509291666718.1273250x223fPC2022-03-27 15:27:57Milne22022-03-282022-04-0115101
17086WISEAJ045649.80-203748.0UVOT74.20751953125-20.6299743652340x015aPC2022-03-27 08:49:27Liu32022-04-012022-04-1514135
170852021eywUVOT190.99987562.3300833333330x223fPC2022-03-25 19:20:33Siebert22022-03-272022-04-0615099
170831ES 1741+196XRT265.9909583333319.5858333333330x30edPC2022-03-25 17:43:39Falcone32022-04-062022-04-0640639
170821ES 1727+502XRT262.0775833333350.2195833333330x30edPC2022-03-25 17:39:50Falcone32022-04-052022-04-0533709
17081PG 1553+113XRT238.929411.19010x30edPC2022-03-25 17:37:46Falcone32022-04-042022-04-0435021
17080H1426+428XRT217.13587142.6725130x30edPC2022-03-25 17:34:57Falcone32022-04-012022-04-0130375
17079PKS 1424+240XRT216.751623.80x30edPC2022-03-25 17:32:44Falcone32022-03-312022-03-3141539
170781ES 1218+304XRT185.341430.1770x30edPC2022-03-25 17:29:44Falcone32022-03-302022-03-3030376
17077W ComXRT185.382034328.23291590x30edPC2022-03-25 17:26:51Falcone32022-03-292022-03-2935018
17076SN2022qhUVOT164.83354166667-43.2686583333330x223fPC2022-03-25 13:59:49Roy32022-03-302022-04-1115100
17075RBS0690XRT121.3610262575.5736222222220x9999PC2022-03-25 11:09:42Foffano42022-04-042022-04-0439145
17074NGC 4151XRT182.635744939.40572990x30edPC2022-03-25 05:38:37Middei32022-03-292022-04-0634455
17073PKS 2155-304XRT329.71666666667-30.2255555555560x30edPC2022-03-24 15:10:35Kapanadze32022-03-302022-04-1730795
17072Mrk421XRT166.1138079166738.2088327777780x308fWT2022-03-24 14:05:37Paneque32022-03-272022-03-2731540
17071WISEA J005739.96-850721.9XRT14.415-85.12240x223fPC2022-03-24 13:10:52Krumpe32022-03-302022-03-3015098
17070WISEA J124028.32-230926.7XRT190.11792-23.157220x223fPC2022-03-24 12:36:50Krumpe32022-03-292022-03-2915025
17069S5 1803+78XRT270.190378.46780x9999PC2022-03-24 11:00:26Prince32022-03-292022-04-0636393

We can also display all the information we obtained for each TOO request as follows, to display the first (and by default most recent) TOO in the list above, do the following.

toos[1]
ParameterValue
ToO ID17088
RequesterJacobson-Galan
Time Submitted2022-03-27 17:04:44
Urgency2
Object NameAT2022ffv
Type or ClassificationSupernova
Right Ascenscion (J2000)54.1236583
Declination (J2000)-35.28935
Position Error (90% confidence - arcminutes)0
Exposure Time per Visit (s)1000
Number of Visits5
Total Exposure (s)5000
InstrumentUVOT
XRT Mode (Approved)PC
UVOT Mode (Approved)0x223f
Primary Target ID15102

If you want to fetch the information for a given too_id value, you get use the by_id method. Here is an example:

toos.by_id(17086)
ParameterValue
ToO ID17086
RequesterLiu
Time Submitted2022-03-27 08:49:27
Urgency3
Object NameWISEAJ045649.80-203748.0
Type or ClassificationX-Ray Transient
Right Ascenscion (J2000)74.20751953125
Declination (J2000)-20.629974365234
Position Error (90% confidence - arcminutes)0
Exposure Time per Visit (s)3000
Number of Visits3
Total Exposure (s)9000
InstrumentUVOT
XRT Mode (Approved)PC
UVOT Mode (Approved)0x015a
Primary Target ID14135

Displaying the scheduling information for a TOO

If you are interested to know when/if a TOO has been scheduled in the Swift Planning calendar, you can obtain this information by looking that the calendar attribute. This is an instance of the Swift_Calendar class. You can display it as follows.

toos.by_id(17086).calendar
#StartStopXRT ModeUVOT ModeExposure (s)AFST (s)
02022-04-01 00:00:002022-04-02 00:00:00PC0x015a30000
12022-04-08 00:00:002022-04-09 00:00:00PC0x015a30000
22022-04-15 00:00:002022-04-16 00:00:00PC0x015a30000

You can see here that the calendar has even more information about the TOO. This includes the start and end time of each window, the XRT and UVOT modes used, the requested exposure time per window, and the column AFST shows the amount of exposure time taken on that target during the window.

Note that a window here is a period of time for which an observation is requested to occur. If the window is a day long, that typically means that the observation can be scheduled at any time during the day. Shorter windows with specific start and end times typically denotes a time constrained observation, e.g. an observation coordinated with another telescope, or an observation where obtaining an observation at a given orbital phase is requested.

Note the AFST column is just a guide. It only shows observations taken with the window, so if an observation were taken the next day, or not completely in the window, it will not reflect the full observation time. In order to obtain information about Swift observations of any given Target, use a Swift_ObsQuery.

Public vs Private TOO Requests

So far the information we have retrieved is what is available publically. This is limited for privacy reasons, but if you have submitted a TOO yourself, you can retrieve more information. To do this you need to provide your username and shared_secret. Note that if your computer supports Python's keyring module, for storing passwords, then your secret should already be stored if you've used it before to submit a TOO request. In this case you can just give your username.

mytoo = TOORequests()
mytoo.username = "myuser"
mytoo.shared_secret = 'my_shared_secret'
mytoo.detail = True
mytoo.too_id = 16832
mytoo.submit()
True

You can now look at the detailed information from your TOO request, including non-public information. The TOO request below was submitted by the author (Jamie Kennea), so this is what is presented here.

mytoo[0]
ParameterValue
ToO ID16832
RequesterKennea
Time Submitted2022-01-05 12:00:19
Urgency2
Object NameSXP 15.6
Type or ClassificationBe Binary System
Right Ascenscion (J2000)12.228890419006
Declination (J2000)-73.829299926758
Position Error (90% confidence - arcminutes)0
Science JustificationWe wish to continue to monitor the brightness of SXP 15.6 in it's current outburst which was still ongoing as of Dec 30, . We request an initial observation ASAP, as the most recent observation with S-CUBED (Jan 4th) appeared to show a rebrightening. In addition we request resumption of monitoring until pole constraint.
XRT Estimated Rate (c/s)0.15
Exposure Time per Visit (s)2000
Number of Visits4
Total Exposure (s)8000
Monitoring Cadence2 day
Immediate ObjectiveContinue to monitor the brightness of SXP 15.6. We request an initial observation ASAP.
Exposure Time Justification2ks allows for accurate measurement of flux and spectrum.
InstrumentXRT
What is Driving the Exposure Time?Light Curve
XRT Mode (Approved)PC
UVOT Mode (Approved)0x9999
Primary Target ID34599

Also the calendar for this TOO, including what was observed vs what was planned.

mytoo[0].calendar
#StartStopXRT ModeUVOT ModeExposure (s)AFST (s)
02022-01-05 00:00:002022-01-06 00:00:00PC0x999920001995.0
12022-01-07 00:00:002022-01-08 00:00:00PC0x999920002265.0
22022-01-09 00:00:002022-01-10 00:00:00PC0x999920001960.0
32022-01-11 00:00:002022-01-12 00:00:00PC0x999920001359.0

Swift Mission Operations Center

The Pennsylvania State University
301 Science Park Road,
Building 2 Suite 332,
State College, PA 16801
USA
☎ +1 (814) 865-6834
📧 swiftods@swift.psu.edu

Swift MOC Team Leads

Mission Director: John Nousek
Science Operations: Jamie Kennea
Flight Operations: Mark Hilliard
UVOT: Michael Siegel
XRT: Jamie Kennea