arvi 0.1.27__tar.gz → 0.1.28__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 (59) hide show
  1. {arvi-0.1.27/arvi.egg-info → arvi-0.1.28}/PKG-INFO +1 -1
  2. {arvi-0.1.27 → arvi-0.1.28}/arvi/plots.py +18 -6
  3. {arvi-0.1.27 → arvi-0.1.28}/arvi/timeseries.py +64 -15
  4. {arvi-0.1.27 → arvi-0.1.28/arvi.egg-info}/PKG-INFO +1 -1
  5. {arvi-0.1.27 → arvi-0.1.28}/.github/dependabot.yml +0 -0
  6. {arvi-0.1.27 → arvi-0.1.28}/.github/workflows/docs-gh-pages.yml +0 -0
  7. {arvi-0.1.27 → arvi-0.1.28}/.github/workflows/install.yml +0 -0
  8. {arvi-0.1.27 → arvi-0.1.28}/.github/workflows/python-publish.yml +0 -0
  9. {arvi-0.1.27 → arvi-0.1.28}/.gitignore +0 -0
  10. {arvi-0.1.27 → arvi-0.1.28}/LICENSE +0 -0
  11. {arvi-0.1.27 → arvi-0.1.28}/README.md +0 -0
  12. {arvi-0.1.27 → arvi-0.1.28}/arvi/HZ.py +0 -0
  13. {arvi-0.1.27 → arvi-0.1.28}/arvi/__init__.py +0 -0
  14. {arvi-0.1.27 → arvi-0.1.28}/arvi/ariadne_wrapper.py +0 -0
  15. {arvi-0.1.27 → arvi-0.1.28}/arvi/berv.py +0 -0
  16. {arvi-0.1.27 → arvi-0.1.28}/arvi/binning.py +0 -0
  17. {arvi-0.1.27 → arvi-0.1.28}/arvi/config.py +0 -0
  18. {arvi-0.1.27 → arvi-0.1.28}/arvi/dace_wrapper.py +0 -0
  19. {arvi-0.1.27 → arvi-0.1.28}/arvi/data/extra/HD86226_PFS1.rdb +0 -0
  20. {arvi-0.1.27 → arvi-0.1.28}/arvi/data/extra/HD86226_PFS2.rdb +0 -0
  21. {arvi-0.1.27 → arvi-0.1.28}/arvi/data/extra/metadata.json +0 -0
  22. {arvi-0.1.27 → arvi-0.1.28}/arvi/data/info.svg +0 -0
  23. {arvi-0.1.27 → arvi-0.1.28}/arvi/data/obs_affected_ADC_issues.dat +0 -0
  24. {arvi-0.1.27 → arvi-0.1.28}/arvi/data/obs_affected_blue_cryostat_issues.dat +0 -0
  25. {arvi-0.1.27 → arvi-0.1.28}/arvi/extra_data.py +0 -0
  26. {arvi-0.1.27 → arvi-0.1.28}/arvi/gaia_wrapper.py +0 -0
  27. {arvi-0.1.27 → arvi-0.1.28}/arvi/headers.py +0 -0
  28. {arvi-0.1.27 → arvi-0.1.28}/arvi/instrument_specific.py +0 -0
  29. {arvi-0.1.27 → arvi-0.1.28}/arvi/kima_wrapper.py +0 -0
  30. {arvi-0.1.27 → arvi-0.1.28}/arvi/lbl_wrapper.py +0 -0
  31. {arvi-0.1.27 → arvi-0.1.28}/arvi/nasaexo_wrapper.py +0 -0
  32. {arvi-0.1.27 → arvi-0.1.28}/arvi/programs.py +0 -0
  33. {arvi-0.1.27 → arvi-0.1.28}/arvi/reports.py +0 -0
  34. {arvi-0.1.27 → arvi-0.1.28}/arvi/setup_logger.py +0 -0
  35. {arvi-0.1.27 → arvi-0.1.28}/arvi/simbad_wrapper.py +0 -0
  36. {arvi-0.1.27 → arvi-0.1.28}/arvi/spectra.py +0 -0
  37. {arvi-0.1.27 → arvi-0.1.28}/arvi/stats.py +0 -0
  38. {arvi-0.1.27 → arvi-0.1.28}/arvi/stellar.py +0 -0
  39. {arvi-0.1.27 → arvi-0.1.28}/arvi/translations.py +0 -0
  40. {arvi-0.1.27 → arvi-0.1.28}/arvi/utils.py +0 -0
  41. {arvi-0.1.27 → arvi-0.1.28}/arvi.egg-info/SOURCES.txt +0 -0
  42. {arvi-0.1.27 → arvi-0.1.28}/arvi.egg-info/dependency_links.txt +0 -0
  43. {arvi-0.1.27 → arvi-0.1.28}/arvi.egg-info/requires.txt +0 -0
  44. {arvi-0.1.27 → arvi-0.1.28}/arvi.egg-info/top_level.txt +0 -0
  45. {arvi-0.1.27 → arvi-0.1.28}/docs/API.md +0 -0
  46. {arvi-0.1.27 → arvi-0.1.28}/docs/detailed.md +0 -0
  47. {arvi-0.1.27 → arvi-0.1.28}/docs/index.md +0 -0
  48. {arvi-0.1.27 → arvi-0.1.28}/docs/logo/detective.png +0 -0
  49. {arvi-0.1.27 → arvi-0.1.28}/docs/logo/logo.png +0 -0
  50. {arvi-0.1.27 → arvi-0.1.28}/mkdocs.yml +0 -0
  51. {arvi-0.1.27 → arvi-0.1.28}/pyproject.toml +0 -0
  52. {arvi-0.1.27 → arvi-0.1.28}/setup.cfg +0 -0
  53. {arvi-0.1.27 → arvi-0.1.28}/setup.py +0 -0
  54. {arvi-0.1.27 → arvi-0.1.28}/tests/HD10700-Bcor_ESPRESSO18.rdb +0 -0
  55. {arvi-0.1.27 → arvi-0.1.28}/tests/test_binning.py +0 -0
  56. {arvi-0.1.27 → arvi-0.1.28}/tests/test_create_RV.py +0 -0
  57. {arvi-0.1.27 → arvi-0.1.28}/tests/test_import_object.py +0 -0
  58. {arvi-0.1.27 → arvi-0.1.28}/tests/test_simbad.py +0 -0
  59. {arvi-0.1.27 → arvi-0.1.28}/tests/test_stats.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: arvi
3
- Version: 0.1.27
3
+ Version: 0.1.28
4
4
  Summary: The Automated RV Inspector
5
5
  Author-email: João Faria <joao.faria@unige.ch>
6
6
  License: MIT
@@ -471,13 +471,16 @@ def plot_quantity(self, quantity, ax=None, show_masked=False, instrument=None,
471
471
 
472
472
  ax.minorticks_on()
473
473
 
474
+ delta = 'Δ' if self._did_adjust_means else ''
475
+
474
476
  ylabel = {
475
477
  quantity.lower(): quantity,
476
- 'fwhm': f'FWHM [{self.units}]',
477
- 'bispan': f'BIS [{self.units}]',
478
+ 'fwhm': f'{delta}FWHM [{self.units}]',
479
+ 'bispan': f'{delta}BIS [{self.units}]',
478
480
  'rhk': r"$\log$ R'$_{HK}$",
479
481
  'berv': 'BERV [km/s]',
480
482
  }
483
+
481
484
  ax.set_ylabel(ylabel[quantity.lower()])
482
485
 
483
486
  if remove_50000:
@@ -591,7 +594,10 @@ def gls(self, ax=None, label=None, fap=True, instrument=None,
591
594
  ax.semilogx(1/freq, power, picker=picker, label=label, **kwargs)
592
595
 
593
596
  if fap:
594
- ax.axhline(gls.false_alarm_level(0.01),
597
+ fap_level = 0.01
598
+ if isinstance(fap, float):
599
+ fap_level = fap
600
+ ax.axhline(gls.false_alarm_level(fap_level),
595
601
  color='k', alpha=0.2, zorder=-1)
596
602
 
597
603
  ax.set(xlabel='Period [days]', ylabel='Normalized power', ylim=(0, None))
@@ -698,12 +704,18 @@ def gls_quantity(self, quantity, ax=None, fap=True, instrument=None,
698
704
  else:
699
705
  fig = ax.figure
700
706
 
707
+ spp = kwargs.get('samples_per_peak', 5)
708
+
701
709
  gls = LombScargle(t, y, ye)
702
- freq, power = gls.autopower(maximum_frequency=1.0)
703
- ax.semilogx(1/freq, power, picker=picker)
710
+ freq, power = gls.autopower(maximum_frequency=1.0, samples_per_peak=spp)
711
+
712
+ ax.semilogx(1/freq, power, picker=picker, **kwargs)
704
713
 
705
714
  if fap:
706
- ax.axhline(gls.false_alarm_level(0.01),
715
+ fap_level = 0.01
716
+ if isinstance(fap, float):
717
+ fap_level = fap
718
+ ax.axhline(gls.false_alarm_level(fap_level),
707
719
  color='k', alpha=0.2, zorder=-1)
708
720
 
709
721
  ax.set(xlabel='Period [days]', ylabel='Normalized power', ylim=(0, None))
@@ -310,6 +310,10 @@ class RV:
310
310
  new_self._build_arrays()
311
311
  return new_self
312
312
 
313
+ def __iter__(self):
314
+ for inst in self.instruments:
315
+ yield getattr(self, inst)
316
+
313
317
 
314
318
  def reload(self):
315
319
  self._did_secular_acceleration = False
@@ -512,7 +516,8 @@ class RV:
512
516
  return s
513
517
 
514
518
  @classmethod
515
- def from_rdb(cls, files, star=None, instrument=None, units='ms', **kwargs):
519
+ def from_rdb(cls, files, star=None, instrument=None, units='ms',
520
+ header_skip=2, **kwargs):
516
521
  """ Create an RV object from an rdb file or a list of rdb files
517
522
 
518
523
  Args:
@@ -524,6 +529,8 @@ class RV:
524
529
  Name of the instrument(s). If None, try to infer it from file name
525
530
  units (str, optional):
526
531
  Units of the radial velocities. Defaults to 'ms'.
532
+ header_skip (int, optional):
533
+ Number of lines to skip in the header. Defaults to 2.
527
534
 
528
535
  Examples:
529
536
  s = RV.from_rdb('star_HARPS.rdb')
@@ -566,14 +573,14 @@ class RV:
566
573
  s = cls(star, _child=True, **kwargs)
567
574
 
568
575
  def find_column(data, names):
569
- has_col = np.array([name in data.dtype.fields for name in names])
576
+ has_col = np.array([name.casefold() in data.dtype.fields for name in names])
570
577
  if any(has_col):
571
578
  col = np.where(has_col)[0][0]
572
579
  return np.atleast_1d(data[names[col]])
573
580
  return False
574
581
 
575
582
  for i, (f, instrument) in enumerate(zip(files, instruments)):
576
- data = np.loadtxt(f, skiprows=2, usecols=range(3), unpack=True)
583
+ data = np.loadtxt(f, skiprows=header_skip, usecols=range(3), unpack=True)
577
584
  if data.ndim == 1:
578
585
  data = data.reshape(-1, 1)
579
586
 
@@ -615,11 +622,13 @@ class RV:
615
622
 
616
623
  # try to find FWHM and uncertainty
617
624
  if (v := find_column(data, ['fwhm'])) is not False: # walrus !!
618
- _s.fwhm = v
625
+ _s.fwhm = v * factor
619
626
  if (sv := find_column(data, ['sfwhm', 'fwhm_err', 'sig_fwhm'])) is not False:
620
- _s.fwhm_err = sv
627
+ _s.fwhm_err = sv * factor
628
+ logger.debug('found columns for FWHM and uncertainty') if verbose else None
621
629
  else:
622
630
  _s.fwhm_err = 2 * _s.svrad
631
+ logger.debug('found column for FWHM') if verbose else None
623
632
  else:
624
633
  _s.fwhm = np.full_like(time, np.nan)
625
634
  _s.fwhm_err = np.full_like(time, np.nan)
@@ -633,6 +642,7 @@ class RV:
633
642
  _s.rhk_err = np.full_like(time, np.nan)
634
643
  if (sv := find_column(data, ['srhk', 'rhk_err', 'sig_rhk'])) is not False:
635
644
  _s.rhk_err = sv
645
+ logger.debug('found columns for logRhk and uncertainty') if verbose else None
636
646
  else:
637
647
  _s.rhk = np.full_like(time, np.nan)
638
648
  _s.rhk_err = np.full_like(time, np.nan)
@@ -641,11 +651,11 @@ class RV:
641
651
  _quantities.append('rhk_err')
642
652
 
643
653
  # try to find BISPAN and uncertainty
644
- if (v := find_column(data, ['bispan'])) is not False:
645
- _s.bispan = v
654
+ if (v := find_column(data, ['bis', 'bispan'])) is not False:
655
+ _s.bispan = v * factor
646
656
  _s.bispan_err = np.full_like(time, np.nan)
647
- if (sv := find_column(data, ['sbispan'])) is not False:
648
- _s.bispan_err = sv
657
+ if (sv := find_column(data, ['sbispan', 'sig_bispan', 'bispan_err'])) is not False:
658
+ _s.bispan_err = sv * factor
649
659
  else:
650
660
  _s.bispan = np.full_like(time, np.nan)
651
661
  _s.bispan_err = np.full_like(time, np.nan)
@@ -660,18 +670,57 @@ class RV:
660
670
  _s.berv = np.full_like(time, np.nan)
661
671
  _quantities.append('berv')
662
672
 
663
- # other quantities, but all NaNs
664
- for q in ['caindex', 'ccf_asym', 'contrast', 'haindex', 'naindex', 'sindex']:
665
- setattr(_s, q, np.full_like(time, np.nan))
666
- setattr(_s, q + '_err', np.full_like(time, np.nan))
673
+ # other quantities
674
+ msg = ''
675
+
676
+ for q, possible in {
677
+ 'caindex': ['caindex', 'ca', 'caII'],
678
+ 'ccf_asym': ['ccf_asym'],
679
+ 'contrast': ['contrast'],
680
+ 'haindex': ['haindex', 'ha', 'halpha'],
681
+ 'heindex': ['heindex', 'he', 'heII'],
682
+ 'naindex': ['naindex', 'na'],
683
+ 'sindex': ['sindex', 's_mw'],
684
+ }.items():
685
+ # try to find columns for each quantity
686
+ if (v := find_column(data, possible)) is not False:
687
+ msg += f'{q}, '
688
+ setattr(_s, q, v)
689
+ # try to find uncertainty column for each quantity
690
+ possible_errors = ['s' + p for p in possible] + ['sig_' + p for p in possible] + [p + '_err' for p in possible]
691
+ if (sv := find_column(data, possible_errors)) is not False:
692
+ setattr(_s, q + '_err', sv)
693
+ else:
694
+ setattr(_s, q + '_err', np.full_like(time, np.nan))
695
+ else:
696
+ setattr(_s, q, np.full_like(time, np.nan))
697
+ setattr(_s, q + '_err', np.full_like(time, np.nan))
667
698
  _quantities.append(q)
668
699
  _quantities.append(q + '_err')
700
+
701
+ if verbose and msg != '':
702
+ if msg.endswith(', '):
703
+ msg = msg[:-2]
704
+ logger.debug('found columns for ' + msg)
705
+
706
+
707
+ # more values
669
708
  for q in ['texp', ]:
670
- setattr(_s, q, np.full_like(time, np.nan))
709
+ if (v := find_column(data, q)) is not False:
710
+ setattr(_s, q, v)
711
+ else:
712
+ setattr(_s, q, np.full_like(time, np.nan))
671
713
  _quantities.append(q)
714
+
715
+ # strings
672
716
  for q in ['ccf_mask', 'date_night', 'prog_id', 'raw_file', 'pub_reference']:
673
- setattr(_s, q, np.full(time.size, ''))
717
+ if (v := find_column(data, q)) is not False:
718
+ setattr(_s, q, v)
719
+ else:
720
+ setattr(_s, q, np.full(time.size, ''))
674
721
  _quantities.append(q)
722
+
723
+ # booleans
675
724
  for q in ['drs_qc', ]:
676
725
  setattr(_s, q, np.full(time.size, True))
677
726
  _quantities.append(q)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: arvi
3
- Version: 0.1.27
3
+ Version: 0.1.28
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