arvi 0.1.16__tar.gz → 0.1.19__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.

Potentially problematic release.


This version of arvi might be problematic. Click here for more details.

Files changed (60) hide show
  1. {arvi-0.1.16 → arvi-0.1.19}/.github/workflows/install.yml +5 -0
  2. {arvi-0.1.16 → arvi-0.1.19}/.gitignore +4 -0
  3. {arvi-0.1.16/arvi.egg-info → arvi-0.1.19}/PKG-INFO +34 -1
  4. {arvi-0.1.16 → arvi-0.1.19}/README.md +33 -0
  5. {arvi-0.1.16 → arvi-0.1.19}/arvi/__init__.py +9 -0
  6. {arvi-0.1.16 → arvi-0.1.19}/arvi/ariadne_wrapper.py +3 -0
  7. {arvi-0.1.16 → arvi-0.1.19}/arvi/berv.py +1 -2
  8. arvi-0.1.19/arvi/config.py +36 -0
  9. {arvi-0.1.16 → arvi-0.1.19}/arvi/dace_wrapper.py +92 -62
  10. {arvi-0.1.16 → arvi-0.1.19}/arvi/gaia_wrapper.py +21 -3
  11. arvi-0.1.19/arvi/instrument_specific.py +247 -0
  12. arvi-0.1.19/arvi/kima_wrapper.py +74 -0
  13. {arvi-0.1.16 → arvi-0.1.19}/arvi/plots.py +67 -23
  14. {arvi-0.1.16 → arvi-0.1.19}/arvi/reports.py +23 -0
  15. {arvi-0.1.16 → arvi-0.1.19}/arvi/simbad_wrapper.py +10 -5
  16. {arvi-0.1.16 → arvi-0.1.19}/arvi/stellar.py +30 -11
  17. {arvi-0.1.16 → arvi-0.1.19}/arvi/timeseries.py +414 -121
  18. arvi-0.1.19/arvi/translations.py +31 -0
  19. {arvi-0.1.16 → arvi-0.1.19}/arvi/utils.py +59 -3
  20. {arvi-0.1.16 → arvi-0.1.19/arvi.egg-info}/PKG-INFO +34 -1
  21. {arvi-0.1.16 → arvi-0.1.19}/arvi.egg-info/SOURCES.txt +1 -0
  22. {arvi-0.1.16 → arvi-0.1.19}/pyproject.toml +4 -4
  23. arvi-0.1.19/tests/test_import_object.py +17 -0
  24. arvi-0.1.16/arvi/config.py +0 -14
  25. arvi-0.1.16/arvi/instrument_specific.py +0 -156
  26. arvi-0.1.16/arvi/translations.py +0 -23
  27. arvi-0.1.16/tests/test_import_object.py +0 -17
  28. {arvi-0.1.16 → arvi-0.1.19}/.github/workflows/docs-gh-pages.yml +0 -0
  29. {arvi-0.1.16 → arvi-0.1.19}/.github/workflows/python-publish.yml +0 -0
  30. {arvi-0.1.16 → arvi-0.1.19}/LICENSE +0 -0
  31. {arvi-0.1.16 → arvi-0.1.19}/arvi/HZ.py +0 -0
  32. {arvi-0.1.16 → arvi-0.1.19}/arvi/binning.py +0 -0
  33. {arvi-0.1.16 → arvi-0.1.19}/arvi/data/extra/HD86226_PFS1.rdb +0 -0
  34. {arvi-0.1.16 → arvi-0.1.19}/arvi/data/extra/HD86226_PFS2.rdb +0 -0
  35. {arvi-0.1.16 → arvi-0.1.19}/arvi/data/extra/metadata.json +0 -0
  36. {arvi-0.1.16 → arvi-0.1.19}/arvi/data/info.svg +0 -0
  37. {arvi-0.1.16 → arvi-0.1.19}/arvi/data/obs_affected_ADC_issues.dat +0 -0
  38. {arvi-0.1.16 → arvi-0.1.19}/arvi/data/obs_affected_blue_cryostat_issues.dat +0 -0
  39. {arvi-0.1.16 → arvi-0.1.19}/arvi/extra_data.py +0 -0
  40. {arvi-0.1.16 → arvi-0.1.19}/arvi/headers.py +0 -0
  41. {arvi-0.1.16 → arvi-0.1.19}/arvi/lbl_wrapper.py +0 -0
  42. {arvi-0.1.16 → arvi-0.1.19}/arvi/nasaexo_wrapper.py +0 -0
  43. {arvi-0.1.16 → arvi-0.1.19}/arvi/programs.py +0 -0
  44. {arvi-0.1.16 → arvi-0.1.19}/arvi/setup_logger.py +0 -0
  45. {arvi-0.1.16 → arvi-0.1.19}/arvi/spectra.py +0 -0
  46. {arvi-0.1.16 → arvi-0.1.19}/arvi/stats.py +0 -0
  47. {arvi-0.1.16 → arvi-0.1.19}/arvi.egg-info/dependency_links.txt +0 -0
  48. {arvi-0.1.16 → arvi-0.1.19}/arvi.egg-info/requires.txt +0 -0
  49. {arvi-0.1.16 → arvi-0.1.19}/arvi.egg-info/top_level.txt +0 -0
  50. {arvi-0.1.16 → arvi-0.1.19}/docs/API.md +0 -0
  51. {arvi-0.1.16 → arvi-0.1.19}/docs/detailed.md +0 -0
  52. {arvi-0.1.16 → arvi-0.1.19}/docs/index.md +0 -0
  53. {arvi-0.1.16 → arvi-0.1.19}/docs/logo/detective.png +0 -0
  54. {arvi-0.1.16 → arvi-0.1.19}/docs/logo/logo.png +0 -0
  55. {arvi-0.1.16 → arvi-0.1.19}/mkdocs.yml +0 -0
  56. {arvi-0.1.16 → arvi-0.1.19}/setup.cfg +0 -0
  57. {arvi-0.1.16 → arvi-0.1.19}/setup.py +0 -0
  58. {arvi-0.1.16 → arvi-0.1.19}/tests/test_binning.py +0 -0
  59. {arvi-0.1.16 → arvi-0.1.19}/tests/test_simbad.py +0 -0
  60. {arvi-0.1.16 → arvi-0.1.19}/tests/test_stats.py +0 -0
@@ -44,4 +44,9 @@ jobs:
44
44
  - name: Test with pytest
45
45
  run: |
46
46
  pytest --disable-warnings
47
+
48
+ - name: Check version
49
+ run: |
50
+ python -c "import arvi; print(arvi.__version__)"
51
+
47
52
 
@@ -1,4 +1,8 @@
1
1
  *.fits
2
+ *.pkl
3
+ *.rdb
4
+ arvi/data/KOBE-translate.csv
5
+
2
6
 
3
7
 
4
8
  # Byte-compiled / optimized / DLL files
@@ -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: kepmodel
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)
@@ -2,8 +2,41 @@
2
2
  <img width = "140" src="https://github.com/j-faria/arvi/blob/main/docs/logo/logo.png?raw=true"/>
3
3
  </p>
4
4
 
5
+ This package sits alongside [DACE](https://dace.unige.ch/) to help with the
6
+ analysis of radial velocity datasets.
7
+ It has been used within the ESPRESSO GTO program, and may be useful for other
8
+ surveys and instruments.
5
9
 
6
10
 
11
+ ## Getting started
12
+
13
+ Install `arvi` using pip
14
+
15
+ ```sh
16
+ pip install arvi
17
+
18
+ # or
19
+ pip install arvi -U # to update
20
+ ```
21
+
22
+
23
+ Then either directly import a given target
24
+
25
+ ```py
26
+ from arvi import HD1234
27
+ ```
28
+
29
+ or create an instance of the `RV` class
30
+
31
+ ```py
32
+ from arvi import RV
33
+ s = RV('HD1234', instrument='ESPRESSO')
34
+ ```
35
+
36
+ #### Current version
37
+
38
+ ![PyPI - Version](https://img.shields.io/pypi/v/arvi)
39
+
7
40
  #### Actions
8
41
 
9
42
  [![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)
@@ -1,7 +1,16 @@
1
1
  __all__ = ['RV']
2
2
 
3
+ from importlib.metadata import version, PackageNotFoundError
4
+
5
+ from .config import config
3
6
  from .timeseries import RV
4
7
 
8
+ try:
9
+ __version__ = version("arvi")
10
+ except PackageNotFoundError:
11
+ # package is not installed
12
+ pass
13
+
5
14
  ## OLD
6
15
  # # the __getattr__ function is always called twice, so we need this
7
16
  # # to only build and return the RV object on the second time
@@ -2,6 +2,9 @@ import os
2
2
  import sys
3
3
  from matplotlib import pyplot as plt
4
4
 
5
+ from .utils import stdout_disabled, all_logging_disabled
6
+ from .setup_logger import logger
7
+
5
8
  try:
6
9
  from astroARIADNE.star import Star
7
10
  from astroARIADNE.fitter import Fitter
@@ -12,7 +12,7 @@ from astropy.timeseries import LombScargle
12
12
  from tqdm import tqdm
13
13
 
14
14
  from .setup_logger import logger
15
- from . import config
15
+ from .config import config
16
16
 
17
17
 
18
18
  def correct_rvs(self, simple=False, H=None, save_files=False, plot=True):
@@ -349,7 +349,6 @@ def BERV(self, H=None, use_gaia_meassurements=False, plx=None,
349
349
  axs[1].plot(bjd, diff, 'k.', label=label)
350
350
  axs[1].axhline(np.mean(diff), ls='--', c='k', alpha=0.1)
351
351
 
352
- from adjustText import adjust_text
353
352
  text = axs[1].text(bjd.max(), diff.min() + 0.1*diff.ptp(),
354
353
  f'ptp: {diff.ptp()*1e2:.2f} cm/s',
355
354
  ha='right', va='bottom', color='g', alpha=0.8)
@@ -0,0 +1,36 @@
1
+
2
+ def instancer(cls):
3
+ return cls()
4
+
5
+ @instancer
6
+ class config:
7
+ # configuration values
8
+ __conf = {
9
+ # whether to return self from (some) RV methods
10
+ 'return_self': False,
11
+ # whether to adjust instrument means before gls by default
12
+ 'adjust_means_gls': True,
13
+ # whether to check internet connection before querying DACE
14
+ 'check_internet': False,
15
+ # make all DACE requests without using a .dacerc file
16
+ 'request_as_public': False,
17
+ # username for DACE servers
18
+ 'username': 'desousaj',
19
+ # debug
20
+ 'debug': False,
21
+ }
22
+ # all, for now
23
+ __setters = list(__conf.keys())
24
+
25
+ def __getattr__(self, name):
26
+ if name in ('__custom_documentations__', ):
27
+ # return {'return_self': 'help!'}
28
+ return {}
29
+
30
+ return self.__conf[name]
31
+
32
+ def __setattr__(self, name, value):
33
+ if name in config.__setters:
34
+ self.__conf[name] = value
35
+ else:
36
+ raise NameError(f"unknown configuration name '{name}'")
@@ -10,8 +10,8 @@ from .utils import create_directory, all_logging_disabled, stdout_disabled, tqdm
10
10
 
11
11
 
12
12
  def load_spectroscopy() -> SpectroscopyClass:
13
- from .config import request_as_public
14
- if request_as_public:
13
+ from .config import config
14
+ if config.request_as_public:
15
15
  with all_logging_disabled():
16
16
  dace = DaceClass(dace_rc_config_path='none')
17
17
  return SpectroscopyClass(dace_instance=dace)
@@ -41,14 +41,18 @@ def get_arrays(result, latest_pipeline=True, ESPRESSO_mode='HR11', NIRPS_mode='H
41
41
 
42
42
  # select ESPRESSO mode, which is defined at the level of the pipeline
43
43
  if 'ESPRESSO' in inst:
44
- if any(ESPRESSO_mode in pipe for pipe in pipelines):
44
+
45
+ find_mode = [ESPRESSO_mode in pipe for pipe in pipelines]
46
+ # the mode was not found
47
+ if not any(find_mode):
48
+ if len(pipelines) > 1 and verbose:
49
+ logger.warning(f'no observations for requested ESPRESSO mode ({ESPRESSO_mode})')
50
+ # the mode was found but do nothing if it's the only one
51
+ elif any(find_mode) and not all(find_mode):
45
52
  if verbose:
46
53
  logger.info(f'selecting mode {ESPRESSO_mode} for ESPRESSO')
47
54
  i = [i for i, pipe in enumerate(pipelines) if ESPRESSO_mode in pipe][0]
48
55
  pipelines = [pipelines[i]]
49
- else:
50
- if len(pipelines) > 1 and verbose:
51
- logger.warning(f'no observations for requested ESPRESSO mode ({ESPRESSO_mode})')
52
56
 
53
57
  if latest_pipeline:
54
58
  if verbose and len(pipelines) > 1:
@@ -59,6 +63,7 @@ def get_arrays(result, latest_pipeline=True, ESPRESSO_mode='HR11', NIRPS_mode='H
59
63
  for pipe in pipelines:
60
64
  modes = list(result[inst][pipe].keys())
61
65
 
66
+
62
67
  # select NIRPS mode, which is defined at the level of the mode
63
68
  if 'NIRPS' in inst:
64
69
  if NIRPS_mode in modes:
@@ -70,6 +75,19 @@ def get_arrays(result, latest_pipeline=True, ESPRESSO_mode='HR11', NIRPS_mode='H
70
75
  if verbose:
71
76
  logger.warning(f'no observations for requested NIRPS mode ({NIRPS_mode})')
72
77
 
78
+ # HARPS15 observations should not be separated by 'mode' if some are
79
+ # done together with NIRPS
80
+ if 'HARPS15' in inst and 'HARPS+NIRPS' in modes:
81
+ m0 = modes[0]
82
+ data = {
83
+ k: np.concatenate([result[inst][pipe][m][k] for m in modes])
84
+ for k in result[inst][pipe][m0].keys()
85
+ }
86
+ arrays.append(
87
+ ((inst, pipe, m0), data)
88
+ )
89
+ continue
90
+
73
91
  for mode in modes:
74
92
  if 'rjd' not in result[inst][pipe][mode]:
75
93
  logger.error(f"No 'rjd' key for {inst} - {pipe}")
@@ -105,7 +123,7 @@ def get_observations_from_instrument(star, instrument, main_id=None):
105
123
 
106
124
  Spectroscopy = load_spectroscopy()
107
125
  filters = {
108
- "ins_name": {"contains": [instrument]},
126
+ "ins_name": {"contains": [instrument]},
109
127
  "obj_id_daceid": {"contains": [dace_id]}
110
128
  }
111
129
  with stdout_disabled(), all_logging_disabled():
@@ -115,62 +133,70 @@ def get_observations_from_instrument(star, instrument, main_id=None):
115
133
  raise ValueError
116
134
 
117
135
  r = {}
136
+
118
137
  for inst in np.unique(result['ins_name']):
119
138
  mask1 = result['ins_name'] == inst
120
139
  r[inst] = {}
140
+
121
141
  for pipe in np.unique(result['ins_drs_version'][mask1]):
122
142
  mask2 = mask1 & (result['ins_drs_version'] == pipe)
123
- ins_mode = np.unique(result['ins_mode'][mask2])[0]
124
- _nan = np.full(mask2.sum(), np.nan)
125
- r[inst][pipe] = {
126
- ins_mode: {
127
- 'texp': result['texp'][mask2],
128
- 'bispan': result['spectro_ccf_bispan'][mask2],
129
- 'bispan_err': result['spectro_ccf_bispan_err'][mask2],
130
- 'drift_noise': result['spectro_cal_drift_noise'][mask2],
131
- 'rjd': result['obj_date_bjd'][mask2],
143
+ r[inst][pipe] = {}
144
+
145
+ for ins_mode in np.unique(result['ins_mode'][mask2]):
146
+ mask3 = mask2 & (result['ins_mode'] == ins_mode)
147
+ _nan = np.full(mask3.sum(), np.nan)
148
+
149
+ r[inst][pipe][ins_mode] = {
150
+ 'texp': result['texp'][mask3],
151
+ 'bispan': result['spectro_ccf_bispan'][mask3],
152
+ 'bispan_err': result['spectro_ccf_bispan_err'][mask3],
153
+ 'drift_noise': result['spectro_cal_drift_noise'][mask3],
154
+ 'rjd': result['obj_date_bjd'][mask3],
132
155
  'cal_therror': _nan,
133
- 'fwhm': result['spectro_ccf_fwhm'][mask2],
134
- 'fwhm_err': result['spectro_ccf_fwhm_err'][mask2],
135
- 'rv': result['spectro_ccf_rv'][mask2],
136
- 'rv_err': result['spectro_ccf_rv_err'][mask2],
137
- 'berv': result['spectro_cal_berv'][mask2],
156
+ 'fwhm': result['spectro_ccf_fwhm'][mask3],
157
+ 'fwhm_err': result['spectro_ccf_fwhm_err'][mask3],
158
+ 'rv': result['spectro_ccf_rv'][mask3],
159
+ 'rv_err': result['spectro_ccf_rv_err'][mask3],
160
+ 'berv': result['spectro_cal_berv'][mask3],
138
161
  'ccf_noise': _nan,
139
- 'rhk': result['spectro_analysis_rhk'][mask2],
140
- 'rhk_err': result['spectro_analysis_rhk_err'][mask2],
141
- 'contrast': result['spectro_ccf_contrast'][mask2],
142
- 'contrast_err': result['spectro_ccf_contrast_err'][mask2],
143
- 'cal_thfile': result['spectro_cal_thfile'][mask2],
144
- 'spectroFluxSn50': result['spectro_flux_sn50'][mask2],
145
- 'protm08': result['spectro_analysis_protm08'][mask2],
146
- 'protm08_err': result['spectro_analysis_protm08_err'][mask2],
147
- 'caindex': result['spectro_analysis_ca'][mask2],
148
- 'caindex_err': result['spectro_analysis_ca_err'][mask2],
149
- 'pub_reference': result['pub_ref'][mask2],
150
- 'drs_qc': result['spectro_drs_qc'][mask2],
151
- 'haindex': result['spectro_analysis_halpha'][mask2],
152
- 'haindex_err': result['spectro_analysis_halpha_err'][mask2],
153
- 'protn84': result['spectro_analysis_protn84'][mask2],
154
- 'protn84_err': result['spectro_analysis_protn84_err'][mask2],
155
- 'naindex': result['spectro_analysis_na'][mask2],
156
- 'naindex_err': result['spectro_analysis_na_err'][mask2],
162
+ 'rhk': result['spectro_analysis_rhk'][mask3],
163
+ 'rhk_err': result['spectro_analysis_rhk_err'][mask3],
164
+ 'contrast': result['spectro_ccf_contrast'][mask3],
165
+ 'contrast_err': result['spectro_ccf_contrast_err'][mask3],
166
+ 'cal_thfile': result['spectro_cal_thfile'][mask3],
167
+ 'spectroFluxSn50': result['spectro_flux_sn50'][mask3],
168
+ 'protm08': result['spectro_analysis_protm08'][mask3],
169
+ 'protm08_err': result['spectro_analysis_protm08_err'][mask3],
170
+ 'caindex': result['spectro_analysis_ca'][mask3],
171
+ 'caindex_err': result['spectro_analysis_ca_err'][mask3],
172
+ 'pub_reference': result['pub_ref'][mask3],
173
+ 'drs_qc': result['spectro_drs_qc'][mask3],
174
+ 'haindex': result['spectro_analysis_halpha'][mask3],
175
+ 'haindex_err': result['spectro_analysis_halpha_err'][mask3],
176
+ 'protn84': result['spectro_analysis_protn84'][mask3],
177
+ 'protn84_err': result['spectro_analysis_protn84_err'][mask3],
178
+ 'naindex': result['spectro_analysis_na'][mask3],
179
+ 'naindex_err': result['spectro_analysis_na_err'][mask3],
157
180
  'snca2': _nan,
158
- 'mask': result['spectro_ccf_mask'][mask2],
159
- 'public': result['public'][mask2],
160
- 'spectroFluxSn20': result['spectro_flux_sn20'][mask2],
161
- 'sindex': result['spectro_analysis_smw'][mask2],
162
- 'sindex_err': result['spectro_analysis_smw_err'][mask2],
181
+ 'mask': result['spectro_ccf_mask'][mask3],
182
+ 'public': result['public'][mask3],
183
+ 'spectroFluxSn20': result['spectro_flux_sn20'][mask3],
184
+ 'sindex': result['spectro_analysis_smw'][mask3],
185
+ 'sindex_err': result['spectro_analysis_smw_err'][mask3],
163
186
  'drift_used': _nan,
164
- 'ccf_asym': result['spectro_ccf_asym'][mask2],
165
- 'ccf_asym_err': result['spectro_ccf_asym_err'][mask2],
166
- 'date_night': result['date_night'][mask2],
167
- 'raw_file': result['file_rootpath'][mask2],
168
- 'prog_id': result['prog_id'][mask2],
169
- 'th_ar': result['th_ar'][mask2],
170
- 'th_ar1': result['th_ar1'][mask2],
171
- 'th_ar2': result['th_ar2'][mask2],
187
+ 'ccf_asym': result['spectro_ccf_asym'][mask3],
188
+ 'ccf_asym_err': result['spectro_ccf_asym_err'][mask3],
189
+ 'date_night': result['date_night'][mask3],
190
+ 'raw_file': result['file_rootpath'][mask3],
191
+ 'prog_id': result['prog_id'][mask3],
192
+ 'th_ar': result['th_ar'][mask3],
193
+ 'th_ar1': result['th_ar1'][mask3],
194
+ 'th_ar2': result['th_ar2'][mask3],
172
195
  }
173
- }
196
+
197
+ # print(r.keys())
198
+ # print([r[k].keys() for k in r.keys()])
199
+ # print([r[k1][k2].keys() for k1 in r.keys() for k2 in r[k1].keys()])
174
200
  return r
175
201
 
176
202
  def get_observations(star, instrument=None, main_id=None, verbose=True):
@@ -225,9 +251,9 @@ def get_observations(star, instrument=None, main_id=None, verbose=True):
225
251
  # (i.e. ensure that 3.x.x > 3.5)
226
252
  from re import match
227
253
  def cmp(a, b):
228
- if a[0] in ('3.5', '3.5 EGGS') and match(r'3.\d.\d', b[0]):
254
+ if a[0] in ('3.5', '3.5 EGGS') or 'EGGS' in a[0] and match(r'3.\d.\d', b[0]):
229
255
  return -1
230
- if b[0] in ('3.5', '3.5 EGGS') and match(r'3.\d.\d', a[0]):
256
+ if b[0] in ('3.5', '3.5 EGGS') or 'EGGS' in b[0] and match(r'3.\d.\d', a[0]):
231
257
  return 1
232
258
 
233
259
  if a[0] == b[0]:
@@ -248,16 +274,20 @@ def get_observations(star, instrument=None, main_id=None, verbose=True):
248
274
  _inst = ''
249
275
  for inst in instruments:
250
276
  pipelines = list(new_result[inst].keys())
277
+ max_len = max([len(pipe) for pipe in pipelines])
251
278
  for pipe in pipelines:
279
+ last_pipe = pipe == pipelines[-1]
252
280
  modes = list(new_result[inst][pipe].keys())
253
281
  for mode in modes:
254
282
  N = len(new_result[inst][pipe][mode]['rjd'])
255
283
  # LOG
256
- if inst == _inst:
257
- logger.info(f'{" ":>12s} └ {pipe} - {mode} ({N} observations)')
284
+ if inst == _inst and last_pipe:
285
+ logger.info(f'{" ":>12s} └ {pipe:{max_len}s} - {mode} ({N} observations)')
286
+ elif inst == _inst:
287
+ logger.info(f'{" ":>12s} ├ {pipe:{max_len}s} - {mode} ({N} observations)')
258
288
  else:
259
- logger.info(f'{inst:>12s} ├ {pipe} - {mode} ({N} observations)')
260
- _inst = inst
289
+ logger.info(f'{inst:>12s} ├ {pipe:{max_len}s} - {mode} ({N} observations)')
290
+ _inst = inst
261
291
 
262
292
  return new_result
263
293
 
@@ -381,12 +411,12 @@ def do_download_filetype(type, raw_files, output_directory, clobber=False,
381
411
 
382
412
  if verbose:
383
413
  if chunk_size < n:
384
- msg = f"Downloading {n} {type}s "
414
+ msg = f"downloading {n} {type}s "
385
415
  msg += f"(in chunks of {chunk_size}) "
386
416
  msg += f"into '{output_directory}'..."
387
417
  logger.info(msg)
388
418
  else:
389
- msg = f"Downloading {n} {type}s into '{output_directory}'..."
419
+ msg = f"downloading {n} {type}s into '{output_directory}'..."
390
420
  logger.info(msg)
391
421
 
392
422
  iterator = [raw_files[i:i + chunk_size] for i in range(0, n, chunk_size)]
@@ -394,7 +424,7 @@ def do_download_filetype(type, raw_files, output_directory, clobber=False,
394
424
  download(files, type, output_directory)
395
425
  extract_fits(output_directory)
396
426
 
397
- logger.info('Extracted .fits files')
427
+ logger.info('extracted .fits files')
398
428
 
399
429
 
400
430
  # def do_download_s1d(raw_files, output_directory, clobber=False, verbose=True):
@@ -22,11 +22,24 @@ CONTAINS(
22
22
  )=1
23
23
  """
24
24
 
25
+ QUERY_ID = """
26
+ SELECT TOP 20 gaia_source.designation,gaia_source.source_id,gaia_source.ra,gaia_source.dec,gaia_source.parallax,gaia_source.pmra,gaia_source.pmdec,gaia_source.ruwe,gaia_source.phot_g_mean_mag,gaia_source.bp_rp,gaia_source.radial_velocity,gaia_source.phot_variable_flag,gaia_source.non_single_star,gaia_source.has_xp_continuous,gaia_source.has_xp_sampled,gaia_source.has_rvs,gaia_source.has_epoch_photometry,gaia_source.has_epoch_rv,gaia_source.has_mcmc_gspphot,gaia_source.has_mcmc_msc,gaia_source.teff_gspphot,gaia_source.logg_gspphot,gaia_source.mh_gspphot,gaia_source.distance_gspphot,gaia_source.azero_gspphot,gaia_source.ag_gspphot,gaia_source.ebpminrp_gspphot
27
+ FROM gaiadr3.gaia_source
28
+ WHERE
29
+ gaia_source.source_id = {id}
30
+ """
31
+
32
+ translate = {
33
+ 'Proxima': '5853498713190525696',
34
+ 'LS II +14 13': '4318465066420528000',
35
+ }
36
+
37
+
25
38
  def run_query(query):
26
39
  url = 'https://gea.esac.esa.int/tap-server/tap/sync'
27
40
  data = dict(query=query, request='doQuery', lang='ADQL', format='csv')
28
41
  try:
29
- response = requests.post(url, data=data, timeout=5)
42
+ response = requests.post(url, data=data, timeout=2)
30
43
  except requests.ReadTimeout as err:
31
44
  raise IndexError(err)
32
45
  except requests.ConnectionError as err:
@@ -71,8 +84,13 @@ class gaia:
71
84
  args = dict(ra=ra, dec=dec, plx=plx, pmra=pmra, pmdec=pmdec, rv=rv)
72
85
 
73
86
  try:
74
- table1 = run_query(query=QUERY.format(**args))
75
- results = parse_csv(table1)[0]
87
+ if star in translate:
88
+ table = run_query(query=QUERY_ID.format(id=translate[star]))
89
+ elif hasattr(simbad, 'gaia_id'):
90
+ table = run_query(query=QUERY_ID.format(id=simbad.gaia_id))
91
+ else:
92
+ table = run_query(query=QUERY.format(**args))
93
+ results = parse_csv(table)[0]
76
94
  except IndexError:
77
95
  raise ValueError(f'Gaia query for {star} failed')
78
96