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
da7925b7
Commit
da7925b7
authored
Jun 18, 2018
by
Chris Shallue
Committed by
Christopher Shallue
Jun 23, 2018
Browse files
Deal with empty input arrays in kepler_spline.choose_kepler_spline().
PiperOrigin-RevId: 201007094
parent
9546b04c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
research/astronet/third_party/kepler_spline/kepler_spline.py
research/astronet/third_party/kepler_spline/kepler_spline.py
+2
-1
research/astronet/third_party/kepler_spline/kepler_spline_test.py
.../astronet/third_party/kepler_spline/kepler_spline_test.py
+13
-0
No files found.
research/astronet/third_party/kepler_spline/kepler_spline.py
View file @
da7925b7
...
...
@@ -187,7 +187,8 @@ def choose_kepler_spline(all_time,
# model and sigma is the constant standard deviation for all flux values.
# Moreover, we assume that s[i] ~= s[i+1]. Therefore,
# (f[i+1] - f[i]) / sqrt(2) ~ N(0, sigma^2).
scaled_diffs
=
np
.
concatenate
([
np
.
diff
(
f
)
/
np
.
sqrt
(
2
)
for
f
in
all_flux
])
scaled_diffs
=
[
np
.
diff
(
f
)
/
np
.
sqrt
(
2
)
for
f
in
all_flux
]
scaled_diffs
=
np
.
concatenate
(
scaled_diffs
)
if
scaled_diffs
else
np
.
array
([])
if
not
scaled_diffs
.
size
:
best_spline
=
[
np
.
array
([
np
.
nan
]
*
len
(
f
))
for
f
in
all_flux
]
metadata
.
light_curve_mask
=
[
...
...
research/astronet/third_party/kepler_spline/kepler_spline_test.py
View file @
da7925b7
...
...
@@ -79,6 +79,19 @@ class KeplerSplineTest(absltest.TestCase):
class
ChooseKeplerSplineTest
(
absltest
.
TestCase
):
def
testEmptyInput
(
self
):
# Logarithmically sample candidate break point spacings.
bkspaces
=
np
.
logspace
(
np
.
log10
(
0.5
),
np
.
log10
(
5
),
num
=
20
)
spline
,
metadata
=
kepler_spline
.
choose_kepler_spline
(
all_time
=
[],
all_flux
=
[],
bkspaces
=
bkspaces
,
penalty_coeff
=
1.0
,
verbose
=
False
)
np
.
testing
.
assert_array_equal
(
spline
,
[])
np
.
testing
.
assert_array_equal
(
metadata
.
light_curve_mask
,
[])
def
testNoPoints
(
self
):
all_time
=
[
np
.
array
([])]
all_flux
=
[
np
.
array
([])]
...
...
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