PyMMT 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- PyMMT-1.0.0/PKG-INFO +252 -0
- PyMMT-1.0.0/README.md +239 -0
- PyMMT-1.0.0/pyproject.toml +29 -0
- PyMMT-1.0.0/setup.cfg +4 -0
- PyMMT-1.0.0/src/PyMMT.egg-info/PKG-INFO +252 -0
- PyMMT-1.0.0/src/PyMMT.egg-info/SOURCES.txt +13 -0
- PyMMT-1.0.0/src/PyMMT.egg-info/dependency_links.txt +1 -0
- PyMMT-1.0.0/src/PyMMT.egg-info/requires.txt +3 -0
- PyMMT-1.0.0/src/PyMMT.egg-info/top_level.txt +1 -0
- PyMMT-1.0.0/src/pymmt/__init__.py +39 -0
- PyMMT-1.0.0/src/pymmt/instruments/__init__.py +1 -0
- PyMMT-1.0.0/src/pymmt/instruments/binospec.py +85 -0
- PyMMT-1.0.0/src/pymmt/instruments/mmirs.py +101 -0
- PyMMT-1.0.0/src/pymmt/pymmt.py +590 -0
- PyMMT-1.0.0/tests/test.py +33 -0
PyMMT-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: PyMMT
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A python API wrapper for the MMT Observatory
|
|
5
|
+
Author-email: Samuel Wyatt <swyatt@arizona.edu>, Manisha Shrestha <mshrestha1@arizona.edu>, Griffin Hosseinzadeh <griffin0@arizona.edu>
|
|
6
|
+
Project-URL: Homepage, https://github.com/SAGUARO-MMA/PyMMT
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/SAGUARO-MMA/PyMMT/issues
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# PyMMT
|
|
15
|
+
|
|
16
|
+
This repository is designed to facilitate submitting a rapid Target of Opprotunity (ToO) observation to Binospec at the [MMT](https://www.mmto.org/) with the goal to enable same-night spectroscopy of interesting transients. Here we will provide examples to install and upload targets.
|
|
17
|
+
|
|
18
|
+
## Install
|
|
19
|
+
To get the repository (in a bash/unix terminal)
|
|
20
|
+
```bash
|
|
21
|
+
git-clone repository
|
|
22
|
+
python -m pip install pymmt
|
|
23
|
+
or pip install pymmt
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Using the API Wrapper
|
|
27
|
+
|
|
28
|
+
Here we describe the process to POST, GET, UPDATE, and DELETE a MMT Target. The `Target` class also contains an `api` class that calls each of the API methods. This class contains the request information for each request method so that it can debugged in the command line.
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
import pymmt
|
|
32
|
+
|
|
33
|
+
target = pymmt.Target(token=API_TOKEN, ...)
|
|
34
|
+
#once a request is made
|
|
35
|
+
|
|
36
|
+
target.**action() #post, delete, update... etc
|
|
37
|
+
|
|
38
|
+
#the request response can be viewed by
|
|
39
|
+
target.request
|
|
40
|
+
|
|
41
|
+
#which contains all of the expected request response information:
|
|
42
|
+
# target.request.content
|
|
43
|
+
# target.request.text
|
|
44
|
+
# target.request.status_code
|
|
45
|
+
# etc
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Creating a Target
|
|
49
|
+
|
|
50
|
+
To create a target there are a lot of required fields and conditional parameters based on the observation type. To begin with the metadata for the target itself:
|
|
51
|
+
|
|
52
|
+
* `objectid`: This is the name of the target. The requirements for this field is that it contains no special characters and spaces. It must also be greater than 2 characters and less than 50 characters.
|
|
53
|
+
* `ra`: Right Ascension of the target. Required format to be: `dd:dd:dd.d`
|
|
54
|
+
* `dec`: Declination of the target. Required format to be: `[+/-]dd:dd:dd.d`
|
|
55
|
+
* `magnitude`: Magnitude of the target. Must be a `float`
|
|
56
|
+
* `epoch`: The epoch of the target. Defaults to 2000.0
|
|
57
|
+
|
|
58
|
+
The target exposure information is based on the the field `observationtype`:
|
|
59
|
+
|
|
60
|
+
For Binospec `observationtype:imaging`:
|
|
61
|
+
* `filter`: Must be `g`, `r`, `i`, or `z`
|
|
62
|
+
* `maskid`: can be `110` or a predefined mask set up prior to target request
|
|
63
|
+
* `exposuretime`: The observation exposure time in seconds
|
|
64
|
+
|
|
65
|
+
For MMIRS `observationtype:imaging`:
|
|
66
|
+
* `filter`: Must be `J`, `H`, `K`, or `Ks`
|
|
67
|
+
* `dithersize`: Must be `5`, `7`, `10`, `15`, `20`, `30`, `60`, `120`, or `210`
|
|
68
|
+
* `readtab`: Must be `ramp_4.426` or ramp_1.475`
|
|
69
|
+
* `maskid`: can be `110` or a predefined mask set up prior to target request
|
|
70
|
+
* `exposuretime`: The observation exposure time in seconds
|
|
71
|
+
|
|
72
|
+
For Binospec `observationtype:longslit`:
|
|
73
|
+
* `grating`: Valid options are `270`, `600`, and `1000`
|
|
74
|
+
* `centralwavelength`: Depending on the chosen `grating`:
|
|
75
|
+
* For `grating=270`, valid options are between `5501-7838`
|
|
76
|
+
* For `grating=600`, valid options are between `5146-8783`
|
|
77
|
+
* For `grating=1000`, valid options are between `4108-4683`, `5181-7273`, `7363-7967`, `8153-8772` or `8897-9279`
|
|
78
|
+
* `slitwidth`: valid options are `Longslit0_75`, `Longslit1`, `Longslit1_25`, `Longslit1_5`, `Longslit5`
|
|
79
|
+
* `filter`: valid options are `LP3800` or `LP3500`. Defaults to `LP3800`
|
|
80
|
+
* `maskid`: Can be a predefined mask, or there are common `maskid`s depending on the chosen slitwidth:
|
|
81
|
+
* For `Longslit0_75`: id `113`
|
|
82
|
+
* For `Longslit1`: id `111`
|
|
83
|
+
* For `Longslit1_25`: id `131`
|
|
84
|
+
* For `Longslit1_5`: id `114`
|
|
85
|
+
* For `Longslit5`: id `112`
|
|
86
|
+
|
|
87
|
+
For MMIRS `observationtype:longslit`:
|
|
88
|
+
* `grism`: Valid options are `J`, `HK`, and `HK3`
|
|
89
|
+
* `readtab`: Valid options are `ramp_4.426`
|
|
90
|
+
* `slitwidth`: valid options are '1pixel', '2pixel', '3pixel', '4pixel', '5pixel','6pixel','12pixel'
|
|
91
|
+
* `slitwidthproperty`: valid options are 'long', 'short'
|
|
92
|
+
|
|
93
|
+
Other observation metadata:
|
|
94
|
+
|
|
95
|
+
* `pa`: The parralactic angle. Defaults to 0
|
|
96
|
+
* `pm_ra` and `pm_dec`: Proper motion of of the RA and DEC parameters. Defaults to 0.0 respectively
|
|
97
|
+
* `numberexposures`: Number of exposures. Defaults to 1
|
|
98
|
+
* `visits`: Visits. Defaults to 1
|
|
99
|
+
* `priority`: Ranks for all targets in the users catalog. Valid options are 1,2,3 where 1 is the highest priority. Defaults to 3
|
|
100
|
+
* `photometric`: Valid options are 0 for non-photometric conditions or 1 for photometric conditions. Defaults to 0
|
|
101
|
+
* `targetofopportunity`: Valid options are 0 for non ToO or 1 for requesting a ToO.
|
|
102
|
+
|
|
103
|
+
All metadata will be validated upon initialization. Once the target object has been validated as True, it can be posted to the MMT schedule.
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
import pymmt
|
|
107
|
+
|
|
108
|
+
#example for Binospec imaging target payload:
|
|
109
|
+
|
|
110
|
+
payload = {
|
|
111
|
+
'objectid':'TARGETNAME',
|
|
112
|
+
'ra':'12:34:56.78',
|
|
113
|
+
'dec':'+87:65:43:21',
|
|
114
|
+
'magnitude':21,
|
|
115
|
+
'epoch':2000,
|
|
116
|
+
'filter':g,
|
|
117
|
+
'maskid':110,
|
|
118
|
+
'exposuretime':400,
|
|
119
|
+
'visits':1,
|
|
120
|
+
'numberexposures':2,
|
|
121
|
+
'priority':1
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
#example payload for Binospec longslit target payload
|
|
126
|
+
|
|
127
|
+
payload = {
|
|
128
|
+
'objectid':'Targetname',
|
|
129
|
+
'ra':'12:34:56.78',
|
|
130
|
+
'dec':'+87:65:43:21',
|
|
131
|
+
'magnitude':21,
|
|
132
|
+
'epoch':2000,
|
|
133
|
+
'grating':1000,
|
|
134
|
+
'centralwavelength':7380,
|
|
135
|
+
'slitwidth':'Longslit1_25',
|
|
136
|
+
`maskid`:131,
|
|
137
|
+
`filter`:'LP380'
|
|
138
|
+
'visits':1,
|
|
139
|
+
'numberexposures':2,
|
|
140
|
+
'priority':1,
|
|
141
|
+
'targetofopportunity':1
|
|
142
|
+
}
|
|
143
|
+
#example payload for MMIRS longslit target payload
|
|
144
|
+
|
|
145
|
+
payload = {'dec': '-19:30:45.100', 'epoch': 'J2000', 'exposuretime': 450.0,
|
|
146
|
+
'filter': 'zJ', 'grating': '270','magnitude': 16.9, 'maskid': 111, 'notes': 'Demo observation request. Please do not observe this.',
|
|
147
|
+
'numberexposures': 3, 'objectid': 'AT2021fxy', 'observationtype': 'longslit','priority': 3, 'ra': '13:13:01.560',
|
|
148
|
+
'slitwidth': '1pixel', 'targetofopportunity': 0, 'visits': 1,'instrumentid':15, 'gain':'low',
|
|
149
|
+
'readtab': 'ramp_4.426', 'grism':'J', 'slitwidthproperty':'long', 'dithersize':'5' }
|
|
150
|
+
|
|
151
|
+
#this will create the target along with validating the payload information. It will inform the user of any errors or warnings associated with the metadata
|
|
152
|
+
target = pymmt.Target(token=API_TOKEN,
|
|
153
|
+
verbose=True,
|
|
154
|
+
payload=payload)
|
|
155
|
+
#this will send the information to the scheduler if it is a valid target
|
|
156
|
+
target.post()
|
|
157
|
+
|
|
158
|
+
#this will create the target along with validating the payload information. It will inform the user of any errors or warnings associated with the metadata
|
|
159
|
+
target = pymmt.Target(token=API_TOKEN,
|
|
160
|
+
verbose=True,
|
|
161
|
+
payload=payload)
|
|
162
|
+
#this will send the information to the scheduler if it is a valid target
|
|
163
|
+
target.post()
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Getting Target Information
|
|
167
|
+
|
|
168
|
+
To get Target Information the only parameters to be passed into the Target class initation are the `token` and `targetid`. This will populate the Target with all of the MMT Target's keywords. If the request is successful, print out all of the target information with the `.dump()` method.
|
|
169
|
+
|
|
170
|
+
```python
|
|
171
|
+
import pymmt
|
|
172
|
+
|
|
173
|
+
target = pymmt.Target(token=API_TOKEN,
|
|
174
|
+
verbose=True,
|
|
175
|
+
payload={'targetid':TARGETID})
|
|
176
|
+
target.dump()
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Uploading a Finder Image
|
|
180
|
+
|
|
181
|
+
Once a target is either created, or retrieved with the API GET method, a finder image can be uploaded. If an finder image already exists, this will overwrite it. All that is needed the pathway to the finder image.
|
|
182
|
+
|
|
183
|
+
```python
|
|
184
|
+
target.upload_finder(finder_path=PATH_TO_IMAGE)
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Downloading a completed observation
|
|
188
|
+
|
|
189
|
+
```python
|
|
190
|
+
target.download_exposures()
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Updating Target Information
|
|
194
|
+
|
|
195
|
+
Once a target is created, or retrieved with the API GET method, its meta-data can be updated. All that is required is passing in the valid keyword arguments and their respective values. The updated information will be validated before being submitted to the API.
|
|
196
|
+
|
|
197
|
+
```python
|
|
198
|
+
#the kwargs can be defined as: KEY_WORD1=VAlUE1, KEY_WORD2=VALUE2... etc
|
|
199
|
+
target.update(KEY_WORD1=VAlUE1, KEY_WORD2=VALUE2... etc)
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Valid MMT Target `KEY_WORD`'s:
|
|
203
|
+
|
|
204
|
+
```python
|
|
205
|
+
[
|
|
206
|
+
'id', 'ra', 'objectid', 'observationtype', 'moon', 'seeing', 'photometric', 'priority', 'dec', 'ra_decimal',
|
|
207
|
+
'dec_decimal', 'pm_ra', 'pm_dec', 'magnitude', 'exposuretime', 'numberexposures', 'visits',
|
|
208
|
+
'onevisitpernight', 'filter', 'grism', 'grating', 'centralwavelength', 'readtab', 'gain', 'dithersize',
|
|
209
|
+
'epoch', 'submitted', 'modified', 'notes', 'pa', 'maskid', 'slitwidth', 'slitwidthproperty', 'iscomplete',
|
|
210
|
+
'disabled', 'notify', 'locked', 'findingchartfilename', 'instrumentid', 'targetofopportunity', 'reduced',
|
|
211
|
+
'exposuretimeremaining', 'totallength', 'totallengthformatted', 'exposuretimeremainingformatted',
|
|
212
|
+
'exposuretimecompleted', 'percentcompleted', 'offsetstars', 'details', 'mask'
|
|
213
|
+
]
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Deleting a Target
|
|
217
|
+
|
|
218
|
+
Once a target is created or retireved with the API GET method, it can be deleted from the Observatory scheduler.
|
|
219
|
+
|
|
220
|
+
```python
|
|
221
|
+
target.delete()
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## Other API Endpoints
|
|
225
|
+
|
|
226
|
+
### MMT Instrument
|
|
227
|
+
|
|
228
|
+
Here we describe the API endpoint to get the current instruments in the most recent published schedule. When instantiating a Target through this API it will validate whether or not the Binospec instrument is on the telescope. It can also be used to see what instruments are currently on, or when an instrument will be on the telescope.
|
|
229
|
+
|
|
230
|
+
This function takes can take in two parameters:
|
|
231
|
+
* `date`
|
|
232
|
+
* `instrumentid`
|
|
233
|
+
|
|
234
|
+
if you don't pass any params into the function it will just find the current instruments on the telescope using `datetime.datetime.now()`
|
|
235
|
+
|
|
236
|
+
```python
|
|
237
|
+
from datetime import datetime, timedelta
|
|
238
|
+
api = pymmt.api()
|
|
239
|
+
current_instruments = api.get_instruments()
|
|
240
|
+
|
|
241
|
+
#you can look into the future to see what instruments will be available:
|
|
242
|
+
future_instruments = api.get_instruments(date=datetime.datetime.now()+timedelta(months=1))
|
|
243
|
+
|
|
244
|
+
#you can look through the entire published schedule to see when a certain instrument will be on the telescope (Binospec = 16, MMIRS = 15)
|
|
245
|
+
my_instrument = api.get_instruments(instrumentid=16)
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
This function returns a list of dictionary elements with the values for:
|
|
249
|
+
* `instrumentid` - ID for the instrument
|
|
250
|
+
* `name` - the name of the queue run
|
|
251
|
+
* `start` - start date
|
|
252
|
+
* `end` - end date
|
PyMMT-1.0.0/README.md
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
# PyMMT
|
|
2
|
+
|
|
3
|
+
This repository is designed to facilitate submitting a rapid Target of Opprotunity (ToO) observation to Binospec at the [MMT](https://www.mmto.org/) with the goal to enable same-night spectroscopy of interesting transients. Here we will provide examples to install and upload targets.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
To get the repository (in a bash/unix terminal)
|
|
7
|
+
```bash
|
|
8
|
+
git-clone repository
|
|
9
|
+
python -m pip install pymmt
|
|
10
|
+
or pip install pymmt
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Using the API Wrapper
|
|
14
|
+
|
|
15
|
+
Here we describe the process to POST, GET, UPDATE, and DELETE a MMT Target. The `Target` class also contains an `api` class that calls each of the API methods. This class contains the request information for each request method so that it can debugged in the command line.
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
import pymmt
|
|
19
|
+
|
|
20
|
+
target = pymmt.Target(token=API_TOKEN, ...)
|
|
21
|
+
#once a request is made
|
|
22
|
+
|
|
23
|
+
target.**action() #post, delete, update... etc
|
|
24
|
+
|
|
25
|
+
#the request response can be viewed by
|
|
26
|
+
target.request
|
|
27
|
+
|
|
28
|
+
#which contains all of the expected request response information:
|
|
29
|
+
# target.request.content
|
|
30
|
+
# target.request.text
|
|
31
|
+
# target.request.status_code
|
|
32
|
+
# etc
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Creating a Target
|
|
36
|
+
|
|
37
|
+
To create a target there are a lot of required fields and conditional parameters based on the observation type. To begin with the metadata for the target itself:
|
|
38
|
+
|
|
39
|
+
* `objectid`: This is the name of the target. The requirements for this field is that it contains no special characters and spaces. It must also be greater than 2 characters and less than 50 characters.
|
|
40
|
+
* `ra`: Right Ascension of the target. Required format to be: `dd:dd:dd.d`
|
|
41
|
+
* `dec`: Declination of the target. Required format to be: `[+/-]dd:dd:dd.d`
|
|
42
|
+
* `magnitude`: Magnitude of the target. Must be a `float`
|
|
43
|
+
* `epoch`: The epoch of the target. Defaults to 2000.0
|
|
44
|
+
|
|
45
|
+
The target exposure information is based on the the field `observationtype`:
|
|
46
|
+
|
|
47
|
+
For Binospec `observationtype:imaging`:
|
|
48
|
+
* `filter`: Must be `g`, `r`, `i`, or `z`
|
|
49
|
+
* `maskid`: can be `110` or a predefined mask set up prior to target request
|
|
50
|
+
* `exposuretime`: The observation exposure time in seconds
|
|
51
|
+
|
|
52
|
+
For MMIRS `observationtype:imaging`:
|
|
53
|
+
* `filter`: Must be `J`, `H`, `K`, or `Ks`
|
|
54
|
+
* `dithersize`: Must be `5`, `7`, `10`, `15`, `20`, `30`, `60`, `120`, or `210`
|
|
55
|
+
* `readtab`: Must be `ramp_4.426` or ramp_1.475`
|
|
56
|
+
* `maskid`: can be `110` or a predefined mask set up prior to target request
|
|
57
|
+
* `exposuretime`: The observation exposure time in seconds
|
|
58
|
+
|
|
59
|
+
For Binospec `observationtype:longslit`:
|
|
60
|
+
* `grating`: Valid options are `270`, `600`, and `1000`
|
|
61
|
+
* `centralwavelength`: Depending on the chosen `grating`:
|
|
62
|
+
* For `grating=270`, valid options are between `5501-7838`
|
|
63
|
+
* For `grating=600`, valid options are between `5146-8783`
|
|
64
|
+
* For `grating=1000`, valid options are between `4108-4683`, `5181-7273`, `7363-7967`, `8153-8772` or `8897-9279`
|
|
65
|
+
* `slitwidth`: valid options are `Longslit0_75`, `Longslit1`, `Longslit1_25`, `Longslit1_5`, `Longslit5`
|
|
66
|
+
* `filter`: valid options are `LP3800` or `LP3500`. Defaults to `LP3800`
|
|
67
|
+
* `maskid`: Can be a predefined mask, or there are common `maskid`s depending on the chosen slitwidth:
|
|
68
|
+
* For `Longslit0_75`: id `113`
|
|
69
|
+
* For `Longslit1`: id `111`
|
|
70
|
+
* For `Longslit1_25`: id `131`
|
|
71
|
+
* For `Longslit1_5`: id `114`
|
|
72
|
+
* For `Longslit5`: id `112`
|
|
73
|
+
|
|
74
|
+
For MMIRS `observationtype:longslit`:
|
|
75
|
+
* `grism`: Valid options are `J`, `HK`, and `HK3`
|
|
76
|
+
* `readtab`: Valid options are `ramp_4.426`
|
|
77
|
+
* `slitwidth`: valid options are '1pixel', '2pixel', '3pixel', '4pixel', '5pixel','6pixel','12pixel'
|
|
78
|
+
* `slitwidthproperty`: valid options are 'long', 'short'
|
|
79
|
+
|
|
80
|
+
Other observation metadata:
|
|
81
|
+
|
|
82
|
+
* `pa`: The parralactic angle. Defaults to 0
|
|
83
|
+
* `pm_ra` and `pm_dec`: Proper motion of of the RA and DEC parameters. Defaults to 0.0 respectively
|
|
84
|
+
* `numberexposures`: Number of exposures. Defaults to 1
|
|
85
|
+
* `visits`: Visits. Defaults to 1
|
|
86
|
+
* `priority`: Ranks for all targets in the users catalog. Valid options are 1,2,3 where 1 is the highest priority. Defaults to 3
|
|
87
|
+
* `photometric`: Valid options are 0 for non-photometric conditions or 1 for photometric conditions. Defaults to 0
|
|
88
|
+
* `targetofopportunity`: Valid options are 0 for non ToO or 1 for requesting a ToO.
|
|
89
|
+
|
|
90
|
+
All metadata will be validated upon initialization. Once the target object has been validated as True, it can be posted to the MMT schedule.
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
import pymmt
|
|
94
|
+
|
|
95
|
+
#example for Binospec imaging target payload:
|
|
96
|
+
|
|
97
|
+
payload = {
|
|
98
|
+
'objectid':'TARGETNAME',
|
|
99
|
+
'ra':'12:34:56.78',
|
|
100
|
+
'dec':'+87:65:43:21',
|
|
101
|
+
'magnitude':21,
|
|
102
|
+
'epoch':2000,
|
|
103
|
+
'filter':g,
|
|
104
|
+
'maskid':110,
|
|
105
|
+
'exposuretime':400,
|
|
106
|
+
'visits':1,
|
|
107
|
+
'numberexposures':2,
|
|
108
|
+
'priority':1
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
#example payload for Binospec longslit target payload
|
|
113
|
+
|
|
114
|
+
payload = {
|
|
115
|
+
'objectid':'Targetname',
|
|
116
|
+
'ra':'12:34:56.78',
|
|
117
|
+
'dec':'+87:65:43:21',
|
|
118
|
+
'magnitude':21,
|
|
119
|
+
'epoch':2000,
|
|
120
|
+
'grating':1000,
|
|
121
|
+
'centralwavelength':7380,
|
|
122
|
+
'slitwidth':'Longslit1_25',
|
|
123
|
+
`maskid`:131,
|
|
124
|
+
`filter`:'LP380'
|
|
125
|
+
'visits':1,
|
|
126
|
+
'numberexposures':2,
|
|
127
|
+
'priority':1,
|
|
128
|
+
'targetofopportunity':1
|
|
129
|
+
}
|
|
130
|
+
#example payload for MMIRS longslit target payload
|
|
131
|
+
|
|
132
|
+
payload = {'dec': '-19:30:45.100', 'epoch': 'J2000', 'exposuretime': 450.0,
|
|
133
|
+
'filter': 'zJ', 'grating': '270','magnitude': 16.9, 'maskid': 111, 'notes': 'Demo observation request. Please do not observe this.',
|
|
134
|
+
'numberexposures': 3, 'objectid': 'AT2021fxy', 'observationtype': 'longslit','priority': 3, 'ra': '13:13:01.560',
|
|
135
|
+
'slitwidth': '1pixel', 'targetofopportunity': 0, 'visits': 1,'instrumentid':15, 'gain':'low',
|
|
136
|
+
'readtab': 'ramp_4.426', 'grism':'J', 'slitwidthproperty':'long', 'dithersize':'5' }
|
|
137
|
+
|
|
138
|
+
#this will create the target along with validating the payload information. It will inform the user of any errors or warnings associated with the metadata
|
|
139
|
+
target = pymmt.Target(token=API_TOKEN,
|
|
140
|
+
verbose=True,
|
|
141
|
+
payload=payload)
|
|
142
|
+
#this will send the information to the scheduler if it is a valid target
|
|
143
|
+
target.post()
|
|
144
|
+
|
|
145
|
+
#this will create the target along with validating the payload information. It will inform the user of any errors or warnings associated with the metadata
|
|
146
|
+
target = pymmt.Target(token=API_TOKEN,
|
|
147
|
+
verbose=True,
|
|
148
|
+
payload=payload)
|
|
149
|
+
#this will send the information to the scheduler if it is a valid target
|
|
150
|
+
target.post()
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Getting Target Information
|
|
154
|
+
|
|
155
|
+
To get Target Information the only parameters to be passed into the Target class initation are the `token` and `targetid`. This will populate the Target with all of the MMT Target's keywords. If the request is successful, print out all of the target information with the `.dump()` method.
|
|
156
|
+
|
|
157
|
+
```python
|
|
158
|
+
import pymmt
|
|
159
|
+
|
|
160
|
+
target = pymmt.Target(token=API_TOKEN,
|
|
161
|
+
verbose=True,
|
|
162
|
+
payload={'targetid':TARGETID})
|
|
163
|
+
target.dump()
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Uploading a Finder Image
|
|
167
|
+
|
|
168
|
+
Once a target is either created, or retrieved with the API GET method, a finder image can be uploaded. If an finder image already exists, this will overwrite it. All that is needed the pathway to the finder image.
|
|
169
|
+
|
|
170
|
+
```python
|
|
171
|
+
target.upload_finder(finder_path=PATH_TO_IMAGE)
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Downloading a completed observation
|
|
175
|
+
|
|
176
|
+
```python
|
|
177
|
+
target.download_exposures()
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Updating Target Information
|
|
181
|
+
|
|
182
|
+
Once a target is created, or retrieved with the API GET method, its meta-data can be updated. All that is required is passing in the valid keyword arguments and their respective values. The updated information will be validated before being submitted to the API.
|
|
183
|
+
|
|
184
|
+
```python
|
|
185
|
+
#the kwargs can be defined as: KEY_WORD1=VAlUE1, KEY_WORD2=VALUE2... etc
|
|
186
|
+
target.update(KEY_WORD1=VAlUE1, KEY_WORD2=VALUE2... etc)
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Valid MMT Target `KEY_WORD`'s:
|
|
190
|
+
|
|
191
|
+
```python
|
|
192
|
+
[
|
|
193
|
+
'id', 'ra', 'objectid', 'observationtype', 'moon', 'seeing', 'photometric', 'priority', 'dec', 'ra_decimal',
|
|
194
|
+
'dec_decimal', 'pm_ra', 'pm_dec', 'magnitude', 'exposuretime', 'numberexposures', 'visits',
|
|
195
|
+
'onevisitpernight', 'filter', 'grism', 'grating', 'centralwavelength', 'readtab', 'gain', 'dithersize',
|
|
196
|
+
'epoch', 'submitted', 'modified', 'notes', 'pa', 'maskid', 'slitwidth', 'slitwidthproperty', 'iscomplete',
|
|
197
|
+
'disabled', 'notify', 'locked', 'findingchartfilename', 'instrumentid', 'targetofopportunity', 'reduced',
|
|
198
|
+
'exposuretimeremaining', 'totallength', 'totallengthformatted', 'exposuretimeremainingformatted',
|
|
199
|
+
'exposuretimecompleted', 'percentcompleted', 'offsetstars', 'details', 'mask'
|
|
200
|
+
]
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Deleting a Target
|
|
204
|
+
|
|
205
|
+
Once a target is created or retireved with the API GET method, it can be deleted from the Observatory scheduler.
|
|
206
|
+
|
|
207
|
+
```python
|
|
208
|
+
target.delete()
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## Other API Endpoints
|
|
212
|
+
|
|
213
|
+
### MMT Instrument
|
|
214
|
+
|
|
215
|
+
Here we describe the API endpoint to get the current instruments in the most recent published schedule. When instantiating a Target through this API it will validate whether or not the Binospec instrument is on the telescope. It can also be used to see what instruments are currently on, or when an instrument will be on the telescope.
|
|
216
|
+
|
|
217
|
+
This function takes can take in two parameters:
|
|
218
|
+
* `date`
|
|
219
|
+
* `instrumentid`
|
|
220
|
+
|
|
221
|
+
if you don't pass any params into the function it will just find the current instruments on the telescope using `datetime.datetime.now()`
|
|
222
|
+
|
|
223
|
+
```python
|
|
224
|
+
from datetime import datetime, timedelta
|
|
225
|
+
api = pymmt.api()
|
|
226
|
+
current_instruments = api.get_instruments()
|
|
227
|
+
|
|
228
|
+
#you can look into the future to see what instruments will be available:
|
|
229
|
+
future_instruments = api.get_instruments(date=datetime.datetime.now()+timedelta(months=1))
|
|
230
|
+
|
|
231
|
+
#you can look through the entire published schedule to see when a certain instrument will be on the telescope (Binospec = 16, MMIRS = 15)
|
|
232
|
+
my_instrument = api.get_instruments(instrumentid=16)
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
This function returns a list of dictionary elements with the values for:
|
|
236
|
+
* `instrumentid` - ID for the instrument
|
|
237
|
+
* `name` - the name of the queue run
|
|
238
|
+
* `start` - start date
|
|
239
|
+
* `end` - end date
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "PyMMT"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
authors = [
|
|
9
|
+
{ name="Samuel Wyatt", email="swyatt@arizona.edu" },
|
|
10
|
+
{ name="Manisha Shrestha", email="mshrestha1@arizona.edu" },
|
|
11
|
+
{ name="Griffin Hosseinzadeh", email="griffin0@arizona.edu" }
|
|
12
|
+
]
|
|
13
|
+
description = "A python API wrapper for the MMT Observatory"
|
|
14
|
+
readme = "README.md"
|
|
15
|
+
requires-python = ">=3.10"
|
|
16
|
+
dependencies = [
|
|
17
|
+
"requests",
|
|
18
|
+
"setuptools_scm",
|
|
19
|
+
"ipykernel", # Support for Jupyter notebooks
|
|
20
|
+
]
|
|
21
|
+
classifiers = [
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"License :: OSI Approved :: MIT License",
|
|
24
|
+
"Operating System :: OS Independent",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.urls]
|
|
28
|
+
"Homepage" = "https://github.com/SAGUARO-MMA/PyMMT"
|
|
29
|
+
"Bug Tracker" = "https://github.com/SAGUARO-MMA/PyMMT/issues"
|
PyMMT-1.0.0/setup.cfg
ADDED