예제 #1
0
 def test_preparer(self):
     object_info = MissionObjectInfo("TIC 1234567", 'all')
     sherlock = Sherlock(False, object_info)
     self.assertTrue(
         isinstance(sherlock.lightcurve_builders[type(object_info)],
                    MissionLightcurveBuilder))
     object_info = MissionFfiIdObjectInfo("TIC 1234567", 'all')
     sherlock = Sherlock(False, object_info)
     self.assertTrue(
         isinstance(sherlock.lightcurve_builders[type(object_info)],
                    MissionFfiLightcurveBuilder))
     object_info = MissionFfiCoordsObjectInfo(19, 15, 'all')
     sherlock = Sherlock(False, object_info)
     self.assertTrue(
         isinstance(sherlock.lightcurve_builders[type(object_info)],
                    MissionFfiLightcurveBuilder))
     object_info = MissionInputObjectInfo("TIC 1234567", "testfilename.csv")
     sherlock = Sherlock(False, object_info)
     self.assertTrue(
         isinstance(sherlock.lightcurve_builders[type(object_info)],
                    MissionInputLightcurveBuilder))
     object_info = InputObjectInfo("testfilename.csv")
     sherlock = Sherlock(False, object_info)
     self.assertTrue(
         isinstance(sherlock.lightcurve_builders[type(object_info)],
                    MissionInputLightcurveBuilder))
예제 #2
0
 def test_apdate_epicois(self):
     sherlock = Sherlock(False, None)
     sherlock.ois_manager.update_epic_csvs()
     try:
         self.assertTrue(os.path.isfile(sherlock.ois_manager.epic_csv))
     finally:
         os.remove(sherlock.ois_manager.epic_csv)
예제 #3
0
 def test_setup_transit_adjust_params(self):
     sherlock = Sherlock(False, None)
     sherlock.setup_transit_adjust_params(max_runs=5,
                                          period_protec=5,
                                          period_min=1,
                                          period_max=2,
                                          bin_minutes=5,
                                          run_cores=3,
                                          snr_min=6,
                                          sde_min=5,
                                          fap_max=0.05,
                                          mask_mode="subtract",
                                          best_signal_algorithm="quorum",
                                          quorum_strength=2)
     self.assertEqual(5, sherlock.max_runs)
     self.assertEqual(5, sherlock.period_protec)
     self.assertEqual(1, sherlock.period_min)
     self.assertEqual(2, sherlock.period_max)
     self.assertEqual(5, sherlock.bin_minutes)
     self.assertEqual(3, sherlock.run_cores)
     self.assertEqual(6, sherlock.snr_min)
     self.assertEqual(5, sherlock.sde_min)
     self.assertEqual(0.05, sherlock.fap_max)
     self.assertEqual("subtract", sherlock.mask_mode)
     self.assertEqual("quorum", sherlock.best_signal_algorithm)
예제 #4
0
 def test_setup_detrend(self):
     object_info = MissionObjectInfo("TIC 12345",
                                     sectors="all",
                                     smooth_enabled=False,
                                     high_rms_enabled=False,
                                     high_rms_threshold=3,
                                     high_rms_bin_hours=9,
                                     auto_detrend_enabled=True,
                                     auto_detrend_ratio=1 / 2,
                                     auto_detrend_method="cosine")
     sherlock = Sherlock([
         SherlockTarget(object_info=object_info,
                        detrends_number=2,
                        detrend_method="gp",
                        cpu_cores=3)
     ])
     self.assertEqual(
         False, sherlock.sherlock_targets[0].object_info.smooth_enabled)
     self.assertEqual(
         False, sherlock.sherlock_targets[0].object_info.high_rms_enabled)
     self.assertEqual(
         3, sherlock.sherlock_targets[0].object_info.high_rms_threshold)
     self.assertEqual(
         9, sherlock.sherlock_targets[0].object_info.high_rms_bin_hours)
     self.assertEqual(2, sherlock.sherlock_targets[0].detrends_number)
     self.assertEqual("gp", sherlock.sherlock_targets[0].detrend_method)
     self.assertEqual(3, sherlock.sherlock_targets[0].cpu_cores)
     self.assertEqual(
         True,
         sherlock.sherlock_targets[0].object_info.auto_detrend_enabled)
     self.assertEqual(
         1 / 2, sherlock.sherlock_targets[0].object_info.auto_detrend_ratio)
     self.assertEqual(
         "cosine",
         sherlock.sherlock_targets[0].object_info.auto_detrend_method)
예제 #5
0
 def test_setup_transit_adjust_params(self):
     sherlock = Sherlock([
         SherlockTarget(object_info=None,
                        max_runs=5,
                        period_protect=5,
                        period_min=1,
                        period_max=2,
                        bin_minutes=5,
                        cpu_cores=3,
                        snr_min=6,
                        sde_min=5,
                        mask_mode="subtract",
                        best_signal_algorithm="quorum",
                        quorum_strength=2)
     ])
     self.assertEqual(5, sherlock.sherlock_targets[0].max_runs)
     self.assertEqual(5, sherlock.sherlock_targets[0].period_protect)
     self.assertEqual(1, sherlock.sherlock_targets[0].period_min)
     self.assertEqual(2, sherlock.sherlock_targets[0].period_max)
     self.assertEqual(5, sherlock.sherlock_targets[0].bin_minutes)
     self.assertEqual(3, sherlock.sherlock_targets[0].cpu_cores)
     self.assertEqual(6, sherlock.sherlock_targets[0].snr_min)
     self.assertEqual(5, sherlock.sherlock_targets[0].sde_min)
     self.assertEqual("subtract", sherlock.sherlock_targets[0].mask_mode)
     self.assertEqual("quorum",
                      sherlock.sherlock_targets[0].best_signal_algorithm)
     self.assertEqual(2, sherlock.sherlock_targets[0].quorum_strength)
예제 #6
0
 def test_run_with_rms_mask(self):
     run_dir = "TIC181804752_FFI_all"
     try:
         sherlock = Sherlock(
             False, [MissionFfiIdObjectInfo("TIC 181804752", 'all')])
         sherlock.setup_detrend(n_detrends=1, initial_rms_mask=True) \
             .setup_transit_adjust_params(max_runs=1).run()
         self.__assert_run_files(run_dir)
     finally:
         self.__clean(run_dir)
예제 #7
0
 def test_apdate_kois(self):
     sherlock = Sherlock(None)
     sherlock.ois_manager.update_kic_csvs()
     try:
         self.assertTrue(os.path.isfile(sherlock.ois_manager.kic_star_csv))
     finally:
         os.remove(sherlock.ois_manager.kic_star_csv)
     try:
         self.assertTrue(os.path.isfile(sherlock.ois_manager.kois_csv))
     finally:
         os.remove(sherlock.ois_manager.kois_csv)
예제 #8
0
 def test_run_with_rms_mask(self):
     run_dir = "TIC181804752_FFI_[9]"
     try:
         Sherlock([
             SherlockTarget(MissionFfiIdObjectInfo("TIC 181804752", [9],
                                                   high_rms_enabled=True),
                            max_runs=1,
                            oversampling=0.05)
         ]).run()
         self.__assert_run_files(run_dir)
     finally:
         self.__clean(run_dir)
예제 #9
0
 def test_run(self):
     run_dir = "TIC181804752_FFI_[9]"
     try:
         Sherlock([
             SherlockTarget(MissionFfiIdObjectInfo("TIC 181804752", [9],
                                                   smooth_enabled=False,
                                                   high_rms_enabled=False),
                            detrends_number=1,
                            max_runs=1,
                            oversampling=0.05)
         ]).run()
         self.__assert_run_files(run_dir, assert_rms_mask=False)
     finally:
         self.__clean(run_dir)
예제 #10
0
 def test_run_with_explore(self):
     run_dir = None
     try:
         sherlock = Sherlock(
             False, [MissionFfiIdObjectInfo("TIC 181804752", 'all')], True)
         sherlock.setup_detrend(n_detrends=1, initial_rms_mask=True) \
             .setup_transit_adjust_params(max_runs=1).run()
         run_dir = "TIC181804752_FFI_all"
         self.assertTrue(os.path.exists(run_dir))
         self.assertTrue(
             os.path.exists(run_dir +
                            "/Periodogram_TIC181804752_FFI_all.png"))
         self.assertFalse(os.path.exists(run_dir + "/1"))
     finally:
         self.__clean(run_dir)
예제 #11
0
 def test_ois_loaded(self):
     sherlock = Sherlock(False, None)
     sherlock.load_ois(True)
     sherlock.filter_hj_ois()
     try:
         self.assertGreater(len(sherlock.ois.index), 100)
         sherlock.limit_ois(0, 5)
         self.assertEqual(len(sherlock.ois.index), 5)
         self.assertTrue(sherlock.use_ois)
     finally:
         os.remove(sherlock.ois_manager.tois_csv)
         os.remove(sherlock.ois_manager.ctois_csv)
         os.remove(sherlock.ois_manager.kic_star_csv)
         os.remove(sherlock.ois_manager.kois_csv)
         os.remove(sherlock.ois_manager.epic_csv)
예제 #12
0
 def test_run_epic_ffi(self):
     run_dir = None
     try:
         sherlock = Sherlock(
             False, [MissionFfiIdObjectInfo("EPIC 249631677", 'all')],
             False)
         sherlock.setup_detrend(n_detrends=1, initial_rms_mask=True, auto_detrend_periodic_signals=False) \
             .setup_transit_adjust_params(max_runs=1).run()
         run_dir = "EPIC249631677_FFI_all"
         self.assertTrue(os.path.exists(run_dir))
         self.assertTrue(
             os.path.exists(run_dir +
                            "/Periodogram_EPIC249631677_FFI_all.png"))
         self.assertTrue(os.path.exists(run_dir + "/1"))
     finally:
         self.__clean(run_dir)
예제 #13
0
 def test_run_with_autodetrend(self):
     run_dir = None
     try:
         sherlock = Sherlock(False,
                             [MissionObjectInfo("TIC 259377017", [5])],
                             True)
         sherlock.setup_detrend(n_detrends=1, initial_rms_mask=True, auto_detrend_periodic_signals=True) \
             .setup_transit_adjust_params(max_runs=1).run()
         run_dir = "TIC259377017_[5]"
         self.assertTrue(os.path.exists(run_dir))
         self.assertTrue(
             os.path.exists(
                 run_dir +
                 "/Phase_detrend_period_TIC259377017_[5]_3.60_days.png"))
     finally:
         self.__clean(run_dir)
예제 #14
0
 def test_run_with_explore(self):
     run_dir = None
     try:
         Sherlock([
             SherlockTarget(MissionFfiIdObjectInfo("TIC 181804752", [9],
                                                   high_rms_enabled=True),
                            detrends_number=1,
                            oversampling=0.05)
         ], True).run()
         run_dir = "TIC181804752_FFI_[9]"
         self.assertTrue(os.path.exists(run_dir))
         self.assertTrue(
             os.path.exists(
                 run_dir + "/Periodogram_Initial_TIC181804752_FFI_[9].png"))
         self.assertFalse(os.path.exists(run_dir + "/1"))
     finally:
         self.__clean(run_dir)
예제 #15
0
 def test_run_with_star_info(self):
     run_dir = None
     try:
         Sherlock([
             SherlockTarget(MissionFfiIdObjectInfo(
                 "TIC 181804752", [9],
                 high_rms_enabled=True,
                 star_info=StarInfo(ld_coefficients=(0.15, 0.25),
                                    teff=4000,
                                    lum=1.50,
                                    logg=0.15,
                                    radius=0.4,
                                    radius_min=0.10,
                                    radius_max=0.15,
                                    mass=0.3,
                                    mass_min=0.05,
                                    mass_max=0.075,
                                    ra=13.132258,
                                    dec=64.334238)),
                            detrends_number=1,
                            max_runs=1,
                            oversampling=0.05)
         ], True).run()
         run_dir = "TIC181804752_FFI_[9]"
         self.assertTrue(os.path.exists(run_dir))
         self.assertTrue(
             os.path.exists(
                 run_dir + "/Periodogram_Initial_TIC181804752_FFI_[9].png"))
         self.assertFalse(os.path.exists(run_dir + "/1"))
         with open(run_dir + '/TIC181804752_FFI_[9]_report.log') as f:
             content = f.read()
             self.assertTrue('mass = 0.3' in content)
             self.assertTrue('mass_min = 0.25' in content)
             self.assertTrue('mass_max = 0.375' in content)
             self.assertTrue('radius = 0.4' in content)
             self.assertTrue('radius_min = 0.3' in content)
             self.assertTrue('radius_max = 0.55' in content)
             self.assertTrue(
                 'limb-darkening estimates using quadratic LD (a,b)= (0.15, 0.25)'
                 in content)
             self.assertTrue('teff = 4000' in content)
             self.assertTrue('logg = 0.15' in content)
             self.assertTrue('lum = 1.50' in content)
     finally:
         self.__clean(run_dir)
예제 #16
0
 def test_run_with_autodetrend(self):
     run_dir = None
     try:
         Sherlock([
             SherlockTarget(MissionObjectInfo("TIC 259377017", [5],
                                              auto_detrend_enabled=True),
                            detrends_number=1,
                            max_runs=1,
                            oversampling=0.05)
         ], True).run()
         run_dir = "TIC259377017_[5]"
         self.assertTrue(os.path.exists(run_dir))
         self.assertTrue(
             os.path.exists(
                 run_dir +
                 "/Phase_detrend_period_TIC259377017_[5]_0.52_days.png"))
     finally:
         self.__clean(run_dir)
예제 #17
0
 def test_run_with_star_info(self):
     run_dir = None
     try:
         sherlock = Sherlock(False, [
             MissionFfiIdObjectInfo("TIC 181804752",
                                    'all',
                                    star_info=StarInfo(
                                        ld_coefficients=(0.15, 0.25),
                                        teff=4000,
                                        lum=1.50,
                                        logg=0.15,
                                        radius=0.4,
                                        radius_min=0.10,
                                        radius_max=0.15,
                                        mass=0.3,
                                        mass_min=0.05,
                                        mass_max=0.075,
                                        ra=15,
                                        dec=87))
         ], True)
         sherlock.setup_detrend(n_detrends=1, initial_rms_mask=True)\
             .setup_transit_adjust_params(max_runs=1).run()
         run_dir = "TIC181804752_FFI_all"
         self.assertTrue(os.path.exists(run_dir))
         self.assertTrue(
             os.path.exists(run_dir +
                            "/Periodogram_TIC181804752_FFI_all.png"))
         self.assertFalse(os.path.exists(run_dir + "/1"))
         with open(run_dir + '/TIC181804752_FFI_all_report.log') as f:
             content = f.read()
             self.assertTrue('mass = 0.3' in content)
             self.assertTrue('mass_min = 0.25' in content)
             self.assertTrue('mass_max = 0.375' in content)
             self.assertTrue('radius = 0.4' in content)
             self.assertTrue('radius_min = 0.3' in content)
             self.assertTrue('radius_max = 0.55' in content)
             self.assertTrue(
                 'limb-darkening estimates using quadratic LD (a,b)= (0.15, 0.25)'
                 in content)
             self.assertTrue('teff = 4000' in content)
             self.assertTrue('logg = 0.15' in content)
             self.assertTrue('lum = 1.50' in content)
     finally:
         self.__clean(run_dir)
예제 #18
0
 def test_scoring_algorithm(self):
     sherlock = Sherlock(False, None)
     sherlock.setup_transit_adjust_params(best_signal_algorithm="basic")
     self.assertTrue(
         isinstance(
             sherlock.signal_score_selectors[
                 sherlock.best_signal_algorithm], BasicSignalSelector))
     sherlock.setup_transit_adjust_params(
         best_signal_algorithm="border-correct")
     self.assertTrue(
         isinstance(
             sherlock.signal_score_selectors[
                 sherlock.best_signal_algorithm],
             SnrBorderCorrectedSignalSelector))
     sherlock.setup_transit_adjust_params(best_signal_algorithm="quorum")
     self.assertTrue(
         isinstance(
             sherlock.signal_score_selectors[
                 sherlock.best_signal_algorithm],
             QuorumSnrBorderCorrectedSignalSelector))
예제 #19
0
 def test_run_with_transit_customs(self):
     run_dir = None
     try:
         sherlock = Sherlock([SherlockTarget(MissionFfiIdObjectInfo("TIC 181804752", [9], high_rms_enabled=True),
                                             detrends_number=1, max_runs=1, oversampling=0.1, t0_fit_margin=0.09,
                                             duration_grid_step=1.075, fit_method="bls",
                                             best_signal_algorithm="quorum", quorum_strength=0.31)], False)\
             .run()
         run_dir = "TIC181804752_FFI_[9]"
         with open(run_dir + '/TIC181804752_FFI_[9]_report.log') as f:
             content = f.read()
             self.assertTrue('Fit method: box' in content)
             self.assertTrue('Duration step: 1.075' in content)
             self.assertTrue('T0 Fit Margin: 0.09' in content)
             self.assertTrue('Oversampling: 0.1' in content)
             self.assertTrue('Signal scoring algorithm: quorum' in content)
             self.assertTrue(
                 'Quorum algorithm vote strength: 0.31' in content)
         self.__assert_run_files(run_dir)
     finally:
         self.__clean(run_dir)
예제 #20
0
 def test_scoring_algorithm(self):
     sherlock = Sherlock(
         [SherlockTarget(object_info=None, best_signal_algorithm="basic")])
     self.assertTrue(
         isinstance(
             sherlock.sherlock_targets[0].signal_score_selectors["basic"],
             BasicSdeSignalSelector))
     sherlock = Sherlock([
         SherlockTarget(object_info=None,
                        best_signal_algorithm="border-correct")
     ])
     self.assertTrue(
         isinstance(
             sherlock.sherlock_targets[0].
             signal_score_selectors["border-correct"],
             SdeBorderCorrectedSignalSelector))
     sherlock = Sherlock(
         [SherlockTarget(object_info=None, best_signal_algorithm="quorum")])
     self.assertTrue(
         isinstance(
             sherlock.sherlock_targets[0].signal_score_selectors["quorum"],
             QuorumSdeBorderCorrectedSignalSelector))
     sherlock = Sherlock([
         SherlockTarget(object_info=None, best_signal_algorithm="basic-snr")
     ])
     self.assertTrue(
         isinstance(
             sherlock.sherlock_targets[0].
             signal_score_selectors["basic-snr"], BasicSignalSelector))
     sherlock = Sherlock([
         SherlockTarget(object_info=None,
                        best_signal_algorithm="border-correct-snr")
     ])
     self.assertTrue(
         isinstance(
             sherlock.sherlock_targets[0].
             signal_score_selectors["border-correct-snr"],
             SnrBorderCorrectedSignalSelector))
     sherlock = Sherlock([
         SherlockTarget(object_info=None,
                        best_signal_algorithm="quorum-snr")
     ])
     self.assertTrue(
         isinstance(
             sherlock.sherlock_targets[0].
             signal_score_selectors["quorum-snr"],
             QuorumSnrBorderCorrectedSignalSelector))
예제 #21
0
 def test_run_with_transit_customs(self):
     run_dir = None
     try:
         sherlock = Sherlock(
             False, [MissionFfiIdObjectInfo("TIC 181804752", 'all')], False)
         sherlock.setup_detrend(n_detrends=1, initial_rms_mask=True)\
             .setup_transit_adjust_params(max_runs=1, oversampling=5.5, t0_fit_margin=0.09, duration_grid_step=1.075,
                                          fit_method="bls", best_signal_algorithm="quorum", quorum_strength=0.31)\
             .run()
         run_dir = "TIC181804752_FFI_all"
         with open(run_dir + '/TIC181804752_FFI_all_report.log') as f:
             content = f.read()
             self.assertTrue('Fit method: box' in content)
             self.assertTrue('Duration step: 1.075' in content)
             self.assertTrue('T0 Fit Margin: 0.09' in content)
             self.assertTrue('Oversampling: 5' in content)
             self.assertTrue('Signal scoring algorithm: quorum' in content)
             self.assertTrue(
                 'Quorum algorithm vote strength: 0.31' in content)
         self.__assert_run_files(run_dir)
     finally:
         self.__clean(run_dir)
예제 #22
0
 def test_run_epic_ffi(self):
     run_dir = None
     try:
         Sherlock([
             SherlockTarget(MissionFfiIdObjectInfo(
                 "EPIC 249631677",
                 'all',
                 high_rms_enabled=True,
                 auto_detrend_enabled=False),
                            detrends_number=1,
                            max_runs=1,
                            oversampling=0.05)
         ], False).run()
         run_dir = "EPIC249631677_FFI_all"
         self.assertTrue(os.path.exists(run_dir))
         self.assertTrue(
             os.path.exists(
                 run_dir +
                 "/Periodogram_Initial_EPIC249631677_FFI_all.png"))
         self.assertTrue(os.path.exists(run_dir + "/1"))
     finally:
         self.__clean(run_dir)
예제 #23
0
 def test_setup_detrend(self):
     sherlock = Sherlock(False, None)
     sherlock.setup_detrend(initial_smooth=False,
                            initial_rms_mask=False,
                            initial_rms_threshold=3,
                            initial_rms_bin_hours=9,
                            n_detrends=2,
                            detrend_method="gp",
                            cores=3,
                            auto_detrend_periodic_signals=True,
                            auto_detrend_ratio=1 / 2,
                            auto_detrend_method="cosine")
     self.assertEqual(False, sherlock.initial_smooth)
     self.assertEqual(False, sherlock.initial_rms_mask)
     self.assertEqual(3, sherlock.initial_rms_threshold)
     self.assertEqual(9, sherlock.initial_rms_bin_hours)
     self.assertEqual(2, sherlock.n_detrends)
     self.assertEqual("gp", sherlock.detrend_method)
     self.assertEqual(3, sherlock.detrend_cores)
     self.assertEqual(True, sherlock.auto_detrend_periodic_signals)
     self.assertEqual(1 / 2, sherlock.auto_detrend_ratio)
     self.assertEqual("cosine", sherlock.auto_detrend_method)
예제 #24
0
from contextlib import contextmanager
from timeit import default_timer
from sherlockpipe.sherlock import Sherlock
from sherlockpipe.objectinfo.InputObjectInfo import InputObjectInfo
from sherlockpipe.objectinfo.MissionFfiCoordsObjectInfo import MissionFfiCoordsObjectInfo
from sherlockpipe.objectinfo.MissionFfiIdObjectInfo import MissionFfiIdObjectInfo
from sherlockpipe.objectinfo.MissionInputObjectInfo import MissionInputObjectInfo
from sherlockpipe.objectinfo.MissionObjectInfo import MissionObjectInfo


@contextmanager
def elapsed_timer():
    start = default_timer()
    elapser = lambda: str(default_timer() - start)
    yield lambda: elapser()
    end = default_timer()
    elapser = lambda: str(end - start)


with elapsed_timer() as elapsed:
    # We will use only one mission object and set the period to be initially detrended with a window size of 1/3 times
    # the given period.
    sherlock = Sherlock([MissionObjectInfo("TIC 181804752", 'all')])\
        .setup_detrend(auto_detrend_ratio=1 / 3).run()
    print("Analysis took " + elapsed() + "s")
예제 #25
0
    # 'auto_detrend_ratio' value, which ensures that we are detrending the light curve at 'auto_detrend_ratio' times
    # the stronger period.

    # 7 Set the maximum number of runs to be executed.
    # 8 Select the period protect value, which restricts the minimum detrending window length.
    # 9 Select the min period for a transit to be fit.
    # 10 Select the max period for a transit to be fit.
    # 11 Select the binning to calculate RMS
    # 12 Select the number of CPU cores to be used for the transit search.
    # 13 Select the found transits masking method. We use subtract here as example, but it is discouraged.
    # 14 Select the best signal algorithm, which provides a different implementation to decide which of the detrend
    # signals is the stronger one to be selected.
    # 15 Set the strength of the quorum algorithm votes, which makes every vote that is found to increase the SNR by
    # a factor of 1.2 for our selection.
    arguments = {"smoooth_enabled": True, "high_rms_enabled": True, "high_rms_threshold": 2.5,
                 "high_rms_bin_hours": 3,
                 "detrends_number": 12, "detrend_method": "gp", "cpu_cores": 2, "auto_detrend_enabled": True,
                 "auto_detrend_ratio": 0.33, "auto_detrend_method": "cosine",
                 "max_runs": 10, "period_protect": 12, "period_min": 1, "period_max": 10, "bin_minutes": 20,
                 "run_cores": 3, "snr_min": 6, "sde_min": 6, "mask_mode": "subtract",
                 "best_signal_algorithm": 'quorum', "quorum_strength": 1.2}
    sherlock = Sherlock([SherlockTarget(MissionFfiIdObjectInfo("TIC 181804752", 'all'), **arguments),
                                        SherlockTarget(MissionObjectInfo("TIC 259168516", [15]), **arguments),
                                        SherlockTarget(MissionObjectInfo('KIC 10905746', 'all'), **arguments),
                                        SherlockTarget(MissionObjectInfo('EPIC 249631677', 'all'), **arguments),
                                        SherlockTarget(MissionInputObjectInfo("TIC 181804752", 'example_lc.csv',
                                                               initial_mask=[[1625, 1626], [1645, 1646]]), **arguments),
                                        SherlockTarget(InputObjectInfo("example_lc.csv", initial_detrend_period=0.8), **arguments)]) \
        .run()
    print("Analysis took " + elapsed() + "s")
from contextlib import contextmanager
from timeit import default_timer
from sherlockpipe.sherlock import Sherlock
from lcbuilder.objectinfo.MissionObjectInfo import MissionObjectInfo

from sherlockpipe.sherlock_target import SherlockTarget


@contextmanager
def elapsed_timer():
    start = default_timer()
    elapser = lambda: str(default_timer() - start)
    yield lambda: elapser()
    end = default_timer()
    elapser = lambda: str(end - start)


with elapsed_timer() as elapsed:
    # We will use only one mission object and will mask a time range from 1550 to 1551 and from 1560 to 1561
    sherlock = Sherlock([SherlockTarget(MissionObjectInfo("TIC 181804752", 'all',
                                                    initial_mask=[[1550, 1551], [1560, 1561]]))])\
        .run()
    print("Analysis took " + elapsed() + "s")

@contextmanager
def elapsed_timer():
    start = default_timer()
    elapser = lambda: str(default_timer() - start)
    yield lambda: elapser()
    end = default_timer()
    elapser = lambda: str(end - start)


with elapsed_timer() as elapsed:
    # We will use only one object id so we can explain better the detrend configs that the coder can select
    # We will:
    # 1 Enable the initial smooth function, which reduces local noise in the signal.
    # 2 Enable the initial High RMS areas masking. This procedure will mask all the lightcurve time binned ranges by
    # the 'initial_rms_bin_hours' value with a threshold of the 'initial_rms_threshold' value * RMS_median.
    # 3 Set the number of detrends to be done from PDCSAP_FLUX for each run.
    # 4 Set the SHERLOCK PDCSAP_FLUX detrends method to Gaussian Processes.
    # 5 Set the number of CPU cores to be used by the detrending procedure.
    # 6 Enable the Auto-Detrend detection, which will search for strong periodicities in the light curve and do an
    # initial detrend for it based on the selected 'auto_detrend_method' method and the value of the
    # 'auto_detrend_ratio' value, which ensures that we are detrending the light curve at 'auto_detrend_ratio' times
    # the stronger period.
    sherlock = Sherlock([MissionObjectInfo("TIC 181804752", 'all')])\
        .setup_detrend(initial_smooth=True, initial_rms_mask=True, initial_rms_threshold=2.5, initial_rms_bin_hours=3,
                       n_detrends=12, detrend_method="gp", cores=2, auto_detrend_periodic_signals=True,
                       auto_detrend_ratio=1/3, auto_detrend_method="cosine")\
        .run()
    print("Analysis took " + elapsed() + "s")
예제 #28
0
@contextmanager
def elapsed_timer():
    start = default_timer()
    elapser = lambda: str(default_timer() - start)
    yield lambda: elapser()
    end = default_timer()
    elapser = lambda: str(end - start)


with elapsed_timer() as elapsed:
    # We will use only one object id so we can explain better the detrend configs that the coder can select
    # We will:
    # 1 Enable the initial smooth function, which reduces local noise in the signal.
    # 2 Enable the initial High RMS areas masking. This procedure will mask all the lightcurve time binned ranges by
    # the 'initial_rms_bin_hours' value with a threshold of the 'initial_rms_threshold' value * RMS_median.
    # 3 Set the number of detrends to be done from PDCSAP_FLUX for each run.
    # 4 Set the SHERLOCK PDCSAP_FLUX detrends method to Gaussian Processes.
    # 5 Set the number of CPU cores to be used by the detrending procedure.
    # 6 Enable the Auto-Detrend detection, which will search for strong periodicities in the light curve and do an
    # initial detrend for it based on the selected 'auto_detrend_method' method and the value of the
    # 'auto_detrend_ratio' value, which ensures that we are detrending the light curve at 'auto_detrend_ratio' times
    # the stronger period.
    sherlock = Sherlock([SherlockTarget(object_info=MissionObjectInfo("TIC 181804752", 'all'),
                                        smooth_enabled=True, high_rms_enabled=True, high_rms_threshold=2.5, high_rms_bin_hours=3,
                                        detrends_number=12, detrend_method="gp", cpu_cores=2,
                                        auto_detrend_enabled=True, auto_detrend_ratio=0.33,
                                        auto_detrend_method="cosine")]) \
        .run()
    print("Analysis took " + elapsed() + "s")
예제 #29
0
 def test_run_empty(self):
     sherlock = Sherlock(False, [])
     self.assertFalse(sherlock.use_ois)
     sherlock.run()
     object_dir = "TIC181084752_FFI_all"
     self.assertFalse(os.path.exists(object_dir))
예제 #30
0
 def test_setup_files(self):
     sherlock = Sherlock(False, None)
     sherlock.setup_files(False, "inner/")
     self.assertEqual("inner/", sherlock.results_dir)