arvi 0.1.20__tar.gz → 0.1.21__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 (56) hide show
  1. {arvi-0.1.20 → arvi-0.1.21}/PKG-INFO +1 -1
  2. {arvi-0.1.20 → arvi-0.1.21}/arvi/config.py +28 -4
  3. {arvi-0.1.20 → arvi-0.1.21}/arvi/simbad_wrapper.py +1 -1
  4. {arvi-0.1.20 → arvi-0.1.21}/arvi/timeseries.py +92 -6
  5. {arvi-0.1.20 → arvi-0.1.21}/arvi.egg-info/PKG-INFO +1 -1
  6. {arvi-0.1.20 → arvi-0.1.21}/.github/workflows/docs-gh-pages.yml +0 -0
  7. {arvi-0.1.20 → arvi-0.1.21}/.github/workflows/install.yml +0 -0
  8. {arvi-0.1.20 → arvi-0.1.21}/.github/workflows/python-publish.yml +0 -0
  9. {arvi-0.1.20 → arvi-0.1.21}/.gitignore +0 -0
  10. {arvi-0.1.20 → arvi-0.1.21}/LICENSE +0 -0
  11. {arvi-0.1.20 → arvi-0.1.21}/README.md +0 -0
  12. {arvi-0.1.20 → arvi-0.1.21}/arvi/HZ.py +0 -0
  13. {arvi-0.1.20 → arvi-0.1.21}/arvi/__init__.py +0 -0
  14. {arvi-0.1.20 → arvi-0.1.21}/arvi/ariadne_wrapper.py +0 -0
  15. {arvi-0.1.20 → arvi-0.1.21}/arvi/berv.py +0 -0
  16. {arvi-0.1.20 → arvi-0.1.21}/arvi/binning.py +0 -0
  17. {arvi-0.1.20 → arvi-0.1.21}/arvi/dace_wrapper.py +0 -0
  18. {arvi-0.1.20 → arvi-0.1.21}/arvi/data/extra/HD86226_PFS1.rdb +0 -0
  19. {arvi-0.1.20 → arvi-0.1.21}/arvi/data/extra/HD86226_PFS2.rdb +0 -0
  20. {arvi-0.1.20 → arvi-0.1.21}/arvi/data/extra/metadata.json +0 -0
  21. {arvi-0.1.20 → arvi-0.1.21}/arvi/data/info.svg +0 -0
  22. {arvi-0.1.20 → arvi-0.1.21}/arvi/data/obs_affected_ADC_issues.dat +0 -0
  23. {arvi-0.1.20 → arvi-0.1.21}/arvi/data/obs_affected_blue_cryostat_issues.dat +0 -0
  24. {arvi-0.1.20 → arvi-0.1.21}/arvi/extra_data.py +0 -0
  25. {arvi-0.1.20 → arvi-0.1.21}/arvi/gaia_wrapper.py +0 -0
  26. {arvi-0.1.20 → arvi-0.1.21}/arvi/headers.py +0 -0
  27. {arvi-0.1.20 → arvi-0.1.21}/arvi/instrument_specific.py +0 -0
  28. {arvi-0.1.20 → arvi-0.1.21}/arvi/kima_wrapper.py +0 -0
  29. {arvi-0.1.20 → arvi-0.1.21}/arvi/lbl_wrapper.py +0 -0
  30. {arvi-0.1.20 → arvi-0.1.21}/arvi/nasaexo_wrapper.py +0 -0
  31. {arvi-0.1.20 → arvi-0.1.21}/arvi/plots.py +0 -0
  32. {arvi-0.1.20 → arvi-0.1.21}/arvi/programs.py +0 -0
  33. {arvi-0.1.20 → arvi-0.1.21}/arvi/reports.py +0 -0
  34. {arvi-0.1.20 → arvi-0.1.21}/arvi/setup_logger.py +0 -0
  35. {arvi-0.1.20 → arvi-0.1.21}/arvi/spectra.py +0 -0
  36. {arvi-0.1.20 → arvi-0.1.21}/arvi/stats.py +0 -0
  37. {arvi-0.1.20 → arvi-0.1.21}/arvi/stellar.py +0 -0
  38. {arvi-0.1.20 → arvi-0.1.21}/arvi/translations.py +0 -0
  39. {arvi-0.1.20 → arvi-0.1.21}/arvi/utils.py +0 -0
  40. {arvi-0.1.20 → arvi-0.1.21}/arvi.egg-info/SOURCES.txt +0 -0
  41. {arvi-0.1.20 → arvi-0.1.21}/arvi.egg-info/dependency_links.txt +0 -0
  42. {arvi-0.1.20 → arvi-0.1.21}/arvi.egg-info/requires.txt +0 -0
  43. {arvi-0.1.20 → arvi-0.1.21}/arvi.egg-info/top_level.txt +0 -0
  44. {arvi-0.1.20 → arvi-0.1.21}/docs/API.md +0 -0
  45. {arvi-0.1.20 → arvi-0.1.21}/docs/detailed.md +0 -0
  46. {arvi-0.1.20 → arvi-0.1.21}/docs/index.md +0 -0
  47. {arvi-0.1.20 → arvi-0.1.21}/docs/logo/detective.png +0 -0
  48. {arvi-0.1.20 → arvi-0.1.21}/docs/logo/logo.png +0 -0
  49. {arvi-0.1.20 → arvi-0.1.21}/mkdocs.yml +0 -0
  50. {arvi-0.1.20 → arvi-0.1.21}/pyproject.toml +0 -0
  51. {arvi-0.1.20 → arvi-0.1.21}/setup.cfg +0 -0
  52. {arvi-0.1.20 → arvi-0.1.21}/setup.py +0 -0
  53. {arvi-0.1.20 → arvi-0.1.21}/tests/test_binning.py +0 -0
  54. {arvi-0.1.20 → arvi-0.1.21}/tests/test_import_object.py +0 -0
  55. {arvi-0.1.20 → arvi-0.1.21}/tests/test_simbad.py +0 -0
  56. {arvi-0.1.20 → arvi-0.1.21}/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.21
4
4
  Summary: The Automated RV Inspector
5
5
  Author-email: João Faria <joao.faria@unige.ch>
6
6
  License: MIT
@@ -1,3 +1,20 @@
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
+
1
18
 
2
19
  def instancer(cls):
3
20
  return cls()
@@ -14,23 +31,30 @@ class config:
14
31
  'check_internet': False,
15
32
  # make all DACE requests without using a .dacerc file
16
33
  'request_as_public': False,
17
- # username for DACE servers
18
- 'username': 'desousaj',
19
34
  # debug
20
35
  'debug': False,
21
36
  }
22
- # all, for now
23
37
  __setters = list(__conf.keys())
24
38
 
39
+ __user_config = get_config()
40
+
25
41
  def __getattr__(self, name):
26
42
  if name in ('__custom_documentations__', ):
27
43
  # return {'return_self': 'help!'}
28
44
  return {}
29
45
 
46
+ if self.__user_config.has_option('config', name):
47
+ self.__conf[name] = self.__user_config.get('config', name)
48
+
30
49
  return self.__conf[name]
31
50
 
32
51
  def __setattr__(self, name, value):
33
52
  if name in config.__setters:
34
53
  self.__conf[name] = value
35
54
  else:
36
- raise NameError(f"unknown configuration name '{name}'")
55
+ self.__user_config.set('config', name, value)
56
+ save_config(self.__user_config)
57
+ # raise NameError(f"unknown configuration name '{name}'")
58
+
59
+ def show(self):
60
+ pprint(self.__conf | dict(self.__user_config['config']))
@@ -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,86 @@ 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
+ s._kobe_result = hdul[1].data
792
+
793
+ if tar is not None:
794
+ tar.close()
795
+ hdul.close()
716
796
 
717
797
  return s
718
798
 
@@ -1699,15 +1779,19 @@ class RV:
1699
1779
  d = np.c_[
1700
1780
  _s.time, _s.vrad, _s.svrad,
1701
1781
  _s.fwhm, _s.fwhm_err,
1702
- _s.rhk, _s.rhk_err,
1703
1782
  _s.bispan, _s.bispan_err,
1783
+ _s.contrast, _s.contrast_err,
1784
+ _s.rhk, _s.rhk_err,
1785
+ _s.berv,
1704
1786
  ]
1705
1787
  else:
1706
1788
  d = np.c_[
1707
1789
  _s.mtime, _s.mvrad, _s.msvrad,
1708
1790
  _s.fwhm[_s.mask], _s.fwhm_err[_s.mask],
1709
- _s.rhk[_s.mask], _s.rhk_err[_s.mask],
1710
1791
  _s.bispan[_s.mask], _s.bispan_err[_s.mask],
1792
+ _s.contrast[_s.mask], _s.contrast_err[_s.mask],
1793
+ _s.rhk[_s.mask], _s.rhk_err[_s.mask],
1794
+ _s.berv[_s.mask],
1711
1795
  ]
1712
1796
  if not save_nans:
1713
1797
  if np.isnan(d).any():
@@ -1718,9 +1802,11 @@ class RV:
1718
1802
  logger.warning(f'masking {nan_mask.sum()} observations with NaN in indicators')
1719
1803
 
1720
1804
  header = '\t'.join(['bjd', 'vrad', 'svrad',
1721
- 'fwhm', 'sfwhm',
1722
- 'rhk', 'srhk',
1723
- 'bispan', 'sbispan'
1805
+ 'fwhm', 'sig_fwhm',
1806
+ 'bispan', 'sig_bispan',
1807
+ 'contrast', 'sig_contrast',
1808
+ 'rhk', 'sig_rhk',
1809
+ 'berv',
1724
1810
  ])
1725
1811
  header += '\n'
1726
1812
  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.21
4
4
  Summary: The Automated RV Inspector
5
5
  Author-email: João Faria <joao.faria@unige.ch>
6
6
  License: MIT
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