Skip to content

Commit

Permalink
use star_file when is none
Browse files Browse the repository at this point in the history
  • Loading branch information
martindevora committed Sep 17, 2024
1 parent 94675b8 commit 8330732
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions watson/watson.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def vetting(self, id, period, t0, duration, depth, sectors, rp_rstar=None, a_rst
if star_file is None:
mission, mission_prefix, _ = MissionLightcurveBuilder().parse_object_id(id)
pixel_size = LcbuilderHelper.mission_pixel_size(mission)
create_star_csv(CreateStarCsvInput(lc_file, mission, id, pixel_size, 50,
star_file = create_star_csv(CreateStarCsvInput(lc_file, mission, id, pixel_size, 50,
None, KicStarCatalog() if 'KIC' in id else TicStarCatalog(),
self.data_dir))
try:
Expand Down Expand Up @@ -1964,10 +1964,10 @@ def compute_bootstrap_fap(time, flux, period, duration, star_info, flux_err=None
period_grid, oversampling = LcbuilderHelper.calculate_period_grid(time, period / 2 if period / 2 >= 0.4 else 0.4, period * 1.5, 1, star_info, 1)
bls = BoxLeastSquares(time, flux, flux_err)
result = bls.power(period_grid, np.linspace(duration / 2, duration * 1.5, 10))
signal_spectra = result.power / np.nanmedian(result.power)
power = result.power / np.nanmedian(result.power)
diff = np.abs(period_grid - period)
period_index = np.argmin(diff)
signal_power = signal_spectra[period_index]
signal_power = power[period_index]
bootstrap_max_powers = []
indices = np.arange(len(flux))
for i in range(bootstrap_scenarios):
Expand All @@ -1978,4 +1978,4 @@ def compute_bootstrap_fap(time, flux, period, duration, star_info, flux_err=None
bootstrap_max_powers.append(np.nanmax(power))
bootstrap_max_powers = np.array(bootstrap_max_powers)
fap_bootstrap = np.sum(bootstrap_max_powers >= signal_power) / bootstrap_scenarios
return fap_bootstrap, signal_spectra
return fap_bootstrap

0 comments on commit 8330732

Please sign in to comment.