From 5036e73942c730e36713a2cf5d451a7fcd90cd55 Mon Sep 17 00:00:00 2001 From: Susan Mullally Date: Mon, 26 Apr 2021 09:35:55 -0400 Subject: [PATCH 1/2] small changes to modshift --- exovetter/modshift/modshift.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/exovetter/modshift/modshift.py b/exovetter/modshift/modshift.py index 796f08d..ae5c1d8 100644 --- a/exovetter/modshift/modshift.py +++ b/exovetter/modshift/modshift.py @@ -400,8 +400,11 @@ def estimate_scatter(phi_days, flux, phi_pri_days, phi_sec_days, # Measure rms of all other points idx = ~(idx1 | idx2) if not np.any(idx): - raise ValueError('RMS calculation failed') - rms = np.std(flux[idx]) + Warning('RMS calculation failed. No points remain. \ + Using flux values near secondary.') + rms = np.std(flux[~idx1]) + else: + rms = np.std(flux[idx]) return rms From e0e74ec0cdf87a1f81e4369528d77692e1d7bbc0 Mon Sep 17 00:00:00 2001 From: Susan Mullally Date: Mon, 26 Apr 2021 10:08:42 -0400 Subject: [PATCH 2/2] fix warning syntax --- exovetter/modshift/modshift.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/exovetter/modshift/modshift.py b/exovetter/modshift/modshift.py index ae5c1d8..46cc3ad 100644 --- a/exovetter/modshift/modshift.py +++ b/exovetter/modshift/modshift.py @@ -24,6 +24,7 @@ from scipy import integrate as spint import exovetter.modshift.plotmodshift as plotmodshift +import warnings __all__ = ['compute_modshift_metrics', 'fold_and_bin_data', 'compute_false_alarm_threshold', 'compute_event_significances', @@ -400,9 +401,9 @@ def estimate_scatter(phi_days, flux, phi_pri_days, phi_sec_days, # Measure rms of all other points idx = ~(idx1 | idx2) if not np.any(idx): - Warning('RMS calculation failed. No points remain. \ - Using flux values near secondary.') - rms = np.std(flux[~idx1]) + warnings.warn('RMS calculation failed. No points remain. \ + Including all flux values near primary and secondary.') + rms = np.std(flux) else: rms = np.std(flux[idx]) return rms