arvi 0.1.16__py3-none-any.whl → 0.1.19__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/translations.py CHANGED
@@ -5,19 +5,27 @@ STARS = {
5
5
  'Barnard': 'GJ699',
6
6
  "Barnard's": 'GJ699',
7
7
  'Ross128': 'Ross 128',
8
+ 'Ross 128': 'Ross 128',
8
9
  }
9
10
 
10
11
 
11
- def translate(star):
12
+ def translate(star, ngc=False, ic=False):
12
13
  # known translations
13
14
  if star in STARS:
14
15
  return STARS[star]
15
16
 
16
17
  # regex translations
17
- NGC_match = re.match(r'NGC([\s\d]+)No([\s\d]+)', star)
18
- if NGC_match:
19
- cluster = NGC_match.group(1).replace(' ', '')
20
- target = NGC_match.group(2).replace(' ', '')
21
- return f'Cl* NGC {cluster} MMU {target}'
18
+ if ngc:
19
+ NGC_match = re.match(r'NGC([\s\d]+)No([\s\d]+)', star)
20
+ if NGC_match:
21
+ cluster = NGC_match.group(1).replace(' ', '')
22
+ target = NGC_match.group(2).replace(' ', '')
23
+ return f'Cl* NGC {cluster} MMU {target}'
24
+ if ic:
25
+ IC_match = re.match(r'IC([\s\d]+)No([\s\d]+)', star)
26
+ if IC_match:
27
+ cluster = IC_match.group(1).replace(' ', '')
28
+ target = IC_match.group(2).replace(' ', '')
29
+ return f'Cl* IC {cluster} MMU {target}'
22
30
 
23
31
  return star
arvi/utils.py CHANGED
@@ -1,4 +1,5 @@
1
1
  import os
2
+ import sys
2
3
  import time
3
4
  from contextlib import contextmanager
4
5
  try:
@@ -21,7 +22,7 @@ except ImportError:
21
22
  trange = lambda *args, **kwargs: range(*args, **kwargs)
22
23
 
23
24
  from .setup_logger import logger
24
- from . import config
25
+ from .config import config
25
26
 
26
27
 
27
28
  def create_directory(directory):
@@ -67,13 +68,17 @@ def all_logging_disabled():
67
68
 
68
69
 
69
70
  @contextmanager
70
- def timer():
71
+ def timer(name=None):
71
72
  """ A simple context manager to time a block of code """
72
73
  if not config.debug:
73
74
  yield
74
75
  return
75
76
 
76
- logger.debug(f'starting timer')
77
+ if name is None:
78
+ logger.debug('starting timer')
79
+ else:
80
+ logger.debug(f'starting timer: {name}')
81
+
77
82
  start = time.time()
78
83
  try:
79
84
  yield
@@ -82,6 +87,44 @@ def timer():
82
87
  logger.debug(f'elapsed time: {end - start:.2f} seconds')
83
88
 
84
89
 
90
+ def sanitize_path(path):
91
+ if os.name == 'nt': # on Windows, be careful with ':' in filename
92
+ path = path.replace(':', '_')
93
+ return path
94
+
95
+ def pretty_print_table(rows, line_between_rows=True, logger=None):
96
+ """
97
+ Example Output
98
+ ┌──────┬─────────────┬────┬───────┐
99
+ │ True │ short │ 77 │ catty │
100
+ ├──────┼─────────────┼────┼───────┤
101
+ │ 36 │ long phrase │ 9 │ dog │
102
+ ├──────┼─────────────┼────┼───────┤
103
+ │ 8 │ medium │ 3 │ zebra │
104
+ └──────┴─────────────┴────┴───────┘
105
+ """
106
+ _print = logger.info if logger else print
107
+
108
+ # find the max length of each column
109
+ max_col_lens = list(map(max, zip(*[(len(str(cell)) for cell in row) for row in rows])))
110
+
111
+ # print the table's top border
112
+ _print('┌' + '┬'.join('─' * (n + 2) for n in max_col_lens) + '┐')
113
+
114
+ rows_separator = '├' + '┼'.join('─' * (n + 2) for n in max_col_lens) + '┤'
115
+
116
+ row_fstring = ' │ '.join("{: <%s}" % n for n in max_col_lens)
117
+
118
+ for i, row in enumerate(rows):
119
+ _print('│ ' + row_fstring.format(*map(str, row)) + ' │')
120
+
121
+ if line_between_rows and i < len(rows) - 1:
122
+ _print(rows_separator)
123
+
124
+ # print the table's bottom border
125
+ _print('└' + '┴'.join('─' * (n + 2) for n in max_col_lens) + '┘')
126
+
127
+
85
128
  def strtobool(val):
86
129
  """Convert a string representation of truth to true (1) or false (0).
87
130
 
@@ -106,6 +149,11 @@ def there_is_internet(timeout=1):
106
149
  pass
107
150
  return False
108
151
 
152
+ def get_data_path():
153
+ here = os.path.dirname(os.path.abspath(__file__))
154
+ data_path = os.path.join(here, 'data')
155
+ return data_path
156
+
109
157
  def find_data_file(file):
110
158
  here = os.path.dirname(os.path.abspath(__file__))
111
159
  data_file = os.path.join(here, '..', 'data', file)
@@ -163,4 +211,12 @@ def get_max_berv_span(self, n=None):
163
211
  inds.append(b2)
164
212
  return np.array(inds[:n])
165
213
 
214
+ def get_object_fast(file):
215
+ with open(file, 'rb') as f:
216
+ f.read(800) # read first 10 keywords
217
+ key = f.read(8)
218
+ assert key == b'OBJECT ', 'Object keyword not found.'
219
+ f.read(2)
220
+ value = f.read(20)
221
+ return value.decode().split("'")[1].strip()
166
222
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: arvi
3
- Version: 0.1.16
3
+ Version: 0.1.19
4
4
  Summary: The Automated RV Inspector
5
5
  Author-email: João Faria <joao.faria@unige.ch>
6
6
  License: MIT
@@ -25,8 +25,41 @@ Requires-Dist: mock; python_version < "3.3"
25
25
  <img width = "140" src="https://github.com/j-faria/arvi/blob/main/docs/logo/logo.png?raw=true"/>
26
26
  </p>
27
27
 
28
+ This package sits alongside [DACE](https://dace.unige.ch/) to help with the
29
+ analysis of radial velocity datasets.
30
+ It has been used within the ESPRESSO GTO program, and may be useful for other
31
+ surveys and instruments.
28
32
 
29
33
 
34
+ ## Getting started
35
+
36
+ Install `arvi` using pip
37
+
38
+ ```sh
39
+ pip install arvi
40
+
41
+ # or
42
+ pip install arvi -U # to update
43
+ ```
44
+
45
+
46
+ Then either directly import a given target
47
+
48
+ ```py
49
+ from arvi import HD1234
50
+ ```
51
+
52
+ or create an instance of the `RV` class
53
+
54
+ ```py
55
+ from arvi import RV
56
+ s = RV('HD1234', instrument='ESPRESSO')
57
+ ```
58
+
59
+ #### Current version
60
+
61
+ ![PyPI - Version](https://img.shields.io/pypi/v/arvi)
62
+
30
63
  #### Actions
31
64
 
32
65
  [![Deploy docs](https://github.com/j-faria/arvi/actions/workflows/docs-gh-pages.yml/badge.svg)](https://github.com/j-faria/arvi/actions/workflows/docs-gh-pages.yml)
@@ -0,0 +1,36 @@
1
+ arvi/HZ.py,sha256=u7rguhlILRBW-LOczlY3dkIB4LM8p8W7Xfg4FnNaYG0,2850
2
+ arvi/__init__.py,sha256=r3oaMVwQCjNTd6odg-ga9IRncn54i7tawZrIrvSRQOo,1012
3
+ arvi/ariadne_wrapper.py,sha256=YvilopJa9T4NwPcj3Nah_U8smSeSAU5-HYZMb_GJ-BQ,2232
4
+ arvi/berv.py,sha256=eKnpuPC1w45UrUEyFRbs9F9j3bXz3kxYzNXbnRgvFQM,17596
5
+ arvi/binning.py,sha256=jbemJ-bM3aqoOsqMo_OhWt_co-JAQ0nhdG_GpTsrRsw,15403
6
+ arvi/config.py,sha256=ftqR38bV-zohTynPguiKSp4kSHPjiqJwEi-u6dFrFwk,1047
7
+ arvi/dace_wrapper.py,sha256=ml0xC_KR-oXwEo6ysODzfpx-eP7VNbxURZSns31WbK4,18196
8
+ arvi/extra_data.py,sha256=WEEaYeLh52Zdv0uyHO72Ys5MWS3naTAP4wJV2BJ1mbk,2551
9
+ arvi/gaia_wrapper.py,sha256=icm3LJjG9pjP47_bM30NFyocUQO3X3SHS5yQ-Dwcr5w,4653
10
+ arvi/headers.py,sha256=uvdJebw1M5YkGjE3vJJwYBOnLikib75uuZE9FXB5JJM,1673
11
+ arvi/instrument_specific.py,sha256=-pbm2Vk3iK_1K7nDa1avlJOKHBcXllwILI4lQn-Ze-A,7761
12
+ arvi/kima_wrapper.py,sha256=y_Z0Hl2ECbs2-B6ZR9retrjId7-QxcRylG7b5aDsiFk,2306
13
+ arvi/lbl_wrapper.py,sha256=_ViGVkpakvuBR_xhu9XJRV5EKHpj5Go6jBZGJZMIS2Y,11850
14
+ arvi/nasaexo_wrapper.py,sha256=mWt7eHgSZe4MBKCmUvMPTyUPGuiwGTqKugNBvmjOg9s,7306
15
+ arvi/plots.py,sha256=WUm-sqN0aZTNXvE1kYpvmHTW9QPWqSCpKhNjwaqxjEk,29628
16
+ arvi/programs.py,sha256=C0Fbldjf-QEZYYJp5wBKP3h7zraD0O2mJC7Su967STg,4607
17
+ arvi/reports.py,sha256=ayPdZ4HZO9iCDdnADQ18gQPJh79o-1UYG7TYkvm9Lrc,4051
18
+ arvi/setup_logger.py,sha256=pBzaRTn0hntozjbaRVx0JIbWGuENkvYUApa6uB-FsRo,279
19
+ arvi/simbad_wrapper.py,sha256=f6QYrMN0KzBH9KhdrUR5w6ZK00EoRIYr3Z9jS4CzP_s,5791
20
+ arvi/spectra.py,sha256=pTAWSW4vk96DWRQ-6l5mNJHUhiAyaPR-QDjZdOT6Ak0,7489
21
+ arvi/stats.py,sha256=ilzzGL9ew-SyVa9eEdrYCpD3DliOAwhoNUg9LIlHjzU,2583
22
+ arvi/stellar.py,sha256=veuL_y9kJvvApU_jqYQqP3EkcRnQffTc8Us6iT5UrFI,3790
23
+ arvi/timeseries.py,sha256=tiMky3YESl3Hul02RTB6lQmAMfvByJ3bkNCLncpyips,71278
24
+ arvi/translations.py,sha256=FBF_2OrpMQBG4GtV4_UOspiaxetiGCY7TQFcwZMMVuQ,838
25
+ arvi/utils.py,sha256=ihQcYvk_ix52CW8fVP16CKTVEamGU5gPNRneVcgDrWc,6534
26
+ arvi/data/info.svg,sha256=0IMI6W-eFoTD8acnury79WJJakpBwLa4qKS4JWpsXiI,489
27
+ arvi/data/obs_affected_ADC_issues.dat,sha256=tn93uOL0eCTYhireqp1wG-_c3CbxPA7C-Rf-pejVY8M,10853
28
+ arvi/data/obs_affected_blue_cryostat_issues.dat,sha256=z4AK17xfz8tGTDv1FjRvQFnio4XA6PNNfDXuicewHk4,1771
29
+ arvi/data/extra/HD86226_PFS1.rdb,sha256=vfAozbrKHM_j8dYkCBJsuHyD01KEM1asghe2KInwVao,3475
30
+ arvi/data/extra/HD86226_PFS2.rdb,sha256=F2P7dB6gVyzCglUjNheB0hIHVClC5RmARrGwbrY1cfo,4114
31
+ arvi/data/extra/metadata.json,sha256=C69hIw6CohyES6BI9vDWjxwSz7N4VOYX0PCgjXtYFmU,178
32
+ arvi-0.1.19.dist-info/LICENSE,sha256=6JfQgl7SpM55t0EHMFNMnNh-AdkpGW25MwMiTnhdWQg,1068
33
+ arvi-0.1.19.dist-info/METADATA,sha256=1-fwifbRRjnymfS-6JSA9KF07VYE-ZisksHT7l3Bp-Q,1852
34
+ arvi-0.1.19.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
35
+ arvi-0.1.19.dist-info/top_level.txt,sha256=4EeiKDVLD45ztuflTGfQ3TU8GVjJg5Y95xS5XjI-utU,5
36
+ arvi-0.1.19.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.1.0)
2
+ Generator: setuptools (75.3.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,35 +0,0 @@
1
- arvi/HZ.py,sha256=u7rguhlILRBW-LOczlY3dkIB4LM8p8W7Xfg4FnNaYG0,2850
2
- arvi/__init__.py,sha256=stLL3UtXmR1jpNEoMyVohjvkCatunz1w5ZK0ApmWuYQ,814
3
- arvi/ariadne_wrapper.py,sha256=jv8Wl35LfHl1UH1EklbvxHcQHqaEDhRGNogSYjFt7Y4,2141
4
- arvi/berv.py,sha256=5avwcmc2nkYH1KDo-z4eMPsS1ElNvold2DWkziV13gE,17633
5
- arvi/binning.py,sha256=jbemJ-bM3aqoOsqMo_OhWt_co-JAQ0nhdG_GpTsrRsw,15403
6
- arvi/config.py,sha256=wyj6FTxN7QOZj8LaHAe_ZdPKVfrNfobNNOHRNLH-S7Q,339
7
- arvi/dace_wrapper.py,sha256=F0MIfAFmZJ-wBGNAkhxLqrcFUyfqdFIT4aCD_5LxILs,16912
8
- arvi/extra_data.py,sha256=WEEaYeLh52Zdv0uyHO72Ys5MWS3naTAP4wJV2BJ1mbk,2551
9
- arvi/gaia_wrapper.py,sha256=sapurDBceHbj-pj9t9hcPUrg-3NZEoQouo__lXFD6p8,3554
10
- arvi/headers.py,sha256=uvdJebw1M5YkGjE3vJJwYBOnLikib75uuZE9FXB5JJM,1673
11
- arvi/instrument_specific.py,sha256=fhkvR5jJzpJH7XbT8Fbzkaz6tGeoFYugkJCIAJgSR7o,4746
12
- arvi/lbl_wrapper.py,sha256=_ViGVkpakvuBR_xhu9XJRV5EKHpj5Go6jBZGJZMIS2Y,11850
13
- arvi/nasaexo_wrapper.py,sha256=mWt7eHgSZe4MBKCmUvMPTyUPGuiwGTqKugNBvmjOg9s,7306
14
- arvi/plots.py,sha256=92z0A46cnVdGv840oZZ7PP_fssZECYe5Zyl5OZl1p3k,27996
15
- arvi/programs.py,sha256=C0Fbldjf-QEZYYJp5wBKP3h7zraD0O2mJC7Su967STg,4607
16
- arvi/reports.py,sha256=8HiwWdaOh_P2V4-F6PV4TjasZLeZ8kC5dUYB1tQam1o,3368
17
- arvi/setup_logger.py,sha256=pBzaRTn0hntozjbaRVx0JIbWGuENkvYUApa6uB-FsRo,279
18
- arvi/simbad_wrapper.py,sha256=d8svoEUF6in2M3WrqSXfJ_drwnXD1NGPUnxP94qUOI0,5579
19
- arvi/spectra.py,sha256=pTAWSW4vk96DWRQ-6l5mNJHUhiAyaPR-QDjZdOT6Ak0,7489
20
- arvi/stats.py,sha256=ilzzGL9ew-SyVa9eEdrYCpD3DliOAwhoNUg9LIlHjzU,2583
21
- arvi/stellar.py,sha256=MdO1_-ZXHnMHbkG-a5LvrnYeULy6MCAnWMKPvR4NZxQ,2954
22
- arvi/timeseries.py,sha256=sdm9l_LHItZHDAVI6r_wsQwkrfbuMX46q3Wqs0y-KGA,60787
23
- arvi/translations.py,sha256=SUIrJHt3JZdL_GQh3OJyg2Gm3X5ut86w5zW8hZpxHe0,498
24
- arvi/utils.py,sha256=2TEj6t_6gW6dPQTPn5AFyg_F5SdI7P6IUGkecOkzoV4,4387
25
- arvi/data/info.svg,sha256=0IMI6W-eFoTD8acnury79WJJakpBwLa4qKS4JWpsXiI,489
26
- arvi/data/obs_affected_ADC_issues.dat,sha256=tn93uOL0eCTYhireqp1wG-_c3CbxPA7C-Rf-pejVY8M,10853
27
- arvi/data/obs_affected_blue_cryostat_issues.dat,sha256=z4AK17xfz8tGTDv1FjRvQFnio4XA6PNNfDXuicewHk4,1771
28
- arvi/data/extra/HD86226_PFS1.rdb,sha256=vfAozbrKHM_j8dYkCBJsuHyD01KEM1asghe2KInwVao,3475
29
- arvi/data/extra/HD86226_PFS2.rdb,sha256=F2P7dB6gVyzCglUjNheB0hIHVClC5RmARrGwbrY1cfo,4114
30
- arvi/data/extra/metadata.json,sha256=C69hIw6CohyES6BI9vDWjxwSz7N4VOYX0PCgjXtYFmU,178
31
- arvi-0.1.16.dist-info/LICENSE,sha256=6JfQgl7SpM55t0EHMFNMnNh-AdkpGW25MwMiTnhdWQg,1068
32
- arvi-0.1.16.dist-info/METADATA,sha256=5xv7DMFQMyaJqAMJji4_56s4aDZnumycmVsECnUImS4,1250
33
- arvi-0.1.16.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
34
- arvi-0.1.16.dist-info/top_level.txt,sha256=4EeiKDVLD45ztuflTGfQ3TU8GVjJg5Y95xS5XjI-utU,5
35
- arvi-0.1.16.dist-info/RECORD,,
File without changes