Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
gstlal
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Duncan Macleod
gstlal
Commits
3a617f02
Commit
3a617f02
authored
6 years ago
by
Heather Fong
Browse files
Options
Downloads
Patches
Plain Diff
inspiral_intrinsics.py: added template_id capability for banks with nonsequential event ids
parent
01808b12
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gstlal-inspiral/python/stats/inspiral_intrinsics.py
+14
-1
14 additions, 1 deletion
gstlal-inspiral/python/stats/inspiral_intrinsics.py
with
14 additions
and
1 deletion
gstlal-inspiral/python/stats/inspiral_intrinsics.py
+
14
−
1
View file @
3a617f02
...
...
@@ -114,6 +114,11 @@ class SourcePopulationModel(object):
with
h5py
.
File
(
filename
,
'
r
'
)
as
model
:
coefficients
=
model
[
'
coefficients
'
].
value
snr_bp
=
model
[
'
SNR
'
].
value
try
:
model_ids
=
model
[
'
event_id
'
].
value
except
KeyError
:
# FIXME: assume sequential order if model['event_id'] doesn't exist
model_ids
=
np
.
arange
(
1
,
np
.
shape
(
f
[
'
coefficients
'
].
value
)[
-
1
]
+
1
)
# PPoly can construct an array of polynomials by just
# feeding it the coefficients array all in one go, but then
# it insists on evaluating all of them at once. we don't
...
...
@@ -122,7 +127,15 @@ class SourcePopulationModel(object):
# just one. since we have to do this anyway, we use a
# dictionary to also solve the problem of mapping
# template_id to a specific polynomial
self
.
polys
=
dict
((
template_id
,
PPoly
(
coefficients
[:,:,[
template_id
]],
snr_bp
))
for
template_id
in
template_ids
)
template_indices
=
{}
for
template_id
in
template_ids
:
# maps template ID to the right coefficient array, since template IDs
# in the bank may not be in sequential order
try
:
template_indices
[
template_id
]
=
np
.
where
(
model_ids
==
template_id
)[
0
][
0
]
except
KeyError
:
raise
KeyError
(
"
template ID %d is not in this model
"
%
template_id
)
self
.
polys
=
dict
((
template_id
,
PPoly
(
coefficients
[:,:,[
template_indices
[
template_id
]]],
snr_bp
))
for
template_id
in
template_ids
)
self
.
max_snr
=
snr_bp
.
max
()
else
:
self
.
polys
=
None
...
...
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