Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PyFstat
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
Model registry
Operate
Environments
Monitor
Incidents
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Pep Covas Vidal
PyFstat
Commits
d6ae23d5
Commit
d6ae23d5
authored
7 years ago
by
Gregory Ashton
Browse files
Options
Downloads
Patches
Plain Diff
Speed up tests
parent
51328fe3
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests.py
+24
-19
24 additions, 19 deletions
tests.py
with
24 additions
and
19 deletions
tests.py
+
24
−
19
View file @
d6ae23d5
...
...
@@ -16,19 +16,19 @@ class Test(unittest.TestCase):
class
TestWriter
(
Test
):
label
=
"
Test
"
label
=
"
Test
Writer
"
def
test_make_cff
(
self
):
Writer
=
pyfstat
.
Writer
(
self
.
label
,
outdir
=
outdir
)
Writer
.
make_cff
()
self
.
assertTrue
(
os
.
path
.
isfile
(
'
./TestData/
Test
.cff
'
))
self
.
assertTrue
(
os
.
path
.
isfile
(
'
./TestData/
{}
.cff
'
.
format
(
self
.
label
)
))
def
test_run_makefakedata
(
self
):
Writer
=
pyfstat
.
Writer
(
self
.
label
,
outdir
=
outdir
)
Writer
=
pyfstat
.
Writer
(
self
.
label
,
outdir
=
outdir
,
duration
=
86400
)
Writer
.
make_cff
()
Writer
.
run_makefakedata
()
self
.
assertTrue
(
os
.
path
.
isfile
(
'
./TestData/H-48
00
_H1_1800SFT_Test-700000000-86400
00
.sft
'
))
'
./TestData/H-48_H1_1800SFT_Test
Writer
-700000000-86400.sft
'
))
def
test_makefakedata_usecached
(
self
):
Writer
=
pyfstat
.
Writer
(
self
.
label
,
outdir
=
outdir
,
duration
=
86400
)
...
...
@@ -86,10 +86,11 @@ class TestBaseSearchClass(Test):
class
TestComputeFstat
(
Test
):
label
=
"
Test
"
label
=
"
Test
ComputeFstat
"
def
test_run_computefstatistic_single_point
(
self
):
Writer
=
pyfstat
.
Writer
(
self
.
label
,
outdir
=
outdir
)
Writer
=
pyfstat
.
Writer
(
self
.
label
,
outdir
=
outdir
,
duration
=
86400
,
h0
=
1
,
sqrtSX
=
1
)
Writer
.
make_data
()
predicted_FS
=
Writer
.
predict_fstat
()
...
...
@@ -107,7 +108,8 @@ class TestComputeFstat(Test):
self
.
assertTrue
(
np
.
abs
(
predicted_FS
-
FS
)
/
FS
<
0.2
)
def
run_computefstatistic_single_point_no_noise
(
self
):
Writer
=
pyfstat
.
Writer
(
self
.
label
,
outdir
=
outdir
,
add_noise
=
False
)
Writer
=
pyfstat
.
Writer
(
self
.
label
,
outdir
=
outdir
,
add_noise
=
False
,
duration
=
86400
,
h0
=
1
,
sqrtSX
=
1
)
Writer
.
make_data
()
predicted_FS
=
Writer
.
predict_fstat
()
...
...
@@ -125,7 +127,8 @@ class TestComputeFstat(Test):
self
.
assertTrue
(
np
.
abs
(
predicted_FS
-
FS
)
/
FS
<
0.2
)
def
test_injectSources_from_file
(
self
):
Writer
=
pyfstat
.
Writer
(
self
.
label
,
outdir
=
outdir
,
add_noise
=
False
)
Writer
=
pyfstat
.
Writer
(
self
.
label
,
outdir
=
outdir
,
add_noise
=
False
,
duration
=
86400
,
h0
=
1
,
sqrtSX
=
1
)
Writer
.
make_cff
()
injectSources
=
Writer
.
config_file_name
...
...
@@ -148,15 +151,17 @@ class TestComputeFstat(Test):
class
TestSemiCoherentGlitchSearch
(
Test
):
label
=
"
Test
"
label
=
"
Test
SemiCoherentGlitchSearch
"
def
test_compute_nglitch_fstat
(
self
):
duration
=
10
0
*
86400
dtglitch
=
.
5
*
100
*
86400
duration
=
10
*
86400
dtglitch
=
.
5
*
duration
delta_F0
=
0
h0
=
1
sqrtSX
=
1
Writer
=
pyfstat
.
GlitchWriter
(
self
.
label
,
outdir
=
outdir
,
duration
=
duration
,
dtglitch
=
dtglitch
,
delta_F0
=
delta_F0
)
delta_F0
=
delta_F0
,
sqrtSX
=
sqrtSX
,
h0
=
h0
)
Writer
.
make_data
()
...
...
@@ -190,16 +195,16 @@ class TestSemiCoherentGlitchSearch(Test):
class
TestMCMCSearch
(
Test
):
label
=
"
Test
"
label
=
"
Test
MCMCSearch
"
def
test_fully_coherent
(
self
):
h0
=
5e-24
sqrtSX
=
1
e-22
h0
=
1
sqrtSX
=
1
F0
=
30
F1
=
-
1e-10
F2
=
0
minStartTime
=
700000000
duration
=
1
00
*
86400
duration
=
1
*
86400
maxStartTime
=
minStartTime
+
duration
Alpha
=
5e-3
Delta
=
1.2
...
...
@@ -214,8 +219,8 @@ class TestMCMCSearch(Test):
Writer
.
make_data
()
predicted_FS
=
Writer
.
predict_fstat
()
theta
=
{
'
F0
'
:
{
'
type
'
:
'
norm
'
,
'
loc
'
:
F0
,
'
scale
'
:
np
.
abs
(
1e-
9
*
F0
)},
'
F1
'
:
{
'
type
'
:
'
norm
'
,
'
loc
'
:
F1
,
'
scale
'
:
np
.
abs
(
1e-
9
*
F1
)},
theta
=
{
'
F0
'
:
{
'
type
'
:
'
norm
'
,
'
loc
'
:
F0
,
'
scale
'
:
np
.
abs
(
1e-
10
*
F0
)},
'
F1
'
:
{
'
type
'
:
'
norm
'
,
'
loc
'
:
F1
,
'
scale
'
:
np
.
abs
(
1e-
10
*
F1
)},
'
F2
'
:
F2
,
'
Alpha
'
:
Alpha
,
'
Delta
'
:
Delta
}
search
=
pyfstat
.
MCMCSearch
(
...
...
@@ -233,7 +238,7 @@ class TestMCMCSearch(Test):
FS
>
predicted_FS
or
np
.
abs
((
FS
-
predicted_FS
))
/
predicted_FS
<
0.3
)
def
test_multi_stage
(
self
):
Writer
=
pyfstat
.
Writer
(
F0
=
10
)
Writer
=
pyfstat
.
Writer
(
F0
=
10
,
duration
=
86400
,
h0
=
1
,
sqrtSX
=
1
)
Writer
.
make_cff
()
theta
=
{
'
F0
'
:
{
'
type
'
:
'
norm
'
,
'
loc
'
:
10
,
'
scale
'
:
1e-2
},
...
...
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