Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
geomag-algorithms
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ghsc
National Geomagnetism Program
geomag-algorithms
Commits
842f4a3c
Commit
842f4a3c
authored
9 years ago
by
Eddie McWhirter
Browse files
Options
Downloads
Patches
Plain Diff
Add more messages to test.
parent
9042196c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/algorithm_test/SQDistAlgorithm_test.py
+32
-40
32 additions, 40 deletions
test/algorithm_test/SQDistAlgorithm_test.py
with
32 additions
and
40 deletions
test/algorithm_test/SQDistAlgorithm_test.py
+
32
−
40
View file @
842f4a3c
...
@@ -38,14 +38,13 @@ def test_sqdistalgorithm_additive1():
...
@@ -38,14 +38,13 @@ def test_sqdistalgorithm_additive1():
s0
=
s0
,
l0
=
l0
,
b0
=
b0
,
sigma0
=
sigma0
,
hstep
=
hstep
)
s0
=
s0
,
l0
=
l0
,
b0
=
b0
,
sigma0
=
sigma0
,
hstep
=
hstep
)
assert_almost_equal
(
yhat1
,
[
0
,
1
,
0
,
-
1
,
0
,
1
,
0
,
-
1
,
0
,
1
,
0
,
-
1
],
assert_almost_equal
(
yhat1
,
[
0
,
1
,
0
,
-
1
,
0
,
1
,
0
,
-
1
,
0
,
1
,
0
,
-
1
],
err_msg
=
'
***1***
'
)
err_msg
=
'
yhat1 should almost equal simple time series
'
)
assert_almost_equal
(
shat1
,
[
0
,
1
,
0
,
-
1
,
0
,
1
,
0
,
-
1
,
0
,
1
,
0
,
-
1
],
assert_almost_equal
(
shat1
,
[
0
,
1
,
0
,
-
1
,
0
,
1
,
0
,
-
1
,
0
,
1
,
0
,
-
1
],
err_msg
=
'
***2***
'
)
err_msg
=
'
shat1 should almost equal simple time series
'
)
assert_almost_equal
(
sighat1
,
[
0.70710678
,
0.70955777
,
0.71200031
,
assert_almost_equal
(
sighat1
,
[
0.70710678
,
0.70955777
,
0.71200031
,
0.71443451
,
0.71686044
,
0.71927819
,
0.71443451
,
0.71686044
,
0.71927819
,
0.72168784
,
0.72408947
,
0.72648316
,
0.72168784
,
0.72408947
,
0.72648316
,
0.72886899
,
0.73124703
,
0.73361737
],
0.72886899
,
0.73124703
,
0.73361737
],
err_msg
=
'
sighat1 should almost equal simple time series
'
)
err_msg
=
'
***3***
'
)
# predict three cycles ahead given l0 and s0, no inputs,
# predict three cycles ahead given l0 and s0, no inputs,
# and assume PI only grows with seasonal adjustments
# and assume PI only grows with seasonal adjustments
...
@@ -55,14 +54,13 @@ def test_sqdistalgorithm_additive1():
...
@@ -55,14 +54,13 @@ def test_sqdistalgorithm_additive1():
s0
=
s0
,
l0
=
0
,
b0
=
0
,
sigma0
=
sigma0
,
hstep
=
hstep
)
s0
=
s0
,
l0
=
0
,
b0
=
0
,
sigma0
=
sigma0
,
hstep
=
hstep
)
assert_almost_equal
(
yhat1
,
[
0
,
1
,
0
,
-
1
,
0
,
1
,
0
,
-
1
,
0
,
1
,
0
,
-
1
],
assert_almost_equal
(
yhat1
,
[
0
,
1
,
0
,
-
1
,
0
,
1
,
0
,
-
1
,
0
,
1
,
0
,
-
1
],
err_msg
=
'
***4***
'
)
err_msg
=
'
yhat1 should almost equal simple time series, 2nd run
'
)
assert_almost_equal
(
shat1
,
[
0
,
1
,
0
,
-
1
,
0
,
1
,
0
,
-
1
,
0
,
1
,
0
,
-
1
],
assert_almost_equal
(
shat1
,
[
0
,
1
,
0
,
-
1
,
0
,
1
,
0
,
-
1
,
0
,
1
,
0
,
-
1
],
err_msg
=
'
***5***
'
)
err_msg
=
'
shat1 should almost equal simple time series, 2nd run
'
)
assert_almost_equal
(
sighat1
,
[
0.70710678
,
0.70710678
,
0.70710678
,
assert_almost_equal
(
sighat1
,
[
0.70710678
,
0.70710678
,
0.70710678
,
0.70710678
,
0.74535599
,
0.74535599
,
0.70710678
,
0.74535599
,
0.74535599
,
0.74535599
,
0.74535599
,
0.78173596
,
0.74535599
,
0.74535599
,
0.78173596
,
0.78173596
,
0.78173596
,
0.78173596
],
0.78173596
,
0.78173596
,
0.78173596
],
err_msg
=
'
sighat1 should almost equal simple time series, 2nd run
'
)
err_msg
=
'
***6***
'
)
# smooth three cycles' worth of zero-value input observations,
# smooth three cycles' worth of zero-value input observations,
# assuming only the trendline varies
# assuming only the trendline varies
...
@@ -73,17 +71,15 @@ def test_sqdistalgorithm_additive1():
...
@@ -73,17 +71,15 @@ def test_sqdistalgorithm_additive1():
# check output
# check output
assert_almost_equal
(
yhat1
,
[
0
,
1
,
-
0.08333333
,
-
1.07638889
,
0.01331019
,
assert_almost_equal
(
yhat1
,
[
0
,
1
,
-
0.08333333
,
-
1.07638889
,
0.01331019
,
1.01220100
,
-
0.07214908
,
-
1.06613666
,
1.01220100
,
-
0.07214908
,
-
1.06613666
,
0.02270806
,
1.02081573
,
0.02270806
,
1.02081573
,
-
0.06425225
,
-
0.06425225
,
-
1.0588979
],
8
,
-
1.0588979
],
8
,
err_msg
=
'
yhat1 should almost equal simple time series, 3rd run
'
)
err_msg
=
'
***8***
'
)
assert_almost_equal
(
shat1
,
[
0
,
1
,
0
,
-
1
,
0
,
1
,
0
,
-
1
,
0
,
1
,
0
,
-
1
],
8
,
assert_almost_equal
(
shat1
,
[
0
,
1
,
0
,
-
1
,
0
,
1
,
0
,
-
1
,
0
,
1
,
0
,
-
1
],
8
,
err_msg
=
'
***9***
'
)
err_msg
=
'
shat1 should almost equal simple time series, 3rd run
'
)
assert_almost_equal
(
sighat1
,
[
0.64818122
,
0.67749945
,
0.62798561
,
assert_almost_equal
(
sighat1
,
[
0.64818122
,
0.67749945
,
0.62798561
,
0.66535255
,
0.61101568
,
0.64444779
,
0.66535255
,
0.61101568
,
0.64444779
,
0.59675623
,
0.63587127
,
0.58477433
,
0.59675623
,
0.63587127
,
0.58477433
,
0.62111112
,
0.57470621
,
0.61505552
],
8
,
0.62111112
,
0.57470621
,
0.61505552
],
8
,
err_msg
=
'
sighat1 should almost equal simple time series, 3rd run
'
)
err_msg
=
'
***10***
'
)
# smooth three cycles' worth of zero-value input observations,
# smooth three cycles' worth of zero-value input observations,
# assuming only the seasonal adjustments vary
# assuming only the seasonal adjustments vary
...
@@ -94,17 +90,15 @@ def test_sqdistalgorithm_additive1():
...
@@ -94,17 +90,15 @@ def test_sqdistalgorithm_additive1():
# check output
# check output
assert_almost_equal
(
yhat1
,
[
0
,
1
,
0
,
-
1
,
0
,
0.66666667
,
0
,
-
0.66666667
,
assert_almost_equal
(
yhat1
,
[
0
,
1
,
0
,
-
1
,
0
,
0.66666667
,
0
,
-
0.66666667
,
0
,
0.44444444
,
0
,
-
0.44444444
],
8
,
0
,
0.44444444
,
0
,
-
0.44444444
],
8
,
err_msg
=
'
***11***
'
)
err_msg
=
'
yhat1 should almost equal simple time series, 4th run
'
)
assert_almost_equal
(
shat1
,
[
0
,
1
,
0.08333333
,
-
0.91666667
,
0
,
0.66666667
,
assert_almost_equal
(
shat1
,
[
0
,
1
,
0.08333333
,
-
0.91666667
,
0
,
0.66666667
,
0.05555556
,
-
0.61111111
,
0
,
0.44444444
,
0.05555556
,
-
0.61111111
,
0
,
0.44444444
,
0.03703704
,
-
0.40740741
],
8
,
0.03703704
,
-
0.40740741
],
8
,
err_msg
=
'
shat1 should almost equal simple time series, 4th run
'
)
err_msg
=
'
***12***
'
)
assert_almost_equal
(
sighat1
,
[
0.70710678
,
0.70710678
,
0.70710678
,
assert_almost_equal
(
sighat1
,
[
0.70710678
,
0.70710678
,
0.70710678
,
0.70710678
,
0.70710678
,
0.70710678
,
0.70710678
,
0.70710678
,
0.70710678
,
0.70710678
,
0.70710678
,
0.70710678
,
0.70710678
,
0.70710678
,
0.70710678
,
0.70710678
,
0.70710678
,
0.70710678
],
8
,
0.70710678
,
0.70710678
,
0.70710678
],
8
,
err_msg
=
'
sighat1 should almost equal simple time series, 4th run
'
)
err_msg
=
'
***13***
'
)
# smooth three cycles' worth of sinusoid input observations,
# smooth three cycles' worth of sinusoid input observations,
# assuming only the seasonal adjustments vary, starting at zero
# assuming only the seasonal adjustments vary, starting at zero
...
@@ -115,17 +109,15 @@ def test_sqdistalgorithm_additive1():
...
@@ -115,17 +109,15 @@ def test_sqdistalgorithm_additive1():
# check output
# check output
assert_almost_equal
(
yhat1
,
[
0
,
0
,
0
,
0
,
0
,
0.33333333
,
0
,
-
0.33333333
,
assert_almost_equal
(
yhat1
,
[
0
,
0
,
0
,
0
,
0
,
0.33333333
,
0
,
-
0.33333333
,
0
,
0.55555556
,
0
,
-
0.55555556
],
8
,
0
,
0.55555556
,
0
,
-
0.55555556
],
8
,
err_msg
=
'
***14***
'
)
err_msg
=
'
yhat1 should almost equal simple time series, 5th run
'
)
assert_almost_equal
(
shat1
,
[
0
,
0
,
-
0.08333333
,
-
0.08333333
,
assert_almost_equal
(
shat1
,
[
0
,
0
,
-
0.08333333
,
-
0.08333333
,
0
,
0.33333333
,
0
,
0.33333333
,
-
0.05555556
,
-
0.38888889
,
-
0.05555556
,
-
0.38888889
,
0
,
0.55555555
,
-
0.03703704
,
-
0.59259259
],
8
,
0
,
0.55555555
,
-
0.03703704
,
-
0.59259259
],
8
,
err_msg
=
'
shat1 should almost equal simple time series, 5th run
'
)
err_msg
=
'
***15***
'
)
assert_almost_equal
(
sighat1
,
[
0.70710678
,
0.70710678
,
0.70710678
,
assert_almost_equal
(
sighat1
,
[
0.70710678
,
0.70710678
,
0.70710678
,
0.70710678
,
0.70710678
,
0.70710678
,
0.70710678
,
0.70710678
,
0.70710678
,
0.70710678
,
0.70710678
,
0.70710678
,
0.70710678
,
0.70710678
,
0.70710678
,
0.70710678
,
0.70710678
,
0.70710678
],
8
,
0.70710678
,
0.70710678
,
0.70710678
],
8
,
err_msg
=
'
sighat1 should almost equal simple time series, 5th run
'
)
err_msg
=
'
***16***
'
)
def
test_sqdistalgorithm_additive2
():
def
test_sqdistalgorithm_additive2
():
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment