arvi 0.2.6__py3-none-any.whl → 0.2.7__py3-none-any.whl
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/dace_wrapper.py +18 -9
- arvi/timeseries.py +193 -70
- {arvi-0.2.6.dist-info → arvi-0.2.7.dist-info}/METADATA +1 -1
- {arvi-0.2.6.dist-info → arvi-0.2.7.dist-info}/RECORD +7 -7
- {arvi-0.2.6.dist-info → arvi-0.2.7.dist-info}/WHEEL +0 -0
- {arvi-0.2.6.dist-info → arvi-0.2.7.dist-info}/licenses/LICENSE +0 -0
- {arvi-0.2.6.dist-info → arvi-0.2.7.dist-info}/top_level.txt +0 -0
arvi/dace_wrapper.py
CHANGED
|
@@ -2,7 +2,7 @@ import os
|
|
|
2
2
|
import sys
|
|
3
3
|
import tarfile
|
|
4
4
|
import collections
|
|
5
|
-
from functools import lru_cache
|
|
5
|
+
from functools import lru_cache, partial
|
|
6
6
|
from itertools import islice
|
|
7
7
|
import numpy as np
|
|
8
8
|
|
|
@@ -170,7 +170,7 @@ def get_observations_from_instrument(star, instrument, user=None, main_id=None,
|
|
|
170
170
|
"""
|
|
171
171
|
Spectroscopy = load_spectroscopy(user)
|
|
172
172
|
found_dace_id = False
|
|
173
|
-
with timer('
|
|
173
|
+
with timer('dace_id query'):
|
|
174
174
|
try:
|
|
175
175
|
dace_id = get_dace_id(star, verbose=verbose, raise_error=True)
|
|
176
176
|
found_dace_id = True
|
|
@@ -212,17 +212,22 @@ def get_observations_from_instrument(star, instrument, user=None, main_id=None,
|
|
|
212
212
|
|
|
213
213
|
for inst in np.unique(result['ins_name']):
|
|
214
214
|
mask1 = result['ins_name'] == inst
|
|
215
|
-
r[inst] = {}
|
|
215
|
+
r[str(inst)] = {}
|
|
216
216
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
217
|
+
key2 = 'ins_drs_version'
|
|
218
|
+
n_key2 = len(np.unique(result[key2][mask1]))
|
|
219
|
+
if len(np.unique(result['pub_bibcode'][mask1])) >= n_key2:
|
|
220
|
+
key2 = 'pub_bibcode'
|
|
221
|
+
|
|
222
|
+
for pipe in np.unique(result[key2][mask1]):
|
|
223
|
+
mask2 = mask1 & (result[key2] == pipe)
|
|
224
|
+
r[str(inst)][str(pipe)] = {}
|
|
220
225
|
|
|
221
226
|
for ins_mode in np.unique(result['ins_mode'][mask2]):
|
|
222
227
|
mask3 = mask2 & (result['ins_mode'] == ins_mode)
|
|
223
228
|
_nan = np.full(mask3.sum(), np.nan)
|
|
224
229
|
|
|
225
|
-
r[inst][pipe][ins_mode] = {
|
|
230
|
+
r[str(inst)][str(pipe)][str(ins_mode)] = {
|
|
226
231
|
'texp': result['texp'][mask3],
|
|
227
232
|
'bispan': result['spectro_ccf_bispan'][mask3],
|
|
228
233
|
'bispan_err': result['spectro_ccf_bispan_err'][mask3],
|
|
@@ -372,9 +377,11 @@ def get_observations(star, instrument=None, user=None, main_id=None, verbose=Tru
|
|
|
372
377
|
# # For all other strings, sort alphabetically
|
|
373
378
|
# return (2, s)
|
|
374
379
|
|
|
375
|
-
def custom_key(val):
|
|
380
|
+
def custom_key(val, strip_EGGS=False):
|
|
381
|
+
if strip_EGGS:
|
|
382
|
+
val = val.replace('-EGGS', '').replace(' EGGS', '')
|
|
376
383
|
key = 0
|
|
377
|
-
key -=
|
|
384
|
+
key -= 1 if '3.5' in val else 0
|
|
378
385
|
key -= 1 if 'EGGS' in val else 0
|
|
379
386
|
key -= 1 if ('UHR' in val or 'MR' in val) else 0
|
|
380
387
|
key -= 1 if 'LBL' in val else 0
|
|
@@ -385,6 +392,8 @@ def get_observations(star, instrument=None, user=None, main_id=None, verbose=Tru
|
|
|
385
392
|
# new_result[inst] = dict(
|
|
386
393
|
# sorted(result[inst].items(), key=custom_sort_key, reverse=True)
|
|
387
394
|
# )
|
|
395
|
+
if all(['EGGS' in k for k in result[inst].keys()]):
|
|
396
|
+
custom_key = partial(custom_key, strip_EGGS=True)
|
|
388
397
|
# WARNING: not the same as reverse=True (not sure why)
|
|
389
398
|
sorted_keys = sorted(result[inst].keys(), key=custom_key)[::-1]
|
|
390
399
|
new_result[inst] = {}
|
arvi/timeseries.py
CHANGED
|
@@ -40,24 +40,53 @@ class RV(ISSUES, REPORTS):
|
|
|
40
40
|
"""
|
|
41
41
|
A class holding RV observations
|
|
42
42
|
|
|
43
|
+
Args:
|
|
44
|
+
star (str):
|
|
45
|
+
Name of the star
|
|
46
|
+
instrument (str, list):
|
|
47
|
+
Name of the instrument or list of instruments
|
|
48
|
+
verbose (bool):
|
|
49
|
+
Print logging messages
|
|
50
|
+
do_maxerror:
|
|
51
|
+
Mask points based on a maximum RV uncertainty
|
|
52
|
+
do_secular_acceleration:
|
|
53
|
+
Apply secular acceleration correction. This only applies
|
|
54
|
+
to certain instruments.
|
|
55
|
+
do_sigma_clip (bool):
|
|
56
|
+
Apply sigma clipping on the RVs
|
|
57
|
+
do_adjust_means (bool):
|
|
58
|
+
Subtract individual weighted mean RV from each instrument
|
|
59
|
+
only_latest_pipeline (bool):
|
|
60
|
+
Select only the latest pipeline from each instrument
|
|
61
|
+
load_extra_data (bool):
|
|
62
|
+
check_drs_qc (bool):
|
|
63
|
+
Mask points based on DRS quality control flags
|
|
64
|
+
user (str):
|
|
65
|
+
User name for DACE queries (should be a section in `~/.dacerc` file)
|
|
66
|
+
|
|
43
67
|
Examples:
|
|
44
68
|
>>> s = RV('Proxima')
|
|
69
|
+
>>> s = RV('HD10180', instrument='HARPS')
|
|
45
70
|
|
|
46
|
-
Attributes:
|
|
47
|
-
star (str):
|
|
48
|
-
The name of the star
|
|
49
|
-
N (int):
|
|
50
|
-
Total number of observations
|
|
51
|
-
instruments (list):
|
|
52
|
-
List of instruments for which there are RVs. Each instrument is also
|
|
53
|
-
stored as an attribute (e.g. `self.CORALIE98` or `self.HARPS`)
|
|
54
|
-
simbad (simbad):
|
|
55
|
-
Information on the target from Simbad
|
|
56
71
|
"""
|
|
72
|
+
# Attributes:
|
|
73
|
+
# star (str):
|
|
74
|
+
# The name of the star
|
|
75
|
+
# N (int):
|
|
76
|
+
# Total number of observations
|
|
77
|
+
# NN (dict):
|
|
78
|
+
# Number of observations per instrument
|
|
79
|
+
# instruments (list):
|
|
80
|
+
# List of instruments for which there are RVs. Each instrument is also
|
|
81
|
+
# stored as an attribute (e.g. `self.CORALIE98` or `self.HARPS`)
|
|
82
|
+
# simbad (simbad):
|
|
83
|
+
# Information on the target from Simbad
|
|
84
|
+
# gaia (gaia):
|
|
85
|
+
# Information on the target from Gaia DR3
|
|
57
86
|
star: str
|
|
58
87
|
instrument: Union[str, list] = field(init=True, repr=False, default=None)
|
|
59
88
|
verbose: bool = field(init=True, repr=False, default=True)
|
|
60
|
-
do_maxerror:
|
|
89
|
+
do_maxerror: float = field(init=True, repr=False, default=None)
|
|
61
90
|
do_secular_acceleration: bool = field(init=True, repr=False, default=True)
|
|
62
91
|
do_sigma_clip: bool = field(init=True, repr=False, default=False)
|
|
63
92
|
do_adjust_means: bool = field(init=True, repr=False, default=True)
|
|
@@ -217,7 +246,7 @@ class RV(ISSUES, REPORTS):
|
|
|
217
246
|
else:
|
|
218
247
|
mid = None
|
|
219
248
|
|
|
220
|
-
with timer():
|
|
249
|
+
with timer('dace query'):
|
|
221
250
|
self.dace_result = get_observations(self.__star__, self.instrument,
|
|
222
251
|
user=self.user, main_id=mid, verbose=self.verbose)
|
|
223
252
|
except ValueError as e:
|
|
@@ -318,7 +347,7 @@ class RV(ISSUES, REPORTS):
|
|
|
318
347
|
|
|
319
348
|
if self.do_adjust_means:
|
|
320
349
|
self.adjust_means()
|
|
321
|
-
|
|
350
|
+
|
|
322
351
|
_star_no_space = self.star.replace(' ', '')
|
|
323
352
|
_directory = sanitize_path(_star_no_space)
|
|
324
353
|
self._download_directory = f'{_directory}_downloads'
|
|
@@ -543,7 +572,7 @@ class RV(ISSUES, REPORTS):
|
|
|
543
572
|
return s
|
|
544
573
|
|
|
545
574
|
@classmethod
|
|
546
|
-
def from_arrays(cls, star, time, vrad, svrad, inst,
|
|
575
|
+
def from_arrays(cls, star, time, vrad, svrad, inst, **kwargs):
|
|
547
576
|
s = cls(star, _child=True)
|
|
548
577
|
time, vrad, svrad = map(np.atleast_1d, (time, vrad, svrad))
|
|
549
578
|
|
|
@@ -558,11 +587,15 @@ class RV(ISSUES, REPORTS):
|
|
|
558
587
|
s.time = time
|
|
559
588
|
s.vrad = vrad
|
|
560
589
|
s.svrad = svrad
|
|
561
|
-
|
|
562
|
-
s.mask = kwargs.
|
|
590
|
+
|
|
591
|
+
s.mask = kwargs.pop('mask', np.full_like(s.time, True, dtype=bool))
|
|
592
|
+
s.units = kwargs.pop('units', 'm/s')
|
|
593
|
+
|
|
594
|
+
for k, v in kwargs.items():
|
|
595
|
+
setattr(s, k, np.atleast_1d(v))
|
|
563
596
|
|
|
564
597
|
s.instruments = [inst]
|
|
565
|
-
s._quantities = np.array(
|
|
598
|
+
s._quantities = np.array(list(kwargs.keys()))
|
|
566
599
|
|
|
567
600
|
return s
|
|
568
601
|
|
|
@@ -583,7 +616,7 @@ class RV(ISSUES, REPORTS):
|
|
|
583
616
|
dt = datetime.fromtimestamp(float(timestamp))
|
|
584
617
|
if verbose:
|
|
585
618
|
logger.info(f'reading snapshot of {star} from {dt}')
|
|
586
|
-
|
|
619
|
+
|
|
587
620
|
s = pickle.load(open(file, 'rb'))
|
|
588
621
|
s._snapshot = file
|
|
589
622
|
return s
|
|
@@ -595,7 +628,7 @@ class RV(ISSUES, REPORTS):
|
|
|
595
628
|
|
|
596
629
|
Args:
|
|
597
630
|
files (str, list):
|
|
598
|
-
File name or list of file names
|
|
631
|
+
File name, file object, or list of file names
|
|
599
632
|
star (str, optional):
|
|
600
633
|
Name of the star. If None, try to infer it from file name
|
|
601
634
|
instrument (str, list, optional):
|
|
@@ -606,37 +639,68 @@ class RV(ISSUES, REPORTS):
|
|
|
606
639
|
Number of lines to skip in the header. Defaults to 2.
|
|
607
640
|
|
|
608
641
|
Examples:
|
|
609
|
-
s = RV.from_rdb('star_HARPS.rdb')
|
|
642
|
+
>>> s = RV.from_rdb('star_HARPS.rdb')
|
|
610
643
|
"""
|
|
611
644
|
from glob import glob
|
|
612
645
|
from os.path import splitext, basename
|
|
613
646
|
|
|
614
647
|
verbose = kwargs.pop('verbose', True)
|
|
615
648
|
|
|
649
|
+
file_object = False
|
|
650
|
+
|
|
616
651
|
if isinstance(files, str):
|
|
617
652
|
if '*' in files:
|
|
618
653
|
files = glob(files)
|
|
619
654
|
else:
|
|
620
655
|
files = [files]
|
|
656
|
+
elif isinstance(files, list):
|
|
657
|
+
pass
|
|
658
|
+
else:
|
|
659
|
+
file_object = hasattr(files, 'read')
|
|
660
|
+
files = [files]
|
|
621
661
|
|
|
622
|
-
if len(files) == 0:
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
662
|
+
# if len(files) == 0:
|
|
663
|
+
# if verbose:
|
|
664
|
+
# logger.error('no files found')
|
|
665
|
+
# return
|
|
666
|
+
def get_star_name(file):
|
|
667
|
+
return splitext(basename(file))[0].split('_')[0].replace('-', '_')
|
|
668
|
+
|
|
669
|
+
def get_instrument(file):
|
|
670
|
+
return splitext(basename(file))[0].split('_')[1]
|
|
626
671
|
|
|
627
|
-
if
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
672
|
+
if file_object:
|
|
673
|
+
if star is None:
|
|
674
|
+
try:
|
|
675
|
+
star = get_star_name(files[0].name)
|
|
676
|
+
except Exception:
|
|
677
|
+
star ='unknown'
|
|
631
678
|
if verbose:
|
|
632
679
|
logger.info(f'assuming star is {star}')
|
|
633
680
|
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
681
|
+
if instrument is None:
|
|
682
|
+
try:
|
|
683
|
+
instrument = get_instrument(files[0].name)
|
|
684
|
+
except Exception:
|
|
685
|
+
instrument = 'unknown'
|
|
686
|
+
if verbose:
|
|
687
|
+
logger.info(f'assuming instrument is {instrument}')
|
|
688
|
+
|
|
689
|
+
instruments = np.array([instrument])
|
|
638
690
|
else:
|
|
639
|
-
|
|
691
|
+
if star is None:
|
|
692
|
+
star = np.unique([get_star_name(f) for f in files])[0]
|
|
693
|
+
if verbose:
|
|
694
|
+
logger.info(f'assuming star is {star}')
|
|
695
|
+
else:
|
|
696
|
+
star = 'unknown'
|
|
697
|
+
|
|
698
|
+
if instrument is None:
|
|
699
|
+
instruments = np.array([splitext(basename(f))[0].split('_')[1] for f in files])
|
|
700
|
+
if verbose:
|
|
701
|
+
logger.info(f'assuming instruments: {instruments}')
|
|
702
|
+
else:
|
|
703
|
+
instruments = np.atleast_1d(instrument)
|
|
640
704
|
|
|
641
705
|
if instruments.size == 1 and len(files) > 1:
|
|
642
706
|
instruments = np.repeat(instruments, len(files))
|
|
@@ -669,12 +733,16 @@ class RV(ISSUES, REPORTS):
|
|
|
669
733
|
_quantities = []
|
|
670
734
|
|
|
671
735
|
#! hack
|
|
672
|
-
|
|
673
|
-
header =
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
736
|
+
if file_object:
|
|
737
|
+
header = f.readline().strip()
|
|
738
|
+
else:
|
|
739
|
+
with open(f) as ff:
|
|
740
|
+
header = ff.readline().strip()
|
|
741
|
+
|
|
742
|
+
if '\t' in header:
|
|
743
|
+
names = header.split('\t')
|
|
744
|
+
else:
|
|
745
|
+
names = header.split()
|
|
678
746
|
|
|
679
747
|
if len(names) > 3:
|
|
680
748
|
# if f.endswith('.rdb'):
|
|
@@ -687,7 +755,7 @@ class RV(ISSUES, REPORTS):
|
|
|
687
755
|
data = np.genfromtxt(f, **kw, delimiter='\t')
|
|
688
756
|
else:
|
|
689
757
|
data = np.genfromtxt(f, **kw)
|
|
690
|
-
|
|
758
|
+
|
|
691
759
|
# if data.ndim in (0, 1):
|
|
692
760
|
# data = data.reshape(-1, 1)
|
|
693
761
|
|
|
@@ -831,7 +899,22 @@ class RV(ISSUES, REPORTS):
|
|
|
831
899
|
|
|
832
900
|
@classmethod
|
|
833
901
|
def from_ccf(cls, files, star=None, instrument=None, **kwargs):
|
|
834
|
-
""" Create an RV object from a CCF file or a list of CCF files
|
|
902
|
+
""" Create an RV object from a CCF file or a list of CCF files
|
|
903
|
+
|
|
904
|
+
!!! Note
|
|
905
|
+
This function relies on the `iCCF` package
|
|
906
|
+
|
|
907
|
+
Args:
|
|
908
|
+
files (str or list):
|
|
909
|
+
CCF file or list of CCF files
|
|
910
|
+
star (str):
|
|
911
|
+
Star name. If not provided, it will be inferred from the header
|
|
912
|
+
of the CCF file
|
|
913
|
+
instrument (str):
|
|
914
|
+
Instrument name. If not provided, it will be inferred from the
|
|
915
|
+
header of the CCF file
|
|
916
|
+
|
|
917
|
+
"""
|
|
835
918
|
try:
|
|
836
919
|
import iCCF
|
|
837
920
|
except ImportError:
|
|
@@ -856,7 +939,7 @@ class RV(ISSUES, REPORTS):
|
|
|
856
939
|
objects = np.unique([i.HDU[0].header['OBJECT'].replace(' ', '') for i in CCFs])
|
|
857
940
|
|
|
858
941
|
if len(objects) != 1:
|
|
859
|
-
logger.warning(f'found {objects.size} different stars in the CCF files, '
|
|
942
|
+
logger.warning(f'found {objects.size} different stars in the CCF files ({objects}), '
|
|
860
943
|
'choosing the first one')
|
|
861
944
|
star = objects[0]
|
|
862
945
|
|
|
@@ -882,9 +965,22 @@ class RV(ISSUES, REPORTS):
|
|
|
882
965
|
_quantities.append('contrast')
|
|
883
966
|
_quantities.append('contrast_err')
|
|
884
967
|
|
|
968
|
+
_s.bispan = np.array([i.BIS*1e3 for i in CCFs])
|
|
969
|
+
_s.bispan_err = np.array([i.BISerror*1e3 for i in CCFs])
|
|
970
|
+
_quantities.append('bispan')
|
|
971
|
+
_quantities.append('bispan_err')
|
|
972
|
+
|
|
973
|
+
_s.rhk = np.full_like(time, np.nan)
|
|
974
|
+
_s.rhk_err = np.full_like(time, np.nan)
|
|
975
|
+
_quantities.append('rhk')
|
|
976
|
+
_quantities.append('rhk_err')
|
|
977
|
+
|
|
885
978
|
_s.texp = np.array([i.HDU[0].header['EXPTIME'] for i in CCFs])
|
|
886
979
|
_quantities.append('texp')
|
|
887
980
|
|
|
981
|
+
_s.berv = np.array([i.HDU[0].header['HIERARCH ESO QC BERV'] for i in CCFs])
|
|
982
|
+
_quantities.append('berv')
|
|
983
|
+
|
|
888
984
|
_s.date_night = np.array([
|
|
889
985
|
i.HDU[0].header['DATE-OBS'].split('T')[0] for i in CCFs
|
|
890
986
|
])
|
|
@@ -955,17 +1051,17 @@ class RV(ISSUES, REPORTS):
|
|
|
955
1051
|
if fits_file not in tar.getnames():
|
|
956
1052
|
logger.error(f'KOBE file not found for {star}')
|
|
957
1053
|
return
|
|
958
|
-
|
|
1054
|
+
|
|
959
1055
|
hdul = fits.open(tar.extractfile(fits_file))
|
|
960
1056
|
|
|
961
1057
|
else:
|
|
962
1058
|
resp = requests.get(f'https://kobe.caha.es/internal/fitsfiles/{fits_file}',
|
|
963
1059
|
auth=HTTPBasicAuth('kobeteam', config.kobe_password))
|
|
964
|
-
|
|
1060
|
+
|
|
965
1061
|
if resp.status_code != 200:
|
|
966
1062
|
# something went wrong, try to extract the file by downloading the
|
|
967
1063
|
# full tar.gz archive
|
|
968
|
-
|
|
1064
|
+
|
|
969
1065
|
logger.warning(f'could not find "{fits_file}" on server, trying to download full archive')
|
|
970
1066
|
resp = requests.get('https://kobe.caha.es/internal/fitsfiles.tar.gz',
|
|
971
1067
|
auth=HTTPBasicAuth('kobeteam', config.kobe_password))
|
|
@@ -983,7 +1079,7 @@ class RV(ISSUES, REPORTS):
|
|
|
983
1079
|
if fits_file not in tar.getnames():
|
|
984
1080
|
logger.error(f'KOBE file not found for {star}')
|
|
985
1081
|
return
|
|
986
|
-
|
|
1082
|
+
|
|
987
1083
|
hdul = fits.open(tar.extractfile(fits_file))
|
|
988
1084
|
|
|
989
1085
|
else:
|
|
@@ -1382,7 +1478,9 @@ class RV(ISSUES, REPORTS):
|
|
|
1382
1478
|
def remove_point(self, index):
|
|
1383
1479
|
"""
|
|
1384
1480
|
Remove individual observations at a given index (or indices).
|
|
1385
|
-
|
|
1481
|
+
|
|
1482
|
+
!!! Note
|
|
1483
|
+
Like Python, the index is 0-based.
|
|
1386
1484
|
|
|
1387
1485
|
Args:
|
|
1388
1486
|
index (int, list, ndarray):
|
|
@@ -1414,11 +1512,14 @@ class RV(ISSUES, REPORTS):
|
|
|
1414
1512
|
def restore_point(self, index):
|
|
1415
1513
|
"""
|
|
1416
1514
|
Restore previously deleted individual observations at a given index (or
|
|
1417
|
-
indices).
|
|
1515
|
+
indices).
|
|
1516
|
+
|
|
1517
|
+
!!! Note
|
|
1518
|
+
Like Python, the index is 0-based
|
|
1418
1519
|
|
|
1419
1520
|
Args:
|
|
1420
1521
|
index (int, list, ndarray):
|
|
1421
|
-
Single index, list, or array of indices to restore
|
|
1522
|
+
Single index, list, or array of indices to restore
|
|
1422
1523
|
"""
|
|
1423
1524
|
index = np.atleast_1d(index)
|
|
1424
1525
|
try:
|
|
@@ -1444,6 +1545,14 @@ class RV(ISSUES, REPORTS):
|
|
|
1444
1545
|
self.mask = self.mask & self.public
|
|
1445
1546
|
self._propagate_mask_changes()
|
|
1446
1547
|
|
|
1548
|
+
def remove_public(self):
|
|
1549
|
+
""" Remove public observations """
|
|
1550
|
+
if self.verbose:
|
|
1551
|
+
n = self.public.sum()
|
|
1552
|
+
logger.info(f'masking public observations ({n})')
|
|
1553
|
+
self.mask = self.mask & (~self.public)
|
|
1554
|
+
self._propagate_mask_changes()
|
|
1555
|
+
|
|
1447
1556
|
def remove_single_observations(self):
|
|
1448
1557
|
""" Remove instruments for which there is a single observation """
|
|
1449
1558
|
singles = [i for i in self.instruments if getattr(self, i).mtime.size == 1]
|
|
@@ -1469,26 +1578,26 @@ class RV(ISSUES, REPORTS):
|
|
|
1469
1578
|
if self.verbose:
|
|
1470
1579
|
logger.warning(f'no observations for prog_id "{prog_id}"')
|
|
1471
1580
|
|
|
1472
|
-
def remove_after_bjd(self, bjd):
|
|
1581
|
+
def remove_after_bjd(self, bjd: float):
|
|
1473
1582
|
""" Remove observations after a given BJD """
|
|
1474
1583
|
if (self.time > bjd).any():
|
|
1475
1584
|
ind = np.where(self.time > bjd)[0]
|
|
1476
1585
|
self.remove_point(ind)
|
|
1477
1586
|
|
|
1478
|
-
def remove_before_bjd(self, bjd):
|
|
1587
|
+
def remove_before_bjd(self, bjd: float):
|
|
1479
1588
|
""" Remove observations before a given BJD """
|
|
1480
1589
|
if (self.time < bjd).any():
|
|
1481
1590
|
ind = np.where(self.time < bjd)[0]
|
|
1482
1591
|
self.remove_point(ind)
|
|
1483
|
-
|
|
1484
|
-
def remove_between_bjds(self, bjd1, bjd2):
|
|
1592
|
+
|
|
1593
|
+
def remove_between_bjds(self, bjd1: float, bjd2: float):
|
|
1485
1594
|
""" Remove observations between two BJDs """
|
|
1486
1595
|
to_remove = (self.time > bjd1) & (self.time < bjd2)
|
|
1487
1596
|
if to_remove.any():
|
|
1488
1597
|
ind = np.where(to_remove)[0]
|
|
1489
1598
|
self.remove_point(ind)
|
|
1490
1599
|
|
|
1491
|
-
def choose_n_points(self, n, seed=None, instrument=None):
|
|
1600
|
+
def choose_n_points(self, n: int, seed=None, instrument=None):
|
|
1492
1601
|
""" Randomly choose `n` observations and mask out the remaining ones
|
|
1493
1602
|
|
|
1494
1603
|
Args:
|
|
@@ -1526,15 +1635,20 @@ class RV(ISSUES, REPORTS):
|
|
|
1526
1635
|
getattr(self, inst).mask[m - n_before] = False
|
|
1527
1636
|
|
|
1528
1637
|
def secular_acceleration(self, epoch=None, just_compute=False, force_simbad=False):
|
|
1529
|
-
"""
|
|
1530
|
-
Remove secular acceleration from RVs
|
|
1638
|
+
"""
|
|
1639
|
+
Remove secular acceleration from RVs. This uses the proper motions from
|
|
1640
|
+
Gaia (in `self.gaia`) if available, otherwise from Simbad (in
|
|
1641
|
+
`self.simbad`), unless `force_simbad=True`.
|
|
1642
|
+
|
|
1531
1643
|
|
|
1532
1644
|
Args:
|
|
1533
1645
|
epoch (float, optional):
|
|
1534
1646
|
The reference epoch (DACE uses 55500, 31/10/2010)
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1647
|
+
just_compute (bool, optional):
|
|
1648
|
+
Just compute the secular acceleration and return, without
|
|
1649
|
+
changing the RVs
|
|
1650
|
+
force_simbad (bool, optional):
|
|
1651
|
+
Use Simbad proper motions even if Gaia is available
|
|
1538
1652
|
"""
|
|
1539
1653
|
if self._did_secular_acceleration and not just_compute: # don't do it twice
|
|
1540
1654
|
return
|
|
@@ -1643,7 +1757,7 @@ class RV(ISSUES, REPORTS):
|
|
|
1643
1757
|
|
|
1644
1758
|
if config.return_self:
|
|
1645
1759
|
return self
|
|
1646
|
-
|
|
1760
|
+
|
|
1647
1761
|
def _undo_secular_acceleration(self):
|
|
1648
1762
|
if self._did_secular_acceleration:
|
|
1649
1763
|
_old_verbose = self.verbose
|
|
@@ -1671,7 +1785,15 @@ class RV(ISSUES, REPORTS):
|
|
|
1671
1785
|
self._did_secular_acceleration = False
|
|
1672
1786
|
|
|
1673
1787
|
def sigmaclip(self, sigma=5, instrument=None, strict=True):
|
|
1674
|
-
"""
|
|
1788
|
+
"""
|
|
1789
|
+
Sigma-clip RVs (per instrument!), by MAD away from the median.
|
|
1790
|
+
|
|
1791
|
+
Args:
|
|
1792
|
+
sigma (float):
|
|
1793
|
+
Number of MADs to clip
|
|
1794
|
+
instrument (str, list):
|
|
1795
|
+
Instrument(s) to sigma-clip
|
|
1796
|
+
"""
|
|
1675
1797
|
#from scipy.stats import sigmaclip as dosigmaclip
|
|
1676
1798
|
from .stats import sigmaclip_median as dosigmaclip
|
|
1677
1799
|
|
|
@@ -1708,7 +1830,7 @@ class RV(ISSUES, REPORTS):
|
|
|
1708
1830
|
|
|
1709
1831
|
self._propagate_mask_changes()
|
|
1710
1832
|
|
|
1711
|
-
if self._did_adjust_means:
|
|
1833
|
+
if len(changed_instruments) > 0 and self._did_adjust_means:
|
|
1712
1834
|
self._did_adjust_means = False
|
|
1713
1835
|
self.adjust_means(instrument=changed_instruments)
|
|
1714
1836
|
|
|
@@ -1741,7 +1863,8 @@ class RV(ISSUES, REPORTS):
|
|
|
1741
1863
|
"""
|
|
1742
1864
|
Nightly bin the observations.
|
|
1743
1865
|
|
|
1744
|
-
|
|
1866
|
+
!!! Warning
|
|
1867
|
+
This creates and returns a new object and does not modify self.
|
|
1745
1868
|
"""
|
|
1746
1869
|
|
|
1747
1870
|
# create copy of self to be returned
|
|
@@ -1845,7 +1968,7 @@ class RV(ISSUES, REPORTS):
|
|
|
1845
1968
|
return np.nanmean(z, axis=0)
|
|
1846
1969
|
|
|
1847
1970
|
def subtract_mean(self):
|
|
1848
|
-
""" Subtract (single) mean RV from all instruments """
|
|
1971
|
+
""" Subtract (a single) non-weighted mean RV from all instruments """
|
|
1849
1972
|
self._meanRV = meanRV = self.mvrad.mean()
|
|
1850
1973
|
for inst in self.instruments:
|
|
1851
1974
|
s = getattr(self, inst)
|
|
@@ -1881,7 +2004,7 @@ class RV(ISSUES, REPORTS):
|
|
|
1881
2004
|
# row = []
|
|
1882
2005
|
# if print_as_table:
|
|
1883
2006
|
# logger.info('subtracted weighted average from each instrument:')
|
|
1884
|
-
|
|
2007
|
+
|
|
1885
2008
|
others = ('fwhm', 'bispan', )
|
|
1886
2009
|
|
|
1887
2010
|
instruments = self._check_instrument(instrument, strict=kwargs.get('strict', False))
|
|
@@ -2160,10 +2283,10 @@ class RV(ISSUES, REPORTS):
|
|
|
2160
2283
|
""" Sort instruments by first or last observation date.
|
|
2161
2284
|
|
|
2162
2285
|
Args:
|
|
2163
|
-
by_first_observation (bool, optional
|
|
2164
|
-
Sort by first observation date
|
|
2165
|
-
by_last_observation (bool, optional
|
|
2166
|
-
Sort by last observation date
|
|
2286
|
+
by_first_observation (bool, optional):
|
|
2287
|
+
Sort by first observation date
|
|
2288
|
+
by_last_observation (bool, optional):
|
|
2289
|
+
Sort by last observation date
|
|
2167
2290
|
"""
|
|
2168
2291
|
if by_last_observation:
|
|
2169
2292
|
by_first_observation = False
|
|
@@ -2239,7 +2362,7 @@ class RV(ISSUES, REPORTS):
|
|
|
2239
2362
|
# if self.verbose:
|
|
2240
2363
|
# logger.warning(f'masking {nan_mask.sum()} observations with NaN in indicators')
|
|
2241
2364
|
|
|
2242
|
-
header = '\t'.join(['rjd', 'vrad', 'svrad',
|
|
2365
|
+
header = '\t'.join(['rjd', 'vrad', 'svrad',
|
|
2243
2366
|
'fwhm', 'sig_fwhm',
|
|
2244
2367
|
'bispan', 'sig_bispan',
|
|
2245
2368
|
'contrast', 'sig_contrast',
|
|
@@ -4,7 +4,7 @@ arvi/ariadne_wrapper.py,sha256=YvilopJa9T4NwPcj3Nah_U8smSeSAU5-HYZMb_GJ-BQ,2232
|
|
|
4
4
|
arvi/berv.py,sha256=eKnpuPC1w45UrUEyFRbs9F9j3bXz3kxYzNXbnRgvFQM,17596
|
|
5
5
|
arvi/binning.py,sha256=NK9y9bUrdyWCbh79LkcRABHG-n5MtlETMHMvLj1z-OM,15437
|
|
6
6
|
arvi/config.py,sha256=JkHSwF-EEqwwbcc8thGgbFc9udDZPjQH-9XFjqDepBY,2337
|
|
7
|
-
arvi/dace_wrapper.py,sha256=
|
|
7
|
+
arvi/dace_wrapper.py,sha256=sgFxM2Jtd1NbT0e7xuKIE94dVN5mjlv15m72WYf95HU,25685
|
|
8
8
|
arvi/exofop_wrapper.py,sha256=8S7UEcrBAgANIweMV0-CvaWaVTPgGVo8vQQk_KRa0nU,2414
|
|
9
9
|
arvi/extra_data.py,sha256=Xi65pI5kkzqlMmHGl9xFoumtH699611pJJ5PV-a_IfU,3397
|
|
10
10
|
arvi/gaia_wrapper.py,sha256=HTuigIduin3raWfSC7QYuQxDk2dEXYH_4egRkzzg7Xw,4379
|
|
@@ -22,7 +22,7 @@ arvi/sophie_wrapper.py,sha256=KUeWccXud5_Lrx72S1HSemHIZRdjd2oLvqyofwsL0QQ,3440
|
|
|
22
22
|
arvi/spectra.py,sha256=ebF1ocodTastLx0CyqLSpE8EZNDXBF8riyfxMr3L6H0,7491
|
|
23
23
|
arvi/stats.py,sha256=ilzzGL9ew-SyVa9eEdrYCpD3DliOAwhoNUg9LIlHjzU,2583
|
|
24
24
|
arvi/stellar.py,sha256=GQ7yweuBRnfkJ0M5eWjvLd8uvGq_by81PbXfidBvWis,4918
|
|
25
|
-
arvi/timeseries.py,sha256=
|
|
25
|
+
arvi/timeseries.py,sha256=Ev4McrYznhs4pDgza5TEl0V1KgSrWpmCSlJFG-uQlpM,95722
|
|
26
26
|
arvi/translations.py,sha256=PUSrn4zvYO2MqGzUxlFGwev_tBkgJaJrIYs6NKHzbWo,951
|
|
27
27
|
arvi/utils.py,sha256=EY4hdwGcTUZg_tPT3yQ7ShLIVm9dAfmJC0c7toAVSKI,7221
|
|
28
28
|
arvi/data/info.svg,sha256=0IMI6W-eFoTD8acnury79WJJakpBwLa4qKS4JWpsXiI,489
|
|
@@ -31,8 +31,8 @@ arvi/data/obs_affected_blue_cryostat_issues.dat,sha256=z4AK17xfz8tGTDv1FjRvQFnio
|
|
|
31
31
|
arvi/data/extra/HD86226_PFS1.rdb,sha256=vfAozbrKHM_j8dYkCBJsuHyD01KEM1asghe2KInwVao,3475
|
|
32
32
|
arvi/data/extra/HD86226_PFS2.rdb,sha256=F2P7dB6gVyzCglUjNheB0hIHVClC5RmARrGwbrY1cfo,4114
|
|
33
33
|
arvi/data/extra/metadata.json,sha256=C69hIw6CohyES6BI9vDWjxwSz7N4VOYX0PCgjXtYFmU,178
|
|
34
|
-
arvi-0.2.
|
|
35
|
-
arvi-0.2.
|
|
36
|
-
arvi-0.2.
|
|
37
|
-
arvi-0.2.
|
|
38
|
-
arvi-0.2.
|
|
34
|
+
arvi-0.2.7.dist-info/licenses/LICENSE,sha256=6JfQgl7SpM55t0EHMFNMnNh-AdkpGW25MwMiTnhdWQg,1068
|
|
35
|
+
arvi-0.2.7.dist-info/METADATA,sha256=UnB8zRrrEjG78dAjKiFY2Qh6a1tqvRaptf026MsUrdw,1932
|
|
36
|
+
arvi-0.2.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
37
|
+
arvi-0.2.7.dist-info/top_level.txt,sha256=4EeiKDVLD45ztuflTGfQ3TU8GVjJg5Y95xS5XjI-utU,5
|
|
38
|
+
arvi-0.2.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|