Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bilby
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
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
Service Desk
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
bilby
Commits
ad489a53
Commit
ad489a53
authored
6 years ago
by
Colm Talbot
Browse files
Options
Downloads
Patches
Plain Diff
update basic tutorial
parent
337751e9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!23
implement prior generation
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tutorials/BasicTutorial.py
+12
-27
12 additions, 27 deletions
tutorials/BasicTutorial.py
with
12 additions
and
27 deletions
tutorials/BasicTutorial.py
+
12
−
27
View file @
ad489a53
...
...
@@ -4,8 +4,9 @@ import peyote
peyote
.
utils
.
setup_logger
()
time_duration
=
1.
sampling_frequency
=
4096.
time_duration
=
4.
sampling_frequency
=
2048.
outdir
=
'
outdir
'
injection_parameters
=
dict
(
mass_1
=
36.
,
mass_2
=
29.
,
a_1
=
0
,
a_2
=
0
,
tilt_1
=
0
,
tilt_2
=
0
,
phi_1
=
0
,
phi_2
=
0
,
luminosity_distance
=
2500.
,
iota
=
0.4
,
psi
=
2.659
,
phase
=
1.3
,
geocent_time
=
1126259642.413
,
...
...
@@ -13,46 +14,30 @@ injection_parameters = dict(mass_1=36., mass_2=29., a_1=0, a_2=0, tilt_1=0, tilt
# Create the waveform_generator using a LAL BinaryBlackHole source function
waveform_generator
=
peyote
.
waveform_generator
.
WaveformGenerator
(
sampling_frequency
=
sampling_frequency
,
time_duration
=
time_duration
,
sampling_frequency
=
sampling_frequency
,
time_duration
=
time_duration
,
frequency_domain_source_model
=
peyote
.
source
.
lal_binary_black_hole
,
parameters
=
injection_parameters
)
hf_signal
=
waveform_generator
.
frequency_domain_strain
()
# Set up interferometers.
IFOs
=
[
peyote
.
detector
.
get_empty_interferometer
(
name
)
for
name
in
[
'
H1
'
,
'
L1
'
,
'
V1
'
]]
for
IFO
in
IFOs
:
IFO
.
set_data
(
sampling_frequency
=
sampling_frequency
,
duration
=
time_duration
,
from_power_spectral_density
=
True
)
IFO
.
inject_signal
(
waveform_polarizations
=
hf_signal
,
parameters
=
injection_parameters
)
# Plot the noise and signal
fig
,
ax
=
plt
.
subplots
()
for
IFO
in
IFOs
:
plt
.
loglog
(
IFO
.
frequency_array
,
np
.
abs
(
IFO
.
data
),
lw
=
1.5
,
label
=
'
{} noise+signal
'
.
format
(
IFO
.
name
))
plt
.
loglog
(
IFO
.
frequency_array
,
IFO
.
amplitude_spectral_density_array
,
lw
=
1.5
,
label
=
'
{} ASD
'
.
format
(
IFO
.
name
))
plt
.
xlim
(
10
,
1000
)
plt
.
legend
()
plt
.
xlabel
(
r
'
frequency
'
)
plt
.
ylabel
(
r
'
strain
'
)
fig
.
savefig
(
'
data
'
)
IFOs
=
[
peyote
.
detector
.
get_inteferometer_with_fake_noise_and_injection
(
name
,
injection_polarizations
=
hf_signal
,
injection_parameters
=
injection_parameters
,
sampling_frequency
=
sampling_frequency
,
time_duration
=
time_duration
,
outdir
=
outdir
)
for
name
in
[
'
H1
'
,
'
L1
'
,
'
V1
'
]]
# Set up likelihood
likelihood
=
peyote
.
likelihood
.
Likelihood
(
IFOs
,
waveform_generator
)
# Set up prior
priors
=
{}
priors
[
'
mass_1
'
]
=
peyote
.
prior
.
Uniform
(
lower
=
35
,
upper
=
37
,
name
=
'
mass_1
'
,
latex_label
=
'
$m_1$
'
)
priors
[
'
luminosity_distance
'
]
=
peyote
.
prior
.
create_default_prior
(
'
luminosity_distance
'
)
for
key
in
[
'
mass_2
'
,
'
a_1
'
,
'
a_2
'
,
'
tilt_1
'
,
'
tilt_2
'
,
'
phi_1
'
,
'
phi_2
'
,
'
phase
'
,
'
psi
'
,
'
iota
'
,
'
ra
'
,
'
dec
'
,
'
geocent_time
'
]:
priors
=
dict
()
# These parameters will not be sampled
for
key
in
[
'
a_1
'
,
'
a_2
'
,
'
tilt_1
'
,
'
tilt_2
'
,
'
phi_1
'
,
'
phi_2
'
,
'
phase
'
,
'
psi
'
,
'
iota
'
,
'
ra
'
,
'
dec
'
,
'
geocent_time
'
]:
priors
[
key
]
=
injection_parameters
[
key
]
# Run sampler
result
=
peyote
.
sampler
.
run_sampler
(
likelihood
=
likelihood
,
priors
=
priors
,
sampler
=
'
dynesty
'
,
label
=
'
BasicTutorial
'
,
use_ratio
=
True
,
npoints
=
500
,
verbose
=
True
,
injection_parameters
=
injection_parameters
)
injection_parameters
=
injection_parameters
,
outdir
=
outdir
)
result
.
plot_corner
()
result
.
plot_walks
()
result
.
plot_distributions
()
...
...
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