arvi 0.2.8__py3-none-any.whl → 0.2.10__py3-none-any.whl
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.
Potentially problematic release.
This version of arvi might be problematic. Click here for more details.
- arvi/dace_wrapper.py +7 -5
- arvi/instrument_specific.py +23 -9
- arvi/kepmodel_wrapper.py +296 -0
- arvi/nasaexo_wrapper.py +7 -3
- arvi/plots.py +1 -3
- arvi/reports.py +108 -1
- arvi/stats.py +30 -5
- arvi/timeseries.py +312 -119
- arvi/utils.py +86 -8
- {arvi-0.2.8.dist-info → arvi-0.2.10.dist-info}/METADATA +1 -1
- {arvi-0.2.8.dist-info → arvi-0.2.10.dist-info}/RECORD +14 -13
- {arvi-0.2.8.dist-info → arvi-0.2.10.dist-info}/WHEEL +0 -0
- {arvi-0.2.8.dist-info → arvi-0.2.10.dist-info}/licenses/LICENSE +0 -0
- {arvi-0.2.8.dist-info → arvi-0.2.10.dist-info}/top_level.txt +0 -0
arvi/utils.py
CHANGED
|
@@ -2,6 +2,7 @@ import os
|
|
|
2
2
|
import sys
|
|
3
3
|
import time
|
|
4
4
|
from contextlib import contextmanager
|
|
5
|
+
|
|
5
6
|
try:
|
|
6
7
|
from unittest.mock import patch
|
|
7
8
|
except ImportError:
|
|
@@ -98,8 +99,9 @@ def sanitize_path(path):
|
|
|
98
99
|
path = path.replace('*', '_')
|
|
99
100
|
return path
|
|
100
101
|
|
|
101
|
-
def pretty_print_table(rows, line_between_rows=True,
|
|
102
|
-
|
|
102
|
+
def pretty_print_table(rows, line_between_rows=True, string=False,
|
|
103
|
+
markdown=False, latex=False, logger=None):
|
|
104
|
+
r"""
|
|
103
105
|
Example Output
|
|
104
106
|
┌──────┬─────────────┬────┬───────┐
|
|
105
107
|
│ True │ short │ 77 │ catty │
|
|
@@ -110,25 +112,76 @@ def pretty_print_table(rows, line_between_rows=True, logger=None):
|
|
|
110
112
|
└──────┴─────────────┴────┴───────┘
|
|
111
113
|
"""
|
|
112
114
|
_print = logger.info if logger else print
|
|
115
|
+
if string:
|
|
116
|
+
def _print(x, s):
|
|
117
|
+
s += x + '\n'
|
|
118
|
+
return s
|
|
119
|
+
else:
|
|
120
|
+
if logger:
|
|
121
|
+
def _print(x, _):
|
|
122
|
+
logger.info(x)
|
|
123
|
+
else:
|
|
124
|
+
def _print(x, _):
|
|
125
|
+
print(x)
|
|
126
|
+
|
|
127
|
+
if latex or markdown:
|
|
128
|
+
line_between_rows = False
|
|
129
|
+
|
|
130
|
+
s = ''
|
|
113
131
|
|
|
114
132
|
# find the max length of each column
|
|
115
133
|
max_col_lens = list(map(max, zip(*[(len(str(cell)) for cell in row) for row in rows])))
|
|
116
134
|
|
|
135
|
+
if markdown:
|
|
136
|
+
bar_char = '|'
|
|
137
|
+
else:
|
|
138
|
+
bar_char = r'│'
|
|
139
|
+
|
|
117
140
|
# print the table's top border
|
|
118
|
-
|
|
141
|
+
if markdown:
|
|
142
|
+
pass
|
|
143
|
+
elif latex:
|
|
144
|
+
s = _print(r'\begin{table*}', s)
|
|
145
|
+
# s = _print(r'\centering', s)
|
|
146
|
+
s = _print(r'\begin{tabular}' + '{' + ' c ' * len(rows[0]) + '}', s)
|
|
147
|
+
else:
|
|
148
|
+
s = _print(r'┌' + r'┬'.join(r'─' * (n + 2) for n in max_col_lens) + r'┐', s)
|
|
119
149
|
|
|
120
|
-
|
|
150
|
+
if markdown:
|
|
151
|
+
header_separator = bar_char + bar_char.join('-' * (n + 2) for n in max_col_lens) + bar_char
|
|
121
152
|
|
|
122
|
-
|
|
153
|
+
rows_separator = r'├' + r'┼'.join(r'─' * (n + 2) for n in max_col_lens) + r'┤'
|
|
154
|
+
|
|
155
|
+
if latex:
|
|
156
|
+
row_fstring = ' & '.join("{: <%s}" % n for n in max_col_lens)
|
|
157
|
+
else:
|
|
158
|
+
row_fstring = bar_char.center(3).join("{: <%s}" % n for n in max_col_lens)
|
|
123
159
|
|
|
124
160
|
for i, row in enumerate(rows):
|
|
125
|
-
|
|
161
|
+
if markdown and i == 1:
|
|
162
|
+
s = _print(header_separator, s)
|
|
163
|
+
|
|
164
|
+
if latex:
|
|
165
|
+
s = _print(row_fstring.format(*map(str, row)) + r' \\', s)
|
|
166
|
+
else:
|
|
167
|
+
s = _print(bar_char + ' ' + row_fstring.format(*map(str, row)) + ' ' + bar_char, s)
|
|
126
168
|
|
|
169
|
+
|
|
127
170
|
if line_between_rows and i < len(rows) - 1:
|
|
128
|
-
_print(rows_separator)
|
|
171
|
+
s = _print(rows_separator, s)
|
|
172
|
+
|
|
129
173
|
|
|
130
174
|
# print the table's bottom border
|
|
131
|
-
|
|
175
|
+
if markdown:
|
|
176
|
+
pass
|
|
177
|
+
elif latex:
|
|
178
|
+
s = _print(r'\end{tabular}', s)
|
|
179
|
+
s = _print(r'\end{table*}', s)
|
|
180
|
+
else:
|
|
181
|
+
s = _print(r'└' + r'┴'.join(r'─' * (n + 2) for n in max_col_lens) + r'┘', s)
|
|
182
|
+
|
|
183
|
+
if string:
|
|
184
|
+
return s
|
|
132
185
|
|
|
133
186
|
|
|
134
187
|
def strtobool(val):
|
|
@@ -238,3 +291,28 @@ def get_object_fast(file):
|
|
|
238
291
|
value = f.read(20)
|
|
239
292
|
return value.decode().split("'")[1].strip()
|
|
240
293
|
|
|
294
|
+
|
|
295
|
+
def get_simbad_oid(self):
|
|
296
|
+
import requests
|
|
297
|
+
if isinstance(self, str):
|
|
298
|
+
star = self
|
|
299
|
+
else:
|
|
300
|
+
star = self.star
|
|
301
|
+
oid = requests.post('https://simbad.cds.unistra.fr/simbad/sim-tap/sync',
|
|
302
|
+
data=dict(format='text', request='doQuery', lang='adql', phase='run',
|
|
303
|
+
query=f"SELECT basic.OID FROM basic JOIN ident ON oidref = oid WHERE id = '{star}';"))
|
|
304
|
+
oid = oid.text.split()[-1]
|
|
305
|
+
return oid
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
# from https://stackoverflow.com/questions/37765197/darken-or-lighten-a-color-in-matplotlib
|
|
310
|
+
def adjust_lightness(color, amount=0.5):
|
|
311
|
+
import matplotlib.colors as mc
|
|
312
|
+
import colorsys
|
|
313
|
+
try:
|
|
314
|
+
c = mc.cnames[color]
|
|
315
|
+
except KeyError:
|
|
316
|
+
c = color
|
|
317
|
+
c = colorsys.rgb_to_hls(*mc.to_rgb(c))
|
|
318
|
+
return colorsys.hls_to_rgb(c[0], max(0, min(1, amount * c[1])), c[2])
|
|
@@ -4,35 +4,36 @@ arvi/ariadne_wrapper.py,sha256=YvilopJa9T4NwPcj3Nah_U8smSeSAU5-HYZMb_GJ-BQ,2232
|
|
|
4
4
|
arvi/berv.py,sha256=eKnpuPC1w45UrUEyFRbs9F9j3bXz3kxYzNXbnRgvFQM,17596
|
|
5
5
|
arvi/binning.py,sha256=NK9y9bUrdyWCbh79LkcRABHG-n5MtlETMHMvLj1z-OM,15437
|
|
6
6
|
arvi/config.py,sha256=JkHSwF-EEqwwbcc8thGgbFc9udDZPjQH-9XFjqDepBY,2337
|
|
7
|
-
arvi/dace_wrapper.py,sha256=
|
|
7
|
+
arvi/dace_wrapper.py,sha256=r5e5E3Cpml5eHkSE4pDYVAQHg-6hXNNCSQo8xD_xr1w,25974
|
|
8
8
|
arvi/exofop_wrapper.py,sha256=8S7UEcrBAgANIweMV0-CvaWaVTPgGVo8vQQk_KRa0nU,2414
|
|
9
9
|
arvi/extra_data.py,sha256=Xi65pI5kkzqlMmHGl9xFoumtH699611pJJ5PV-a_IfU,3397
|
|
10
10
|
arvi/gaia_wrapper.py,sha256=HTuigIduin3raWfSC7QYuQxDk2dEXYH_4egRkzzg7Xw,4379
|
|
11
11
|
arvi/headers.py,sha256=uvdJebw1M5YkGjE3vJJwYBOnLikib75uuZE9FXB5JJM,1673
|
|
12
|
-
arvi/instrument_specific.py,sha256=
|
|
12
|
+
arvi/instrument_specific.py,sha256=94oMb6UeH6tp7H8YXnXHpxEhIz2evz0iYsT_HrNOCTo,12105
|
|
13
|
+
arvi/kepmodel_wrapper.py,sha256=mmHudetAZ4cBxKDwzQzgUydzkjhomCWw5VVuyiKfXq8,10288
|
|
13
14
|
arvi/kima_wrapper.py,sha256=GrAZWkDCg8ukhW41M1VTadSbab0GBa6BIzjtAtvjk58,3891
|
|
14
15
|
arvi/lbl_wrapper.py,sha256=_ViGVkpakvuBR_xhu9XJRV5EKHpj5Go6jBZGJZMIS2Y,11850
|
|
15
|
-
arvi/nasaexo_wrapper.py,sha256=
|
|
16
|
-
arvi/plots.py,sha256=
|
|
16
|
+
arvi/nasaexo_wrapper.py,sha256=ZKY3IUClqsJuysxDv0Gu51EnzMX7101zQb7UQy_urhI,7431
|
|
17
|
+
arvi/plots.py,sha256=U4VUNyIx4h_rEFd7ZWgBcawUcIGcURES0A4VXIBKp3U,35240
|
|
17
18
|
arvi/programs.py,sha256=M8o8hXr6W22dMiIX3Nxz4pgb8lsJXApDlq7HStyTfqs,9047
|
|
18
|
-
arvi/reports.py,sha256=
|
|
19
|
+
arvi/reports.py,sha256=a38EZNhyGoSSzJh63wBQCAt3_xhqbpVGcDOXaZWTLXs,11127
|
|
19
20
|
arvi/setup_logger.py,sha256=dHzO2gPjw6CaKWpYZd2f83z09tmxgi--qpp7k1jROjI,615
|
|
20
21
|
arvi/simbad_wrapper.py,sha256=uZc8mcfNijXsQi29LReRTabZb2hRPhYdLsDLMgq1OEI,9927
|
|
21
22
|
arvi/sophie_wrapper.py,sha256=KUeWccXud5_Lrx72S1HSemHIZRdjd2oLvqyofwsL0QQ,3440
|
|
22
23
|
arvi/spectra.py,sha256=ebF1ocodTastLx0CyqLSpE8EZNDXBF8riyfxMr3L6H0,7491
|
|
23
|
-
arvi/stats.py,sha256=
|
|
24
|
+
arvi/stats.py,sha256=gvMkKzP83AV8_Oi71JHmA8QH8Y1z1viYykV9ELVDqZI,3547
|
|
24
25
|
arvi/stellar.py,sha256=GQ7yweuBRnfkJ0M5eWjvLd8uvGq_by81PbXfidBvWis,4918
|
|
25
|
-
arvi/timeseries.py,sha256=
|
|
26
|
+
arvi/timeseries.py,sha256=kKmBbwHG3U544XcrhcL0FC3h-VLq33HgS_rnkpJWxIo,104563
|
|
26
27
|
arvi/translations.py,sha256=PUSrn4zvYO2MqGzUxlFGwev_tBkgJaJrIYs6NKHzbWo,951
|
|
27
|
-
arvi/utils.py,sha256=
|
|
28
|
+
arvi/utils.py,sha256=x_zDTW1vp672CZe-m9-KXo5IVk-JKOs2wme_ta4t8MU,9402
|
|
28
29
|
arvi/data/info.svg,sha256=0IMI6W-eFoTD8acnury79WJJakpBwLa4qKS4JWpsXiI,489
|
|
29
30
|
arvi/data/obs_affected_ADC_issues.dat,sha256=tn93uOL0eCTYhireqp1wG-_c3CbxPA7C-Rf-pejVY8M,10853
|
|
30
31
|
arvi/data/obs_affected_blue_cryostat_issues.dat,sha256=z4AK17xfz8tGTDv1FjRvQFnio4XA6PNNfDXuicewHk4,1771
|
|
31
32
|
arvi/data/extra/HD86226_PFS1.rdb,sha256=vfAozbrKHM_j8dYkCBJsuHyD01KEM1asghe2KInwVao,3475
|
|
32
33
|
arvi/data/extra/HD86226_PFS2.rdb,sha256=F2P7dB6gVyzCglUjNheB0hIHVClC5RmARrGwbrY1cfo,4114
|
|
33
34
|
arvi/data/extra/metadata.json,sha256=C69hIw6CohyES6BI9vDWjxwSz7N4VOYX0PCgjXtYFmU,178
|
|
34
|
-
arvi-0.2.
|
|
35
|
-
arvi-0.2.
|
|
36
|
-
arvi-0.2.
|
|
37
|
-
arvi-0.2.
|
|
38
|
-
arvi-0.2.
|
|
35
|
+
arvi-0.2.10.dist-info/licenses/LICENSE,sha256=6JfQgl7SpM55t0EHMFNMnNh-AdkpGW25MwMiTnhdWQg,1068
|
|
36
|
+
arvi-0.2.10.dist-info/METADATA,sha256=rUZI75Y3zhDh4HmpsviDj6MnYJJPeOIu6aA09JLB2d8,1933
|
|
37
|
+
arvi-0.2.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
38
|
+
arvi-0.2.10.dist-info/top_level.txt,sha256=4EeiKDVLD45ztuflTGfQ3TU8GVjJg5Y95xS5XjI-utU,5
|
|
39
|
+
arvi-0.2.10.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|