Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bilby
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
lscsoft
bilby
Commits
fd027dda
Commit
fd027dda
authored
6 years ago
by
Colm Talbot
Browse files
Options
Downloads
Patches
Plain Diff
add calibration test
parent
7ab25303
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!113
Add calibration
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/calibration_tests.py
+52
-0
52 additions, 0 deletions
test/calibration_tests.py
with
52 additions
and
0 deletions
test/calibration_tests.py
0 → 100644
+
52
−
0
View file @
fd027dda
from
tupak.gw
import
calibration
import
unittest
import
numpy
as
np
class
TestBaseClass
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
model
=
calibration
.
Recalibrate
()
def
tearDown
(
self
):
del
self
.
model
def
test_calibration_factor
(
self
):
frequency_array
=
np
.
linspace
(
20
,
1024
,
1000
)
cal_factor
=
self
.
model
.
get_calibration_factor
(
frequency_array
)
assert
np
.
alltrue
(
cal_factor
.
real
==
np
.
ones_like
(
frequency_array
))
class
TestCubicSpline
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
model
=
calibration
.
CubicSpline
(
prefix
=
'
recalib_
'
,
minimum_frequency
=
20
,
maximum_frequency
=
1024
,
n_points
=
5
)
self
.
parameters
=
{
'
recalib_{}_{}
'
.
format
(
param
,
ii
):
0.0
for
ii
in
range
(
5
)
for
param
in
[
'
amplitude
'
,
'
phase
'
]}
def
tearDown
(
self
):
del
self
.
model
del
self
.
parameters
def
test_calibration_factor
(
self
):
frequency_array
=
np
.
linspace
(
20
,
1024
,
1000
)
cal_factor
=
self
.
model
.
get_calibration_factor
(
frequency_array
,
**
self
.
parameters
)
assert
np
.
alltrue
(
cal_factor
.
real
==
np
.
ones_like
(
frequency_array
))
class
TestCubicSplineRequiresFourNodes
(
unittest
.
TestCase
):
def
test_cannot_instantiate_with_too_few_nodes
(
self
):
self
.
assertRaises
(
ValueError
,
lambda
:
calibration
.
CubicSpline
(
'
test
'
,
1
,
10
,
3
))
def
test_can_instantiate_with_four_few_nodes
(
self
):
calibration
.
CubicSpline
(
'
test
'
,
1
,
10
,
4
)
if
__name__
==
'
__main__
'
:
unittest
.
main
()
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