p2api 1.0.6__tar.gz → 1.0.7__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.
- {p2api-1.0.6 → p2api-1.0.7}/.gitignore +1 -0
- {p2api-1.0.6 → p2api-1.0.7}/PKG-INFO +1 -1
- p2api-1.0.7/p2api/__about__.py +1 -0
- {p2api-1.0.6 → p2api-1.0.7}/p2api/utils/add_absolute_time_intervals.py +56 -9
- {p2api-1.0.6 → p2api-1.0.7}/p2api/utils/generate_finding_charts.py +2 -0
- {p2api-1.0.6 → p2api-1.0.7}/p2api/utils/p2api_utils.py +5 -5
- {p2api-1.0.6 → p2api-1.0.7}/pyproject.toml +2 -0
- p2api-1.0.7/setup.cfg +4 -0
- p2api-1.0.7/setup.py +127 -0
- p2api-1.0.6/p2api/__about__.py +0 -1
- {p2api-1.0.6 → p2api-1.0.7}/LICENSE +0 -0
- {p2api-1.0.6 → p2api-1.0.7}/README.md +0 -0
- {p2api-1.0.6 → p2api-1.0.7}/p2api/__init__.py +0 -0
- {p2api-1.0.6 → p2api-1.0.7}/p2api/p2api.py +0 -0
- {p2api-1.0.6 → p2api-1.0.7}/p2api/utils/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: p2api
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.7
|
|
4
4
|
Summary: Binding for the ESO phase 2 programmatic API
|
|
5
5
|
Project-URL: Homepage, https://www.eso.org/copdemo/apidoc/index.html
|
|
6
6
|
Author-email: Thomas Bierwirth <thomas.bierwirth@eso.org>, John Pritchard <john.pritchard@eso.org>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.0.7"
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
from __future__ import print_function
|
|
5
5
|
|
|
6
6
|
_VERSION_ = "$Revision: 267033 $"
|
|
7
|
+
from ..p2api import __version__
|
|
8
|
+
_VERSION_ = __version__
|
|
7
9
|
|
|
8
10
|
import sys # interaction with Python interpreter
|
|
9
11
|
from optparse import OptionParser # for parsing command line arguments
|
|
@@ -65,7 +67,7 @@ e.g. yyyy-mm-ddThh:mm,yyyy-mm-ddThh:mm_yyyy-mm-ddThh:mm,yyyy-mm-ddThh:mm{_...}
|
|
|
65
67
|
group.add_option("-E", "--ephem", dest="ephem", metavar="T0,PERIOD", help="Comma separated list of orbital T0[JD] and period[days] [optional]", default=None)
|
|
66
68
|
group.add_option("--phase_intervals", dest="phase_intervals", help="Comma separated list of phase intervals e.g. 0.1-0.2,0.305-0.375 [optional]", default=None)
|
|
67
69
|
group.add_option("--phase_target", dest="phase_target", help="Comma separated list of target phase, start_before [mins], min_start_before [mins] e.g. 0.01,120,30 [optional]", default=None)
|
|
68
|
-
group.add_option("--periods", dest="periods", help=
|
|
70
|
+
group.add_option("--periods", dest="periods", help="Comma separated list of periods, default={} [optional]".format(default_eso_period), default=str(default_eso_period))
|
|
69
71
|
parser.add_option_group(group)
|
|
70
72
|
|
|
71
73
|
group = OptionGroup(parser, "p2 server selection, options and password management")
|
|
@@ -214,9 +216,23 @@ def get_ob_ATCs(telescope=None, ob_info=None, run_info=None) :
|
|
|
214
216
|
checked_phase_intervals+=[p_int,]
|
|
215
217
|
else :
|
|
216
218
|
if ob_exec_time < p_int_in_sec :
|
|
217
|
-
logging.warning(
|
|
219
|
+
logging.warning(
|
|
220
|
+
'Phase interval {}--{} == {:3.1f}sec is too short to start and finish this OB with execution time of {}secs.'.format(
|
|
221
|
+
p_int[0],
|
|
222
|
+
p_int[1],
|
|
223
|
+
p_int_in_sec,
|
|
224
|
+
ob_exec_time,
|
|
225
|
+
)
|
|
226
|
+
)
|
|
218
227
|
if p_int_in_sec > min_ATI_length.to_value(u.second) :
|
|
219
|
-
logging.warning(
|
|
228
|
+
logging.warning(
|
|
229
|
+
'Phase interval {}--{} == {:3.1f}sec is shorter than the minimum ATI length time of {}secs.'.format(
|
|
230
|
+
p_int[0],
|
|
231
|
+
p_int[1],
|
|
232
|
+
p_int_in_sec,
|
|
233
|
+
min_ATI_length.to_value(u.second),
|
|
234
|
+
)
|
|
235
|
+
)
|
|
220
236
|
|
|
221
237
|
sf_ints=[]
|
|
222
238
|
for sf_jd in sf_jds :
|
|
@@ -267,11 +283,33 @@ def get_ob_ATCs(telescope=None, ob_info=None, run_info=None) :
|
|
|
267
283
|
sf_ints+=[sf_int,]
|
|
268
284
|
else :
|
|
269
285
|
if not int_spans_nighttime :
|
|
270
|
-
logging.debug(
|
|
286
|
+
logging.debug(
|
|
287
|
+
'Interval does not span any part of the night, original interval = {}, SSSR of previous and next nights {}--{} and {}--{}'.format(
|
|
288
|
+
original_sf_int,
|
|
289
|
+
sssr[0][0].jd,
|
|
290
|
+
sssr[0][1].jd,
|
|
291
|
+
sssr[1][0].jd,
|
|
292
|
+
sssr[1][1].jd,
|
|
293
|
+
)
|
|
294
|
+
)
|
|
271
295
|
if ((sf_int[1]-sf_int[0])*24*60.*60. < ob_exec_time) :
|
|
272
|
-
logging.debug(
|
|
296
|
+
logging.debug(
|
|
297
|
+
'Checked Interval shorter [{:3.1f}sec] than OB execution time [{:3.1f}sec], original interval = {}, checked interval = {}'.format(
|
|
298
|
+
(sf_int[1]-sf_int[0])*24*60.*60.,
|
|
299
|
+
ob_exec_time,
|
|
300
|
+
original_sf_int,
|
|
301
|
+
sf_int,
|
|
302
|
+
)
|
|
303
|
+
)
|
|
273
304
|
if ((sf_int[1]-sf_int[0])*24*60.*60. < min_ATI_length.to_value(u.second)) :
|
|
274
|
-
logging.debug(
|
|
305
|
+
logging.debug(
|
|
306
|
+
'Checked Interval shorter [{:3.1f}sec] than minimum ATI length time [{:3.1f}sec], original interval = {}, checked interval = {}'.format(
|
|
307
|
+
(sf_int[1]-sf_int[0])*24*60.*60.,
|
|
308
|
+
min_ATI_length.to_value(u.second),
|
|
309
|
+
original_sf_int,
|
|
310
|
+
sf_int,
|
|
311
|
+
)
|
|
312
|
+
)
|
|
275
313
|
pass
|
|
276
314
|
ATCs=[Time(sf_int, format='jd') for sf_int in sf_ints]
|
|
277
315
|
check_ATCs=True
|
|
@@ -290,8 +328,17 @@ def get_ob_ATCs(telescope=None, ob_info=None, run_info=None) :
|
|
|
290
328
|
if check_ATCs :
|
|
291
329
|
phase_range=''
|
|
292
330
|
if options.ephem is not None :
|
|
293
|
-
phase_range=
|
|
294
|
-
|
|
331
|
+
phase_range=" [Phases: {:5.3f} -- {:5.3f}]".format(
|
|
332
|
+
(((t[0]-Time(T0,format='jd'))/P).to_value(u.day)%1),
|
|
333
|
+
(((t[1]-Time(T0,format='jd'))/P).to_value(u.day)%1),
|
|
334
|
+
)
|
|
335
|
+
print("{:3d} {} -- {} [duration={}]{}".format(
|
|
336
|
+
i+1,
|
|
337
|
+
ob_ATCs[-1]['from'],
|
|
338
|
+
ob_ATCs[-1]['to'],
|
|
339
|
+
((t[1]-t[0]).to_datetime()),
|
|
340
|
+
phase_range,
|
|
341
|
+
))
|
|
295
342
|
if check_ATCs :
|
|
296
343
|
'''
|
|
297
344
|
logging.warning("****************************************************************************************")
|
|
@@ -313,7 +360,7 @@ def get_ob_ATCs(telescope=None, ob_info=None, run_info=None) :
|
|
|
313
360
|
print("to report/discuss the errors/problems in the above calculations.")
|
|
314
361
|
print("Please include in the description the EXACT command line used to run the script.")
|
|
315
362
|
sys.exit(0)
|
|
316
|
-
#raise Exception(
|
|
363
|
+
#raise Exception("Aborted.")
|
|
317
364
|
return ob_ATCs
|
|
318
365
|
# ------------------------------------------------------------------------------
|
|
319
366
|
def oneOB( api, obId ) :
|
|
@@ -59,7 +59,7 @@ def ESO_period_start_end_dates(P):
|
|
|
59
59
|
md1=ESO_period_first_last_dates[P%2][0]
|
|
60
60
|
y2=1967+(P+2)//2
|
|
61
61
|
md2=ESO_period_first_last_dates[P%2][1]
|
|
62
|
-
return [
|
|
62
|
+
return ["{}{}".format(y1,md1),"{y2}{md2}.format(y2,md2)"]
|
|
63
63
|
# ---------------------------------------------------------------------------------------
|
|
64
64
|
def ESO_period_start_end_datetimes(P):
|
|
65
65
|
ESO_period_first_last_dates=[
|
|
@@ -70,7 +70,7 @@ def ESO_period_start_end_datetimes(P):
|
|
|
70
70
|
md1=ESO_period_first_last_dates[P%2][0]
|
|
71
71
|
y2=1967+(P+2)//2
|
|
72
72
|
md2=ESO_period_first_last_dates[P%2][1]
|
|
73
|
-
return [
|
|
73
|
+
return ["{}{}".format(y1,md1),"{y2}{md2}.format(y2,md2)"]
|
|
74
74
|
# ---------------------------------------------------------------------------------------
|
|
75
75
|
def get_attrs(klass):
|
|
76
76
|
return [k for k in klass.__dict__.keys()
|
|
@@ -280,8 +280,8 @@ def decode_datetime( d ) :
|
|
|
280
280
|
d_tz=d
|
|
281
281
|
for tz in tz_info :
|
|
282
282
|
d_tz=re.sub(
|
|
283
|
-
|
|
284
|
-
|
|
283
|
+
'{}.format(tz)',
|
|
284
|
+
'{}.format(tz_info[tz])',
|
|
285
285
|
d_tz,
|
|
286
286
|
)
|
|
287
287
|
for s in [d_tz,d] :
|
|
@@ -300,5 +300,5 @@ def decode_datetime( d ) :
|
|
|
300
300
|
return dt
|
|
301
301
|
except :
|
|
302
302
|
pass
|
|
303
|
-
raise Exception(
|
|
303
|
+
raise Exception("Could not decode date '{}'.".format(d))
|
|
304
304
|
# ---------------------------------------------------------------------------------------
|
p2api-1.0.7/setup.cfg
ADDED
p2api-1.0.7/setup.py
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
from setuptools import setup
|
|
2
|
+
import os
|
|
3
|
+
import io
|
|
4
|
+
|
|
5
|
+
'''
|
|
6
|
+
Restored setup.py & setup.cfg following instructions at:
|
|
7
|
+
Follow instructions at https://stackoverflow.com/questions/42287533/restore-deleted-file-with-history-in-git
|
|
8
|
+
|
|
9
|
+
git config --get remote.origin.url
|
|
10
|
+
git checkout a53fb714b8b48cd0112ae175a179e4a2c6859de1 -b restore_setuptools_build_support
|
|
11
|
+
git mv setup.py setup_1.py
|
|
12
|
+
git mv setup.cfg setup_1.cfg
|
|
13
|
+
git commit -m "Move file (1)"
|
|
14
|
+
SAVED=`git rev-parse HEAD`
|
|
15
|
+
git reset --hard "HEAD^"
|
|
16
|
+
git mv setup.py setup_2.py
|
|
17
|
+
git mv setup.cfg setup_2.cfg
|
|
18
|
+
git commit -m "Move file (2)"
|
|
19
|
+
git merge $SAVED
|
|
20
|
+
git commit -a -n
|
|
21
|
+
git checkout master
|
|
22
|
+
git merge restore_setuptools_build_support
|
|
23
|
+
git commit -a -n
|
|
24
|
+
git rm setup_1.py setup_1.cfg
|
|
25
|
+
git mv setup_2.py setup.py
|
|
26
|
+
git mv setup_2.cfg setup.cfg
|
|
27
|
+
git commit -m "recovery finished"
|
|
28
|
+
'''
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
# ----------------------------------------------------
|
|
32
|
+
def read(*paths, **kwargs):
|
|
33
|
+
"""Read the contents of a text file safely.
|
|
34
|
+
>>> read("p2api", "VERSION")
|
|
35
|
+
'0.1.0'
|
|
36
|
+
>>> read("README.md")
|
|
37
|
+
...
|
|
38
|
+
"""
|
|
39
|
+
content = ""
|
|
40
|
+
with io.open(
|
|
41
|
+
os.path.join(os.path.dirname(__file__), *paths),
|
|
42
|
+
encoding=kwargs.get("encoding", "utf8"),
|
|
43
|
+
) as open_file:
|
|
44
|
+
content = open_file.read().strip()
|
|
45
|
+
return content
|
|
46
|
+
# ----------------------------------------------------
|
|
47
|
+
from p2api import __about__
|
|
48
|
+
setup(
|
|
49
|
+
name='p2api',
|
|
50
|
+
#version=read('p2api', 'VERSION'),
|
|
51
|
+
version=__about__.__version__,
|
|
52
|
+
description='Binding for the ESO phase 2 programmatic API',
|
|
53
|
+
long_description=read('README.md'),
|
|
54
|
+
long_description_content_type='text/markdown',
|
|
55
|
+
url='https://www.eso.org/copdemo/apidoc/index.html',
|
|
56
|
+
author='Thomas Bierwirth',
|
|
57
|
+
author_email='thomas.bierwirth@eso.org',
|
|
58
|
+
|
|
59
|
+
packages=['p2api', 'p2api/utils',],
|
|
60
|
+
include_package_data=True,
|
|
61
|
+
entry_points={
|
|
62
|
+
'console_scripts' : [
|
|
63
|
+
'p2api_generate_finding_charts = p2api.utils.generate_finding_charts:main',
|
|
64
|
+
'p2api_add_absolute_time_intervals = p2api.utils.add_absolute_time_intervals:main',
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
# Classifiers help users find your project by categorizing it.
|
|
69
|
+
#
|
|
70
|
+
# For a list of valid classifiers, see
|
|
71
|
+
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
|
|
72
|
+
classifiers=[ # Optional
|
|
73
|
+
# How mature is this project? Common values are
|
|
74
|
+
# 3 - Alpha
|
|
75
|
+
# 4 - Beta
|
|
76
|
+
# 5 - Production/Stable
|
|
77
|
+
'Development Status :: 5 - Production/Stable',
|
|
78
|
+
|
|
79
|
+
# Indicate who your project is intended for
|
|
80
|
+
'Intended Audience :: Developers',
|
|
81
|
+
|
|
82
|
+
# Pick your license as you wish
|
|
83
|
+
'License :: OSI Approved :: MIT License',
|
|
84
|
+
|
|
85
|
+
# Specify the Python versions you support here. In particular, ensure
|
|
86
|
+
# that you indicate whether you support Python 2, Python 3 or both.
|
|
87
|
+
'Programming Language :: Python :: 2',
|
|
88
|
+
'Programming Language :: Python :: 2.7',
|
|
89
|
+
'Programming Language :: Python :: 3',
|
|
90
|
+
'Programming Language :: Python :: 3.4',
|
|
91
|
+
'Programming Language :: Python :: 3.5',
|
|
92
|
+
'Programming Language :: Python :: 3.6',
|
|
93
|
+
'Programming Language :: Python :: 3.7',
|
|
94
|
+
'Programming Language :: Python :: 3.8',
|
|
95
|
+
'Programming Language :: Python :: 3.9',
|
|
96
|
+
'Programming Language :: Python :: 3.10',
|
|
97
|
+
],
|
|
98
|
+
|
|
99
|
+
# This field adds keywords for your project which will appear on the
|
|
100
|
+
# project page. What does your project relate to?
|
|
101
|
+
#
|
|
102
|
+
# Note that this is a string of words separated by whitespace, not a list.
|
|
103
|
+
keywords='ESO Phase2 Observation Preparation Programmatic API',
|
|
104
|
+
|
|
105
|
+
# You can just specify package directories manually here if your project is
|
|
106
|
+
# simple. Or you can use find_packages().
|
|
107
|
+
#
|
|
108
|
+
# Alternatively, if you just want to distribute a single Python file, use
|
|
109
|
+
# the `py_modules` argument instead as follows, which will expect a file
|
|
110
|
+
# called `my_module.py` to exist:
|
|
111
|
+
#
|
|
112
|
+
py_modules=["p2api"],
|
|
113
|
+
|
|
114
|
+
# This field lists other packages that your project depends on to run.
|
|
115
|
+
# Any package you put here will be installed by pip when your project is
|
|
116
|
+
# installed, so they must be valid existing projects.
|
|
117
|
+
#
|
|
118
|
+
# For an analysis of "install_requires" vs pip's requirements files see:
|
|
119
|
+
# https://packaging.python.org/en/latest/requirements.html
|
|
120
|
+
install_requires=[
|
|
121
|
+
'requests',
|
|
122
|
+
'keyring',
|
|
123
|
+
'astropy', ## needed for add_absolute_time_intervals
|
|
124
|
+
'astroplan', ## needed for add_absolute_time_intervals
|
|
125
|
+
],
|
|
126
|
+
license='MIT'
|
|
127
|
+
)
|
p2api-1.0.6/p2api/__about__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.0.6"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|