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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Pep Covas Vidal
PyFstat
Commits
57f1968e
Commit
57f1968e
authored
Jan 31, 2017
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):
...
@@ -151,8 +151,8 @@ class ComputeFstat(object):
def
__init__
(
self
,
tref
,
sftfilepath
=
None
,
minStartTime
=
None
,
def
__init__
(
self
,
tref
,
sftfilepath
=
None
,
minStartTime
=
None
,
maxStartTime
=
None
,
binary
=
False
,
transient
=
True
,
BSGL
=
False
,
maxStartTime
=
None
,
binary
=
False
,
transient
=
True
,
BSGL
=
False
,
detector
=
None
,
minCoverFreq
=
None
,
maxCoverFreq
=
None
,
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
Parameters
----------
----------
...
@@ -180,6 +180,10 @@ class ComputeFstat(object):
...
@@ -180,6 +180,10 @@ class ComputeFstat(object):
Paths of the two files containing positions of Earth and Sun,
Paths of the two files containing positions of Earth and Sun,
respectively at evenly spaced times, as passed to CreateFstatInput.
respectively at evenly spaced times, as passed to CreateFstatInput.
If None defaults defined in BaseSearchClass will be used.
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):
...
@@ -250,7 +254,14 @@ class ComputeFstat(object):
FstatOAs
.
runningMedianWindow
=
lalpulsar
.
FstatOptionalArgsDefaults
.
runningMedianWindow
FstatOAs
.
runningMedianWindow
=
lalpulsar
.
FstatOptionalArgsDefaults
.
runningMedianWindow
FstatOAs
.
FstatMethod
=
lalpulsar
.
FstatOptionalArgsDefaults
.
FstatMethod
FstatOAs
.
FstatMethod
=
lalpulsar
.
FstatOptionalArgsDefaults
.
FstatMethod
FstatOAs
.
InjectSqrtSX
=
lalpulsar
.
FstatOptionalArgsDefaults
.
injectSqrtSX
FstatOAs
.
InjectSqrtSX
=
lalpulsar
.
FstatOptionalArgsDefaults
.
injectSqrtSX
if
self
.
assumeSqrtSX
is
None
:
FstatOAs
.
assumeSqrtSX
=
lalpulsar
.
FstatOptionalArgsDefaults
.
assumeSqrtSX
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
.
prevInput
=
lalpulsar
.
FstatOptionalArgsDefaults
.
prevInput
FstatOAs
.
collectTiming
=
lalpulsar
.
FstatOptionalArgsDefaults
.
collectTiming
FstatOAs
.
collectTiming
=
lalpulsar
.
FstatOptionalArgsDefaults
.
collectTiming
...
@@ -460,7 +471,7 @@ class SemiCoherentSearch(BaseSearchClass, ComputeFstat):
...
@@ -460,7 +471,7 @@ class SemiCoherentSearch(BaseSearchClass, ComputeFstat):
binary
=
False
,
BSGL
=
False
,
minStartTime
=
None
,
binary
=
False
,
BSGL
=
False
,
minStartTime
=
None
,
maxStartTime
=
None
,
minCoverFreq
=
None
,
maxCoverFreq
=
None
,
maxStartTime
=
None
,
minCoverFreq
=
None
,
maxCoverFreq
=
None
,
detector
=
None
,
earth_ephem
=
None
,
sun_ephem
=
None
,
detector
=
None
,
earth_ephem
=
None
,
sun_ephem
=
None
,
injectSources
=
None
):
injectSources
=
None
,
assumeSqrtSX
=
None
):
"""
"""
Parameters
Parameters
----------
----------
...
@@ -570,7 +581,7 @@ class SemiCoherentGlitchSearch(BaseSearchClass, ComputeFstat):
...
@@ -570,7 +581,7 @@ class SemiCoherentGlitchSearch(BaseSearchClass, ComputeFstat):
@helper_functions.initializer
@helper_functions.initializer
def
__init__
(
self
,
label
,
outdir
,
tref
,
minStartTime
,
maxStartTime
,
def
__init__
(
self
,
label
,
outdir
,
tref
,
minStartTime
,
maxStartTime
,
nglitch
=
0
,
sftfilepath
=
None
,
theta0_idx
=
0
,
BSGL
=
False
,
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
):
detector
=
None
,
earth_ephem
=
None
,
sun_ephem
=
None
):
"""
"""
Parameters
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
...
@@ -13,7 +13,8 @@ import emcee
import
corner
import
corner
import
dill
as
pickle
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
core
import
tqdm
,
args
,
earth_ephem
,
sun_ephem
from
optimal_setup_functions
import
get_optimal_setup
from
optimal_setup_functions
import
get_optimal_setup
import
helper_functions
import
helper_functions
...
@@ -28,7 +29,7 @@ class MCMCSearch(BaseSearchClass):
...
@@ -28,7 +29,7 @@ class MCMCSearch(BaseSearchClass):
theta_initial
=
None
,
scatter_val
=
1e-10
,
theta_initial
=
None
,
scatter_val
=
1e-10
,
binary
=
False
,
BSGL
=
False
,
minCoverFreq
=
None
,
binary
=
False
,
BSGL
=
False
,
minCoverFreq
=
None
,
maxCoverFreq
=
None
,
detector
=
None
,
earth_ephem
=
None
,
maxCoverFreq
=
None
,
detector
=
None
,
earth_ephem
=
None
,
sun_ephem
=
None
,
injectSources
=
None
):
sun_ephem
=
None
,
injectSources
=
None
,
assumeSqrtSX
=
None
):
"""
"""
Parameters
Parameters
label, outdir: str
label, outdir: str
...
@@ -113,7 +114,8 @@ class MCMCSearch(BaseSearchClass):
...
@@ -113,7 +114,8 @@ class MCMCSearch(BaseSearchClass):
earth_ephem
=
self
.
earth_ephem
,
sun_ephem
=
self
.
sun_ephem
,
earth_ephem
=
self
.
earth_ephem
,
sun_ephem
=
self
.
sun_ephem
,
detector
=
self
.
detector
,
BSGL
=
self
.
BSGL
,
transient
=
False
,
detector
=
self
.
detector
,
BSGL
=
self
.
BSGL
,
transient
=
False
,
minStartTime
=
self
.
minStartTime
,
maxStartTime
=
self
.
maxStartTime
,
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
):
def
logp
(
self
,
theta_vals
,
theta_prior
,
theta_keys
,
search
):
H
=
[
self
.
generic_lnprior
(
**
theta_prior
[
key
])(
p
)
for
p
,
key
in
H
=
[
self
.
generic_lnprior
(
**
theta_prior
[
key
])(
p
)
for
p
,
key
in
...
@@ -1247,7 +1249,7 @@ class MCMCSemiCoherentSearch(MCMCSearch):
...
@@ -1247,7 +1249,7 @@ class MCMCSemiCoherentSearch(MCMCSearch):
scatter_val
=
1e-10
,
detector
=
None
,
BSGL
=
False
,
scatter_val
=
1e-10
,
detector
=
None
,
BSGL
=
False
,
minStartTime
=
None
,
maxStartTime
=
None
,
minCoverFreq
=
None
,
minStartTime
=
None
,
maxStartTime
=
None
,
minCoverFreq
=
None
,
maxCoverFreq
=
None
,
earth_ephem
=
None
,
sun_ephem
=
None
,
maxCoverFreq
=
None
,
earth_ephem
=
None
,
sun_ephem
=
None
,
injectSources
=
None
):
injectSources
=
None
,
assumeSqrtSX
=
None
):
"""
"""
"""
"""
...
@@ -1284,7 +1286,7 @@ class MCMCSemiCoherentSearch(MCMCSearch):
...
@@ -1284,7 +1286,7 @@ class MCMCSemiCoherentSearch(MCMCSearch):
maxStartTime
=
self
.
maxStartTime
,
minCoverFreq
=
self
.
minCoverFreq
,
maxStartTime
=
self
.
maxStartTime
,
minCoverFreq
=
self
.
minCoverFreq
,
maxCoverFreq
=
self
.
maxCoverFreq
,
detector
=
self
.
detector
,
maxCoverFreq
=
self
.
maxCoverFreq
,
detector
=
self
.
detector
,
earth_ephem
=
self
.
earth_ephem
,
sun_ephem
=
self
.
sun_ephem
,
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
):
def
logp
(
self
,
theta_vals
,
theta_prior
,
theta_keys
,
search
):
H
=
[
self
.
generic_lnprior
(
**
theta_prior
[
key
])(
p
)
for
p
,
key
in
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):
...
@@ -105,6 +105,23 @@ class TestComputeFstat(Test):
print
predicted_FS
,
FS
print
predicted_FS
,
FS
self
.
assertTrue
(
np
.
abs
(
predicted_FS
-
FS
)
/
FS
<
0.2
)
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
):
class
TestSemiCoherentGlitchSearch
(
Test
):
label
=
"
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