Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GstLAL
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
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
GstLAL
Commits
10e1a0c7
Commit
10e1a0c7
authored
9 years ago
by
Chad Hanna
Browse files
Options
Downloads
Patches
Plain Diff
Revert "far.py: don't convolve snr,chi numerators with KDE"
This reverts commit
fef0db69
.
parent
8b208925
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/far.py
+25
-38
25 additions, 38 deletions
gstlal-inspiral/python/far.py
with
25 additions
and
38 deletions
gstlal-inspiral/python/far.py
+
25
−
38
View file @
10e1a0c7
...
...
@@ -934,16 +934,10 @@ class ThincaCoincParamsDistributions(snglcoinc.CoincParamsDistributions):
progressbar
.
increment
()
new_binarr
.
array
[
snrindices
,
rcossindices
]
+=
ncx2pdf
(
snrchi2
,
df
,
numpy
.
array
([
pf
*
snrs2
]).
T
)
# apply a bit of smoothing (5 bins in each
# direction) to soften the stair steps caused by
# the limited set of discrete prefactors
rate
.
filter_array
(
new_binarr
.
array
,
rate
.
gaussian_window
(
5.
,
5.
,
sigma
=
10.
))
# Add an SNR power law in with the differentials
dsnrdchi2
=
numpy
.
outer
(
dsnr
/
snr
**
inv_snr_pow
,
drcoss
)
new_binarr
.
array
[
snrindices
,
rcossindices
]
*=
dsnrdchi2
new_binarr
.
array
[
snrindices
,
rcossindices
]
*=
number_of_events
/
new_binarr
.
array
.
sum
()
# add to raw counts
binarr
+=
new_binarr
...
...
@@ -1130,38 +1124,31 @@ class ThincaCoincParamsDistributions(snglcoinc.CoincParamsDistributions):
def
pdf_from_rates_snrchi2
(
self
,
key
,
pdf_dict
,
snr_kernel_width_at_8
=
10.
,
chisq_kernel_width
=
0.1
,
sigma
=
10.
):
# get the binned array we're going to process
binnedarray
=
pdf_dict
[
key
]
# if this is not the numerator, convolve with density
# estimation kernel (numerator is known analytically).
if
pdf_dict
is
not
self
.
injection_pdf
:
# total number of samples. be conservative and
# assume only 1 in 10 samples are independent.
numsamples
=
binnedarray
.
array
.
sum
()
/
10.
+
1.
# construct the density estimation kernel. apply
# Silverman's rule so that the width scales with
# numsamples**(-1./6.) for a 2D PDF. don't let the
# kernel get smaller than the 2.5 times the bin
# size.
snr_bins
=
binnedarray
.
bins
[
0
]
chisq_bins
=
binnedarray
.
bins
[
1
]
snr_per_bin_at_8
=
(
snr_bins
.
upper
()
-
snr_bins
.
lower
())[
snr_bins
[
8.
]]
chisq_per_bin_at_0_02
=
(
chisq_bins
.
upper
()
-
chisq_bins
.
lower
())[
chisq_bins
[
0.02
]]
snr_kernel_bins
=
snr_kernel_width_at_8
/
snr_per_bin_at_8
/
numsamples
**
(
1.
/
6.
)
chisq_kernel_bins
=
chisq_kernel_width
/
chisq_per_bin_at_0_02
/
numsamples
**
(
1.
/
6.
)
if
snr_kernel_bins
<
2.5
:
snr_kernel_bins
=
2.5
warnings
.
warn
(
"
Replacing snr kernel bins with 2.5
"
)
if
chisq_kernel_bins
<
2.5
:
chisq_kernel_bins
=
2.5
warnings
.
warn
(
"
Replacing chisq kernel bins with 2.5
"
)
kernel
=
rate
.
gaussian_window
(
snr_kernel_bins
,
chisq_kernel_bins
,
sigma
=
sigma
)
# convolve with the bin count data
rate
.
filter_array
(
binnedarray
.
array
,
kernel
)
numsamples
=
binnedarray
.
array
.
sum
()
/
10.
+
1.
# Be extremely conservative and assume only 1 in 10 samples are independent.
# construct the density estimation kernel
snr_bins
=
binnedarray
.
bins
[
0
]
chisq_bins
=
binnedarray
.
bins
[
1
]
snr_per_bin_at_8
=
(
snr_bins
.
upper
()
-
snr_bins
.
lower
())[
snr_bins
[
8.
]]
chisq_per_bin_at_0_02
=
(
chisq_bins
.
upper
()
-
chisq_bins
.
lower
())[
chisq_bins
[
0.02
]]
# Apply Silverman's rule so that the width scales with numsamples**(-1./6.) for a 2D PDF
snr_kernel_bins
=
snr_kernel_width_at_8
/
snr_per_bin_at_8
/
numsamples
**
(
1.
/
6.
)
chisq_kernel_bins
=
chisq_kernel_width
/
chisq_per_bin_at_0_02
/
numsamples
**
(
1.
/
6.
)
# check the size of the kernel. We don't ever let it get
# smaller than the 2.5 times the bin size
if
snr_kernel_bins
<
2.5
:
snr_kernel_bins
=
2.5
warnings
.
warn
(
"
Replacing snr kernel bins with 2.5
"
)
if
chisq_kernel_bins
<
2.5
:
chisq_kernel_bins
=
2.5
warnings
.
warn
(
"
Replacing chisq kernel bins with 2.5
"
)
# Compute the KDE
kernel
=
rate
.
gaussian_window
(
snr_kernel_bins
,
chisq_kernel_bins
,
sigma
=
sigma
)
# convolve with the bin count data
rate
.
filter_array
(
binnedarray
.
array
,
kernel
)
# zero everything below the SNR cut-off. need to do the
# slicing ourselves to avoid zeroing the at-threshold bin
...
...
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