exovetter 0.0.3__py3-none-any.whl → 0.0.4__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.
exovetter/leo.py CHANGED
@@ -81,6 +81,7 @@ class Leo:
81
81
  self.near_tran = abs(self.phase) < self.qtran
82
82
  # Actual number of transits accounting for gaps
83
83
  self.epochs = np.round((time - epo) / per)
84
+
84
85
  self.tran_epochs = np.unique(self.epochs[self.in_tran])
85
86
  self.N_transit = len(self.tran_epochs)
86
87
  # Cadences within 2 transit durations
@@ -128,7 +129,7 @@ class Leo:
128
129
  # Get running mean and uncertainty of out-of-transit fluxes, binned over transit timescale
129
130
  in_bin = in_tran & ~self.near_tran
130
131
  bin_flux[i] = weighted_mean(self.flux[in_bin], self.flux_err[in_bin])
131
- bin_flux_err[i] = weighted_err(self.flux[in_bin], self.flux_err[in_bin])
132
+ bin_flux_err[i] = weighted_err(self.flux[in_bin], self.flux_err[in_bin]).value
132
133
  # Estimate white and red noise following Hartman & Bakos (2016)
133
134
  mask = ~np.isnan(bin_flux) & ~self.near_tran
134
135
  std = weighted_std(self.flux[mask], self.flux_err[mask])
@@ -137,7 +138,7 @@ class Leo:
137
138
  std
138
139
  * np.sqrt(np.nanmean(bin_flux_err[mask] ** 2))
139
140
  / np.sqrt(np.nanmean(self.flux_err[mask] ** 2))
140
- )
141
+ ).value
141
142
  self.sig_w = std
142
143
  sig_r2 = bin_std**2 - expected_bin_std**2
143
144
  self.sig_r = np.sqrt(sig_r2) if sig_r2 > 0 else 0
@@ -223,4 +224,4 @@ class Leo:
223
224
  self.DMM = np.nanmean(deps) / np.nanmedian(deps)
224
225
 
225
226
  def plot (self):
226
- print('Implement plotting')
227
+ print('Plotting not yet implemented')
exovetter/lpp.py CHANGED
@@ -327,7 +327,7 @@ def plot_lpp_diagnostic(data, target, norm_lpp):
327
327
  ax2.legend()
328
328
 
329
329
  fig.tight_layout()
330
- plt.draw() #Why is this here? MD 2023
330
+ plt.draw()
331
331
 
332
332
  return fig
333
333
 
exovetter/sweet.py CHANGED
@@ -1,4 +1,4 @@
1
- """Module ot handle SWEET vetter."""
1
+ """Module to handle SWEET vetter."""
2
2
 
3
3
  import os
4
4
 
@@ -63,8 +63,8 @@ def sweet(time, flux, period, epoch, duration, plot=False):
63
63
 
64
64
  if plot:
65
65
  import matplotlib.pyplot as plt
66
- #plt.clf() # removed MD 2023
67
- plt.figure(figsize=(7,7)) # Added MD 2023
66
+ #plt.clf() # swapped with a plt.figure below MD 2023
67
+ plt.figure(figsize=(7,7))
68
68
 
69
69
  out = []
70
70
  for i, per in enumerate([period * 0.5, period, 2 * period]):
@@ -82,7 +82,7 @@ def sweet(time, flux, period, epoch, duration, plot=False):
82
82
  plt.plot(phase[srt], f_obj.get_best_fit_model(phase[srt]), '-')
83
83
  plt.ylabel("P=%g" % (per))
84
84
  if i==0:
85
- plt.title('SWEET: Folded at 1, 1/2, and 1/4 times the period') # Added MD 2023
85
+ plt.title('SWEET: Folded at 1/2, 1, and 2 times the period')
86
86
 
87
87
  result = np.array(out)
88
88
 
exovetter/tce.py CHANGED
@@ -130,9 +130,15 @@ class Tce(dict):
130
130
  """
131
131
  if 'epoch' not in self or 'epoch_offset' not in self:
132
132
  raise KeyError('epoch and epoch_offset must be defined first')
133
+
134
+ # Puts into bjd
133
135
  epoch = self["epoch"] - self["epoch_offset"]
136
+
134
137
  if offset is not None:
138
+ # Transforms from bjd into desired time system
135
139
  epoch = epoch + offset
140
+
141
+
136
142
  return epoch
137
143
 
138
144
  def validate(self):
exovetter/utils.py CHANGED
@@ -7,7 +7,7 @@ import numpy as np
7
7
 
8
8
  __all__ = ['sine', 'estimate_scatter', 'mark_transit_cadences', 'median_detrend',
9
9
  'plateau', 'set_median_flux_to_zero', 'set_median_flux_to_one', 'sigmaClip',
10
- 'get_mast_tce', 'WqedLSF', 'compute_phases']
10
+ 'get_mast_tce', 'WqedLSF', 'compute_phases', 'first_epoch']
11
11
 
12
12
  def sine(x, order, period=1):
13
13
  """Sine function for SWEET vetter."""
@@ -614,3 +614,33 @@ def compute_phases(time, period, epoch, offset=0.5):
614
614
  pmin = np.min(phases)
615
615
 
616
616
  return phases
617
+
618
+ def first_epoch(epoch, period, lc):
619
+ """Returns epoch of the first time in a lc file. Usefull when pulling down TCEs from MAST.
620
+
621
+ Parameters
622
+ ----------
623
+ epoch : float
624
+ Time of transit from a given TCE in same time system as lc.
625
+
626
+ period : float
627
+ Period in units of time.
628
+
629
+ lc : lightkurve object
630
+ lightkurve object with flux and time.
631
+
632
+ Returns
633
+ -------
634
+ first_epoch : float
635
+ Epoch of first transit in lc in the time system of the lc.
636
+
637
+ """
638
+ # TODO might need to assert epoch.value is within lc.time.value
639
+ if epoch.value >= lc.time.value[0]:
640
+ N = np.floor((epoch.value-lc.time.value[0])/period.value)
641
+ first_epoch = epoch - N*period
642
+ else:
643
+ N = np.ceil((lc.time.value[0]-epoch.value)/period.value)
644
+ first_epoch = epoch + N*period
645
+
646
+ return first_epoch
exovetter/version.py CHANGED
@@ -5,4 +5,4 @@ try:
5
5
  from setuptools_scm import get_version
6
6
  version = get_version(root='..', relative_to=__file__)
7
7
  except Exception:
8
- version = '0.0.3'
8
+ version = '0.0.4'
exovetter/vetters.py CHANGED
@@ -22,7 +22,7 @@ from exovetter import leo
22
22
 
23
23
  __all__ = ['BaseVetter', 'ModShift', 'Lpp', 'OddEven',
24
24
  'TransitPhaseCoverage', 'Sweet', 'Centroid',
25
- 'VizTransits']
25
+ 'VizTransits', 'LeoVetter']
26
26
 
27
27
  class BaseVetter(ABC):
28
28
  """Base class for vetters.
@@ -105,6 +105,9 @@ class ModShift(BaseVetter):
105
105
  time : array
106
106
  Time values of the TCE, populated by :meth:`run`.
107
107
 
108
+ lc_name : str
109
+ Input ``lc_name``.
110
+
108
111
  flux : array
109
112
  Flux values of the TCE, populated by :meth:`run`.
110
113
 
@@ -283,7 +286,7 @@ class Lpp(BaseVetter):
283
286
  self.lpp_data, self.map_info
284
287
  ) # noqa: E501
285
288
 
286
- if plot: # Added to allow plotting with run MD 2023
289
+ if plot:
287
290
  target = self.tce.get("target_name", "Target")
288
291
  lpp.plot_lpp_diagnostic(self.plot_data, target, self.norm_lpp)
289
292
 
@@ -468,7 +471,7 @@ class TransitPhaseCoverage(BaseVetter):
468
471
  Returns
469
472
  ------------
470
473
  metrics : dict
471
- odd_even result dictionary containing the following:
474
+ transit_coverage result dictionary containing the following:
472
475
  transit_phase_coverage : Fraction of coverage
473
476
  """
474
477
  time, flux, time_offset_str = lightkurve_utils.unpack_lk_version(
@@ -679,11 +682,11 @@ class VizTransits(BaseVetter):
679
682
  lc_name : str
680
683
  Name of the flux array in the ``lightkurve`` object.
681
684
 
682
- max_transits : type
683
- description
685
+ max_transits : bool
686
+ Total number of transits to plot.
684
687
 
685
- transit_only : type
686
- description
688
+ transit_only : bool
689
+ Zoom in on the transit
687
690
 
688
691
  smooth : type
689
692
  description
@@ -735,8 +738,7 @@ class VizTransits(BaseVetter):
735
738
  centroid result dictionary containing the following:
736
739
  num_transits : Number of transits with data in transit (3*duration).
737
740
  """
738
-
739
- # Added plotting options MD 2023
741
+
740
742
  if plot == True:
741
743
  run_transit_plot = True
742
744
  run_folded_plot = True
@@ -777,14 +779,14 @@ class VizTransits(BaseVetter):
777
779
  # This will always show both. If you want one or the other do run with whichever one initialized
778
780
  self.run(self.tce, self.lc, plot=True)
779
781
 
780
- # def plot(self, tce, lightcurve): #OLD PLOT METHOD, MD 2023
782
+ # def plot(self, tce, lightcurve): # old plot method
781
783
 
782
784
  # _ = self.run(tce, lightcurve, max_transits=self.max_transits,
783
785
  # transit_only=self.transit_only, smooth=self.smooth,
784
786
  # plot=True)
785
787
 
786
788
  class LeoVetter(BaseVetter):
787
- """Leo based vetter"""
789
+ """Leo based vetter (see https://github.com/mkunimoto/LEO-vetter)"""
788
790
 
789
791
  def __init__(self, lc_name="flux", flux_err=None, frac=0.7, max_chases_phase=0.1):
790
792
  """
@@ -875,14 +877,15 @@ class LeoVetter(BaseVetter):
875
877
  time_offset_q = getattr(exo_const, time_offset_str)
876
878
  self.epoch = tce.get_epoch(time_offset_q).to_value(u.day)
877
879
 
878
- # epo needs to be the time of first transit in TESS BJD
880
+ # epo needs to be the time of first transit in TESS BJD
881
+ # (above converted to BTJD but here check it is actually at the beggining of the time series)
879
882
  if self.epoch >= self.time[0]:
880
883
  N = np.floor((self.epoch-self.time[0])/self.period)
881
884
  self.epo = self.epoch - N*self.period
882
885
  else:
883
886
  N = np.ceil((self.time[0]-self.epoch)/self.period)
884
887
  self.epo = self.epoch + N*self.period
885
-
888
+
886
889
  # create flux_err array defaulted to flux_err col of lc
887
890
  if self.flux_err is None:
888
891
  print("No flux error given, defaulting to 'flux_err' column of light curve")
@@ -949,4 +952,4 @@ class LeoVetter(BaseVetter):
949
952
  return self.metrics
950
953
 
951
954
  def plot(self): # pragma: no cover
952
- self.run(self.tce, self.lc, plot=True)
955
+ self.run(self.tce, self.lc, plot=True)
exovetter/viz_transits.py CHANGED
@@ -94,8 +94,12 @@ def plot_all_transits(time, flux, period, epoch, dur, depth, max_transits=20,
94
94
  c=color, ms=5, lw=1)
95
95
 
96
96
  plt.annotate("Transit %i" % nt,
97
- (xmin, np.median(fl) + step_size * i),
98
- c=color) # Pretty sure this should be % i+1? Although no clue why nt starts at 12
97
+ (xmin, np.median(fl) + step_size * (i+0.15)), c=color)
98
+ # Added buffer between transit and annotation
99
+
100
+ # plt.annotate("Transit %i" % nt,
101
+ # (xmin, np.median(fl) + step_size * i),
102
+ # c=color)
99
103
 
100
104
  plt.xlim(xmin, xmax)
101
105
  plt.axvspan(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: exovetter
3
- Version: 0.0.3
3
+ Version: 0.0.4
4
4
  Summary: Exoplanet vetting package
5
5
  Home-page: https://github.com/spacetelescope/exovetter
6
6
  Author: Susan Mullally et al.
@@ -1,18 +1,18 @@
1
1
  exovetter/__init__.py,sha256=79wPvKodLvzu1QiCX8tYpm7WcxST0mx-CWorfUz3D-c,278
2
2
  exovetter/const.py,sha256=aKBZmiZYlia2EuMDarzHpIRFYFKz-Vk81TJK2o2lUEE,996
3
- exovetter/leo.py,sha256=HbTxWUmLcpfTZ7eGlR0YVI8HTZKTalBf3cT4O3n103k,9322
3
+ exovetter/leo.py,sha256=03kYnhwlbNU5pXmuIXwFRJ9CpSxrfQlWMOYtCJCY_mw,9345
4
4
  exovetter/lightkurve_utils.py,sha256=3cKkQpubFNT7nid2OKHrhezcJlZHYBRAUBZXPKKIL8g,1121
5
- exovetter/lpp.py,sha256=0ZYlptPHl-5DtZIU-ZsXNENBXjVhgHDVWAZ7N6Imtf8,13005
5
+ exovetter/lpp.py,sha256=3U6PWGeY-TimeKmHhOHCJw1Pv7k1jU-NgTWesBKahaE,12978
6
6
  exovetter/model.py,sha256=ZRMoSLf_4V0Mgftpi_4A0iRgoEYHSdc96tWB8MjDH8k,2817
7
7
  exovetter/odd_even.py,sha256=g8TTd2JpwxLuTfYlonw2pbcVqnj2a7QvEAzL4qkxso4,6910
8
- exovetter/sweet.py,sha256=EkAjqkZKDG3AzZAQwPqeAH42VDfY-XQP6YA4lizKhRI,3076
9
- exovetter/tce.py,sha256=m1yfVNjjsPX36REXCWB_TPhklQ6xyEQ831O4g2rRFe4,7195
8
+ exovetter/sweet.py,sha256=prbuteEaahFWhAoCtQCVP47SbA6h4pYJn1Wn9JkEalc,3066
9
+ exovetter/tce.py,sha256=5JFKkbKoKCtdhm5EuW6FMAvp0LiaHLuqpFUbY0joyLI,7302
10
10
  exovetter/transit_coverage.py,sha256=Y4Muj7lKRsa0Sn6hD70O5On-2Aae1p5i-VTfJt5tsOw,2154
11
11
  exovetter/trapezoid_fit.py,sha256=Dok-H0zRsfigh4zfVO4R6Wi2TgK6hQXh4EIIYGouxiQ,31097
12
- exovetter/utils.py,sha256=ARk3nE2tbOyHG0let0xoDdOQpvBGy5N79H7Vy6ElhRk,17108
13
- exovetter/version.py,sha256=bzzqB-uZxarscjM25ZlqU8Tlq0y-r92XwWFCRjH4pA0,337
14
- exovetter/vetters.py,sha256=-NFGPO9__gCM88GuRB8TQAs7F_5g69ePVJ8Ramdv8Ic,30810
15
- exovetter/viz_transits.py,sha256=wMzz0VaxaOTtD-FMtdWjREU-GXJEWKaqoJFlJHPU27k,5536
12
+ exovetter/utils.py,sha256=EeP4_jRsPWGiFoOwmdGf7IgZhLz1Kve_nGqjlZqyRDc,17976
13
+ exovetter/version.py,sha256=SLdro-VW9GFWjSUPvxHnmIQgPaSWyx6-CbUu_R_I9UA,337
14
+ exovetter/vetters.py,sha256=70Douz_igYXslJ0HJcmaCIQ8ni8_JwIvH0N2QCNdRf4,30975
15
+ exovetter/viz_transits.py,sha256=SGUP-LLKN8030xGGqqk47OgrO4Gwk_ladIUqH5wT8_8,5651
16
16
  exovetter/centroid/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
17
17
  exovetter/centroid/centroid.py,sha256=LWqjn-Oerdw5j2wDCFYqB6omE4K9gckIwAA0-WZvgkY,8655
18
18
  exovetter/centroid/covar.py,sha256=suSgPjOVVEOclIi7rnhqc7wBbcSVsPOrdad91NXjX3Y,8973
@@ -21,8 +21,8 @@ exovetter/centroid/fastpsffit.py,sha256=eRMxYUJ_4hsCxso4u1d1zQvFSJQlJ_gRzhNa2PXk
21
21
  exovetter/modshift/__init__.py,sha256=j5665q0RHVzbzdPBXv_jUozGB4sex8ANXtzB41EYzRQ,68
22
22
  exovetter/modshift/modshift.py,sha256=cAYT0zcWsJYcGRDyfVPUjHsk7l8zQdecP0LY0hTdjOw,14531
23
23
  exovetter/modshift/plotmodshift.py,sha256=U0XKxVDKlNDXknj1g1to5dkIr0bQ_FqGp__BHhIQ2FQ,2400
24
- exovetter-0.0.3.dist-info/LICENSE.rst,sha256=uhiFz7eEG8WszLtRtYIT89FNMI3ijy1aACnvl5BOz2Y,1492
25
- exovetter-0.0.3.dist-info/METADATA,sha256=ARQQdgXwUUUmEXxlPDlB4OXLWzijhlCzLm0ikpdBSYk,3706
26
- exovetter-0.0.3.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
27
- exovetter-0.0.3.dist-info/top_level.txt,sha256=wh0_U5IPEspONX8zhGRaFUqfuovCGkgYjAmWuQe0w6Q,10
28
- exovetter-0.0.3.dist-info/RECORD,,
24
+ exovetter-0.0.4.dist-info/LICENSE.rst,sha256=uhiFz7eEG8WszLtRtYIT89FNMI3ijy1aACnvl5BOz2Y,1492
25
+ exovetter-0.0.4.dist-info/METADATA,sha256=kXfBbYmve3Tn_N_wZObJzLw6wmXi2ktrSS3gjrFBgUw,3706
26
+ exovetter-0.0.4.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
27
+ exovetter-0.0.4.dist-info/top_level.txt,sha256=wh0_U5IPEspONX8zhGRaFUqfuovCGkgYjAmWuQe0w6Q,10
28
+ exovetter-0.0.4.dist-info/RECORD,,