arvi 0.1.20__tar.gz → 0.1.22__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 (57) hide show
  1. {arvi-0.1.20 → arvi-0.1.22}/PKG-INFO +1 -1
  2. arvi-0.1.22/arvi/config.py +65 -0
  3. {arvi-0.1.20 → arvi-0.1.22}/arvi/simbad_wrapper.py +1 -1
  4. {arvi-0.1.20 → arvi-0.1.22}/arvi/timeseries.py +95 -6
  5. {arvi-0.1.20 → arvi-0.1.22}/arvi.egg-info/PKG-INFO +1 -1
  6. arvi-0.1.20/arvi/config.py +0 -36
  7. {arvi-0.1.20 → arvi-0.1.22}/.github/workflows/docs-gh-pages.yml +0 -0
  8. {arvi-0.1.20 → arvi-0.1.22}/.github/workflows/install.yml +0 -0
  9. {arvi-0.1.20 → arvi-0.1.22}/.github/workflows/python-publish.yml +0 -0
  10. {arvi-0.1.20 → arvi-0.1.22}/.gitignore +0 -0
  11. {arvi-0.1.20 → arvi-0.1.22}/LICENSE +0 -0
  12. {arvi-0.1.20 → arvi-0.1.22}/README.md +0 -0
  13. {arvi-0.1.20 → arvi-0.1.22}/arvi/HZ.py +0 -0
  14. {arvi-0.1.20 → arvi-0.1.22}/arvi/__init__.py +0 -0
  15. {arvi-0.1.20 → arvi-0.1.22}/arvi/ariadne_wrapper.py +0 -0
  16. {arvi-0.1.20 → arvi-0.1.22}/arvi/berv.py +0 -0
  17. {arvi-0.1.20 → arvi-0.1.22}/arvi/binning.py +0 -0
  18. {arvi-0.1.20 → arvi-0.1.22}/arvi/dace_wrapper.py +0 -0
  19. {arvi-0.1.20 → arvi-0.1.22}/arvi/data/extra/HD86226_PFS1.rdb +0 -0
  20. {arvi-0.1.20 → arvi-0.1.22}/arvi/data/extra/HD86226_PFS2.rdb +0 -0
  21. {arvi-0.1.20 → arvi-0.1.22}/arvi/data/extra/metadata.json +0 -0
  22. {arvi-0.1.20 → arvi-0.1.22}/arvi/data/info.svg +0 -0
  23. {arvi-0.1.20 → arvi-0.1.22}/arvi/data/obs_affected_ADC_issues.dat +0 -0
  24. {arvi-0.1.20 → arvi-0.1.22}/arvi/data/obs_affected_blue_cryostat_issues.dat +0 -0
  25. {arvi-0.1.20 → arvi-0.1.22}/arvi/extra_data.py +0 -0
  26. {arvi-0.1.20 → arvi-0.1.22}/arvi/gaia_wrapper.py +0 -0
  27. {arvi-0.1.20 → arvi-0.1.22}/arvi/headers.py +0 -0
  28. {arvi-0.1.20 → arvi-0.1.22}/arvi/instrument_specific.py +0 -0
  29. {arvi-0.1.20 → arvi-0.1.22}/arvi/kima_wrapper.py +0 -0
  30. {arvi-0.1.20 → arvi-0.1.22}/arvi/lbl_wrapper.py +0 -0
  31. {arvi-0.1.20 → arvi-0.1.22}/arvi/nasaexo_wrapper.py +0 -0
  32. {arvi-0.1.20 → arvi-0.1.22}/arvi/plots.py +0 -0
  33. {arvi-0.1.20 → arvi-0.1.22}/arvi/programs.py +0 -0
  34. {arvi-0.1.20 → arvi-0.1.22}/arvi/reports.py +0 -0
  35. {arvi-0.1.20 → arvi-0.1.22}/arvi/setup_logger.py +0 -0
  36. {arvi-0.1.20 → arvi-0.1.22}/arvi/spectra.py +0 -0
  37. {arvi-0.1.20 → arvi-0.1.22}/arvi/stats.py +0 -0
  38. {arvi-0.1.20 → arvi-0.1.22}/arvi/stellar.py +0 -0
  39. {arvi-0.1.20 → arvi-0.1.22}/arvi/translations.py +0 -0
  40. {arvi-0.1.20 → arvi-0.1.22}/arvi/utils.py +0 -0
  41. {arvi-0.1.20 → arvi-0.1.22}/arvi.egg-info/SOURCES.txt +0 -0
  42. {arvi-0.1.20 → arvi-0.1.22}/arvi.egg-info/dependency_links.txt +0 -0
  43. {arvi-0.1.20 → arvi-0.1.22}/arvi.egg-info/requires.txt +0 -0
  44. {arvi-0.1.20 → arvi-0.1.22}/arvi.egg-info/top_level.txt +0 -0
  45. {arvi-0.1.20 → arvi-0.1.22}/docs/API.md +0 -0
  46. {arvi-0.1.20 → arvi-0.1.22}/docs/detailed.md +0 -0
  47. {arvi-0.1.20 → arvi-0.1.22}/docs/index.md +0 -0
  48. {arvi-0.1.20 → arvi-0.1.22}/docs/logo/detective.png +0 -0
  49. {arvi-0.1.20 → arvi-0.1.22}/docs/logo/logo.png +0 -0
  50. {arvi-0.1.20 → arvi-0.1.22}/mkdocs.yml +0 -0
  51. {arvi-0.1.20 → arvi-0.1.22}/pyproject.toml +0 -0
  52. {arvi-0.1.20 → arvi-0.1.22}/setup.cfg +0 -0
  53. {arvi-0.1.20 → arvi-0.1.22}/setup.py +0 -0
  54. {arvi-0.1.20 → arvi-0.1.22}/tests/test_binning.py +0 -0
  55. {arvi-0.1.20 → arvi-0.1.22}/tests/test_import_object.py +0 -0
  56. {arvi-0.1.20 → arvi-0.1.22}/tests/test_simbad.py +0 -0
  57. {arvi-0.1.20 → arvi-0.1.22}/tests/test_stats.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: arvi
3
- Version: 0.1.20
3
+ Version: 0.1.22
4
4
  Summary: The Automated RV Inspector
5
5
  Author-email: João Faria <joao.faria@unige.ch>
6
6
  License: MIT
@@ -0,0 +1,65 @@
1
+ from pathlib import Path
2
+ import configparser
3
+ from pprint import pprint
4
+
5
+
6
+ def get_config_path():
7
+ return Path.home() / '.config' / 'arvi.ini'
8
+
9
+ def get_config():
10
+ config = configparser.ConfigParser()
11
+ if (path := get_config_path()).exists():
12
+ config.read(path)
13
+ return config
14
+
15
+ def save_config(config):
16
+ config.write(get_config_path().open('w'))
17
+
18
+
19
+ def instancer(cls):
20
+ return cls()
21
+
22
+ @instancer
23
+ class config:
24
+ # configuration values
25
+ __conf = {
26
+ # whether to return self from (some) RV methods
27
+ 'return_self': False,
28
+ # whether to adjust instrument means before gls by default
29
+ 'adjust_means_gls': True,
30
+ # whether to check internet connection before querying DACE
31
+ 'check_internet': False,
32
+ # make all DACE requests without using a .dacerc file
33
+ 'request_as_public': False,
34
+ # debug
35
+ 'debug': False,
36
+ }
37
+ __setters = list(__conf.keys())
38
+
39
+ __user_config = get_config()
40
+
41
+ def __getattr__(self, name):
42
+ if name in ('__custom_documentations__', ):
43
+ # return {'return_self': 'help!'}
44
+ return {}
45
+
46
+ if self.__user_config.has_option('config', name):
47
+ self.__conf[name] = self.__user_config.get('config', name)
48
+
49
+ return self.__conf[name]
50
+
51
+ def __setattr__(self, name, value):
52
+ if name in config.__setters:
53
+ self.__conf[name] = value
54
+ else:
55
+ if 'config' not in self.__user_config:
56
+ self.__user_config.add_section('config')
57
+ self.__user_config.set('config', name, value)
58
+ save_config(self.__user_config)
59
+ # raise NameError(f"unknown configuration name '{name}'")
60
+
61
+ def show(self):
62
+ if 'config' in self.__user_config:
63
+ pprint(self.__conf | dict(self.__user_config['config']))
64
+ else:
65
+ pprint(self.__conf)
@@ -45,7 +45,7 @@ def run_query(query):
45
45
  url = 'http://simbad.u-strasbg.fr/simbad/sim-tap/sync'
46
46
  data = dict(query=query, request='doQuery', lang='ADQL', format='text/plain', phase='run')
47
47
  try:
48
- response = requests.post(url, data=data, timeout=5)
48
+ response = requests.post(url, data=data, timeout=2)
49
49
  except requests.ReadTimeout as err:
50
50
  raise IndexError(err)
51
51
  except requests.ConnectionError as err:
@@ -1,7 +1,7 @@
1
1
  import os
2
2
  from dataclasses import dataclass, field
3
3
  from typing import Union
4
- from functools import partial, partialmethod
4
+ from functools import lru_cache, partial, partialmethod
5
5
  from glob import glob
6
6
  import warnings
7
7
  from copy import deepcopy
@@ -713,6 +713,89 @@ class RV:
713
713
  if instruments == ['ESPRESSO']:
714
714
  from .instrument_specific import divide_ESPRESSO
715
715
  divide_ESPRESSO(s)
716
+ elif instruments == ['HARPS']:
717
+ from .instrument_specific import divide_HARPS
718
+ divide_HARPS(s)
719
+
720
+ if kwargs.get('do_adjust_means', False):
721
+ s.adjust_means()
722
+
723
+ return s
724
+
725
+ @classmethod
726
+ @lru_cache(maxsize=10)
727
+ def from_KOBE_file(cls, star, **kwargs):
728
+ assert 'KOBE' in star, f'{star} is not a KOBE star?'
729
+ import requests
730
+ from requests.auth import HTTPBasicAuth
731
+ from io import BytesIO
732
+ import tarfile
733
+ from astropy.io import fits
734
+ from .config import config
735
+
736
+ try:
737
+ config.kobe_password
738
+ except KeyError:
739
+ logger.error('please set arvi.config.kobe_password')
740
+ return
741
+
742
+ tar = None
743
+ fits_file = f'{star}_RVs.fits'
744
+ resp = requests.get(f'https://kobe.caha.es/internal/fitsfiles/{fits_file}',
745
+ auth=HTTPBasicAuth('kobeteam', config.kobe_password))
746
+
747
+ if resp.status_code != 200:
748
+ # something went wrong, try to extract the file by downloading the
749
+ # full tar.gz archive
750
+
751
+ logger.warning(f'could not find "{fits_file}" on server, trying to download full archive')
752
+ resp = requests.get('https://kobe.caha.es/internal/fitsfiles.tar.gz',
753
+ auth=HTTPBasicAuth('kobeteam', config.kobe_password))
754
+
755
+ if resp.status_code != 200:
756
+ logger.error(f'KOBE file not found for {star}')
757
+ return
758
+
759
+ tar = tarfile.open(fileobj=BytesIO(resp.content))
760
+
761
+ if fits_file not in tar.getnames():
762
+ logger.error(f'KOBE file not found for {star}')
763
+ return
764
+
765
+ hdul = fits.open(tar.extractfile(fits_file))
766
+
767
+ else:
768
+ # found the file on the server, read it directly
769
+ hdul = fits.open(BytesIO(resp.content))
770
+
771
+ s = cls(star, _child=True)
772
+
773
+ s.time = hdul[1].data['BJD']
774
+
775
+ s.vrad = hdul[1].data['RVc']
776
+ s.svrad = hdul[1].data['eRVc']
777
+ s.vrad_preNZP = hdul[1].data['RVd']
778
+ s.vrad_preNZP_err = hdul[1].data['eRVd']
779
+
780
+ s.drift = hdul[1].data['drift']
781
+ s.drift_err = hdul[1].data['e_drift']
782
+
783
+ s.nzp = hdul[1].data['NZP']
784
+ s.nzp_err = hdul[1].data['eNZP']
785
+
786
+ s.berv = hdul[1].data['BERV']
787
+
788
+ s.mask = np.full_like(s.time, True, dtype=bool)
789
+ s.instruments = ['CARMENES']
790
+
791
+ # so meta!
792
+ setattr(s, 'CARMENES', s)
793
+
794
+ s._kobe_result = hdul[1].data
795
+
796
+ if tar is not None:
797
+ tar.close()
798
+ hdul.close()
716
799
 
717
800
  return s
718
801
 
@@ -1699,15 +1782,19 @@ class RV:
1699
1782
  d = np.c_[
1700
1783
  _s.time, _s.vrad, _s.svrad,
1701
1784
  _s.fwhm, _s.fwhm_err,
1702
- _s.rhk, _s.rhk_err,
1703
1785
  _s.bispan, _s.bispan_err,
1786
+ _s.contrast, _s.contrast_err,
1787
+ _s.rhk, _s.rhk_err,
1788
+ _s.berv,
1704
1789
  ]
1705
1790
  else:
1706
1791
  d = np.c_[
1707
1792
  _s.mtime, _s.mvrad, _s.msvrad,
1708
1793
  _s.fwhm[_s.mask], _s.fwhm_err[_s.mask],
1709
- _s.rhk[_s.mask], _s.rhk_err[_s.mask],
1710
1794
  _s.bispan[_s.mask], _s.bispan_err[_s.mask],
1795
+ _s.contrast[_s.mask], _s.contrast_err[_s.mask],
1796
+ _s.rhk[_s.mask], _s.rhk_err[_s.mask],
1797
+ _s.berv[_s.mask],
1711
1798
  ]
1712
1799
  if not save_nans:
1713
1800
  if np.isnan(d).any():
@@ -1718,9 +1805,11 @@ class RV:
1718
1805
  logger.warning(f'masking {nan_mask.sum()} observations with NaN in indicators')
1719
1806
 
1720
1807
  header = '\t'.join(['bjd', 'vrad', 'svrad',
1721
- 'fwhm', 'sfwhm',
1722
- 'rhk', 'srhk',
1723
- 'bispan', 'sbispan'
1808
+ 'fwhm', 'sig_fwhm',
1809
+ 'bispan', 'sig_bispan',
1810
+ 'contrast', 'sig_contrast',
1811
+ 'rhk', 'sig_rhk',
1812
+ 'berv',
1724
1813
  ])
1725
1814
  header += '\n'
1726
1815
  header += '\t'.join(['-' * len(c) for c in header.strip().split('\t')])
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: arvi
3
- Version: 0.1.20
3
+ Version: 0.1.22
4
4
  Summary: The Automated RV Inspector
5
5
  Author-email: João Faria <joao.faria@unige.ch>
6
6
  License: MIT
@@ -1,36 +0,0 @@
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}'")
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
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
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
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
File without changes
File without changes