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
9dd54b8e
Commit
9dd54b8e
authored
3 years ago
by
Colm Talbot
Committed by
Gregory Ashton
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
add raise_error to network
parent
6cf9a859
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1041
add raise_error to network
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bilby/gw/detector/networks.py
+16
-2
16 additions, 2 deletions
bilby/gw/detector/networks.py
test/gw/detector/networks_test.py
+2
-2
2 additions, 2 deletions
test/gw/detector/networks_test.py
with
18 additions
and
4 deletions
bilby/gw/detector/networks.py
+
16
−
2
View file @
9dd54b8e
...
@@ -109,7 +109,13 @@ class InterferometerList(list):
...
@@ -109,7 +109,13 @@ class InterferometerList(list):
duration
=
duration
,
duration
=
duration
,
start_time
=
start_time
)
start_time
=
start_time
)
def
inject_signal
(
self
,
parameters
=
None
,
injection_polarizations
=
None
,
waveform_generator
=
None
):
def
inject_signal
(
self
,
parameters
=
None
,
injection_polarizations
=
None
,
waveform_generator
=
None
,
raise_error
=
True
,
):
"""
Inject a signal into noise in each of the three detectors.
"""
Inject a signal into noise in each of the three detectors.
Parameters
Parameters
...
@@ -124,6 +130,9 @@ class InterferometerList(list):
...
@@ -124,6 +130,9 @@ class InterferometerList(list):
waveform_generator: bilby.gw.waveform_generator.WaveformGenerator
waveform_generator: bilby.gw.waveform_generator.WaveformGenerator
A WaveformGenerator instance using the source model to inject. If
A WaveformGenerator instance using the source model to inject. If
`injection_polarizations` is given, this will be ignored.
`injection_polarizations` is given, this will be ignored.
raise_error: bool
Whether to raise an error if the injected signal does not fit in
the segment.
Notes
Notes
==========
==========
...
@@ -148,7 +157,12 @@ class InterferometerList(list):
...
@@ -148,7 +157,12 @@ class InterferometerList(list):
all_injection_polarizations
=
list
()
all_injection_polarizations
=
list
()
for
interferometer
in
self
:
for
interferometer
in
self
:
all_injection_polarizations
.
append
(
all_injection_polarizations
.
append
(
interferometer
.
inject_signal
(
parameters
=
parameters
,
injection_polarizations
=
injection_polarizations
))
interferometer
.
inject_signal
(
parameters
=
parameters
,
injection_polarizations
=
injection_polarizations
,
raise_error
=
raise_error
,
)
)
return
all_injection_polarizations
return
all_injection_polarizations
...
...
This diff is collapsed.
Click to expand it.
test/gw/detector/networks_test.py
+
2
−
2
View file @
9dd54b8e
...
@@ -240,8 +240,8 @@ class TestInterferometerList(unittest.TestCase):
...
@@ -240,8 +240,8 @@ class TestInterferometerList(unittest.TestCase):
@patch.object
(
bilby
.
gw
.
detector
.
Interferometer
,
"
inject_signal
"
)
@patch.object
(
bilby
.
gw
.
detector
.
Interferometer
,
"
inject_signal
"
)
def
test_inject_signal_with_inj_pol
(
self
,
m
):
def
test_inject_signal_with_inj_pol
(
self
,
m
):
self
.
ifo_list
.
inject_signal
(
injection_polarizations
=
dict
(
plus
=
1
))
self
.
ifo_list
.
inject_signal
(
injection_polarizations
=
dict
(
plus
=
1
)
,
raise_error
=
False
)
m
.
assert_called_with
(
parameters
=
None
,
injection_polarizations
=
dict
(
plus
=
1
))
m
.
assert_called_with
(
parameters
=
None
,
injection_polarizations
=
dict
(
plus
=
1
)
,
raise_error
=
False
)
self
.
assertEqual
(
len
(
self
.
ifo_list
),
m
.
call_count
)
self
.
assertEqual
(
len
(
self
.
ifo_list
),
m
.
call_count
)
@patch.object
(
bilby
.
gw
.
detector
.
Interferometer
,
"
inject_signal
"
)
@patch.object
(
bilby
.
gw
.
detector
.
Interferometer
,
"
inject_signal
"
)
...
...
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