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
Gregory Ashton
PyFstat
Commits
6a8ad3f5
Commit
6a8ad3f5
authored
Dec 05, 2016
by
Gregory Ashton
Browse files
Update All Sky MC table and plots
parent
2bf77d55
Changes
6
Hide whitespace changes
Inline
Side-by-side
Paper/AllSkyMC/generate_data.py
View file @
6a8ad3f5
...
@@ -2,6 +2,7 @@ import pyfstat
...
@@ -2,6 +2,7 @@ import pyfstat
import
numpy
as
np
import
numpy
as
np
import
os
import
os
import
sys
import
sys
import
time
ID
=
sys
.
argv
[
1
]
ID
=
sys
.
argv
[
1
]
outdir
=
sys
.
argv
[
2
]
outdir
=
sys
.
argv
[
2
]
...
@@ -29,21 +30,20 @@ DeltaF1 = VF1 * np.sqrt(45/4.)/(np.pi*Tspan**2)
...
@@ -29,21 +30,20 @@ DeltaF1 = VF1 * np.sqrt(45/4.)/(np.pi*Tspan**2)
depths
=
np
.
linspace
(
100
,
400
,
7
)
depths
=
np
.
linspace
(
100
,
400
,
7
)
run_setup
=
[((
100
,
0
),
27
,
False
),
nsteps
=
50
((
100
,
0
),
15
,
False
),
run_setup
=
[((
nsteps
,
0
),
20
,
False
),
((
100
,
0
),
8
,
False
),
((
nsteps
,
0
),
11
,
False
),
((
100
,
0
),
4
,
False
),
((
nsteps
,
0
),
6
,
False
),
((
50
,
50
),
1
,
False
)]
((
nsteps
,
0
),
3
,
False
),
((
nsteps
,
nsteps
),
1
,
False
)]
DeltaAlpha
=
0.05
DeltaAlpha
=
0.05
DeltaDelta
=
0.05
DeltaDelta
=
0.05
for
depth
in
depths
:
for
depth
in
depths
:
h0
=
sqrtSX
/
float
(
depth
)
h0
=
sqrtSX
/
float
(
depth
)
r
=
np
.
random
.
uniform
(
0
,
1
)
F0
=
F0_center
+
np
.
random
.
uniform
(
-
0.5
,
0.5
)
*
DeltaF0
theta
=
np
.
random
.
uniform
(
0
,
2
*
np
.
pi
)
F1
=
F1_center
+
np
.
random
.
uniform
(
-
0.5
,
0.5
)
*
DeltaF1
F0
=
F0_center
+
3
*
np
.
sqrt
(
r
)
*
np
.
cos
(
theta
)
/
(
np
.
pi
**
2
*
Tspan
**
2
)
F1
=
F1_center
+
45
*
np
.
sqrt
(
r
)
*
np
.
sin
(
theta
)
/
(
4
*
np
.
pi
**
2
*
Tspan
**
4
)
Alpha
=
np
.
random
.
uniform
(
0
,
2
*
np
.
pi
)
Alpha
=
np
.
random
.
uniform
(
0
,
2
*
np
.
pi
)
Delta
=
np
.
arccos
(
2
*
np
.
random
.
uniform
(
0
,
1
)
-
1
)
-
np
.
pi
/
2
Delta
=
np
.
arccos
(
2
*
np
.
random
.
uniform
(
0
,
1
)
-
1
)
-
np
.
pi
/
2
fAlpha
=
np
.
random
.
uniform
(
0
,
1
)
fAlpha
=
np
.
random
.
uniform
(
0
,
1
)
...
@@ -65,6 +65,7 @@ for depth in depths:
...
@@ -65,6 +65,7 @@ for depth in depths:
data
.
make_data
()
data
.
make_data
()
predicted_twoF
=
data
.
predict_fstat
()
predicted_twoF
=
data
.
predict_fstat
()
startTime
=
time
.
time
()
theta_prior
=
{
'F0'
:
{
'type'
:
'unif'
,
theta_prior
=
{
'F0'
:
{
'type'
:
'unif'
,
'lower'
:
F0
-
DeltaF0
/
2.
,
'lower'
:
F0
-
DeltaF0
/
2.
,
'upper'
:
F0
+
DeltaF0
/
2.
},
'upper'
:
F0
+
DeltaF0
/
2.
},
...
@@ -96,7 +97,8 @@ for depth in depths:
...
@@ -96,7 +97,8 @@ for depth in depths:
d
,
maxtwoF
=
mcmc
.
get_max_twoF
()
d
,
maxtwoF
=
mcmc
.
get_max_twoF
()
dF0
=
F0
-
d
[
'F0'
]
dF0
=
F0
-
d
[
'F0'
]
dF1
=
F1
-
d
[
'F1'
]
dF1
=
F1
-
d
[
'F1'
]
runTime
=
time
.
time
()
-
startTime
with
open
(
results_file_name
,
'a'
)
as
f
:
with
open
(
results_file_name
,
'a'
)
as
f
:
f
.
write
(
'{} {:1.8e} {:1.8e} {:1.8e} {:1.8e} {:1.8e}
\n
'
f
.
write
(
'{} {:1.8e} {:1.8e} {:1.8e} {:1.8e} {:1.8e}
{}
\n
'
.
format
(
depth
,
h0
,
dF0
,
dF1
,
predicted_twoF
,
maxtwoF
))
.
format
(
depth
,
h0
,
dF0
,
dF1
,
predicted_twoF
,
maxtwoF
,
runTime
))
os
.
system
(
'rm {}/*{}*'
.
format
(
outdir
,
label
))
os
.
system
(
'rm {}/*{}*'
.
format
(
outdir
,
label
))
Paper/AllSkyMC/generate_table.py
View file @
6a8ad3f5
...
@@ -3,7 +3,7 @@ import numpy as np
...
@@ -3,7 +3,7 @@ import numpy as np
outdir
=
'data'
outdir
=
'data'
label
=
'
A
ll
S
ky'
label
=
'
a
ll
s
ky
_setup
'
data_label
=
'{}_data'
.
format
(
label
)
data_label
=
'{}_data'
.
format
(
label
)
# Properties of the GW data
# Properties of the GW data
...
@@ -23,32 +23,30 @@ VF0 = VF1 = 100
...
@@ -23,32 +23,30 @@ VF0 = VF1 = 100
DeltaF0
=
VF0
*
np
.
sqrt
(
3
)
/
(
np
.
pi
*
Tspan
)
DeltaF0
=
VF0
*
np
.
sqrt
(
3
)
/
(
np
.
pi
*
Tspan
)
DeltaF1
=
VF1
*
np
.
sqrt
(
45
/
4.
)
/
(
np
.
pi
*
Tspan
**
2
)
DeltaF1
=
VF1
*
np
.
sqrt
(
45
/
4.
)
/
(
np
.
pi
*
Tspan
**
2
)
depths
=
np
.
linspace
(
100
,
400
,
7
)
run_setup
=
[((
100
,
0
),
27
,
False
),
((
100
,
0
),
15
,
False
),
((
100
,
0
),
8
,
False
),
((
100
,
0
),
4
,
False
),
((
50
,
50
),
1
,
False
)]
DeltaAlpha
=
0.05
DeltaAlpha
=
0.05
DeltaDelta
=
0.05
DeltaDelta
=
0.05
depth
=
100
depth
=
100
nsteps
=
50
run_setup
=
[((
nsteps
,
0
),
20
,
False
),
((
nsteps
,
0
),
11
,
False
),
((
nsteps
,
0
),
6
,
False
),
((
nsteps
,
0
),
3
,
False
),
((
nsteps
,
nsteps
),
1
,
False
)]
h0
=
sqrtSX
/
float
(
depth
)
h0
=
sqrtSX
/
float
(
depth
)
F0
=
F0_center
r
=
np
.
random
.
uniform
(
0
,
1
)
F1
=
F1_center
theta
=
np
.
random
.
uniform
(
0
,
2
*
np
.
pi
)
F0
=
F0_center
+
3
*
np
.
sqrt
(
r
)
*
np
.
cos
(
theta
)
/
(
np
.
pi
**
2
*
Tspan
**
2
)
F1
=
F1_center
+
45
*
np
.
sqrt
(
r
)
*
np
.
sin
(
theta
)
/
(
4
*
np
.
pi
**
2
*
Tspan
**
4
)
Alpha
=
0
Alpha
=
0
Delta
=
0
Delta
=
0
Alpha_min
=
Alpha
-
DeltaAlpha
/
2
Alpha_max
=
Alpha
+
DeltaAlpha
/
2
Delta_min
=
Delta
-
DeltaDelta
/
2
Delta_max
=
Delta
+
DeltaDelta
/
2
psi
=
0
psi
=
np
.
random
.
uniform
(
-
np
.
pi
/
4
,
np
.
pi
/
4
)
phi
=
0
phi
=
np
.
random
.
uniform
(
0
,
2
*
np
.
pi
)
cosi
=
0
cosi
=
np
.
random
.
uniform
(
-
1
,
1
)
data
=
pyfstat
.
Writer
(
data
=
pyfstat
.
Writer
(
label
=
data_label
,
outdir
=
outdir
,
tref
=
tref
,
label
=
data_label
,
outdir
=
outdir
,
tref
=
tref
,
...
@@ -66,11 +64,11 @@ theta_prior = {'F0': {'type': 'unif',
...
@@ -66,11 +64,11 @@ theta_prior = {'F0': {'type': 'unif',
'upper'
:
F1
+
DeltaF1
/
2.
},
'upper'
:
F1
+
DeltaF1
/
2.
},
'F2'
:
F2
,
'F2'
:
F2
,
'Alpha'
:
{
'type'
:
'unif'
,
'Alpha'
:
{
'type'
:
'unif'
,
'lower'
:
Alpha
_min
,
'lower'
:
Alpha
-
DeltaAlpha
/
2.
,
'upper'
:
Alpha
_max
},
'upper'
:
Alpha
+
DeltaAlpha
/
2.
},
'Delta'
:
{
'type'
:
'unif'
,
'Delta'
:
{
'type'
:
'unif'
,
'lower'
:
Delta
_min
,
'lower'
:
Delta
-
DeltaDelta
/
2.
,
'upper'
:
Delta
_max
},
'upper'
:
Delta
+
DeltaDelta
/
2.
},
}
}
ntemps
=
1
ntemps
=
1
...
@@ -84,4 +82,4 @@ mcmc = pyfstat.MCMCFollowUpSearch(
...
@@ -84,4 +82,4 @@ mcmc = pyfstat.MCMCFollowUpSearch(
tref
=
tref
,
minStartTime
=
tstart
,
maxStartTime
=
tend
,
tref
=
tref
,
minStartTime
=
tstart
,
maxStartTime
=
tend
,
nwalkers
=
nwalkers
,
ntemps
=
ntemps
,
nwalkers
=
nwalkers
,
ntemps
=
ntemps
,
log10temperature_min
=
log10temperature_min
)
log10temperature_min
=
log10temperature_min
)
mcmc
.
run
(
run_setup
=
run_setup
)
mcmc
.
run
(
run_setup
)
Paper/AllSkyMC/plot_data.py
View file @
6a8ad3f5
...
@@ -4,6 +4,9 @@ import numpy as np
...
@@ -4,6 +4,9 @@ import numpy as np
import
os
import
os
from
tqdm
import
tqdm
from
tqdm
import
tqdm
from
oct2py
import
octave
from
oct2py
import
octave
import
glob
filenames
=
glob
.
glob
(
"CollectedOutput/*.txt"
)
plt
.
style
.
use
(
'paper'
)
plt
.
style
.
use
(
'paper'
)
...
@@ -25,11 +28,14 @@ def binomialConfidenceInterval(N, K, confidence=0.95):
...
@@ -25,11 +28,14 @@ def binomialConfidenceInterval(N, K, confidence=0.95):
[
l
,
u
]
=
octave
.
eval
(
cmd
,
verbose
=
False
,
return_both
=
True
)[
0
].
split
(
'
\n
'
)
[
l
,
u
]
=
octave
.
eval
(
cmd
,
verbose
=
False
,
return_both
=
True
)[
0
].
split
(
'
\n
'
)
return
float
(
l
.
split
(
'='
)[
1
]),
float
(
u
.
split
(
'='
)[
1
])
return
float
(
l
.
split
(
'='
)[
1
]),
float
(
u
.
split
(
'='
)[
1
])
results_file_name
=
'MCResults.txt'
df_list
=
[]
for
fn
in
filenames
:
df
=
pd
.
read_csv
(
df
=
pd
.
read_csv
(
results_file_name
,
sep
=
' '
,
names
=
[
'depth'
,
'h0'
,
'dF0'
,
'dF1'
,
fn
,
sep
=
' '
,
names
=
[
'depth'
,
'h0'
,
'dF0'
,
'dF1'
,
'twoF_predicted'
,
'twoF_predicted'
,
'twoF'
])
'twoF'
,
'runTime'
])
df
[
'CLUSTER_ID'
]
=
fn
.
split
(
'_'
)[
1
]
df_list
.
append
(
df
)
df
=
pd
.
concat
(
df_list
)
twoFstar
=
60
twoFstar
=
60
depths
=
np
.
unique
(
df
.
depth
.
values
)
depths
=
np
.
unique
(
df
.
depth
.
values
)
...
@@ -71,3 +77,10 @@ ax.legend(loc=1, frameon=False)
...
@@ -71,3 +77,10 @@ ax.legend(loc=1, frameon=False)
fig
.
tight_layout
()
fig
.
tight_layout
()
fig
.
savefig
(
'allsky_recovery.png'
)
fig
.
savefig
(
'allsky_recovery.png'
)
fig
,
ax
=
plt
.
subplots
()
ax
.
hist
(
df
.
runTime
,
bins
=
20
)
ax
.
set_xlabel
(
'runTime per follow-up [s]'
)
fig
.
savefig
(
'runTimeHist.png'
)
Paper/AllSkyMC/submitfile
View file @
6a8ad3f5
...
@@ -9,4 +9,4 @@ Log=CollectedOutput/log.$(Process)
...
@@ -9,4 +9,4 @@ Log=CollectedOutput/log.$(Process)
request_cpus = 1
request_cpus = 1
request_memory = 16 GB
request_memory = 16 GB
Queue
1
0
Queue
9
0
Paper/allsky_recovery.png
View replaced file @
2bf77d55
View file @
6a8ad3f5
50.8 KB
|
W:
|
H:
50.7 KB
|
W:
|
H:
2-up
Swipe
Onion skin
Paper/allsky_setup_run_setup.tex
0 → 100644
View file @
6a8ad3f5
\begin{tabular}
{
c|cccccc
}
Stage
&
$
\Nseg
$
&
$
\Tcoh
^{
\rm
days
}$
&$
\Nsteps
$
&
$
\V
$
&
$
\Vsky
$
&
$
\Vpe
$
\\
\hline
0
&
20
&
5.0
&
100
&
$
2
{
\times
}
10
^{
2
}$
&
10.0
&
10.0
\\
1
&
11
&
9.1
&
100
&
$
2
{
\times
}
10
^{
3
}$
&
40.0
&
50.0
\\
2
&
6
&
16.7
&
100
&
$
2
{
\times
}
10
^{
4
}$
&
$
1
{
\times
}
10
^{
2
}$
&
$
2
{
\times
}
10
^{
2
}$
\\
3
&
3
&
33.3
&
100
&
$
1
{
\times
}
10
^{
5
}$
&
$
2
{
\times
}
10
^{
2
}$
&
$
6
{
\times
}
10
^{
2
}$
\\
4
&
1
&
100.0
&
100,100
&
$
8
{
\times
}
10
^{
5
}$
&
$
3
{
\times
}
10
^{
2
}$
&
$
2
{
\times
}
10
^{
3
}$
\\
\end{tabular}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment