Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
ResNet50_tensorflow
Commits
252e2d2e
Commit
252e2d2e
authored
Sep 21, 2018
by
Chris Shallue
Committed by
Christopher Shallue
Oct 16, 2018
Browse files
Update formatting.
PiperOrigin-RevId: 213963765
parent
9d0f41b7
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
34 deletions
+32
-34
research/astronet/light_curve_util/median_filter_test.py
research/astronet/light_curve_util/median_filter_test.py
+1
-1
research/astronet/light_curve_util/periodic_event.py
research/astronet/light_curve_util/periodic_event.py
+1
-1
research/astronet/light_curve_util/util.py
research/astronet/light_curve_util/util.py
+12
-12
research/astronet/third_party/kepler_spline/kepler_spline.py
research/astronet/third_party/kepler_spline/kepler_spline.py
+17
-19
research/astronet/third_party/robust_mean/robust_mean.py
research/astronet/third_party/robust_mean/robust_mean.py
+1
-1
No files found.
research/astronet/light_curve_util/median_filter_test.py
View file @
252e2d2e
...
@@ -124,5 +124,5 @@ class MedianFilterTest(absltest.TestCase):
...
@@ -124,5 +124,5 @@ class MedianFilterTest(absltest.TestCase):
np
.
testing
.
assert_array_equal
([
7
,
1
,
5
,
2
,
3
],
result
)
np
.
testing
.
assert_array_equal
([
7
,
1
,
5
,
2
,
3
],
result
)
if
__name__
==
'
__main__
'
:
if
__name__
==
"
__main__
"
:
absltest
.
main
()
absltest
.
main
()
research/astronet/light_curve_util/periodic_event.py
View file @
252e2d2e
...
@@ -62,7 +62,7 @@ class Event(object):
...
@@ -62,7 +62,7 @@ class Event(object):
other_event: An Event.
other_event: An Event.
period_rtol: Relative tolerance in matching the periods.
period_rtol: Relative tolerance in matching the periods.
t0_durations: Tolerance in matching the t0 values, in units of the other
t0_durations: Tolerance in matching the t0 values, in units of the other
Event's duration.
Event's duration.
Returns:
Returns:
True if this Event is the same as other_event, within the given tolerance.
True if this Event is the same as other_event, within the given tolerance.
...
...
research/astronet/light_curve_util/util.py
View file @
252e2d2e
...
@@ -51,9 +51,9 @@ def split(all_time, all_flux, gap_width=0.75):
...
@@ -51,9 +51,9 @@ def split(all_time, all_flux, gap_width=0.75):
Args:
Args:
all_time: Numpy array or sequence of numpy arrays; each is a sequence of
all_time: Numpy array or sequence of numpy arrays; each is a sequence of
time values.
time values.
all_flux: Numpy array or sequence of numpy arrays; each is a sequence of
all_flux: Numpy array or sequence of numpy arrays; each is a sequence of
flux values of the corresponding time array.
flux values of the corresponding time array.
gap_width: Minimum gap size (in time units) for a split.
gap_width: Minimum gap size (in time units) for a split.
Returns:
Returns:
...
@@ -91,9 +91,9 @@ def remove_events(all_time,
...
@@ -91,9 +91,9 @@ def remove_events(all_time,
Args:
Args:
all_time: Numpy array or sequence of numpy arrays; each is a sequence of
all_time: Numpy array or sequence of numpy arrays; each is a sequence of
time values.
time values.
all_flux: Numpy array or sequence of numpy arrays; each is a sequence of
all_flux: Numpy array or sequence of numpy arrays; each is a sequence of
flux values of the corresponding time array.
flux values of the corresponding time array.
events: List of Event objects to remove.
events: List of Event objects to remove.
width_factor: Fractional multiplier of the duration of each event to remove.
width_factor: Fractional multiplier of the duration of each event to remove.
include_empty_segments: Whether to include empty segments in the output.
include_empty_segments: Whether to include empty segments in the output.
...
@@ -136,12 +136,12 @@ def interpolate_missing_time(time, cadence_no=None, fill_value="extrapolate"):
...
@@ -136,12 +136,12 @@ def interpolate_missing_time(time, cadence_no=None, fill_value="extrapolate"):
Args:
Args:
time: A numpy array of monotonically increasing values, with missing values
time: A numpy array of monotonically increasing values, with missing values
denoted by NaN or Inf.
denoted by NaN or Inf.
cadence_no: Optional numpy array of cadence numbers corresponding to the
cadence_no: Optional numpy array of cadence numbers corresponding to the
time values. If not provided, missing time values are assumed to be
time values. If not provided, missing time values are assumed to be
evenly
evenly
spaced between present time values.
spaced between present time values.
fill_value: Specifies how missing time values should be treated at the
fill_value: Specifies how missing time values should be treated at the
beginning and end of the array. See scipy.interpolate.interp1d.
beginning and end of the array. See scipy.interpolate.interp1d.
Returns:
Returns:
A numpy array of the same length as the input time array, with NaN/Inf
A numpy array of the same length as the input time array, with NaN/Inf
...
@@ -177,17 +177,17 @@ def interpolate_masked_spline(all_time, all_masked_time, all_masked_spline):
...
@@ -177,17 +177,17 @@ def interpolate_masked_spline(all_time, all_masked_time, all_masked_spline):
Args:
Args:
all_time: List of numpy arrays; each is a sequence of time values.
all_time: List of numpy arrays; each is a sequence of time values.
all_masked_time: List of numpy arrays; each is a sequence of time values
all_masked_time: List of numpy arrays; each is a sequence of time values
with some values missing (masked).
with some values missing (masked).
all_masked_spline: List of numpy arrays; the masked spline values
all_masked_spline: List of numpy arrays; the masked spline values
corresponding to all_masked_time.
corresponding to all_masked_time.
Returns:
Returns:
interp_spline: List of numpy arrays; each is the masked spline with missing
interp_spline: List of numpy arrays; each is the masked spline with missing
points linearly interpolated.
points linearly interpolated.
"""
"""
interp_spline
=
[]
interp_spline
=
[]
for
time
,
masked_time
,
masked_spline
in
zip
(
for
time
,
masked_time
,
masked_spline
in
zip
(
all_time
,
all_masked_time
,
all_time
,
all_masked_time
,
all_masked_spline
):
all_masked_spline
):
if
masked_time
.
size
:
if
masked_time
.
size
:
interp_spline
.
append
(
np
.
interp
(
time
,
masked_time
,
masked_spline
))
interp_spline
.
append
(
np
.
interp
(
time
,
masked_time
,
masked_spline
))
else
:
else
:
...
...
research/astronet/third_party/kepler_spline/kepler_spline.py
View file @
252e2d2e
...
@@ -37,9 +37,9 @@ def kepler_spline(time, flux, bkspace=1.5, maxiter=5, outlier_cut=3):
...
@@ -37,9 +37,9 @@ def kepler_spline(time, flux, bkspace=1.5, maxiter=5, outlier_cut=3):
flux: Numpy array; the flux (brightness) values of the light curve.
flux: Numpy array; the flux (brightness) values of the light curve.
bkspace: Spline break point spacing in time units.
bkspace: Spline break point spacing in time units.
maxiter: Maximum number of attempts to fit the spline after removing badly
maxiter: Maximum number of attempts to fit the spline after removing badly
fit points.
fit points.
outlier_cut: The maximum number of standard deviations from the median
outlier_cut: The maximum number of standard deviations from the median
spline residual before a point is considered an outlier.
spline residual before a point is considered an outlier.
Returns:
Returns:
spline: The values of the fitted spline corresponding to the input time
spline: The values of the fitted spline corresponding to the input time
...
@@ -119,15 +119,15 @@ class SplineMetadata(object):
...
@@ -119,15 +119,15 @@ class SplineMetadata(object):
Attributes:
Attributes:
light_curve_mask: List of boolean numpy arrays indicating which points in
light_curve_mask: List of boolean numpy arrays indicating which points in
the light curve were used to fit the best-fit spline.
the light curve were used to fit the best-fit spline.
bkspace: The break-point spacing used for the best-fit spline.
bkspace: The break-point spacing used for the best-fit spline.
bad_bkspaces: List of break-point spacing values that failed.
bad_bkspaces: List of break-point spacing values that failed.
likelihood_term: The likelihood term of the Bayesian Information Criterion;
likelihood_term: The likelihood term of the Bayesian Information Criterion;
-2*ln(L), where L is the likelihood of the data given the model.
-2*ln(L), where L is the likelihood of the data given the model.
penalty_term: The penalty term for the number of parameters in the
penalty_term: The penalty term for the number of parameters in the
Bayesian
Bayesian
Information Criterion.
Information Criterion.
bic: The value of the Bayesian Information Criterion; equal to
bic: The value of the Bayesian Information Criterion; equal to
likelihood_term + penalty_coeff * penalty_term.
likelihood_term + penalty_coeff * penalty_term.
"""
"""
def
__init__
(
self
):
def
__init__
(
self
):
...
@@ -163,14 +163,13 @@ def choose_kepler_spline(all_time,
...
@@ -163,14 +163,13 @@ def choose_kepler_spline(all_time,
all_flux: List of 1D numpy arrays; the flux values of the light curve.
all_flux: List of 1D numpy arrays; the flux values of the light curve.
bkspaces: List of break-point spacings to try.
bkspaces: List of break-point spacings to try.
maxiter: Maximum number of attempts to fit each spline after removing badly
maxiter: Maximum number of attempts to fit each spline after removing badly
fit points.
fit points.
penalty_coeff: Coefficient of the penalty term for using more parameters in
penalty_coeff: Coefficient of the penalty term for using more parameters in
the Bayesian Information Criterion. Decreasing this value will allow
the Bayesian Information Criterion. Decreasing this value will allow more
more parameters to be used (i.e. smaller break-point spacing), and
parameters to be used (i.e. smaller break-point spacing), and vice-versa.
vice-versa.
verbose: Whether to log individual spline errors. Note that if bkspaces
verbose: Whether to log individual spline errors. Note that if bkspaces
contains many values (particularly small ones) then this may cause
contains many values (particularly small ones) then this may cause
logging
logging
pollution if calling this function for many light curves.
pollution if calling this function for many light curves.
Returns:
Returns:
spline: List of numpy arrays; values of the best-fit spline corresponding to
spline: List of numpy arrays; values of the best-fit spline corresponding to
...
@@ -295,14 +294,13 @@ def fit_kepler_spline(all_time,
...
@@ -295,14 +294,13 @@ def fit_kepler_spline(all_time,
bkspace_max: Maximum breakpoint spacing to try.
bkspace_max: Maximum breakpoint spacing to try.
bkspace_num: Number of breakpoint spacings to try.
bkspace_num: Number of breakpoint spacings to try.
maxiter: Maximum number of attempts to fit each spline after removing badly
maxiter: Maximum number of attempts to fit each spline after removing badly
fit points.
fit points.
penalty_coeff: Coefficient of the penalty term for using more parameters in
penalty_coeff: Coefficient of the penalty term for using more parameters in
the Bayesian Information Criterion. Decreasing this value will allow
the Bayesian Information Criterion. Decreasing this value will allow more
more parameters to be used (i.e. smaller break-point spacing), and
parameters to be used (i.e. smaller break-point spacing), and vice-versa.
vice-versa.
verbose: Whether to log individual spline errors. Note that if bkspaces
verbose: Whether to log individual spline errors. Note that if bkspaces
contains many values (particularly small ones) then this may cause
contains many values (particularly small ones) then this may cause
logging
logging
pollution if calling this function for many light curves.
pollution if calling this function for many light curves.
Returns:
Returns:
spline: List of numpy arrays; values of the best-fit spline corresponding to
spline: List of numpy arrays; values of the best-fit spline corresponding to
...
...
research/astronet/third_party/robust_mean/robust_mean.py
View file @
252e2d2e
...
@@ -17,7 +17,7 @@ def robust_mean(y, cut):
...
@@ -17,7 +17,7 @@ def robust_mean(y, cut):
Args:
Args:
y: 1D numpy array. Assumed to be normally distributed with outliers.
y: 1D numpy array. Assumed to be normally distributed with outliers.
cut: Points more than this number of standard deviations from the median are
cut: Points more than this number of standard deviations from the median are
ignored.
ignored.
Returns:
Returns:
mean: A robust estimate of the mean of y.
mean: A robust estimate of the mean of y.
...
...
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment