PyMMT 1.0.1__tar.gz → 1.0.2__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.1 → pymmt-1.0.2}/PKG-INFO +1 -1
- {pymmt-1.0.1 → pymmt-1.0.2}/pyproject.toml +1 -1
- {pymmt-1.0.1 → pymmt-1.0.2}/src/PyMMT.egg-info/PKG-INFO +1 -1
- {pymmt-1.0.1 → pymmt-1.0.2}/src/pymmt/pymmt.py +23 -17
- {pymmt-1.0.1 → pymmt-1.0.2}/README.md +0 -0
- {pymmt-1.0.1 → pymmt-1.0.2}/setup.cfg +0 -0
- {pymmt-1.0.1 → pymmt-1.0.2}/src/PyMMT.egg-info/SOURCES.txt +0 -0
- {pymmt-1.0.1 → pymmt-1.0.2}/src/PyMMT.egg-info/dependency_links.txt +0 -0
- {pymmt-1.0.1 → pymmt-1.0.2}/src/PyMMT.egg-info/requires.txt +0 -0
- {pymmt-1.0.1 → pymmt-1.0.2}/src/PyMMT.egg-info/top_level.txt +0 -0
- {pymmt-1.0.1 → pymmt-1.0.2}/src/pymmt/__init__.py +0 -0
- {pymmt-1.0.1 → pymmt-1.0.2}/src/pymmt/instruments/__init__.py +0 -0
- {pymmt-1.0.1 → pymmt-1.0.2}/src/pymmt/instruments/binospec.py +0 -0
- {pymmt-1.0.1 → pymmt-1.0.2}/src/pymmt/instruments/mmirs.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyMMT
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: A python API wrapper for the MMT Observatory
|
|
5
5
|
Author-email: Samuel Wyatt <swyatt@arizona.edu>, Manisha Shrestha <mshrestha1@arizona.edu>, Griffin Hosseinzadeh <griffin0@arizona.edu>
|
|
6
6
|
Project-URL: Homepage, https://github.com/SAGUARO-MMA/PyMMT
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyMMT
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: A python API wrapper for the MMT Observatory
|
|
5
5
|
Author-email: Samuel Wyatt <swyatt@arizona.edu>, Manisha Shrestha <mshrestha1@arizona.edu>, Griffin Hosseinzadeh <griffin0@arizona.edu>
|
|
6
6
|
Project-URL: Homepage, https://github.com/SAGUARO-MMA/PyMMT
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
import
|
|
1
|
+
import json
|
|
2
|
+
import os
|
|
3
|
+
import re
|
|
4
|
+
import time
|
|
5
|
+
from datetime import datetime
|
|
2
6
|
from pathlib import Path
|
|
3
|
-
|
|
7
|
+
|
|
8
|
+
import requests # type: ignore
|
|
9
|
+
|
|
10
|
+
from . import MMT_JSON_KEYS, isFloat, isInt
|
|
4
11
|
from .instruments.binospec import validate as bino_validate
|
|
5
12
|
from .instruments.mmirs import validate as mmirs_validate
|
|
6
|
-
from datetime import datetime
|
|
7
|
-
|
|
8
13
|
|
|
9
|
-
|
|
14
|
+
BASE_URL = "https://scheduler.mmto.arizona.edu/APIv2"
|
|
10
15
|
|
|
11
|
-
|
|
16
|
+
class api:
|
|
12
17
|
|
|
13
|
-
|
|
18
|
+
def __init__(self, base=BASE_URL, target=None, token=None):
|
|
19
|
+
self.base = base
|
|
14
20
|
self.target = target
|
|
15
21
|
|
|
16
22
|
if token is None:
|
|
@@ -62,7 +68,7 @@ class api():
|
|
|
62
68
|
|
|
63
69
|
|
|
64
70
|
class Target(api):
|
|
65
|
-
def __init__(self, token=None, verbose=True, payload={}):
|
|
71
|
+
def __init__(self, token=None, verbose=True, payload={}, base=BASE_URL):
|
|
66
72
|
self.verbose = verbose
|
|
67
73
|
self.valid = False
|
|
68
74
|
self.downloaded = False
|
|
@@ -73,7 +79,7 @@ class Target(api):
|
|
|
73
79
|
}
|
|
74
80
|
|
|
75
81
|
assert token is not None, 'Token cannot be None'
|
|
76
|
-
super().__init__('catalogTarget', token)
|
|
82
|
+
super().__init__(target='catalogTarget', token=token, base=base)
|
|
77
83
|
|
|
78
84
|
allowed_keys = list(MMT_JSON_KEYS)
|
|
79
85
|
self.__dict__.update((str(key).lower(), value) for key, value in payload.items() if str(key).lower() in allowed_keys)
|
|
@@ -94,7 +100,7 @@ class Target(api):
|
|
|
94
100
|
|
|
95
101
|
if 'ra' in selfkeys:
|
|
96
102
|
ra = selfdict['ra']
|
|
97
|
-
r = re.compile('.{2}:.{2}:.{2}\.*')
|
|
103
|
+
r = re.compile(r'.{2}:.{2}:.{2}\.*')
|
|
98
104
|
if not r.match(ra):
|
|
99
105
|
errors.append('Invalid format for field \'ra\' ['+ra+']. Valid format is dd:dd:dd.d')
|
|
100
106
|
else:
|
|
@@ -102,7 +108,7 @@ class Target(api):
|
|
|
102
108
|
|
|
103
109
|
if 'dec' in selfkeys:
|
|
104
110
|
dec = selfdict['dec']
|
|
105
|
-
r = re.compile('.{2}:.{2}:.{2}\.*')
|
|
111
|
+
r = re.compile(r'.{2}:.{2}:.{2}\.*')
|
|
106
112
|
isNeg = dec.startswith('-')
|
|
107
113
|
if '-' in dec:
|
|
108
114
|
dec = dec.split('-')[1]
|
|
@@ -460,9 +466,9 @@ class Target(api):
|
|
|
460
466
|
|
|
461
467
|
|
|
462
468
|
class Instruments(api):
|
|
463
|
-
def __init__(self, token=None, verbose=True, payload={}):
|
|
469
|
+
def __init__(self, token=None, verbose=True, payload={}, base=BASE_URL):
|
|
464
470
|
self. verbose = verbose
|
|
465
|
-
super().__init__('trimester//schedule/all/', token)
|
|
471
|
+
super().__init__(target='trimester//schedule/all/', token=token)
|
|
466
472
|
|
|
467
473
|
def get_instruments(self, date=None, instrumentid=None, getAll=False):
|
|
468
474
|
if date is None and instrumentid is None:
|
|
@@ -505,10 +511,10 @@ class Instruments(api):
|
|
|
505
511
|
|
|
506
512
|
|
|
507
513
|
class Datalist(api):
|
|
508
|
-
def __init__(self, token=None, verbose=True, payload={}):
|
|
514
|
+
def __init__(self, token=None, verbose=True, payload={}, base=BASE_URL):
|
|
509
515
|
self.verbose = verbose
|
|
510
516
|
self.data = []
|
|
511
|
-
super().__init__('data/list/catalogtarget', token)
|
|
517
|
+
super().__init__(target='data/list/catalogtarget', token=token)
|
|
512
518
|
|
|
513
519
|
|
|
514
520
|
def get(self, targetid, data_type='raw'):
|
|
@@ -530,9 +536,9 @@ class Datalist(api):
|
|
|
530
536
|
|
|
531
537
|
|
|
532
538
|
class Image(api):
|
|
533
|
-
def __init__(self, token=None, verbose=True, payload={}):
|
|
539
|
+
def __init__(self, token=None, verbose=True, payload={}, base=BASE_URL):
|
|
534
540
|
self. verbose = verbose
|
|
535
|
-
super().__init__('data/download/datafile', token)
|
|
541
|
+
super().__init__(target='data/download/datafile', token=token)
|
|
536
542
|
|
|
537
543
|
|
|
538
544
|
def get(self, datafileid=None, filepath=os.getcwd()):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|