exovetter 0.0.5__tar.gz → 0.0.7__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.
Files changed (74) hide show
  1. {exovetter-0.0.5 → exovetter-0.0.7}/PKG-INFO +1 -1
  2. {exovetter-0.0.5 → exovetter-0.0.7}/exovetter/utils.py +170 -2
  3. {exovetter-0.0.5 → exovetter-0.0.7}/exovetter/version.py +1 -1
  4. {exovetter-0.0.5 → exovetter-0.0.7}/exovetter/vetters.py +180 -118
  5. {exovetter-0.0.5 → exovetter-0.0.7}/exovetter.egg-info/PKG-INFO +1 -1
  6. {exovetter-0.0.5 → exovetter-0.0.7}/exovetter.egg-info/SOURCES.txt +2 -6
  7. exovetter-0.0.7/tutorial_notebooks/100100827.pdf +0 -0
  8. exovetter-0.0.7/tutorial_notebooks/run_all.ipynb +372 -0
  9. exovetter-0.0.5/tutorial_notebooks/run_all.ipynb +0 -1513
  10. exovetter-0.0.5/tutorial_notebooks/run_all_plots/TOI_1000.01.pdf +0 -0
  11. exovetter-0.0.5/tutorial_notebooks/run_all_plots/TOI_1001.01.pdf +0 -0
  12. exovetter-0.0.5/tutorial_notebooks/run_all_plots/TOI_1004.01.pdf +0 -0
  13. exovetter-0.0.5/tutorial_notebooks/run_all_plots/TOI_1007.01.pdf +0 -0
  14. exovetter-0.0.5/tutorial_notebooks/run_all_plots/TOI_1011.01.pdf +0 -0
  15. {exovetter-0.0.5 → exovetter-0.0.7}/.bandit.yaml +0 -0
  16. {exovetter-0.0.5 → exovetter-0.0.7}/.github/workflows/ci_workflows.yml +0 -0
  17. {exovetter-0.0.5 → exovetter-0.0.7}/.github/workflows/publish.yml +0 -0
  18. {exovetter-0.0.5 → exovetter-0.0.7}/.gitignore +0 -0
  19. {exovetter-0.0.5 → exovetter-0.0.7}/.readthedocs.yml +0 -0
  20. {exovetter-0.0.5 → exovetter-0.0.7}/CHANGES.rst +0 -0
  21. {exovetter-0.0.5 → exovetter-0.0.7}/LICENSE.rst +0 -0
  22. {exovetter-0.0.5 → exovetter-0.0.7}/MANIFEST.in +0 -0
  23. {exovetter-0.0.5 → exovetter-0.0.7}/README.rst +0 -0
  24. {exovetter-0.0.5 → exovetter-0.0.7}/docs/Makefile +0 -0
  25. {exovetter-0.0.5 → exovetter-0.0.7}/docs/conf.py +0 -0
  26. {exovetter-0.0.5 → exovetter-0.0.7}/docs/index.rst +0 -0
  27. {exovetter-0.0.5 → exovetter-0.0.7}/docs/install.rst +0 -0
  28. {exovetter-0.0.5 → exovetter-0.0.7}/docs/make.bat +0 -0
  29. {exovetter-0.0.5 → exovetter-0.0.7}/docs/utils.rst +0 -0
  30. {exovetter-0.0.5 → exovetter-0.0.7}/docs/vetters.rst +0 -0
  31. {exovetter-0.0.5 → exovetter-0.0.7}/docs/vetters_low_level.rst +0 -0
  32. {exovetter-0.0.5 → exovetter-0.0.7}/exovetter/__init__.py +0 -0
  33. {exovetter-0.0.5 → exovetter-0.0.7}/exovetter/centroid/__init__.py +0 -0
  34. {exovetter-0.0.5 → exovetter-0.0.7}/exovetter/centroid/centroid.py +0 -0
  35. {exovetter-0.0.5 → exovetter-0.0.7}/exovetter/centroid/covar.py +0 -0
  36. {exovetter-0.0.5 → exovetter-0.0.7}/exovetter/centroid/disp.py +0 -0
  37. {exovetter-0.0.5 → exovetter-0.0.7}/exovetter/centroid/fastpsffit.py +0 -0
  38. {exovetter-0.0.5 → exovetter-0.0.7}/exovetter/const.py +0 -0
  39. {exovetter-0.0.5 → exovetter-0.0.7}/exovetter/leo.py +0 -0
  40. {exovetter-0.0.5 → exovetter-0.0.7}/exovetter/lightkurve_utils.py +0 -0
  41. {exovetter-0.0.5 → exovetter-0.0.7}/exovetter/lpp.py +0 -0
  42. {exovetter-0.0.5 → exovetter-0.0.7}/exovetter/model.py +0 -0
  43. {exovetter-0.0.5 → exovetter-0.0.7}/exovetter/modshift/__init__.py +0 -0
  44. {exovetter-0.0.5 → exovetter-0.0.7}/exovetter/modshift/modshift.py +0 -0
  45. {exovetter-0.0.5 → exovetter-0.0.7}/exovetter/modshift/plotmodshift.py +0 -0
  46. {exovetter-0.0.5 → exovetter-0.0.7}/exovetter/odd_even.py +0 -0
  47. {exovetter-0.0.5 → exovetter-0.0.7}/exovetter/sweet.py +0 -0
  48. {exovetter-0.0.5 → exovetter-0.0.7}/exovetter/tce.py +0 -0
  49. {exovetter-0.0.5 → exovetter-0.0.7}/exovetter/transit_coverage.py +0 -0
  50. {exovetter-0.0.5 → exovetter-0.0.7}/exovetter/trapezoid_fit.py +0 -0
  51. {exovetter-0.0.5 → exovetter-0.0.7}/exovetter/viz_transits.py +0 -0
  52. {exovetter-0.0.5 → exovetter-0.0.7}/exovetter.egg-info/dependency_links.txt +0 -0
  53. {exovetter-0.0.5 → exovetter-0.0.7}/exovetter.egg-info/not-zip-safe +0 -0
  54. {exovetter-0.0.5 → exovetter-0.0.7}/exovetter.egg-info/requires.txt +0 -0
  55. {exovetter-0.0.5 → exovetter-0.0.7}/exovetter.egg-info/top_level.txt +0 -0
  56. {exovetter-0.0.5 → exovetter-0.0.7}/licenses/DAVE_LICENSE +0 -0
  57. {exovetter-0.0.5 → exovetter-0.0.7}/licenses/README.rst +0 -0
  58. {exovetter-0.0.5 → exovetter-0.0.7}/licenses/TEMPLATE_LICENCE.rst +0 -0
  59. {exovetter-0.0.5 → exovetter-0.0.7}/pyproject.toml +0 -0
  60. {exovetter-0.0.5 → exovetter-0.0.7}/requirements.txt +0 -0
  61. {exovetter-0.0.5 → exovetter-0.0.7}/setup.cfg +0 -0
  62. {exovetter-0.0.5 → exovetter-0.0.7}/setup.py +0 -0
  63. {exovetter-0.0.5 → exovetter-0.0.7}/tutorial_notebooks/Centroid.ipynb +0 -0
  64. {exovetter-0.0.5 → exovetter-0.0.7}/tutorial_notebooks/LPP.ipynb +0 -0
  65. {exovetter-0.0.5 → exovetter-0.0.7}/tutorial_notebooks/LeoTransitEvents.ipynb +0 -0
  66. {exovetter-0.0.5 → exovetter-0.0.7}/tutorial_notebooks/OddEven.ipynb +0 -0
  67. {exovetter-0.0.5 → exovetter-0.0.7}/tutorial_notebooks/SWEET.ipynb +0 -0
  68. {exovetter-0.0.5 → exovetter-0.0.7}/tutorial_notebooks/TCEs.ipynb +0 -0
  69. {exovetter-0.0.5 → exovetter-0.0.7}/tutorial_notebooks/TransitPhaseCoverage.ipynb +0 -0
  70. {exovetter-0.0.5 → exovetter-0.0.7}/tutorial_notebooks/VizTransits.ipynb +0 -0
  71. {exovetter-0.0.5 → exovetter-0.0.7}/tutorial_notebooks/lightcurves.ipynb +0 -0
  72. {exovetter-0.0.5 → exovetter-0.0.7}/tutorial_notebooks/modshift.ipynb +0 -0
  73. {exovetter-0.0.5 → exovetter-0.0.7}/tutorial_notebooks/wasp18b.fits +0 -0
  74. {exovetter-0.0.5 → exovetter-0.0.7}/tutorial_notebooks/wasp18b_tce +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: exovetter
3
- Version: 0.0.5
3
+ Version: 0.0.7
4
4
  Summary: Exoplanet vetting package
5
5
  Home-page: https://github.com/spacetelescope/exovetter
6
6
  Author: Susan Mullally et al.
@@ -2,12 +2,19 @@
2
2
 
3
3
  import sys
4
4
  import warnings
5
-
5
+ from exovetter import lightkurve_utils
6
+ from exovetter import utils
7
+ from exovetter import const as exo_const
8
+ import astropy.units as u
9
+ from exovetter import vetters as vet
10
+ from matplotlib.backends.backend_pdf import PdfPages
11
+ import matplotlib.pyplot as plt
6
12
  import numpy as np
13
+ import os
7
14
 
8
15
  __all__ = ['sine', 'estimate_scatter', 'mark_transit_cadences', 'median_detrend',
9
16
  'plateau', 'set_median_flux_to_zero', 'set_median_flux_to_one', 'sigmaClip',
10
- 'get_mast_tce', 'WqedLSF', 'compute_phases', 'first_epoch']
17
+ 'get_mast_tce', 'WqedLSF', 'compute_phases', 'first_epoch', 'run_all']
11
18
 
12
19
  def sine(x, order, period=1):
13
20
  """Sine function for SWEET vetter."""
@@ -653,3 +660,164 @@ def first_epoch(epoch, period, lc):
653
660
  first_epoch = epoch + N*period
654
661
 
655
662
  return first_epoch
663
+
664
+ def run_all(tce, lc, tpf=None, vetters=None, remove_metrics=None, plot=False, plot_dir=None):
665
+ """Run a set of vetters on a tce and lc, returning a dictionary of all metrics collected
666
+
667
+ Parameters
668
+ ----------
669
+ tce : tce object
670
+ tce object is a dictionary that contains information about the tce
671
+ to vet, like period, epoch, duration, depth
672
+
673
+ lc : lightkurve object
674
+ lightkurve object with the time and flux to use for vetting.
675
+
676
+ tpf : obj
677
+ ``lightkurve`` target pixel file object with pixels in column lc_name
678
+
679
+ vetters : list
680
+ list of vetter objects to run on, ie [vet.ModShift(), vet.OddEven(dur_frac=0.75)]
681
+ Defaults to all vetters
682
+
683
+ remove_metrics : list
684
+ metrics to not store, defaults to removing plotting values
685
+
686
+ plot : bool
687
+ Option to return a pdf of the vetting diagnostic plots, defaults to False
688
+
689
+ plot_dir : str
690
+ Path to store diagnostic pdfs in, defaults to current working directory
691
+
692
+ Returns
693
+ -------
694
+ results_dict : dictionary
695
+ Dictionary of the kept vetting metrics
696
+ """
697
+
698
+ # Set initial parameters
699
+ if not vetters:
700
+ vetters = [vet.VizTransits(), vet.ModShift(), vet.Lpp(), vet.OddEven(), vet.TransitPhaseCoverage(), vet.Sweet(), vet.LeoTransitEvents(), vet.Centroid()]
701
+
702
+ if not remove_metrics:
703
+ remove_metrics = ['plot_data']
704
+
705
+ if not plot_dir:
706
+ plot_dir = os.getcwd()+'/'
707
+
708
+ if not tpf:
709
+ if any(vetter.__class__.__name__ == 'Centroid' for vetter in vetters):
710
+ raise Exception("TPF file required while running centroid")
711
+
712
+ # Run all listed vetters
713
+ results_list = []
714
+
715
+ if not plot:
716
+ for vetter in vetters:
717
+ if vetter.__class__.__name__ != 'Centroid':
718
+ vetter_results = vetter.run(tce, lc, plot=False) # dictionary returned from each vetter
719
+ results_list.append(vetter_results)
720
+ else:
721
+ vetter_results = vetter.run(tce, tpf, plot=False) # centroid uses tpf rather than lc
722
+ results_list.append(vetter_results)
723
+
724
+ else:
725
+ plot_name = lc.LABEL
726
+
727
+ diagnostic_plot = PdfPages(plot_dir+plot_name+'.pdf') # initialize a pdf to save each figure into
728
+ plot_figures = []
729
+
730
+ # Manually run viz transits with an extra mark cadences plot
731
+ cadences_plot = mark_cadences_plot(lc, tce)
732
+ diagnostic_plot.savefig(cadences_plot)
733
+
734
+ for vetter in vetters:
735
+ if vetter.__class__.__name__ not in ['VizTransits', 'Centroid', 'LeoTransitEvents']: # viz_transits and Centroid generate more than one figures so handle later
736
+ vetter_results = vetter.run(tce, lc, plot=True) # dictionary returned from each vetter
737
+ plot_figures.append(plt.gcf())
738
+ plt.close() # Make them not show up if running in a notebook
739
+ results_list.append(vetter_results)
740
+
741
+ if vetter.__class__.__name__ == 'Centroid': # centroid produces 2 plots, the second of which is the most useful so just collect that one
742
+ vetter_results = vet.Centroid(lc_name=vetter.lc_name, diff_plots=False, centroid_plots=True).run(tce, tpf)
743
+ plot_figures.append(plt.gcf())
744
+ plt.close()
745
+ results_list.append(vetter_results)
746
+
747
+ # run viz_transits plots
748
+ transit = vet.VizTransits(transit_plot=True, folded_plot=False).run(tce, lc)
749
+ transit_plot = plt.gcf()
750
+ transit_plot.suptitle(plot_name+' Transits')
751
+ transit_plot.tight_layout()
752
+ plt.close()
753
+ diagnostic_plot.savefig(transit_plot)
754
+
755
+ folded = vet.VizTransits(transit_plot=False, folded_plot=True).run(tce, lc)
756
+ folded_plot = plt.gcf()
757
+ folded_plot.suptitle(plot_name+' Folded Transits')
758
+ folded_plot.tight_layout()
759
+ plt.close()
760
+ diagnostic_plot.savefig(folded_plot)
761
+
762
+ # Save each diagnostic plot stored in plot_figures to diagnostic_plot pdf file
763
+ for plot in plot_figures:
764
+ diagnostic_plot.savefig(plot)
765
+
766
+ diagnostic_plot.close()
767
+
768
+ # Convert to a single dictionary output
769
+ results_dict = {k: v for d in results_list for k, v in d.items()} # Combine all dictionaries returned from vetters
770
+
771
+ # delete specified metrics
772
+ for key in remove_metrics:
773
+ if results_dict.get(key):
774
+ del results_dict[key]
775
+
776
+ return results_dict
777
+
778
+
779
+ def mark_cadences_plot(lc, tce):
780
+ """return figure object of the lightcurve with epochs oeverplotted"""
781
+
782
+ fig, ax1 = plt.subplots(nrows=1, ncols=1, figsize=(9,5))
783
+
784
+ # Get lightcurve data
785
+ time, flux, time_offset_str = lightkurve_utils.unpack_lk_version(lc, "flux") # noqa: E50
786
+ time_offset_q = getattr(exo_const, time_offset_str)
787
+ epoch = tce.get_epoch(time_offset_q).to_value(u.day)
788
+
789
+ # Get points of lightcurve found to be in transit
790
+ period = tce["period"].to_value(u.day)
791
+ dur = tce["duration"].to_value(u.day)
792
+ intransit = mark_transit_cadences(time, period, epoch, dur)
793
+
794
+ # Plot epoch
795
+ ax1.axvline(x=epoch, lw='0.6', color='r', label='epoch', alpha=0.5)
796
+
797
+ # Plot transit train
798
+ ax1.plot(time, flux, lw=0.72, alpha=0.9)
799
+ ax1.scatter(time, flux, color='k', s=3, label='cadences', alpha=0.5)
800
+
801
+ # TODO This only plots forward in time from the epoch, works fine assuming tce epoch is first in light curve but not robust
802
+ transit_epochs = epoch-dur/2
803
+ while transit_epochs <= time[-1]:
804
+ ax1.axvline(x=transit_epochs, lw='0.6', color='r', alpha=0.3, ls='--')
805
+ transit_epochs = transit_epochs+dur
806
+ ax1.axvline(x=transit_epochs, lw='0.6', color='r', alpha=0.3, ls='--')
807
+ transit_epochs = transit_epochs-dur + period
808
+
809
+ # Plot cadences in transit
810
+ ax1.scatter(time[intransit], flux[intransit], color='r', s=4, label='cadences in transit');
811
+
812
+ # Plotting params
813
+ ax1.set_ylabel('Flux')
814
+ ax1.set_xlabel('Time '+time_offset_str)
815
+ ax1.set_title(lc.label+' period='+'{0:.2f}'.format(period)+'d, dur='+'{0:.2f}'.format(dur)+'d')
816
+ ax1.legend();
817
+
818
+ cadences_plot = plt.gcf()
819
+ plt.close()
820
+
821
+ return cadences_plot
822
+
823
+
@@ -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.5'
8
+ version = '0.0.7'
@@ -6,10 +6,10 @@ from abc import ABC, abstractmethod
6
6
  import astropy.units as u
7
7
  import numpy as np
8
8
  import pandas as pd
9
- import time as py_time
9
+ # import time as py_time
10
10
  import os
11
- import matplotlib.pyplot as plt
12
- from matplotlib.backends.backend_pdf import PdfPages
11
+ # import matplotlib.pyplot as plt
12
+ # from matplotlib.backends.backend_pdf import PdfPages
13
13
 
14
14
  from exovetter.centroid import centroid as cent
15
15
  from exovetter import transit_coverage
@@ -26,7 +26,7 @@ from exovetter import leo
26
26
 
27
27
  __all__ = ['BaseVetter', 'ModShift', 'Lpp', 'OddEven',
28
28
  'TransitPhaseCoverage', 'Sweet', 'Centroid',
29
- 'VizTransits', 'LeoTransitEvents', 'run_all']
29
+ 'VizTransits', 'LeoTransitEvents']
30
30
 
31
31
  class BaseVetter(ABC):
32
32
  """Base class for vetters.
@@ -585,13 +585,19 @@ class Sweet(BaseVetter):
585
585
  class Centroid(BaseVetter):
586
586
  """Class to handle centroid vetting"""
587
587
 
588
- def __init__(self, lc_name="flux"):
588
+ def __init__(self, lc_name="flux", diff_plots=False, centroid_plots=False):
589
589
  """
590
590
  Parameters
591
591
  ----------
592
592
  lc_name : str
593
593
  Name of the flux array in the ``lightkurve`` object.
594
594
 
595
+ diff_plots : bool
596
+ Show centroid difference plots
597
+
598
+ centroid_plots : bool
599
+ Show centroid summary plot
600
+
595
601
  Attributes
596
602
  ----------
597
603
  tce : tce object
@@ -608,6 +614,8 @@ class Centroid(BaseVetter):
608
614
  self.tce = None
609
615
  self.tpf = None
610
616
  self.metrics = None
617
+ self.diff_plots = diff_plots
618
+ self.centroid_plots = centroid_plots
611
619
 
612
620
  def run(self, tce, lk_tpf, plot=False, remove_transits=None):
613
621
  """Runs cent.compute_diff_image_centroids and cent.measure_centroid_shift
@@ -642,6 +650,10 @@ class Centroid(BaseVetter):
642
650
  self.tce = tce
643
651
  self.tpf = lk_tpf
644
652
 
653
+ if plot:
654
+ self.diff_plots = True
655
+ self.centroid_plots = True
656
+
645
657
  time, cube, time_offset_str = lightkurve_utils.unpack_tpf(
646
658
  self.tpf, self.lc_name
647
659
  ) # noqa: E50
@@ -656,9 +668,9 @@ class Centroid(BaseVetter):
656
668
 
657
669
  centroids, figs, kept_transits = cent.compute_diff_image_centroids(
658
670
  time, cube, period_days, epoch, duration_days,
659
- remove_transits, plot=plot)
671
+ remove_transits, plot=self.diff_plots)
660
672
 
661
- offset, signif, fig = cent.measure_centroid_shift(centroids, kept_transits, plot)
673
+ offset, signif, fig = cent.measure_centroid_shift(centroids, kept_transits, self.centroid_plots)
662
674
  figs.append(fig)
663
675
 
664
676
  # TODO: If plot=True, figs is a list of figure handles.
@@ -901,17 +913,14 @@ class LeoTransitEvents(BaseVetter):
901
913
  def plot(self):
902
914
  pass
903
915
 
904
- @staticmethod
905
- def run_all(tces, lcs, vetters=[VizTransits(), ModShift(), Lpp(), OddEven(), TransitPhaseCoverage(), Sweet(), LeoTransitEvents()], plot=False, verbose=False, plot_dir=None):
906
- # TODO Add centroid, maybe rething plotting in general since plotting uses vetter.plot which essentially doubles runtime,
907
- # probably should run initially with vet.run(plot=True) and not store them unless run_all plot=True
908
- """Runs vetters and packs results into a dataframe.
916
+ def run_all(tce, lc, vetters=[VizTransits(), ModShift(), Lpp(), OddEven(), TransitPhaseCoverage(), Sweet(), LeoTransitEvents()], remove_metrics = ['plot_data'], plot=False, plot_dir='', plot_name=None ,verbose=False):
917
+ """Runs vetters on a tce and lc and packs results into a dictionary.
909
918
 
910
919
  Parameters
911
920
  ----------
912
- tces: list of tce objects to vet on
921
+ tces: tce object to vet on
913
922
 
914
- lc: list of lightkurve objects to vet on
923
+ lc: lightkurve object to vet on
915
924
 
916
925
  vetters : list
917
926
  List of vetter classes to run
@@ -919,127 +928,180 @@ def run_all(tces, lcs, vetters=[VizTransits(), ModShift(), Lpp(), OddEven(), Tra
919
928
  plot : bool
920
929
  Toggle diagnostic plots
921
930
 
922
- plot_dir : str
923
- path to store plots in, defaults to current working directory
924
-
925
931
  verbose : bool
926
932
  Toggle timing info and other print statements
927
933
 
928
934
  Returns
929
935
  ------------
930
- results : dataframe
931
- Pandas dataframe of all the numerical results from the vetters
936
+ results : dictionary
937
+ Dictionary of all the numerical results from the vetters
932
938
 
933
939
  """
934
940
 
935
- results_dicts = [] # initialize a list to pack results from each tce into
936
- tce_names = []
937
- run_start = py_time.time()
941
+ results = run_vetters.run_all(tce, lc, vetters, remove_metrics, plot, plot_dir, plot_name, verbose)
942
+
943
+ return results
944
+
945
+ # results_list = []
946
+
947
+ # if plot == False:
948
+ # for vetter in vetters:
949
+ # vetter_results = vetter.run(tce, lc, plot=False) # dictionary returned from each vetter
950
+ # results_list.append(vetter_results)
951
+
952
+ # else:
953
+ #
954
+ # if plot_name is None:
955
+ # plot_name = tce['target']
956
+ # diagnostic_plot = PdfPages(plot_dir+plot_name+'.pdf') # initialize a pdf to save each figure into
957
+ # plot_figures = []
958
+
959
+ # for vetter in vetters:
960
+ # vetter_results = vetter.run(tce, lc, plot=True)
961
+ # plot_figures.append(plt.gcf())
962
+ # plt.close()
963
+ # results_list.append(vetter_results)
964
+
965
+ # # Save each diagnostic plot ran on that tce/lc
966
+ # for plot in plot_figures:
967
+ # diagnostic_plot.savefig(plot)
968
+
969
+ # diagnostic_plot.close()
970
+
971
+ # results_dict = {k: v for d in results_list for k, v in d.items()}
972
+
973
+ # # delete dictionary entries that are huge arrays to save space
974
+ # for key in remove_metrics:
975
+ # if results_dict.get(key):
976
+ # del results_dict[key]
977
+
978
+ # return results_dict
979
+
980
+ # OLDER CODE
981
+ # if plot:
982
+ # if vetter.__class__.__name__ != 'VizTransits' and vetter.__class__.__name__ != 'LeoTransitEvents':
983
+ # # viz_transits generates 2 figures so it's handled later, LeoTransitEvents just doesn't have a plot
984
+ # vetter.plot()
985
+ # vetter_plot = plt.gcf()
986
+ # vetter_plot.suptitle(tce['target']+' '+vetter.__class__.__name__)
987
+ # vetter_plot.tight_layout()
988
+ # plt.close()
989
+ # plot_figures.append(vetter_plot)
990
+
991
+ # if verbose:
992
+ # time_end = py_time.time()
993
+ # print(vetter.__class__.__name__, 'finished in', time_end - time_start, 's.')
994
+
995
+ # results_list.append(vetter_results)
996
+
997
+
998
+ # results_dicts = [] # initialize a list to pack results from each tce into
999
+ # tce_names = []
1000
+ # run_start = py_time.time()
938
1001
 
939
- if plot_dir is None:
940
- plot_dir = os.getcwd()
1002
+ # if plot_dir is None:
1003
+ # plot_dir = os.getcwd()
941
1004
 
942
- if plot or verbose:
943
- for tce in tces:
944
- if 'target' not in tce.keys():
945
- print("ERROR: Please supply a 'target' key to all input tces to use the plot or verbose parameters")
946
- return
947
-
948
- for tce, lc in zip(tces, lcs):
949
- if verbose:
950
- print('Vetting', tce['target'], ':')
951
-
952
- tce_names.append(tce['target'])
953
- results_list = [] # initialize a list to pack result dictionaries into
1005
+ # if plot or verbose:
1006
+ # for tce in tces:
1007
+ # if 'target' not in tce.keys():
1008
+ # print("ERROR: Please supply a 'target' key to all input tces to use the plot or verbose parameters")
1009
+ # return
1010
+
1011
+ # for tce, lc in zip(tces, lcs):
1012
+ # if verbose:
1013
+ # print('Vetting', tce['target'], ':')
1014
+
1015
+ # tce_names.append(tce['target'])
1016
+ # results_list = [] # initialize a list to pack result dictionaries into
954
1017
 
955
- # run each vetter, if plotting is true fill the figures into a list to save later
956
- plot_figures = []
957
- for vetter in vetters:
958
- time_start = py_time.time()
959
- vetter_results = vetter.run(tce, lc)
1018
+ # # run each vetter, if plotting is true fill the figures into a list to save later
1019
+ # plot_figures = []
1020
+ # for vetter in vetters:
1021
+ # time_start = py_time.time()
1022
+ # vetter_results = vetter.run(tce, lc)
960
1023
 
961
- if plot:
962
- if vetter.__class__.__name__ != 'VizTransits' and vetter.__class__.__name__ != 'LeoTransitEvents':
963
- # viz_transits generates 2 figures so it's handled later, LeoTransitEvents just doesn't have a plot
964
- vetter.plot()
965
- vetter_plot = plt.gcf()
966
- vetter_plot.suptitle(tce['target']+' '+vetter.__class__.__name__)
967
- vetter_plot.tight_layout()
968
- plt.close()
969
- plot_figures.append(vetter_plot)
970
-
971
- if verbose:
972
- time_end = py_time.time()
973
- print(vetter.__class__.__name__, 'finished in', time_end - time_start, 's.')
1024
+ # if plot:
1025
+ # if vetter.__class__.__name__ != 'VizTransits' and vetter.__class__.__name__ != 'LeoTransitEvents':
1026
+ # # viz_transits generates 2 figures so it's handled later, LeoTransitEvents just doesn't have a plot
1027
+ # vetter.plot()
1028
+ # vetter_plot = plt.gcf()
1029
+ # vetter_plot.suptitle(tce['target']+' '+vetter.__class__.__name__)
1030
+ # vetter_plot.tight_layout()
1031
+ # plt.close()
1032
+ # plot_figures.append(vetter_plot)
1033
+
1034
+ # if verbose:
1035
+ # time_end = py_time.time()
1036
+ # print(vetter.__class__.__name__, 'finished in', time_end - time_start, 's.')
974
1037
 
975
- results_list.append(vetter_results)
1038
+ # results_list.append(vetter_results)
976
1039
 
977
- if verbose: # add some whitespace for readability
978
- print()
979
-
980
- if plot: # save a pdf of each figure made for that vetter
981
- diagnostic_plot = PdfPages(plot_dir+tce['target']+'.pdf') # initialize a pdf to save each figure into
982
-
983
- # plot the lightcurve with epochs oeverplotted
984
- time, flux, time_offset_str = lightkurve_utils.unpack_lk_version(lc, "flux") # noqa: E50
985
- period = tce["period"].to_value(u.day)
986
- dur = tce["duration"].to_value(u.day)
987
-
988
- time_offset_q = getattr(exo_const, time_offset_str)
989
- epoch = tce.get_epoch(time_offset_q).to_value(u.day)
990
- intransit = utils.mark_transit_cadences(time, period, epoch, dur, num_durations=3, flags=None)
991
-
992
- fig, ax1 = plt.subplots(nrows=1, ncols=1, figsize=(9,5))
993
- ax1.plot(time, flux, lw=0.4);
994
- ax1.axvline(x=epoch, lw='0.6', color='r', label='epoch');
995
- ax1.fill_between(time, 0,1, where=intransit, transform=ax1.get_xaxis_transform(), color='r', alpha=0.15, label='in transit')
996
-
997
- ax1.set_ylabel('Flux')
998
- ax1.set_xlabel('Time '+time_offset_str)
999
- if 'target' in tce:
1000
- ax1.set_title(tce['target']);
1001
-
1002
- ax1.legend();
1003
- lightcurve_plot = plt.gcf()
1004
- plt.close()
1005
- diagnostic_plot.savefig(lightcurve_plot)
1006
-
1007
- # run viz_transits plots
1008
- transit = VizTransits(transit_plot=True, folded_plot=False).run(tce, lc)
1009
- transit_plot = plt.gcf()
1010
- transit_plot.suptitle(tce['target']+' Transits')
1011
- transit_plot.tight_layout()
1012
- plt.close()
1013
- diagnostic_plot.savefig(transit_plot)
1014
-
1015
- folded = VizTransits(transit_plot=False, folded_plot=True).run(tce, lc)
1016
- folded_plot = plt.gcf()
1017
- folded_plot.suptitle(tce['target']+' Folded Transits')
1018
- folded_plot.tight_layout()
1019
- plt.close()
1020
- diagnostic_plot.savefig(folded_plot)
1021
-
1022
- # Save each diagnostic plot ran on that tce/lc
1023
- for plot in plot_figures:
1024
- diagnostic_plot.savefig(plot)
1025
-
1026
- diagnostic_plot.close()
1040
+ # if verbose: # add some whitespace for readability
1041
+ # print()
1042
+
1043
+ # if plot: # save a pdf of each figure made for that vetter
1044
+ # diagnostic_plot = PdfPages(plot_dir+tce['target']+'.pdf') # initialize a pdf to save each figure into
1045
+
1046
+ # # plot the lightcurve with epochs oeverplotted
1047
+ # time, flux, time_offset_str = lightkurve_utils.unpack_lk_version(lc, "flux") # noqa: E50
1048
+ # period = tce["period"].to_value(u.day)
1049
+ # dur = tce["duration"].to_value(u.day)
1050
+
1051
+ # time_offset_q = getattr(exo_const, time_offset_str)
1052
+ # epoch = tce.get_epoch(time_offset_q).to_value(u.day)
1053
+ # intransit = utils.mark_transit_cadences(time, period, epoch, dur, num_durations=3, flags=None)
1054
+
1055
+ # fig, ax1 = plt.subplots(nrows=1, ncols=1, figsize=(9,5))
1056
+ # ax1.plot(time, flux, lw=0.4);
1057
+ # ax1.axvline(x=epoch, lw='0.6', color='r', label='epoch');
1058
+ # ax1.fill_between(time, 0,1, where=intransit, transform=ax1.get_xaxis_transform(), color='r', alpha=0.15, label='in transit')
1059
+
1060
+ # ax1.set_ylabel('Flux')
1061
+ # ax1.set_xlabel('Time '+time_offset_str)
1062
+ # if 'target' in tce:
1063
+ # ax1.set_title(tce['target']);
1064
+
1065
+ # ax1.legend();
1066
+ # lightcurve_plot = plt.gcf()
1067
+ # plt.close()
1068
+ # diagnostic_plot.savefig(lightcurve_plot)
1069
+
1070
+ # # run viz_transits plots
1071
+ # transit = VizTransits(transit_plot=True, folded_plot=False).run(tce, lc)
1072
+ # transit_plot = plt.gcf()
1073
+ # transit_plot.suptitle(tce['target']+' Transits')
1074
+ # transit_plot.tight_layout()
1075
+ # plt.close()
1076
+ # diagnostic_plot.savefig(transit_plot)
1077
+
1078
+ # folded = VizTransits(transit_plot=False, folded_plot=True).run(tce, lc)
1079
+ # folded_plot = plt.gcf()
1080
+ # folded_plot.suptitle(tce['target']+' Folded Transits')
1081
+ # folded_plot.tight_layout()
1082
+ # plt.close()
1083
+ # diagnostic_plot.savefig(folded_plot)
1084
+
1085
+ # # Save each diagnostic plot ran on that tce/lc
1086
+ # for plot in plot_figures:
1087
+ # diagnostic_plot.savefig(plot)
1088
+
1089
+ # diagnostic_plot.close()
1027
1090
 
1028
- # put all values from each results dictionary into a single dictionary
1029
- results_dict = {k: v for d in results_list for k, v in d.items()}
1091
+ # # put all values from each results dictionary into a single dictionary
1092
+ # results_dict = {k: v for d in results_list for k, v in d.items()}
1030
1093
 
1031
- # delete dictionary entries that are huge arrays to save space
1032
- if results_dict.get('plot_data'):
1033
- del results_dict['plot_data']
1094
+ # # delete dictionary entries that are huge arrays to save space
1095
+ # if results_dict.get('plot_data'):
1096
+ # del results_dict['plot_data']
1034
1097
 
1035
- # add the dictionary to the final list
1036
- results_dicts.append(results_dict)
1098
+ # # add the dictionary to the final list
1099
+ # results_dicts.append(results_dict)
1037
1100
 
1038
- results_df = pd.DataFrame(results_dicts) # Put the values from each result dictionary into a dataframe
1101
+ # results_df = pd.DataFrame(results_dicts) # Put the values from each result dictionary into a dataframe
1039
1102
 
1040
- results_df.insert(loc=0, column='tce', value=tce_names)
1041
- if verbose:
1042
- print('Execution time:', (py_time.time() - run_start), 's')
1103
+ # results_df.insert(loc=0, column='tce', value=tce_names)
1104
+ # if verbose:
1105
+ # print('Execution time:', (py_time.time() - run_start), 's')
1043
1106
 
1044
- return results_df
1045
-
1107
+ # return results_df
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: exovetter
3
- Version: 0.0.5
3
+ Version: 0.0.7
4
4
  Summary: Exoplanet vetting package
5
5
  Home-page: https://github.com/spacetelescope/exovetter
6
6
  Author: Susan Mullally et al.
@@ -51,6 +51,7 @@ exovetter/modshift/plotmodshift.py
51
51
  licenses/DAVE_LICENSE
52
52
  licenses/README.rst
53
53
  licenses/TEMPLATE_LICENCE.rst
54
+ tutorial_notebooks/100100827.pdf
54
55
  tutorial_notebooks/Centroid.ipynb
55
56
  tutorial_notebooks/LPP.ipynb
56
57
  tutorial_notebooks/LeoTransitEvents.ipynb
@@ -63,9 +64,4 @@ tutorial_notebooks/lightcurves.ipynb
63
64
  tutorial_notebooks/modshift.ipynb
64
65
  tutorial_notebooks/run_all.ipynb
65
66
  tutorial_notebooks/wasp18b.fits
66
- tutorial_notebooks/wasp18b_tce
67
- tutorial_notebooks/run_all_plots/TOI_1000.01.pdf
68
- tutorial_notebooks/run_all_plots/TOI_1001.01.pdf
69
- tutorial_notebooks/run_all_plots/TOI_1004.01.pdf
70
- tutorial_notebooks/run_all_plots/TOI_1007.01.pdf
71
- tutorial_notebooks/run_all_plots/TOI_1011.01.pdf
67
+ tutorial_notebooks/wasp18b_tce