Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PyFstat
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
David Keitel
PyFstat
Commits
57f1968e
Commit
57f1968e
authored
8 years ago
by
Gregory Ashton
Browse files
Options
Downloads
Patches
Plain Diff
Exposes assumeSqrtSX functionality
parent
921cc823
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
pyfstat/core.py
+16
-5
16 additions, 5 deletions
pyfstat/core.py
pyfstat/mcmc_based_searches.py
+7
-5
7 additions, 5 deletions
pyfstat/mcmc_based_searches.py
tests.py
+17
-0
17 additions, 0 deletions
tests.py
with
40 additions
and
10 deletions
pyfstat/core.py
+
16
−
5
View file @
57f1968e
...
...
@@ -151,8 +151,8 @@ class ComputeFstat(object):
def
__init__
(
self
,
tref
,
sftfilepath
=
None
,
minStartTime
=
None
,
maxStartTime
=
None
,
binary
=
False
,
transient
=
True
,
BSGL
=
False
,
detector
=
None
,
minCoverFreq
=
None
,
maxCoverFreq
=
None
,
earth_ephem
=
None
,
sun_ephem
=
None
,
injectSources
=
None
):
earth_ephem
=
None
,
sun_ephem
=
None
,
injectSources
=
None
,
assumeSqrtSX
=
None
):
"""
Parameters
----------
...
...
@@ -180,6 +180,10 @@ class ComputeFstat(object):
Paths of the two files containing positions of Earth and Sun,
respectively at evenly spaced times, as passed to CreateFstatInput.
If None defaults defined in BaseSearchClass will be used.
assumeSqrtSX: float
Don
'
t estimate noise-floors but assume (stationary) per-IFO
sqrt{SX} (if single value: use for all IFOs). If signal only,
set sqrtSX=1
"""
...
...
@@ -250,7 +254,14 @@ class ComputeFstat(object):
FstatOAs
.
runningMedianWindow
=
lalpulsar
.
FstatOptionalArgsDefaults
.
runningMedianWindow
FstatOAs
.
FstatMethod
=
lalpulsar
.
FstatOptionalArgsDefaults
.
FstatMethod
FstatOAs
.
InjectSqrtSX
=
lalpulsar
.
FstatOptionalArgsDefaults
.
injectSqrtSX
if
self
.
assumeSqrtSX
is
None
:
FstatOAs
.
assumeSqrtSX
=
lalpulsar
.
FstatOptionalArgsDefaults
.
assumeSqrtSX
else
:
mnf
=
lalpulsar
.
MultiNoiseFloor
()
assumeSqrtSX
=
np
.
atleast_1d
(
self
.
assumeSqrtSX
)
mnf
.
sqrtSn
[:
len
(
assumeSqrtSX
)]
=
assumeSqrtSX
mnf
.
length
=
len
(
assumeSqrtSX
)
FstatOAs
.
assumeSqrtSX
=
mnf
FstatOAs
.
prevInput
=
lalpulsar
.
FstatOptionalArgsDefaults
.
prevInput
FstatOAs
.
collectTiming
=
lalpulsar
.
FstatOptionalArgsDefaults
.
collectTiming
...
...
@@ -460,7 +471,7 @@ class SemiCoherentSearch(BaseSearchClass, ComputeFstat):
binary
=
False
,
BSGL
=
False
,
minStartTime
=
None
,
maxStartTime
=
None
,
minCoverFreq
=
None
,
maxCoverFreq
=
None
,
detector
=
None
,
earth_ephem
=
None
,
sun_ephem
=
None
,
injectSources
=
None
):
injectSources
=
None
,
assumeSqrtSX
=
None
):
"""
Parameters
----------
...
...
@@ -570,7 +581,7 @@ class SemiCoherentGlitchSearch(BaseSearchClass, ComputeFstat):
@helper_functions.initializer
def
__init__
(
self
,
label
,
outdir
,
tref
,
minStartTime
,
maxStartTime
,
nglitch
=
0
,
sftfilepath
=
None
,
theta0_idx
=
0
,
BSGL
=
False
,
minCoverFreq
=
None
,
maxCoverFreq
=
None
,
minCoverFreq
=
None
,
maxCoverFreq
=
None
,
assumeSqrtSX
=
None
,
detector
=
None
,
earth_ephem
=
None
,
sun_ephem
=
None
):
"""
Parameters
...
...
This diff is collapsed.
Click to expand it.
pyfstat/mcmc_based_searches.py
+
7
−
5
View file @
57f1968e
...
...
@@ -13,7 +13,8 @@ import emcee
import
corner
import
dill
as
pickle
from
core
import
BaseSearchClass
,
ComputeFstat
from
core
import
BaseSearchClass
,
ComputeFstat
,
SemiCoherentSearch
from
optimal_setup_functions
import
get_V_estimate
from
core
import
tqdm
,
args
,
earth_ephem
,
sun_ephem
from
optimal_setup_functions
import
get_optimal_setup
import
helper_functions
...
...
@@ -28,7 +29,7 @@ class MCMCSearch(BaseSearchClass):
theta_initial
=
None
,
scatter_val
=
1e-10
,
binary
=
False
,
BSGL
=
False
,
minCoverFreq
=
None
,
maxCoverFreq
=
None
,
detector
=
None
,
earth_ephem
=
None
,
sun_ephem
=
None
,
injectSources
=
None
):
sun_ephem
=
None
,
injectSources
=
None
,
assumeSqrtSX
=
None
):
"""
Parameters
label, outdir: str
...
...
@@ -113,7 +114,8 @@ class MCMCSearch(BaseSearchClass):
earth_ephem
=
self
.
earth_ephem
,
sun_ephem
=
self
.
sun_ephem
,
detector
=
self
.
detector
,
BSGL
=
self
.
BSGL
,
transient
=
False
,
minStartTime
=
self
.
minStartTime
,
maxStartTime
=
self
.
maxStartTime
,
binary
=
self
.
binary
,
injectSources
=
self
.
injectSources
)
binary
=
self
.
binary
,
injectSources
=
self
.
injectSources
,
assumeSqrtSX
=
self
.
assumeSqrtSX
)
def
logp
(
self
,
theta_vals
,
theta_prior
,
theta_keys
,
search
):
H
=
[
self
.
generic_lnprior
(
**
theta_prior
[
key
])(
p
)
for
p
,
key
in
...
...
@@ -1247,7 +1249,7 @@ class MCMCSemiCoherentSearch(MCMCSearch):
scatter_val
=
1e-10
,
detector
=
None
,
BSGL
=
False
,
minStartTime
=
None
,
maxStartTime
=
None
,
minCoverFreq
=
None
,
maxCoverFreq
=
None
,
earth_ephem
=
None
,
sun_ephem
=
None
,
injectSources
=
None
):
injectSources
=
None
,
assumeSqrtSX
=
None
):
"""
"""
...
...
@@ -1284,7 +1286,7 @@ class MCMCSemiCoherentSearch(MCMCSearch):
maxStartTime
=
self
.
maxStartTime
,
minCoverFreq
=
self
.
minCoverFreq
,
maxCoverFreq
=
self
.
maxCoverFreq
,
detector
=
self
.
detector
,
earth_ephem
=
self
.
earth_ephem
,
sun_ephem
=
self
.
sun_ephem
,
injectSources
=
self
.
injectSources
)
injectSources
=
self
.
injectSources
,
assumeSqrtSX
=
self
.
assumeSqrtSX
)
def
logp
(
self
,
theta_vals
,
theta_prior
,
theta_keys
,
search
):
H
=
[
self
.
generic_lnprior
(
**
theta_prior
[
key
])(
p
)
for
p
,
key
in
...
...
This diff is collapsed.
Click to expand it.
tests.py
+
17
−
0
View file @
57f1968e
...
...
@@ -105,6 +105,23 @@ class TestComputeFstat(Test):
print
predicted_FS
,
FS
self
.
assertTrue
(
np
.
abs
(
predicted_FS
-
FS
)
/
FS
<
0.2
)
def
run_computefstatistic_single_point_no_noise
(
self
):
Writer
=
pyfstat
.
Writer
(
self
.
label
,
outdir
=
outdir
,
add_noise
=
False
)
Writer
.
make_data
()
predicted_FS
=
Writer
.
predict_fstat
()
search
=
pyfstat
.
ComputeFstat
(
tref
=
Writer
.
tref
,
assumeSqrtSX
=
1
,
sftfilepath
=
'
{}/*{}*sft
'
.
format
(
Writer
.
outdir
,
Writer
.
label
))
FS
=
search
.
run_computefstatistic_single_point
(
Writer
.
tstart
,
Writer
.
tend
,
Writer
.
F0
,
Writer
.
F1
,
Writer
.
F2
,
Writer
.
Alpha
,
Writer
.
Delta
)
print
predicted_FS
,
FS
self
.
assertTrue
(
np
.
abs
(
predicted_FS
-
FS
)
/
FS
<
0.2
)
class
TestSemiCoherentGlitchSearch
(
Test
):
label
=
"
Test
"
...
...
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