Residuals¶
-
class
salter.
Residuals
(residuals=None, buffer_duration=0.15, params=None, phases=None)[source] [edit on github]¶ Bases:
object
Transit light curve residuals.
Methods Summary
anderson
(attrs1, attrs2)k-sample Anderson test from anderson_ksamp
.from_rms
(times, residuals, star, planet[, …])Load residuals from an rms
simulation.from_transits
(transits, params[, …])Load transit residuals from a list of TransitLightCurve
objects.ks
(attrs1, attrs2)Two-sample KS test from ks_2samp
plot
()Generate a quick plot of the transit residuals. ttest
(attrs1, attrs2)Independent two-sample T test from ttest_ind
.Methods Documentation
-
anderson
(attrs1, attrs2)[source] [edit on github]¶ k-sample Anderson test from
anderson_ksamp
.Parameters: attrs1 : list of attributes
List of conditions in first sample
attrs2 : list of attributes
List of conditions in second sample
Returns: sig : float
significance level (see
anderson_ksamp
)Examples
>>> import numpy as np >>> import batman >>> from salter import LightCurve >>> # Create example transiting planet properties >>> params = batman.TransitParams() >>> params.t0 = 0.5 >>> params.rp = 0.1 >>> params.per = 1 >>> params.duration = 0.3 >>> params.inc = 90 >>> params.w = 90 >>> params.ecc = 0 >>> params.a = 10 >>> params.limb_dark = 'quadratic' >>> params.u = [0.2, 0.1] >>> # Create example transit light curves: >>> transits = [LightCurve(times=i + np.linspace(0, 1, 500), >>> fluxes=np.random.randn(500), >>> params=params) for i in range(10)] >>> r = Residuals(transits, params) >>> # How significant is the difference between the distributions of the fluxes in and out-of-transit? >>> r.anderson('out_of_transit', 'in_transit') 1.1428634099527666 >>> # How significant is the difference between the distributions of the in-transit fluxes before and after midtransit? >>> r.anderson(['in_transit', 'before_midtransit'], ['in_transit', 'after_midtransit']) 0.2792395871784852
-
classmethod
from_rms
(times, residuals, star, planet, buffer_duration=0.15)[source] [edit on github]¶ Load residuals from an
rms
simulation.Parameters: times :
ndarray
Times of each flux
residuals :
ndarray
Flux residual measurements
star :
Star
Stellar properties
planet :
Planet
Transiting planet parameters
buffer_duration : float
fraction of transit duration to ignore centered on ingress and egress.
-
classmethod
from_transits
(transits, params, buffer_duration=0.15)[source] [edit on github]¶ Load transit residuals from a list of
TransitLightCurve
objects.Parameters: transits : list of (or single)
TransitLightCurve
objectslist of transits
params :
TransitParams()
transiting planet parameters
buffer_duration : float
fraction of transit duration to ignore centered on ingress and egress.
-
ks
(attrs1, attrs2)[source] [edit on github]¶ Two-sample KS test from
ks_2samp
Parameters: attrs1 : list of attributes
List of conditions in first sample
attrs2 : list of attributes
List of conditions in second sample
Returns: pvalue : float
p value.
Examples
>>> import numpy as np >>> import batman >>> from salter import LightCurve >>> # Create example transiting planet properties >>> params = batman.TransitParams() >>> params.t0 = 0.5 >>> params.rp = 0.1 >>> params.per = 1 >>> params.duration = 0.3 >>> params.inc = 90 >>> params.w = 90 >>> params.ecc = 0 >>> params.a = 10 >>> params.limb_dark = 'quadratic' >>> params.u = [0.2, 0.1] >>> # Create example transit light curves: >>> transits = [LightCurve(times=i + np.linspace(0, 1, 500), >>> fluxes=np.random.randn(500), >>> params=params) for i in range(10)] >>> r = Residuals(transits, params) >>> # How significant is the difference between the distributions of the fluxes in and out-of-transit? >>> r.ks('out_of_transit', 'in_transit') 0.91710727901331124 >>> # How significant is the difference between the distributions of the in-transit fluxes before and after midtransit? >>> r.ks(['in_transit', 'before_midtransit'], ['in_transit', 'after_midtransit']) 0.39171715554793468
-
plot
()[source] [edit on github]¶ Generate a quick plot of the transit residuals.
Returns: fig :
Figure
Figure object
ax :
Axes
axis object
-
ttest
(attrs1, attrs2)[source] [edit on github]¶ Independent two-sample T test from
ttest_ind
.Parameters: attrs1 : list of attributes
List of conditions in first sample
attrs2 : list of attributes
List of conditions in second sample
Returns: pvalue : float
p value.
Examples
>>> import numpy as np >>> import batman >>> from salter import LightCurve >>> # Create example transiting planet properties >>> params = batman.TransitParams() >>> params.t0 = 0.5 >>> params.rp = 0.1 >>> params.per = 1 >>> params.duration = 0.3 >>> params.inc = 90 >>> params.w = 90 >>> params.ecc = 0 >>> params.a = 10 >>> params.limb_dark = 'quadratic' >>> params.u = [0.2, 0.1] >>> # Create example transit light curves: >>> transits = [LightCurve(times=i + np.linspace(0, 1, 500), >>> fluxes=np.random.randn(500), >>> params=params) for i in range(10)] >>> # Create residuals object >>> r = Residuals(transits, params) >>> # How significant is the difference between the means of the fluxes in and out-of-transit? >>> r.ttest('out_of_transit', 'in_transit') 0.310504218041 >>> # How significant is the difference between the means of the in-transit fluxes before and after midtransit? >>> r.ttest(['in_transit', 'before_midtransit'], ['in_transit', 'after_midtransit']) 0.823997471194
-