arvi 0.2.7__tar.gz → 0.2.8__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 (64) hide show
  1. {arvi-0.2.7/arvi.egg-info → arvi-0.2.8}/PKG-INFO +1 -1
  2. {arvi-0.2.7 → arvi-0.2.8}/arvi/dace_wrapper.py +7 -3
  3. {arvi-0.2.7 → arvi-0.2.8}/arvi/instrument_specific.py +19 -18
  4. {arvi-0.2.7 → arvi-0.2.8}/arvi/kima_wrapper.py +42 -7
  5. {arvi-0.2.7 → arvi-0.2.8}/arvi/programs.py +8 -4
  6. {arvi-0.2.7 → arvi-0.2.8}/arvi/simbad_wrapper.py +20 -0
  7. {arvi-0.2.7 → arvi-0.2.8}/arvi/timeseries.py +57 -14
  8. {arvi-0.2.7 → arvi-0.2.8/arvi.egg-info}/PKG-INFO +1 -1
  9. {arvi-0.2.7 → arvi-0.2.8}/.github/dependabot.yml +0 -0
  10. {arvi-0.2.7 → arvi-0.2.8}/.github/workflows/docs-gh-pages.yml +0 -0
  11. {arvi-0.2.7 → arvi-0.2.8}/.github/workflows/install.yml +0 -0
  12. {arvi-0.2.7 → arvi-0.2.8}/.github/workflows/python-publish.yml +0 -0
  13. {arvi-0.2.7 → arvi-0.2.8}/.gitignore +0 -0
  14. {arvi-0.2.7 → arvi-0.2.8}/LICENSE +0 -0
  15. {arvi-0.2.7 → arvi-0.2.8}/README.md +0 -0
  16. {arvi-0.2.7 → arvi-0.2.8}/arvi/HZ.py +0 -0
  17. {arvi-0.2.7 → arvi-0.2.8}/arvi/__init__.py +0 -0
  18. {arvi-0.2.7 → arvi-0.2.8}/arvi/ariadne_wrapper.py +0 -0
  19. {arvi-0.2.7 → arvi-0.2.8}/arvi/berv.py +0 -0
  20. {arvi-0.2.7 → arvi-0.2.8}/arvi/binning.py +0 -0
  21. {arvi-0.2.7 → arvi-0.2.8}/arvi/config.py +0 -0
  22. {arvi-0.2.7 → arvi-0.2.8}/arvi/data/extra/HD86226_PFS1.rdb +0 -0
  23. {arvi-0.2.7 → arvi-0.2.8}/arvi/data/extra/HD86226_PFS2.rdb +0 -0
  24. {arvi-0.2.7 → arvi-0.2.8}/arvi/data/extra/metadata.json +0 -0
  25. {arvi-0.2.7 → arvi-0.2.8}/arvi/data/info.svg +0 -0
  26. {arvi-0.2.7 → arvi-0.2.8}/arvi/data/obs_affected_ADC_issues.dat +0 -0
  27. {arvi-0.2.7 → arvi-0.2.8}/arvi/data/obs_affected_blue_cryostat_issues.dat +0 -0
  28. {arvi-0.2.7 → arvi-0.2.8}/arvi/exofop_wrapper.py +0 -0
  29. {arvi-0.2.7 → arvi-0.2.8}/arvi/extra_data.py +0 -0
  30. {arvi-0.2.7 → arvi-0.2.8}/arvi/gaia_wrapper.py +0 -0
  31. {arvi-0.2.7 → arvi-0.2.8}/arvi/headers.py +0 -0
  32. {arvi-0.2.7 → arvi-0.2.8}/arvi/lbl_wrapper.py +0 -0
  33. {arvi-0.2.7 → arvi-0.2.8}/arvi/nasaexo_wrapper.py +0 -0
  34. {arvi-0.2.7 → arvi-0.2.8}/arvi/plots.py +0 -0
  35. {arvi-0.2.7 → arvi-0.2.8}/arvi/reports.py +0 -0
  36. {arvi-0.2.7 → arvi-0.2.8}/arvi/setup_logger.py +0 -0
  37. {arvi-0.2.7 → arvi-0.2.8}/arvi/sophie_wrapper.py +0 -0
  38. {arvi-0.2.7 → arvi-0.2.8}/arvi/spectra.py +0 -0
  39. {arvi-0.2.7 → arvi-0.2.8}/arvi/stats.py +0 -0
  40. {arvi-0.2.7 → arvi-0.2.8}/arvi/stellar.py +0 -0
  41. {arvi-0.2.7 → arvi-0.2.8}/arvi/translations.py +0 -0
  42. {arvi-0.2.7 → arvi-0.2.8}/arvi/utils.py +0 -0
  43. {arvi-0.2.7 → arvi-0.2.8}/arvi.egg-info/SOURCES.txt +0 -0
  44. {arvi-0.2.7 → arvi-0.2.8}/arvi.egg-info/dependency_links.txt +0 -0
  45. {arvi-0.2.7 → arvi-0.2.8}/arvi.egg-info/requires.txt +0 -0
  46. {arvi-0.2.7 → arvi-0.2.8}/arvi.egg-info/top_level.txt +0 -0
  47. {arvi-0.2.7 → arvi-0.2.8}/docs/API.md +0 -0
  48. {arvi-0.2.7 → arvi-0.2.8}/docs/detailed.ipynb +0 -0
  49. {arvi-0.2.7 → arvi-0.2.8}/docs/downloading_data.md +0 -0
  50. {arvi-0.2.7 → arvi-0.2.8}/docs/index.md +0 -0
  51. {arvi-0.2.7 → arvi-0.2.8}/docs/logo/detective.png +0 -0
  52. {arvi-0.2.7 → arvi-0.2.8}/docs/logo/logo.png +0 -0
  53. {arvi-0.2.7 → arvi-0.2.8}/docs/stylesheets/extra.css +0 -0
  54. {arvi-0.2.7 → arvi-0.2.8}/mkdocs.yml +0 -0
  55. {arvi-0.2.7 → arvi-0.2.8}/pyproject.toml +0 -0
  56. {arvi-0.2.7 → arvi-0.2.8}/setup.cfg +0 -0
  57. {arvi-0.2.7 → arvi-0.2.8}/setup.py +0 -0
  58. {arvi-0.2.7 → arvi-0.2.8}/tests/HD10700-Bcor_ESPRESSO18.rdb +0 -0
  59. {arvi-0.2.7 → arvi-0.2.8}/tests/test_binning.py +0 -0
  60. {arvi-0.2.7 → arvi-0.2.8}/tests/test_config.py +0 -0
  61. {arvi-0.2.7 → arvi-0.2.8}/tests/test_create_RV.py +0 -0
  62. {arvi-0.2.7 → arvi-0.2.8}/tests/test_import_object.py +0 -0
  63. {arvi-0.2.7 → arvi-0.2.8}/tests/test_simbad.py +0 -0
  64. {arvi-0.2.7 → arvi-0.2.8}/tests/test_stats.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: arvi
3
- Version: 0.2.7
3
+ Version: 0.2.8
4
4
  Summary: The Automated RV Inspector
5
5
  Author-email: João Faria <joao.faria@unige.ch>
6
6
  License: MIT
@@ -95,7 +95,7 @@ def get_arrays(result, latest_pipeline=True, ESPRESSO_mode='HR11', NIRPS_mode='H
95
95
  npipe = len(pipelines)
96
96
  if 'NIRPS' in inst and any(['LBL' in p for p in pipelines]):
97
97
  # TODO: correctly load both CCF and LBL
98
- pipelines = [pipelines[1]]
98
+ pipelines = [pipelines[0]]
99
99
  if 'HARPS' in inst and npipe > 1 and pipelines[1] == pipelines[0] + '-EGGS':
100
100
  pipelines = pipelines[:2]
101
101
  else:
@@ -544,6 +544,7 @@ def do_download_filetype(type, raw_files, output_directory, clobber=False, user=
544
544
  """ Download CCFs / S1Ds / S2Ds from DACE """
545
545
  logger = setup_logger()
546
546
  raw_files = np.atleast_1d(raw_files)
547
+ raw_files_original = raw_files.copy()
547
548
 
548
549
  create_directory(output_directory)
549
550
 
@@ -557,7 +558,7 @@ def do_download_filetype(type, raw_files, output_directory, clobber=False, user=
557
558
  if n == 0:
558
559
  if verbose:
559
560
  logger.info('no files to download')
560
- return
561
+ return list(map(os.path.basename, raw_files_original))
561
562
 
562
563
  # avoid an empty chunk
563
564
  if chunk_size > n:
@@ -575,7 +576,9 @@ def do_download_filetype(type, raw_files, output_directory, clobber=False, user=
575
576
 
576
577
  if n < parallel_limit:
577
578
  iterator = [raw_files[i:i + chunk_size] for i in range(0, n, chunk_size)]
578
- for files in tqdm(iterator, total=len(iterator)):
579
+ if len(iterator) > 1:
580
+ iterator = tqdm(iterator, total=len(iterator))
581
+ for files in iterator:
579
582
  download(files, type, output_directory, quiet=False, user=user)
580
583
  extract_fits(output_directory)
581
584
 
@@ -604,6 +607,7 @@ def do_download_filetype(type, raw_files, output_directory, clobber=False, user=
604
607
 
605
608
  sys.stdout.flush()
606
609
  logger.info('extracted .fits files')
610
+ return list(map(os.path.basename, raw_files_original))
607
611
 
608
612
 
609
613
  # def do_download_s1d(raw_files, output_directory, clobber=False, verbose=True):
@@ -127,9 +127,9 @@ def HARPS_commissioning(self, mask=True, plot=True):
127
127
  total_affected = affected.sum()
128
128
 
129
129
  if self.verbose:
130
- n = total_affected
131
- logger.info(f"there {'are'[:n^1]}{'is'[n^1:]} {n} frame{'s'[:n^1]} "
132
- "during HARPS commissioning")
130
+ n, i = total_affected, int(total_affected != 1)
131
+ logger.info(f"there {['is', 'are'][i]} {n} frame{['', 's'][i]} "
132
+ "during HARPS commissioning")
133
133
 
134
134
  if mask:
135
135
  self.mask[affected] = False
@@ -159,9 +159,9 @@ def HARPS_fiber_commissioning(self, mask=True, plot=True):
159
159
  total_affected = affected.sum()
160
160
 
161
161
  if self.verbose:
162
- n = total_affected
163
- logger.info(f"there {'are'[:n^1]}{'is'[n^1:]} {n} frame{'s'[:n^1]} "
164
- "during the HARPS fiber commissioning period")
162
+ n, i = total_affected, int(total_affected != 1)
163
+ logger.info(f"there {['is', 'are'][i]} {n} frame{['', 's'][i]} "
164
+ "during the HARPS fiber commissioning period")
165
165
 
166
166
  if mask:
167
167
  self.mask[affected] = False
@@ -191,15 +191,15 @@ def ESPRESSO_commissioning(self, mask=True, plot=True):
191
191
  total_affected = affected.sum()
192
192
 
193
193
  if self.verbose:
194
- n = total_affected
195
- logger.info(f"there {'are'[:n^1]}{'is'[n^1:]} {n} frame{'s'[:n^1]} "
196
- "during ESPRESSO commissioning")
194
+ n, i = total_affected, int(total_affected != 1)
195
+ logger.info(f"there {['is', 'are'][i]} {n} frame{['', 's'][i]} "
196
+ "during ESPRESSO commissioning")
197
197
 
198
198
  if mask:
199
199
  self.mask[affected] = False
200
200
  self._propagate_mask_changes()
201
201
 
202
- if plot:
202
+ if plot and total_affected > 0:
203
203
  self.plot(show_masked=True)
204
204
 
205
205
  return affected
@@ -240,9 +240,9 @@ def ADC_issues(self, mask=True, plot=True, check_headers=False):
240
240
  total_affected = intersect.sum()
241
241
 
242
242
  if self.verbose:
243
- n = total_affected
244
- logger.info(f"there {'are'[:n^1]}{'is'[n^1:]} {n} frame{'s'[:n^1]} "
245
- "affected by ADC issues")
243
+ n, i = total_affected, int(total_affected != 1)
244
+ logger.info(f"there {['is', 'are'][i]} {n} frame{['', 's'][i]} "
245
+ "affected by ADC issues")
246
246
 
247
247
  if mask:
248
248
  self.mask[intersect] = False
@@ -276,9 +276,9 @@ def blue_cryostat_issues(self, mask=True, plot=True):
276
276
  total_affected = intersect.sum()
277
277
 
278
278
  if self.verbose:
279
- n = total_affected
280
- logger.info(f"there {'are'[:n^1]}{'is'[n^1:]} {n} frame{'s'[:n^1]} "
281
- "affected by blue cryostat issues")
279
+ n, i = total_affected, int(total_affected != 1)
280
+ logger.info(f"there {['is', 'are'][i]} {n} frame{['', 's'][i]} "
281
+ "affected by blue cryostat issues")
282
282
 
283
283
  if mask:
284
284
  self.mask[intersect] = False
@@ -322,8 +322,9 @@ def qc_scired_issues(self, plot=False, **kwargs):
322
322
  n = affected.sum()
323
323
 
324
324
  if self.verbose:
325
- logger.info(f"there {'are'[:n^1]}{'is'[n^1:]} {n} frame{'s'[:n^1]} "
326
- "where QC SCIRED CHECK is 0")
325
+ i = int(n != 1)
326
+ logger.info(f"there {['is', 'are'][i]} {n} frame{['', 's'][i]} "
327
+ "where QC SCIRED CHECK is 0")
327
328
 
328
329
  if n == 0:
329
330
  return
@@ -1,13 +1,14 @@
1
1
  import os
2
2
  import numpy as np
3
3
 
4
- from .setup_logger import logger
4
+ from .setup_logger import setup_logger
5
5
 
6
6
  try:
7
7
  import kima
8
8
  from kima.pykima.utils import chdir
9
9
  from kima import distributions
10
- from kima import RVData, RVmodel
10
+ from kima import RVData, HGPMdata
11
+ from kima import RVmodel, GPmodel, RVHGPMmodel
11
12
  kima_available = True
12
13
  except ImportError:
13
14
  kima_available = False
@@ -21,9 +22,12 @@ def try_to_guess_prior(model, prior):
21
22
  return None
22
23
 
23
24
 
24
- def run_kima(self, run=False, load=False, run_directory=None, priors={}, **kwargs):
25
+ def run_kima(self, run=False, load=False, run_directory=None,
26
+ model=RVmodel, priors={}, **kwargs):
25
27
  if not kima_available:
26
28
  raise ImportError('kima not available, please install with `pip install kima`')
29
+
30
+ logger = setup_logger()
27
31
 
28
32
  instruments = [inst for inst in self.instruments if self.NN[inst] > 1]
29
33
  time = [getattr(self, inst).mtime for inst in instruments]
@@ -33,12 +37,34 @@ def run_kima(self, run=False, load=False, run_directory=None, priors={}, **kwarg
33
37
 
34
38
  fix = kwargs.pop('fix', False)
35
39
  npmax = kwargs.pop('npmax', 1)
36
- model = RVmodel(fix=fix, npmax=npmax, data=data)
40
+
41
+ if isinstance(model, str):
42
+ try:
43
+ model = {
44
+ 'RVmodel': RVmodel,
45
+ 'GPmodel': GPmodel,
46
+ 'RVHGPMmodel': RVHGPMmodel
47
+ }[model]
48
+ except KeyError:
49
+ raise ValueError(f'unknown model: {model}')
50
+
51
+ if model is RVHGPMmodel:
52
+ pm_data = HGPMdata(self.simbad.gaia_id)
53
+ model = model(fix=fix, npmax=npmax, data=data, pm_data=pm_data)
54
+ else:
55
+ model = model(fix=fix, npmax=npmax, data=data)
37
56
 
38
57
  model.trend = kwargs.pop('trend', False)
39
58
  model.degree = kwargs.pop('degree', 0)
40
59
 
41
- model.studentt = kwargs.pop('studentt', False)
60
+ if isinstance(model, RVmodel):
61
+ model.studentt = kwargs.pop('studentt', False)
62
+
63
+ if isinstance(model, GPmodel):
64
+ if 'kernel' in kwargs:
65
+ model.kernel = kwargs.pop('kernel')
66
+
67
+
42
68
  model.enforce_stability = kwargs.pop('enforce_stability', False)
43
69
  model.star_mass = kwargs.pop('star_mass', 1.0)
44
70
 
@@ -49,6 +75,13 @@ def run_kima(self, run=False, load=False, run_directory=None, priors={}, **kwarg
49
75
  if kwargs.pop('kuma', False):
50
76
  model.conditional.eprior = distributions.Kumaraswamy(0.867, 3.03)
51
77
 
78
+ if isinstance(model, RVHGPMmodel):
79
+ model.pm_ra_bary_prior = priors.pop('pm_ra_bary_prior',
80
+ distributions.Gaussian(pm_data.pm_ra_hg, pm_data.sig_hg_ra))
81
+ model.pm_dec_bary_prior = priors.pop('pm_dec_bary_prior',
82
+ distributions.Gaussian(pm_data.pm_dec_hg, pm_data.sig_hg_dec))
83
+
84
+
52
85
  for k, v in priors.items():
53
86
  try:
54
87
  if 'conditional' in k:
@@ -67,7 +100,6 @@ def run_kima(self, run=False, load=False, run_directory=None, priors={}, **kwarg
67
100
  run_directory = os.getcwd()
68
101
 
69
102
  if run:
70
-
71
103
  # TODO: use signature of kima.run to pop the correct kwargs
72
104
  # model_name = model.__class__.__name__
73
105
  # model_name = f'kima.{model_name}.{model_name}'
@@ -75,7 +107,10 @@ def run_kima(self, run=False, load=False, run_directory=None, priors={}, **kwarg
75
107
 
76
108
  with chdir(run_directory):
77
109
  kima.run(model, **kwargs)
78
-
110
+
111
+ if isinstance(model, RVHGPMmodel):
112
+ data = (data, pm_data)
113
+
79
114
  if load:
80
115
  with chdir(run_directory):
81
116
  res = kima.load_results(model)
@@ -3,11 +3,13 @@ import multiprocessing
3
3
  from functools import partial, lru_cache
4
4
  from itertools import chain
5
5
  from collections import namedtuple
6
- from multiprocessing.pool import ThreadPool
6
+ from multiprocessing.pool import ThreadPool, Pool
7
+ import concurrent.futures
8
+ import sys
7
9
  from tqdm import tqdm
8
10
  # import numpy as np
9
11
 
10
- from .setup_logger import logger
12
+ from .setup_logger import setup_logger
11
13
  from .timeseries import RV
12
14
 
13
15
  __all__ = ['ESPRESSO_GTO']
@@ -22,13 +24,14 @@ def get_star(star, instrument=None, verbose=False, **kwargs):
22
24
 
23
25
  class LazyRV:
24
26
  def __init__(self, stars: list, instrument: str = None,
25
- _parallel_limit=10):
27
+ _parallel_limit=10, _parallel_workers=8):
26
28
  self.stars = stars
27
29
  if isinstance(self.stars, str):
28
30
  self.stars = [self.stars]
29
31
  self.instrument = instrument
30
32
  self._saved = None
31
33
  self._parallel_limit = _parallel_limit
34
+ self._parallel_workers = _parallel_workers
32
35
 
33
36
  @property
34
37
  def N(self):
@@ -38,10 +41,11 @@ class LazyRV:
38
41
  return f"RV({self.N} stars)"
39
42
 
40
43
  def _get(self, **kwargs):
44
+ logger = setup_logger()
41
45
  if self.N > self._parallel_limit:
42
46
  # logger.info('Querying DACE...')
43
47
  _get_star = partial(get_star, instrument=self.instrument, **kwargs)
44
- with ThreadPool(8) as pool:
48
+ with Pool(self._parallel_workers) as pool:
45
49
  result = list(tqdm(pool.imap(_get_star, self.stars),
46
50
  total=self.N, unit='star',
47
51
  desc='Querying DACE (can take a while)'))
@@ -70,6 +70,17 @@ FROM ident AS id1 JOIN ident AS id2 USING(oidref)
70
70
  WHERE id1.id = '{star}' AND id2.id LIKE '{name}%';
71
71
  """
72
72
 
73
+ RA_DEC_QUERY = """
74
+ SELECT DISTINCT basic.OID,
75
+ RA,
76
+ DEC,
77
+ main_id,
78
+ DISTANCE(POINT('ICRS', RA, DEC), POINT('ICRS', {ra}, {dec})) as "dist"
79
+ FROM basic JOIN flux ON oidref = oid
80
+ WHERE CONTAINS(POINT('ICRS', RA, DEC), CIRCLE('ICRS', {ra}, {dec}, 0.02)) = 1
81
+ ORDER BY "dist";
82
+ """
83
+
73
84
  def find_identifier(identifier, star):
74
85
  response = run_query(HD_GJ_HIP_QUERY.format(name=identifier, star=star))
75
86
  if identifier in response:
@@ -288,6 +299,15 @@ class simbad:
288
299
  def bmv(self):
289
300
  return self.B - self.V
290
301
 
302
+ @classmethod
303
+ def from_ra_dec(cls, ra, dec, **kwargs):
304
+ table1 = run_query(query=RA_DEC_QUERY.format(ra=ra, dec=dec))
305
+ cols, values = parse_tablen(table1)
306
+ if len(values) == 0:
307
+ raise ValueError(f'no Simbad results for ra={ra}, dec={dec}')
308
+ assert cols == ['oid', 'ra', 'dec', 'main_id', 'dist']
309
+ star = values[0][cols.index('main_id')].replace('"', '')
310
+ return cls(star, **kwargs)
291
311
 
292
312
  def argsort_by_spectral_type(sptypes):
293
313
  STs = [f'{letter}{n}' for letter in ('F', 'G', 'K', 'M') for n in range(10)]
@@ -408,16 +408,41 @@ class RV(ISSUES, REPORTS):
408
408
  self._did_correct_berv = False
409
409
  self.__post_init__()
410
410
 
411
- def snapshot(self):
411
+ def snapshot(self, directory=None, delete_others=False):
412
412
  import pickle
413
413
  from datetime import datetime
414
414
  ts = datetime.now().timestamp()
415
415
  star_name = self.star.replace(' ', '')
416
416
  file = f'{star_name}_{ts}.pkl'
417
- pickle.dump(self, open(file, 'wb'), protocol=0)
417
+
418
+ if directory is None:
419
+ directory = '.'
420
+ else:
421
+ os.makedirs(directory, exist_ok=True)
422
+
423
+ file = os.path.join(directory, file)
424
+
425
+ if delete_others:
426
+ import re
427
+ other_pkls = [
428
+ f for f in os.listdir(directory)
429
+ if re.search(fr'{star_name}_\d+.\d+.pkl', f)
430
+ ]
431
+ for pkl in other_pkls:
432
+ os.remove(os.path.join(directory, pkl))
433
+
434
+ metadata = {
435
+ 'star': self.star,
436
+ 'timestamp': ts,
437
+ 'description': 'arvi snapshot'
438
+ }
439
+ pickle.dump((self, metadata), open(file, 'wb'), protocol=0)
440
+
418
441
  if self.verbose:
419
442
  logger.info(f'saved snapshot to {file}')
420
443
 
444
+ return file
445
+
421
446
  @property
422
447
  def N(self) -> int:
423
448
  """Total number of observations"""
@@ -618,6 +643,8 @@ class RV(ISSUES, REPORTS):
618
643
  logger.info(f'reading snapshot of {star} from {dt}')
619
644
 
620
645
  s = pickle.load(open(file, 'rb'))
646
+ if isinstance(s, tuple) and len(s) == 2:
647
+ s, _metadata = s
621
648
  s._snapshot = file
622
649
  return s
623
650
 
@@ -659,10 +686,11 @@ class RV(ISSUES, REPORTS):
659
686
  file_object = hasattr(files, 'read')
660
687
  files = [files]
661
688
 
662
- # if len(files) == 0:
663
- # if verbose:
664
- # logger.error('no files found')
665
- # return
689
+ if len(files) == 0:
690
+ if verbose:
691
+ logger.error('from_rdb: no files found')
692
+ return
693
+
666
694
  def get_star_name(file):
667
695
  return splitext(basename(file))[0].split('_')[0].replace('-', '_')
668
696
 
@@ -1260,8 +1288,9 @@ class RV(ISSUES, REPORTS):
1260
1288
  logger.warning('may need to provide `top_level` in kwargs to find file')
1261
1289
  do_symlink_filetype('CCF', files[:limit], directory, **kwargs)
1262
1290
  else:
1263
- do_download_filetype('CCF', files[:limit], directory, clobber=clobber,
1264
- verbose=self.verbose, user=self.user, **kwargs)
1291
+ downloaded = do_download_filetype('CCF', files[:limit], directory,
1292
+ clobber=clobber, verbose=self.verbose,
1293
+ user=self.user, **kwargs)
1265
1294
 
1266
1295
  if load:
1267
1296
  try:
@@ -1273,17 +1302,26 @@ class RV(ISSUES, REPORTS):
1273
1302
  for f in files[:limit]
1274
1303
  ]
1275
1304
  downloaded = [
1276
- skysub
1305
+ skysub
1277
1306
  if exists(skysub := f.replace('CCF_A.fits', 'CCF_SKYSUB_A.fits')) else f
1278
1307
  for f in downloaded
1279
1308
  ]
1280
1309
  if self.verbose:
1281
1310
  logger.info('loading the CCF(s) into `.CCF` attribute')
1282
1311
 
1283
- self.CCF = iCCF.from_file(downloaded)
1312
+ self.CCF = iCCF.from_file(downloaded, verbose=False)
1313
+ if len(self.CCF) == 1:
1314
+ self.CCF = [self.CCF]
1284
1315
 
1285
- except (ImportError, ValueError):
1286
- pass
1316
+ if self.simbad is None:
1317
+ if self.verbose:
1318
+ logger.info('querying Simbad with RA/DEC from CCF header')
1319
+ ra = self.CCF[0].HDU[0].header['RA']
1320
+ dec = self.CCF[0].HDU[0].header['DEC']
1321
+ self._simbad = simbad.from_ra_dec(ra, dec)
1322
+
1323
+ except (ImportError, ValueError, FileNotFoundError):
1324
+ logger.error('could not load CCF(s) into `.CCF` attribute')
1287
1325
 
1288
1326
  def download_s1d(self, instrument=None, index=None, limit=None,
1289
1327
  directory=None, clobber=False, apply_mask=True, symlink=False, **kwargs):
@@ -1633,6 +1671,9 @@ class RV(ISSUES, REPORTS):
1633
1671
  inst = self.instruments[self.obs[m] - 1]
1634
1672
  n_before = (self.obs < self.obs[m]).sum()
1635
1673
  getattr(self, inst).mask[m - n_before] = False
1674
+ for inst in self.instruments:
1675
+ if getattr(self, inst).mtime.size == 0:
1676
+ self.remove_instrument(inst, strict=True)
1636
1677
 
1637
1678
  def secular_acceleration(self, epoch=None, just_compute=False, force_simbad=False):
1638
1679
  """
@@ -1806,9 +1847,11 @@ class RV(ISSUES, REPORTS):
1806
1847
  for inst in instruments:
1807
1848
  m = self.instrument_array == inst
1808
1849
  result = dosigmaclip(self.vrad[m], low=sigma, high=sigma)
1809
- n = self.vrad[m].size - result.clipped.size
1850
+ # n = self.vrad[m].size - result.clipped.size
1810
1851
 
1811
- ind = m & ((self.vrad < result.lower) | (self.vrad > result.upper))
1852
+ ind = m & self.mask & \
1853
+ ((self.vrad < result.lower) | (self.vrad > result.upper))
1854
+ n = ind.sum()
1812
1855
 
1813
1856
  if self.verbose and n > 0:
1814
1857
  s = 's' if (n == 0 or n > 1) else ''
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: arvi
3
- Version: 0.2.7
3
+ Version: 0.2.8
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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes