Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Pep Covas Vidal
PyFstat
Commits
a2acfcff
Commit
a2acfcff
authored
Jul 01, 2019
by
Reinhard Prix
Browse files
apply 'black' coding style (stricter subset of PEP8)
- supply consistent flake8 settings in setup.cfg
parent
96e1046c
Changes
30
Expand all
Hide whitespace changes
Inline
Side-by-side
examples/MCMC_examples/fully_coherent_search_using_MCMC.py
View file @
a2acfcff
...
@@ -4,7 +4,7 @@ import numpy as np
...
@@ -4,7 +4,7 @@ import numpy as np
# Properties of the GW data
# Properties of the GW data
sqrtSX
=
1e-23
sqrtSX
=
1e-23
tstart
=
1000000000
tstart
=
1000000000
duration
=
100
*
86400
duration
=
100
*
86400
tend
=
tstart
+
duration
tend
=
tstart
+
duration
# Properties of the signal
# Properties of the signal
...
@@ -13,39 +13,46 @@ F1 = -1e-10
...
@@ -13,39 +13,46 @@ F1 = -1e-10
F2
=
0
F2
=
0
Alpha
=
np
.
radians
(
83.6292
)
Alpha
=
np
.
radians
(
83.6292
)
Delta
=
np
.
radians
(
22.0144
)
Delta
=
np
.
radians
(
22.0144
)
tref
=
.
5
*
(
tstart
+
tend
)
tref
=
0
.5
*
(
tstart
+
tend
)
depth
=
10
depth
=
10
h0
=
sqrtSX
/
depth
h0
=
sqrtSX
/
depth
label
=
'
fully_coherent_search_using_MCMC
'
label
=
"
fully_coherent_search_using_MCMC
"
outdir
=
'
data
'
outdir
=
"
data
"
data
=
pyfstat
.
Writer
(
data
=
pyfstat
.
Writer
(
label
=
label
,
outdir
=
outdir
,
tref
=
tref
,
label
=
label
,
tstart
=
tstart
,
F0
=
F0
,
F1
=
F1
,
F2
=
F2
,
duration
=
duration
,
Alpha
=
Alpha
,
outdir
=
outdir
,
Delta
=
Delta
,
h0
=
h0
,
sqrtSX
=
sqrtSX
)
tref
=
tref
,
tstart
=
tstart
,
F0
=
F0
,
F1
=
F1
,
F2
=
F2
,
duration
=
duration
,
Alpha
=
Alpha
,
Delta
=
Delta
,
h0
=
h0
,
sqrtSX
=
sqrtSX
,
)
data
.
make_data
()
data
.
make_data
()
# The predicted twoF, given by lalapps_predictFstat can be accessed by
# The predicted twoF, given by lalapps_predictFstat can be accessed by
twoF
=
data
.
predict_fstat
()
twoF
=
data
.
predict_fstat
()
print
(
'
Predicted twoF value: {}
\n
'
.
format
(
twoF
))
print
(
"
Predicted twoF value: {}
\n
"
.
format
(
twoF
))
DeltaF0
=
1e-7
DeltaF0
=
1e-7
DeltaF1
=
1e-13
DeltaF1
=
1e-13
VF0
=
(
np
.
pi
*
duration
*
DeltaF0
)
**
2
/
3.0
VF0
=
(
np
.
pi
*
duration
*
DeltaF0
)
**
2
/
3.0
VF1
=
(
np
.
pi
*
duration
**
2
*
DeltaF1
)
**
2
*
4
/
45.
VF1
=
(
np
.
pi
*
duration
**
2
*
DeltaF1
)
**
2
*
4
/
45.
0
print
(
'
\n
V={:1.2e}, VF0={:1.2e}, VF1={:1.2e}
\n
'
.
format
(
VF0
*
VF1
,
VF0
,
VF1
))
print
(
"
\n
V={:1.2e}, VF0={:1.2e}, VF1={:1.2e}
\n
"
.
format
(
VF0
*
VF1
,
VF0
,
VF1
))
theta_prior
=
{
'F0'
:
{
'type'
:
'unif'
,
theta_prior
=
{
'lower'
:
F0
-
DeltaF0
/
2.
,
"F0"
:
{
"type"
:
"unif"
,
"lower"
:
F0
-
DeltaF0
/
2.0
,
"upper"
:
F0
+
DeltaF0
/
2.0
},
'upper'
:
F0
+
DeltaF0
/
2.
},
"F1"
:
{
"type"
:
"unif"
,
"lower"
:
F1
-
DeltaF1
/
2.0
,
"upper"
:
F1
+
DeltaF1
/
2.0
},
'F1'
:
{
'type'
:
'unif'
,
"F2"
:
F2
,
'lower'
:
F1
-
DeltaF1
/
2.
,
"Alpha"
:
Alpha
,
'upper'
:
F1
+
DeltaF1
/
2.
},
"Delta"
:
Delta
,
'F2'
:
F2
,
}
'Alpha'
:
Alpha
,
'Delta'
:
Delta
}
ntemps
=
2
ntemps
=
2
log10beta_min
=
-
0.5
log10beta_min
=
-
0.5
...
@@ -53,13 +60,22 @@ nwalkers = 100
...
@@ -53,13 +60,22 @@ nwalkers = 100
nsteps
=
[
300
,
300
]
nsteps
=
[
300
,
300
]
mcmc
=
pyfstat
.
MCMCSearch
(
mcmc
=
pyfstat
.
MCMCSearch
(
label
=
label
,
outdir
=
outdir
,
label
=
label
,
sftfilepattern
=
'{}/*{}*sft'
.
format
(
outdir
,
label
),
theta_prior
=
theta_prior
,
outdir
=
outdir
,
tref
=
tref
,
minStartTime
=
tstart
,
maxStartTime
=
tend
,
nsteps
=
nsteps
,
sftfilepattern
=
"{}/*{}*sft"
.
format
(
outdir
,
label
),
nwalkers
=
nwalkers
,
ntemps
=
ntemps
,
log10beta_min
=
log10beta_min
)
theta_prior
=
theta_prior
,
tref
=
tref
,
minStartTime
=
tstart
,
maxStartTime
=
tend
,
nsteps
=
nsteps
,
nwalkers
=
nwalkers
,
ntemps
=
ntemps
,
log10beta_min
=
log10beta_min
,
)
mcmc
.
transform_dictionary
=
dict
(
mcmc
.
transform_dictionary
=
dict
(
F0
=
dict
(
subtractor
=
F0
,
symbol
=
'$f-f^\mathrm{s}$'
),
F0
=
dict
(
subtractor
=
F0
,
symbol
=
"$f-f^\mathrm{s}$"
),
F1
=
dict
(
subtractor
=
F1
,
symbol
=
'$\dot{f}-\dot{f}^\mathrm{s}$'
))
F1
=
dict
(
subtractor
=
F1
,
symbol
=
"$\dot{f}-\dot{f}^\mathrm{s}$"
),
)
mcmc
.
run
()
mcmc
.
run
()
mcmc
.
plot_corner
(
add_prior
=
True
)
mcmc
.
plot_corner
(
add_prior
=
True
)
mcmc
.
print_summary
()
mcmc
.
print_summary
()
examples/MCMC_examples/semi_coherent_search_using_MCMC.py
View file @
a2acfcff
...
@@ -4,7 +4,7 @@ import numpy as np
...
@@ -4,7 +4,7 @@ import numpy as np
# Properties of the GW data
# Properties of the GW data
sqrtSX
=
1e-23
sqrtSX
=
1e-23
tstart
=
1000000000
tstart
=
1000000000
duration
=
100
*
86400
duration
=
100
*
86400
tend
=
tstart
+
duration
tend
=
tstart
+
duration
# Properties of the signal
# Properties of the signal
...
@@ -13,39 +13,46 @@ F1 = -1e-10
...
@@ -13,39 +13,46 @@ F1 = -1e-10
F2
=
0
F2
=
0
Alpha
=
np
.
radians
(
83.6292
)
Alpha
=
np
.
radians
(
83.6292
)
Delta
=
np
.
radians
(
22.0144
)
Delta
=
np
.
radians
(
22.0144
)
tref
=
.
5
*
(
tstart
+
tend
)
tref
=
0
.5
*
(
tstart
+
tend
)
depth
=
10
depth
=
10
h0
=
sqrtSX
/
depth
h0
=
sqrtSX
/
depth
label
=
'
semicoherent_search_using_MCMC
'
label
=
"
semicoherent_search_using_MCMC
"
outdir
=
'
data
'
outdir
=
"
data
"
data
=
pyfstat
.
Writer
(
data
=
pyfstat
.
Writer
(
label
=
label
,
outdir
=
outdir
,
tref
=
tref
,
label
=
label
,
tstart
=
tstart
,
F0
=
F0
,
F1
=
F1
,
F2
=
F2
,
duration
=
duration
,
Alpha
=
Alpha
,
outdir
=
outdir
,
Delta
=
Delta
,
h0
=
h0
,
sqrtSX
=
sqrtSX
)
tref
=
tref
,
tstart
=
tstart
,
F0
=
F0
,
F1
=
F1
,
F2
=
F2
,
duration
=
duration
,
Alpha
=
Alpha
,
Delta
=
Delta
,
h0
=
h0
,
sqrtSX
=
sqrtSX
,
)
data
.
make_data
()
data
.
make_data
()
# The predicted twoF, given by lalapps_predictFstat can be accessed by
# The predicted twoF, given by lalapps_predictFstat can be accessed by
twoF
=
data
.
predict_fstat
()
twoF
=
data
.
predict_fstat
()
print
(
'
Predicted twoF value: {}
\n
'
.
format
(
twoF
))
print
(
"
Predicted twoF value: {}
\n
"
.
format
(
twoF
))
DeltaF0
=
1e-7
DeltaF0
=
1e-7
DeltaF1
=
1e-13
DeltaF1
=
1e-13
VF0
=
(
np
.
pi
*
duration
*
DeltaF0
)
**
2
/
3.0
VF0
=
(
np
.
pi
*
duration
*
DeltaF0
)
**
2
/
3.0
VF1
=
(
np
.
pi
*
duration
**
2
*
DeltaF1
)
**
2
*
4
/
45.
VF1
=
(
np
.
pi
*
duration
**
2
*
DeltaF1
)
**
2
*
4
/
45.
0
print
(
'
\n
V={:1.2e}, VF0={:1.2e}, VF1={:1.2e}
\n
'
.
format
(
VF0
*
VF1
,
VF0
,
VF1
))
print
(
"
\n
V={:1.2e}, VF0={:1.2e}, VF1={:1.2e}
\n
"
.
format
(
VF0
*
VF1
,
VF0
,
VF1
))
theta_prior
=
{
'F0'
:
{
'type'
:
'unif'
,
theta_prior
=
{
'lower'
:
F0
-
DeltaF0
/
2.
,
"F0"
:
{
"type"
:
"unif"
,
"lower"
:
F0
-
DeltaF0
/
2.0
,
"upper"
:
F0
+
DeltaF0
/
2.0
},
'upper'
:
F0
+
DeltaF0
/
2.
},
"F1"
:
{
"type"
:
"unif"
,
"lower"
:
F1
-
DeltaF1
/
2.0
,
"upper"
:
F1
+
DeltaF1
/
2.0
},
'F1'
:
{
'type'
:
'unif'
,
"F2"
:
F2
,
'lower'
:
F1
-
DeltaF1
/
2.
,
"Alpha"
:
Alpha
,
'upper'
:
F1
+
DeltaF1
/
2.
},
"Delta"
:
Delta
,
'F2'
:
F2
,
}
'Alpha'
:
Alpha
,
'Delta'
:
Delta
}
ntemps
=
1
ntemps
=
1
log10beta_min
=
-
1
log10beta_min
=
-
1
...
@@ -53,14 +60,23 @@ nwalkers = 100
...
@@ -53,14 +60,23 @@ nwalkers = 100
nsteps
=
[
300
,
300
]
nsteps
=
[
300
,
300
]
mcmc
=
pyfstat
.
MCMCSemiCoherentSearch
(
mcmc
=
pyfstat
.
MCMCSemiCoherentSearch
(
label
=
label
,
outdir
=
outdir
,
nsegs
=
10
,
label
=
label
,
sftfilepattern
=
'{}/*{}*sft'
.
format
(
outdir
,
label
),
outdir
=
outdir
,
theta_prior
=
theta_prior
,
tref
=
tref
,
minStartTime
=
tstart
,
maxStartTime
=
tend
,
nsegs
=
10
,
nsteps
=
nsteps
,
nwalkers
=
nwalkers
,
ntemps
=
ntemps
,
sftfilepattern
=
"{}/*{}*sft"
.
format
(
outdir
,
label
),
log10beta_min
=
log10beta_min
)
theta_prior
=
theta_prior
,
tref
=
tref
,
minStartTime
=
tstart
,
maxStartTime
=
tend
,
nsteps
=
nsteps
,
nwalkers
=
nwalkers
,
ntemps
=
ntemps
,
log10beta_min
=
log10beta_min
,
)
mcmc
.
transform_dictionary
=
dict
(
mcmc
.
transform_dictionary
=
dict
(
F0
=
dict
(
subtractor
=
F0
,
symbol
=
'$f-f^\mathrm{s}$'
),
F0
=
dict
(
subtractor
=
F0
,
symbol
=
"$f-f^\mathrm{s}$"
),
F1
=
dict
(
subtractor
=
F1
,
symbol
=
'$\dot{f}-\dot{f}^\mathrm{s}$'
))
F1
=
dict
(
subtractor
=
F1
,
symbol
=
"$\dot{f}-\dot{f}^\mathrm{s}$"
),
)
mcmc
.
run
()
mcmc
.
run
()
mcmc
.
plot_corner
(
add_prior
=
True
)
mcmc
.
plot_corner
(
add_prior
=
True
)
mcmc
.
print_summary
()
mcmc
.
print_summary
()
examples/followup_examples/semi_coherent_directed_follow_up.py
View file @
a2acfcff
...
@@ -11,39 +11,47 @@ Delta = np.radians(22.0144)
...
@@ -11,39 +11,47 @@ Delta = np.radians(22.0144)
# Properties of the GW data
# Properties of the GW data
sqrtSX
=
1e-23
sqrtSX
=
1e-23
tstart
=
1000000000
tstart
=
1000000000
duration
=
100
*
86400
duration
=
100
*
86400
tend
=
tstart
+
duration
tend
=
tstart
+
duration
tref
=
.
5
*
(
tstart
+
tend
)
tref
=
0
.5
*
(
tstart
+
tend
)
depth
=
40
depth
=
40
label
=
'
semicoherent_directed_follow_up
'
label
=
"
semicoherent_directed_follow_up
"
outdir
=
'
data
'
outdir
=
"
data
"
h0
=
sqrtSX
/
depth
h0
=
sqrtSX
/
depth
data
=
pyfstat
.
Writer
(
data
=
pyfstat
.
Writer
(
label
=
label
,
outdir
=
outdir
,
tref
=
tref
,
tstart
=
tstart
,
F0
=
F0
,
F1
=
F1
,
label
=
label
,
F2
=
F2
,
duration
=
duration
,
Alpha
=
Alpha
,
Delta
=
Delta
,
h0
=
h0
,
sqrtSX
=
sqrtSX
)
outdir
=
outdir
,
tref
=
tref
,
tstart
=
tstart
,
F0
=
F0
,
F1
=
F1
,
F2
=
F2
,
duration
=
duration
,
Alpha
=
Alpha
,
Delta
=
Delta
,
h0
=
h0
,
sqrtSX
=
sqrtSX
,
)
data
.
make_data
()
data
.
make_data
()
# The predicted twoF, given by lalapps_predictFstat can be accessed by
# The predicted twoF, given by lalapps_predictFstat can be accessed by
twoF
=
data
.
predict_fstat
()
twoF
=
data
.
predict_fstat
()
print
(
'
Predicted twoF value: {}
\n
'
.
format
(
twoF
))
print
(
"
Predicted twoF value: {}
\n
"
.
format
(
twoF
))
# Search
# Search
VF0
=
VF1
=
1e5
VF0
=
VF1
=
1e5
DeltaF0
=
np
.
sqrt
(
VF0
)
*
np
.
sqrt
(
3
)
/
(
np
.
pi
*
duration
)
DeltaF0
=
np
.
sqrt
(
VF0
)
*
np
.
sqrt
(
3
)
/
(
np
.
pi
*
duration
)
DeltaF1
=
np
.
sqrt
(
VF1
)
*
np
.
sqrt
(
180
)
/
(
np
.
pi
*
duration
**
2
)
DeltaF1
=
np
.
sqrt
(
VF1
)
*
np
.
sqrt
(
180
)
/
(
np
.
pi
*
duration
**
2
)
theta_prior
=
{
'F0'
:
{
'type'
:
'unif'
,
theta_prior
=
{
'lower'
:
F0
-
DeltaF0
/
2.
,
"F0"
:
{
"type"
:
"unif"
,
"lower"
:
F0
-
DeltaF0
/
2.0
,
"upper"
:
F0
+
DeltaF0
/
2
},
'upper'
:
F0
+
DeltaF0
/
2
},
"F1"
:
{
"type"
:
"unif"
,
"lower"
:
F1
-
DeltaF1
/
2.0
,
"upper"
:
F1
+
DeltaF1
/
2
},
'F1'
:
{
'type'
:
'unif'
,
"F2"
:
F2
,
'lower'
:
F1
-
DeltaF1
/
2.
,
"Alpha"
:
Alpha
,
'upper'
:
F1
+
DeltaF1
/
2
},
"Delta"
:
Delta
,
'F2'
:
F2
,
}
'Alpha'
:
Alpha
,
'Delta'
:
Delta
}
ntemps
=
3
ntemps
=
3
log10beta_min
=
-
0.5
log10beta_min
=
-
0.5
...
@@ -51,23 +59,35 @@ nwalkers = 100
...
@@ -51,23 +59,35 @@ nwalkers = 100
nsteps
=
[
100
,
100
]
nsteps
=
[
100
,
100
]
mcmc
=
pyfstat
.
MCMCFollowUpSearch
(
mcmc
=
pyfstat
.
MCMCFollowUpSearch
(
label
=
label
,
outdir
=
outdir
,
label
=
label
,
sftfilepattern
=
'{}/*{}*sft'
.
format
(
outdir
,
label
),
outdir
=
outdir
,
theta_prior
=
theta_prior
,
tref
=
tref
,
minStartTime
=
tstart
,
maxStartTime
=
tend
,
sftfilepattern
=
"{}/*{}*sft"
.
format
(
outdir
,
label
),
nwalkers
=
nwalkers
,
nsteps
=
nsteps
,
ntemps
=
ntemps
,
theta_prior
=
theta_prior
,
log10beta_min
=
log10beta_min
)
tref
=
tref
,
minStartTime
=
tstart
,
maxStartTime
=
tend
,
nwalkers
=
nwalkers
,
nsteps
=
nsteps
,
ntemps
=
ntemps
,
log10beta_min
=
log10beta_min
,
)
NstarMax
=
1000
NstarMax
=
1000
Nsegs0
=
100
Nsegs0
=
100
fig
,
axes
=
plt
.
subplots
(
nrows
=
2
,
figsize
=
(
3.4
,
3.5
))
fig
,
axes
=
plt
.
subplots
(
nrows
=
2
,
figsize
=
(
3.4
,
3.5
))
fig
,
axes
=
mcmc
.
run
(
fig
,
axes
=
mcmc
.
run
(
NstarMax
=
NstarMax
,
Nsegs0
=
Nsegs0
,
labelpad
=
0.01
,
NstarMax
=
NstarMax
,
plot_det_stat
=
False
,
return_fig
=
True
,
fig
=
fig
,
Nsegs0
=
Nsegs0
,
axes
=
axes
)
labelpad
=
0.01
,
plot_det_stat
=
False
,
return_fig
=
True
,
fig
=
fig
,
axes
=
axes
,
)
for
ax
in
axes
:
for
ax
in
axes
:
ax
.
grid
()
ax
.
grid
()
ax
.
set_xticks
(
np
.
arange
(
0
,
600
,
100
))
ax
.
set_xticks
(
np
.
arange
(
0
,
600
,
100
))
ax
.
set_xticklabels
([
str
(
s
)
for
s
in
np
.
arange
(
0
,
700
,
100
)])
ax
.
set_xticklabels
([
str
(
s
)
for
s
in
np
.
arange
(
0
,
700
,
100
)])
axes
[
-
1
].
set_xlabel
(
r
'
$\textrm{Number of steps}$
'
,
labelpad
=
0.1
)
axes
[
-
1
].
set_xlabel
(
r
"
$\textrm{Number of steps}$
"
,
labelpad
=
0.1
)
fig
.
tight_layout
()
fig
.
tight_layout
()
fig
.
savefig
(
'
{}/{}_walkers.png
'
.
format
(
mcmc
.
outdir
,
mcmc
.
label
),
dpi
=
400
)
fig
.
savefig
(
"
{}/{}_walkers.png
"
.
format
(
mcmc
.
outdir
,
mcmc
.
label
),
dpi
=
400
)
examples/glitch_examples/make_simulated_data.py
View file @
a2acfcff
from
pyfstat
import
Writer
,
GlitchWriter
from
pyfstat
import
Writer
,
GlitchWriter
import
numpy
as
np
import
numpy
as
np
outdir
=
'
data
'
outdir
=
"
data
"
# First, we generate data with a reasonably strong smooth signal
# First, we generate data with a reasonably strong smooth signal
# Define parameters of the Crab pulsar as an example
# Define parameters of the Crab pulsar as an example
...
@@ -17,37 +17,75 @@ h0 = 5e-24
...
@@ -17,37 +17,75 @@ h0 = 5e-24
# Properties of the GW data
# Properties of the GW data
sqrtSX
=
1e-22
sqrtSX
=
1e-22
tstart
=
1000000000
tstart
=
1000000000
duration
=
50
*
86400
duration
=
50
*
86400
tend
=
tstart
+
duration
tend
=
tstart
+
duration
tref
=
tstart
+
0.5
*
duration
tref
=
tstart
+
0.5
*
duration
data
=
Writer
(
data
=
Writer
(
label
=
'0_glitch'
,
outdir
=
outdir
,
tref
=
tref
,
tstart
=
tstart
,
F0
=
F0
,
F1
=
F1
,
label
=
"0_glitch"
,
F2
=
F2
,
duration
=
duration
,
Alpha
=
Alpha
,
Delta
=
Delta
,
h0
=
h0
,
sqrtSX
=
sqrtSX
)
outdir
=
outdir
,
tref
=
tref
,
tstart
=
tstart
,
F0
=
F0
,
F1
=
F1
,
F2
=
F2
,
duration
=
duration
,
Alpha
=
Alpha
,
Delta
=
Delta
,
h0
=
h0
,
sqrtSX
=
sqrtSX
,
)
data
.
make_data
()
data
.
make_data
()
# Next, taking the same signal parameters, we include a glitch half way through
# Next, taking the same signal parameters, we include a glitch half way through
dtglitch
=
duration
/
2.0
dtglitch
=
duration
/
2.0
delta_F0
=
5e-6
delta_F0
=
5e-6
delta_F1
=
0
delta_F1
=
0
glitch_data
=
GlitchWriter
(
glitch_data
=
GlitchWriter
(
label
=
'1_glitch'
,
outdir
=
outdir
,
tref
=
tref
,
tstart
=
tstart
,
F0
=
F0
,
F1
=
F1
,
label
=
"1_glitch"
,
F2
=
F2
,
duration
=
duration
,
Alpha
=
Alpha
,
Delta
=
Delta
,
h0
=
h0
,
sqrtSX
=
sqrtSX
,
outdir
=
outdir
,
dtglitch
=
dtglitch
,
delta_F0
=
delta_F0
,
delta_F1
=
delta_F1
)
tref
=
tref
,
tstart
=
tstart
,
F0
=
F0
,
F1
=
F1
,
F2
=
F2
,
duration
=
duration
,
Alpha
=
Alpha
,
Delta
=
Delta
,
h0
=
h0
,
sqrtSX
=
sqrtSX
,
dtglitch
=
dtglitch
,
delta_F0
=
delta_F0
,
delta_F1
=
delta_F1
,
)
glitch_data
.
make_data
()
glitch_data
.
make_data
()
# Making data with two glitches
# Making data with two glitches
dtglitch_2
=
[
duration
/
4.0
,
4
*
duration
/
5.0
]
dtglitch_2
=
[
duration
/
4.0
,
4
*
duration
/
5.0
]
delta_phi_2
=
[
0
,
0
]
delta_phi_2
=
[
0
,
0
]
delta_F0_2
=
[
4e-6
,
3e-7
]
delta_F0_2
=
[
4e-6
,
3e-7
]
delta_F1_2
=
[
0
,
0
]
delta_F1_2
=
[
0
,
0
]
delta_F2_2
=
[
0
,
0
]
delta_F2_2
=
[
0
,
0
]
two_glitch_data
=
GlitchWriter
(
two_glitch_data
=
GlitchWriter
(
label
=
'2_glitch'
,
outdir
=
outdir
,
tref
=
tref
,
tstart
=
tstart
,
F0
=
F0
,
F1
=
F1
,
label
=
"2_glitch"
,
F2
=
F2
,
duration
=
duration
,
Alpha
=
Alpha
,
Delta
=
Delta
,
h0
=
h0
,
sqrtSX
=
sqrtSX
,
outdir
=
outdir
,
dtglitch
=
dtglitch_2
,
delta_phi
=
delta_phi_2
,
delta_F0
=
delta_F0_2
,
tref
=
tref
,
delta_F1
=
delta_F1_2
,
delta_F2
=
delta_F2_2
)
tstart
=
tstart
,
F0
=
F0
,
F1
=
F1
,
F2
=
F2
,
duration
=
duration
,
Alpha
=
Alpha
,
Delta
=
Delta
,
h0
=
h0
,
sqrtSX
=
sqrtSX
,
dtglitch
=
dtglitch_2
,
delta_phi
=
delta_phi_2
,
delta_F0
=
delta_F0_2
,
delta_F1
=
delta_F1_2
,
delta_F2
=
delta_F2_2
,
)
two_glitch_data
.
make_data
()
two_glitch_data
.
make_data
()
examples/glitch_examples/semicoherent_glitch_robust_directed_MCMC_search_on_1_glitch.py
View file @
a2acfcff
...
@@ -3,34 +3,42 @@ import matplotlib.pyplot as plt
...
@@ -3,34 +3,42 @@ import matplotlib.pyplot as plt
import
pyfstat
import
pyfstat
import
gridcorner
import
gridcorner
import
time
import
time
from
make_simulated_data
import
tstart
,
duration
,
tref
,
F0
,
F1
,
F2
,
Alpha
,
Delta
,
delta_F0
,
dtglitch
,
outdir
from
make_simulated_data
import
(
tstart
,
duration
,
tref
,
F0
,
F1
,
F2
,
Alpha
,
Delta
,
delta_F0
,
dtglitch
,
outdir
,
)
plt
.
style
.
use
(
'
./paper.mplstyle
'
)
plt
.
style
.
use
(
"
./paper.mplstyle
"
)
label
=
'
semicoherent_glitch_robust_directed_MCMC_search_on_1_glitch
'
label
=
"
semicoherent_glitch_robust_directed_MCMC_search_on_1_glitch
"
Nstar
=
1000
Nstar
=
1000
F0_width
=
np
.
sqrt
(
Nstar
)
*
np
.
sqrt
(
12
)
/
(
np
.
pi
*
duration
)
F0_width
=
np
.
sqrt
(
Nstar
)
*
np
.
sqrt
(
12
)
/
(
np
.
pi
*
duration
)
F1_width
=
np
.
sqrt
(
Nstar
)
*
np
.
sqrt
(
180
)
/
(
np
.
pi
*
duration
**
2
)
F1_width
=
np
.
sqrt
(
Nstar
)
*
np
.
sqrt
(
180
)
/
(
np
.
pi
*
duration
**
2
)
theta_prior
=
{
theta_prior
=
{
'F0'
:
{
'type'
:
'unif'
,
"F0"
:
{
"type"
:
"unif"
,
"lower"
:
F0
-
F0_width
/
2.0
,
"upper"
:
F0
+
F0_width
/
2.0
},
'lower'
:
F0
-
F0_width
/
2.
,
"F1"
:
{
"type"
:
"unif"
,
"lower"
:
F1
-
F1_width
/
2.0
,
"upper"
:
F1
+
F1_width
/
2.0
},
'upper'
:
F0
+
F0_width
/
2.
},
"F2"
:
F2
,
'F1'
:
{
'type'
:
'unif'
,
"delta_F0"
:
{
"type"
:
"unif"
,
"lower"
:
0
,
"upper"
:
1e-5
},
'lower'
:
F1
-
F1_width
/
2.
,
"delta_F1"
:
0
,
'upper'
:
F1
+
F1_width
/
2.
},
"tglitch"
:
{
'F2'
:
F2
,
"type"
:
"unif"
,
'delta_F0'
:
{
'type'
:
'unif'
,
"lower"
:
tstart
+
0.1
*
duration
,
'lower'
:
0
,
"upper"
:
tstart
+
0.9
*
duration
,
'upper'
:
1e-5
},
},
'delta_F1'
:
0
,
"Alpha"
:
Alpha
,
'tglitch'
:
{
'type'
:
'unif'
,
"Delta"
:
Delta
,
'lower'
:
tstart
+
0.1
*
duration
,
}
'upper'
:
tstart
+
0.9
*
duration
},
'Alpha'
:
Alpha
,
'Delta'
:
Delta
,