arvi 0.1.27__tar.gz → 0.1.29__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.
- {arvi-0.1.27/arvi.egg-info → arvi-0.1.29}/PKG-INFO +1 -1
- {arvi-0.1.27 → arvi-0.1.29}/arvi/plots.py +65 -13
- {arvi-0.1.27 → arvi-0.1.29}/arvi/timeseries.py +64 -15
- {arvi-0.1.27 → arvi-0.1.29/arvi.egg-info}/PKG-INFO +1 -1
- {arvi-0.1.27 → arvi-0.1.29}/.github/dependabot.yml +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/.github/workflows/docs-gh-pages.yml +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/.github/workflows/install.yml +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/.github/workflows/python-publish.yml +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/.gitignore +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/LICENSE +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/README.md +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/arvi/HZ.py +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/arvi/__init__.py +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/arvi/ariadne_wrapper.py +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/arvi/berv.py +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/arvi/binning.py +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/arvi/config.py +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/arvi/dace_wrapper.py +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/arvi/data/extra/HD86226_PFS1.rdb +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/arvi/data/extra/HD86226_PFS2.rdb +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/arvi/data/extra/metadata.json +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/arvi/data/info.svg +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/arvi/data/obs_affected_ADC_issues.dat +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/arvi/data/obs_affected_blue_cryostat_issues.dat +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/arvi/extra_data.py +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/arvi/gaia_wrapper.py +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/arvi/headers.py +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/arvi/instrument_specific.py +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/arvi/kima_wrapper.py +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/arvi/lbl_wrapper.py +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/arvi/nasaexo_wrapper.py +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/arvi/programs.py +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/arvi/reports.py +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/arvi/setup_logger.py +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/arvi/simbad_wrapper.py +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/arvi/spectra.py +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/arvi/stats.py +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/arvi/stellar.py +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/arvi/translations.py +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/arvi/utils.py +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/arvi.egg-info/SOURCES.txt +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/arvi.egg-info/dependency_links.txt +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/arvi.egg-info/requires.txt +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/arvi.egg-info/top_level.txt +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/docs/API.md +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/docs/detailed.md +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/docs/index.md +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/docs/logo/detective.png +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/docs/logo/logo.png +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/mkdocs.yml +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/pyproject.toml +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/setup.cfg +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/setup.py +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/tests/HD10700-Bcor_ESPRESSO18.rdb +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/tests/test_binning.py +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/tests/test_create_RV.py +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/tests/test_import_object.py +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/tests/test_simbad.py +0 -0
- {arvi-0.1.27 → arvi-0.1.29}/tests/test_stats.py +0 -0
|
@@ -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:
|
|
@@ -499,8 +502,8 @@ plot_berv = partialmethod(plot_quantity, quantity='berv')
|
|
|
499
502
|
|
|
500
503
|
|
|
501
504
|
@plot_fast
|
|
502
|
-
def gls(self, ax=None, label=None,
|
|
503
|
-
adjust_means=config.adjust_means_gls,
|
|
505
|
+
def gls(self, ax=None, label=None, instrument=None,
|
|
506
|
+
fap=True, fap_method='baluev', adjust_means=config.adjust_means_gls,
|
|
504
507
|
picker=True, **kwargs):
|
|
505
508
|
"""
|
|
506
509
|
Calculate and plot the Generalised Lomb-Scargle periodogram of the radial
|
|
@@ -512,11 +515,15 @@ def gls(self, ax=None, label=None, fap=True, instrument=None,
|
|
|
512
515
|
created.
|
|
513
516
|
label (str):
|
|
514
517
|
The label to use for the plot.
|
|
515
|
-
fap (bool):
|
|
516
|
-
Whether to show the false alarm probability. Default is True.
|
|
517
518
|
instrument (str or list):
|
|
518
519
|
Which instruments' data to include in the periodogram. Default is
|
|
519
520
|
all instruments.
|
|
521
|
+
fap (bool or float):
|
|
522
|
+
Whether to show the false alarm probability. A value (not a
|
|
523
|
+
percentage) can be provided to display a given FAP. Default is True.
|
|
524
|
+
fap_method (str):
|
|
525
|
+
Method used to estimate the FAP, passed directly to
|
|
526
|
+
`astropy.timeseries.LombScargle`. Default is 'baluev'.
|
|
520
527
|
adjust_means (bool):
|
|
521
528
|
Whether to adjust (subtract) the weighted means of each instrument.
|
|
522
529
|
Default is `config.adjust_means_gls`.
|
|
@@ -591,8 +598,17 @@ def gls(self, ax=None, label=None, fap=True, instrument=None,
|
|
|
591
598
|
ax.semilogx(1/freq, power, picker=picker, label=label, **kwargs)
|
|
592
599
|
|
|
593
600
|
if fap:
|
|
594
|
-
|
|
595
|
-
|
|
601
|
+
fap_level = 0.01
|
|
602
|
+
if isinstance(fap, float):
|
|
603
|
+
fap_level = fap
|
|
604
|
+
|
|
605
|
+
fap = gls.false_alarm_level(fap_level, method=fap_method)
|
|
606
|
+
|
|
607
|
+
if fap > 0.05 and fap_method == 'baluev':
|
|
608
|
+
logger.warning('FAP is high (>5%), the analytical estimate may be underestimated. Using the bootstrap method instead.')
|
|
609
|
+
fap = gls.false_alarm_level(fap_level, method='bootstrap')
|
|
610
|
+
|
|
611
|
+
ax.axhline(fap, color='k', alpha=0.2, zorder=-1)
|
|
596
612
|
|
|
597
613
|
ax.set(xlabel='Period [days]', ylabel='Normalized power', ylim=(0, None))
|
|
598
614
|
ax.minorticks_on()
|
|
@@ -634,8 +650,32 @@ def gls(self, ax=None, label=None, fap=True, instrument=None,
|
|
|
634
650
|
|
|
635
651
|
|
|
636
652
|
# @plot_fast
|
|
637
|
-
def gls_quantity(self, quantity, ax=None,
|
|
653
|
+
def gls_quantity(self, quantity, ax=None, instrument=None,
|
|
654
|
+
fap=True, fap_method='baluev',
|
|
638
655
|
adjust_means=True, picker=True, **kwargs):
|
|
656
|
+
"""
|
|
657
|
+
Calculate and plot the Generalised Lomb-Scargle periodogram of the given
|
|
658
|
+
quantity (e.g. fwhm, rhk, etc.)
|
|
659
|
+
|
|
660
|
+
Args:
|
|
661
|
+
quantity (str):
|
|
662
|
+
The quantity to calculate for which to compute the periodogram.
|
|
663
|
+
ax (matplotlib.axes.Axes):
|
|
664
|
+
The matplotlib axes to plot on. If None, a new figure will be
|
|
665
|
+
created.
|
|
666
|
+
instrument (str or list):
|
|
667
|
+
Which instruments' data to include in the periodogram. Default is
|
|
668
|
+
all instruments.
|
|
669
|
+
fap (bool or float):
|
|
670
|
+
Whether to show the false alarm probability. A value (not a
|
|
671
|
+
percentage) can be provided to display a given FAP. Default is True.
|
|
672
|
+
fap_method (str):
|
|
673
|
+
Method used to estimate the FAP, passed directly to
|
|
674
|
+
`astropy.timeseries.LombScargle`. Default is 'baluev'.
|
|
675
|
+
adjust_means (bool):
|
|
676
|
+
Whether to adjust (subtract) the weighted means of each instrument.
|
|
677
|
+
Default is `config.adjust_means_gls`.
|
|
678
|
+
"""
|
|
639
679
|
|
|
640
680
|
if not hasattr(self, quantity):
|
|
641
681
|
if self.verbose:
|
|
@@ -698,13 +738,25 @@ def gls_quantity(self, quantity, ax=None, fap=True, instrument=None,
|
|
|
698
738
|
else:
|
|
699
739
|
fig = ax.figure
|
|
700
740
|
|
|
741
|
+
spp = kwargs.get('samples_per_peak', 5)
|
|
742
|
+
|
|
701
743
|
gls = LombScargle(t, y, ye)
|
|
702
|
-
freq, power = gls.autopower(maximum_frequency=1.0)
|
|
703
|
-
|
|
744
|
+
freq, power = gls.autopower(maximum_frequency=1.0, samples_per_peak=spp)
|
|
745
|
+
|
|
746
|
+
ax.semilogx(1/freq, power, picker=picker, **kwargs)
|
|
704
747
|
|
|
705
748
|
if fap:
|
|
706
|
-
|
|
707
|
-
|
|
749
|
+
fap_level = 0.01
|
|
750
|
+
if isinstance(fap, float):
|
|
751
|
+
fap_level = fap
|
|
752
|
+
|
|
753
|
+
fap = gls.false_alarm_level(fap_level, method=fap_method)
|
|
754
|
+
|
|
755
|
+
if fap > 0.05 and fap_method == 'baluev':
|
|
756
|
+
logger.warning('FAP is high (>5%), the analytical estimate may be underestimated. Using the bootstrap method instead.')
|
|
757
|
+
fap = gls.false_alarm_level(fap_level, method='bootstrap')
|
|
758
|
+
|
|
759
|
+
ax.axhline(fap, color='k', alpha=0.2, zorder=-1)
|
|
708
760
|
|
|
709
761
|
ax.set(xlabel='Period [days]', ylabel='Normalized power', ylim=(0, None))
|
|
710
762
|
ax.minorticks_on()
|
|
@@ -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',
|
|
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=
|
|
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
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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)
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|