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
ce27f0a2
Commit
ce27f0a2
authored
5 years ago
by
Sylvia Biscoveanu
Browse files
Options
Downloads
Patches
Plain Diff
Update test
parent
63222892
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!653
Add waveform error handling
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/gw_source_test.py
+15
-5
15 additions, 5 deletions
test/gw_source_test.py
with
15 additions
and
5 deletions
test/gw_source_test.py
+
15
−
5
View file @
ce27f0a2
...
...
@@ -18,11 +18,14 @@ class TestLalBBH(unittest.TestCase):
waveform_approximant
=
'
IMRPhenomPv2
'
,
reference_frequency
=
50.0
,
minimum_frequency
=
20.0
,
catch_waveform_errors
=
True
)
self
.
frequency_array
=
bilby
.
core
.
utils
.
create_frequency_series
(
2048
,
4
)
self
.
bad_parameters
=
copy
(
self
.
parameters
)
self
.
bad_parameters
[
'
mass_1
'
]
=
-
30.
def
tearDown
(
self
):
del
self
.
parameters
del
self
.
waveform_kwargs
del
self
.
frequency_array
del
self
.
bad_parameters
def
test_lal_bbh_works_runs_valid_parameters
(
self
):
self
.
parameters
.
update
(
self
.
waveform_kwargs
)
...
...
@@ -31,10 +34,17 @@ class TestLalBBH(unittest.TestCase):
self
.
frequency_array
,
**
self
.
parameters
),
dict
)
def
test_waveform_error_catching
(
self
):
bad_parameters
=
copy
(
self
.
parameters
)
bad_parameters
[
'
mass_1
'
]
=
-
30.
bad_parameters
.
update
(
self
.
waveform_kwargs
)
self
.
assertFalse
(
bilby
.
gw
.
source
.
lal_binary_black_hole
(
self
.
frequency_array
,
**
bad_parameters
))
self
.
bad_parameters
.
update
(
self
.
waveform_kwargs
)
self
.
assertIsNone
(
bilby
.
gw
.
source
.
lal_binary_black_hole
(
self
.
frequency_array
,
**
self
.
bad_parameters
))
def
test_waveform_error_raising
(
self
):
raise_error_parameters
=
copy
(
self
.
bad_parameters
)
raise_error_parameters
.
update
(
self
.
waveform_kwargs
)
raise_error_parameters
[
'
catch_waveform_errors
'
]
=
False
with
self
.
assertRaises
(
Exception
):
bilby
.
gw
.
source
.
lal_binary_black_hole
(
self
.
frequency_array
,
**
raise_error_parameters
)
def
test_lal_bbh_works_without_waveform_parameters
(
self
):
self
.
assertIsInstance
(
...
...
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