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
63222892
Commit
63222892
authored
5 years ago
by
Sylvia Biscoveanu
Browse files
Options
Downloads
Patches
Plain Diff
Add flag to turn off waveform error catching
parent
2a4a8c55
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!653
Add waveform error handling
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bilby/gw/source.py
+27
-18
27 additions, 18 deletions
bilby/gw/source.py
test/gw_source_test.py
+1
-1
1 addition, 1 deletion
test/gw_source_test.py
with
28 additions
and
19 deletions
bilby/gw/source.py
+
27
−
18
View file @
63222892
...
...
@@ -59,6 +59,7 @@ def lal_binary_black_hole(
reference_frequency
minimum_frequency
maximum_frequency
catch_waveform_errors
pn_spin_order
pn_tidal_order
pn_phase_order
...
...
@@ -87,7 +88,8 @@ def lal_binary_black_hole(
waveform_kwargs
=
dict
(
waveform_approximant
=
'
IMRPhenomPv2
'
,
reference_frequency
=
50.0
,
minimum_frequency
=
20.0
,
maximum_frequency
=
frequency_array
[
-
1
],
pn_spin_order
=-
1
,
pn_tidal_order
=-
1
,
pn_phase_order
=-
1
,
pn_amplitude_order
=
0
)
catch_waveform_errors
=
False
,
pn_spin_order
=-
1
,
pn_tidal_order
=-
1
,
pn_phase_order
=-
1
,
pn_amplitude_order
=
0
)
waveform_kwargs
.
update
(
kwargs
)
return
_base_lal_cbc_fd_waveform
(
frequency_array
=
frequency_array
,
mass_1
=
mass_1
,
mass_2
=
mass_2
,
...
...
@@ -140,6 +142,7 @@ def lal_binary_neutron_star(
reference_frequency
minimum_frequency
maximum_frequency
catch_waveform_errors
pn_spin_order
pn_tidal_order
pn_phase_order
...
...
@@ -168,8 +171,8 @@ def lal_binary_neutron_star(
waveform_kwargs
=
dict
(
waveform_approximant
=
'
IMRPhenomPv2_NRTidal
'
,
reference_frequency
=
50.0
,
minimum_frequency
=
20.0
,
maximum_frequency
=
frequency_array
[
-
1
],
pn_spin_order
=-
1
,
pn_tidal
_order
=-
1
,
pn_
phase
_order
=-
1
,
pn_amplitude_order
=
0
)
catch_waveform_errors
=
False
,
pn_spin
_order
=-
1
,
pn_
tidal
_order
=-
1
,
pn_phase_order
=-
1
,
pn_amplitude_order
=
0
)
waveform_kwargs
.
update
(
kwargs
)
return
_base_lal_cbc_fd_waveform
(
frequency_array
=
frequency_array
,
mass_1
=
mass_1
,
mass_2
=
mass_2
,
...
...
@@ -206,6 +209,7 @@ def lal_eccentric_binary_black_hole_no_spins(
reference_frequency
minimum_frequency
maximum_frequency
catch_waveform_errors
pn_spin_order
pn_tidal_order
pn_phase_order
...
...
@@ -234,7 +238,8 @@ def lal_eccentric_binary_black_hole_no_spins(
waveform_kwargs
=
dict
(
waveform_approximant
=
'
EccentricFD
'
,
reference_frequency
=
10.0
,
minimum_frequency
=
10.0
,
maximum_frequency
=
frequency_array
[
-
1
],
pn_spin_order
=-
1
,
pn_tidal_order
=-
1
,
pn_phase_order
=-
1
,
pn_amplitude_order
=
0
)
catch_waveform_errors
=
False
,
pn_spin_order
=-
1
,
pn_tidal_order
=-
1
,
pn_phase_order
=-
1
,
pn_amplitude_order
=
0
)
waveform_kwargs
.
update
(
kwargs
)
return
_base_lal_cbc_fd_waveform
(
frequency_array
=
frequency_array
,
mass_1
=
mass_1
,
mass_2
=
mass_2
,
...
...
@@ -291,6 +296,7 @@ def _base_lal_cbc_fd_waveform(
reference_frequency
=
waveform_kwargs
[
'
reference_frequency
'
]
minimum_frequency
=
waveform_kwargs
[
'
minimum_frequency
'
]
maximum_frequency
=
waveform_kwargs
[
'
maximum_frequency
'
]
catch_waveform_errors
=
waveform_kwargs
[
'
catch_waveform_errors
'
]
pn_spin_order
=
waveform_kwargs
[
'
pn_spin_order
'
]
pn_tidal_order
=
waveform_kwargs
[
'
pn_tidal_order
'
]
pn_phase_order
=
waveform_kwargs
[
'
pn_phase_order
'
]
...
...
@@ -354,21 +360,24 @@ def _base_lal_cbc_fd_waveform(
start_frequency
,
maximum_frequency
,
reference_frequency
,
waveform_dictionary
,
approximant
)
except
Exception
as
e
:
EDOM
=
(
e
.
args
[
0
]
==
'
Internal function call failed: Input domain error
'
)
if
EDOM
:
failed_parameters
=
dict
(
mass_1
=
mass_1
,
mass_2
=
mass_2
,
spin_1
=
(
spin_1x
,
spin_2y
,
spin_1z
),
spin_2
=
(
spin_2x
,
spin_2y
,
spin_2z
),
luminosity_distance
=
luminosity_distance
,
iota
=
iota
,
phase
=
phase
,
eccentricity
=
eccentricity
,
start_frequency
=
start_frequency
)
logger
.
warning
(
"
Evaluating the waveform failed with error: {}
\n
"
.
format
(
e
)
+
"
The parameters were {}
\n
"
.
format
(
failed_parameters
)
+
"
Likelihood will be set to -inf.
"
)
return
None
else
:
if
not
catch_waveform_errors
:
raise
else
:
EDOM
=
(
e
.
args
[
0
]
==
'
Internal function call failed: Input domain error
'
)
if
EDOM
:
failed_parameters
=
dict
(
mass_1
=
mass_1
,
mass_2
=
mass_2
,
spin_1
=
(
spin_1x
,
spin_2y
,
spin_1z
),
spin_2
=
(
spin_2x
,
spin_2y
,
spin_2z
),
luminosity_distance
=
luminosity_distance
,
iota
=
iota
,
phase
=
phase
,
eccentricity
=
eccentricity
,
start_frequency
=
start_frequency
)
logger
.
warning
(
"
Evaluating the waveform failed with error: {}
\n
"
.
format
(
e
)
+
"
The parameters were {}
\n
"
.
format
(
failed_parameters
)
+
"
Likelihood will be set to -inf.
"
)
return
None
else
:
raise
h_plus
=
np
.
zeros_like
(
frequency_array
,
dtype
=
np
.
complex
)
h_cross
=
np
.
zeros_like
(
frequency_array
,
dtype
=
np
.
complex
)
...
...
This diff is collapsed.
Click to expand it.
test/gw_source_test.py
+
1
−
1
View file @
63222892
...
...
@@ -16,7 +16,7 @@ class TestLalBBH(unittest.TestCase):
theta_jn
=
0.3
,
phase
=
0.0
)
self
.
waveform_kwargs
=
dict
(
waveform_approximant
=
'
IMRPhenomPv2
'
,
reference_frequency
=
50.0
,
minimum_frequency
=
20.0
)
minimum_frequency
=
20.0
,
catch_waveform_errors
=
True
)
self
.
frequency_array
=
bilby
.
core
.
utils
.
create_frequency_series
(
2048
,
4
)
def
tearDown
(
self
):
...
...
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