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
0a82f169
Commit
0a82f169
authored
7 years ago
by
moritz
Browse files
Options
Downloads
Patches
Plain Diff
Moritz Huebner: Rewrote to match the properties and setters design pattern
parent
821042fb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
peyote/parameter.py
+51
-51
51 additions, 51 deletions
peyote/parameter.py
with
51 additions
and
51 deletions
peyote/parameter.py
+
51
−
51
View file @
0a82f169
...
...
@@ -15,47 +15,47 @@ class Parameter:
@property
def
prior
(
self
):
return
self
.
prior
return
self
.
__
prior
@property
def
value
(
self
):
return
self
.
value
return
self
.
__
value
@property
def
latex_label
(
self
):
return
self
.
latex_label
return
self
.
__
latex_label
@property
def
is_fixed
(
self
):
return
self
.
is_fixed
return
self
.
__
is_fixed
@prior.setter
def
prior
(
self
,
prior
=
None
):
if
prior
is
None
:
self
.
set_default_prior
()
else
:
self
.
prior
=
prior
self
.
__
prior
=
prior
@value.setter
def
value
(
self
,
value
=
None
):
if
value
is
None
:
self
.
set_default_values
()
else
:
self
.
value
=
value
self
.
__
value
=
value
@latex_label.setter
def
latex_label
(
self
,
latex_label
=
None
):
if
latex_label
is
None
:
self
.
latex_label
=
self
.
name
self
.
__
latex_label
=
self
.
name
else
:
self
.
set_default_latex_label
()
@is_fixed.setter
def
is_fixed
(
self
,
is_fixed
):
if
is_fixed
:
self
.
is_fixed
=
True
self
.
__
is_fixed
=
True
else
:
self
.
is_fixed
=
False
self
.
__
is_fixed
=
False
def
fix
(
self
,
value
=
None
):
"""
...
...
@@ -71,91 +71,91 @@ class Parameter:
def
set_default_prior
(
self
):
if
self
.
name
==
'
mass_1
'
:
self
.
prior
=
peyote
.
prior
.
PowerLaw
(
alpha
=
0
,
bounds
=
(
5
,
100
))
self
.
__
prior
=
peyote
.
prior
.
PowerLaw
(
alpha
=
0
,
bounds
=
(
5
,
100
))
elif
self
.
name
==
'
mass_2
'
:
self
.
prior
=
peyote
.
prior
.
PowerLaw
(
alpha
=
0
,
bounds
=
(
5
,
100
))
self
.
__
prior
=
peyote
.
prior
.
PowerLaw
(
alpha
=
0
,
bounds
=
(
5
,
100
))
elif
self
.
name
==
'
mchirp
'
:
self
.
prior
=
peyote
.
prior
.
PowerLaw
(
alpha
=
0
,
bounds
=
(
5
,
100
))
self
.
__
prior
=
peyote
.
prior
.
PowerLaw
(
alpha
=
0
,
bounds
=
(
5
,
100
))
elif
self
.
name
==
'
q
'
:
self
.
prior
=
peyote
.
prior
.
PowerLaw
(
alpha
=
0
,
bounds
=
(
0
,
1
))
self
.
__
prior
=
peyote
.
prior
.
PowerLaw
(
alpha
=
0
,
bounds
=
(
0
,
1
))
elif
self
.
name
==
'
a1
'
:
self
.
prior
=
peyote
.
prior
.
PowerLaw
(
alpha
=
0
,
bounds
=
(
0
,
1
))
self
.
__
prior
=
peyote
.
prior
.
PowerLaw
(
alpha
=
0
,
bounds
=
(
0
,
1
))
elif
self
.
name
==
'
a2
'
:
self
.
prior
=
peyote
.
prior
.
PowerLaw
(
alpha
=
0
,
bounds
=
(
0
,
1
))
self
.
__
prior
=
peyote
.
prior
.
PowerLaw
(
alpha
=
0
,
bounds
=
(
0
,
1
))
elif
self
.
name
==
'
tilt1
'
:
self
.
prior
=
peyote
.
prior
.
Sine
()
self
.
__
prior
=
peyote
.
prior
.
Sine
()
elif
self
.
name
==
'
tilt2
'
:
self
.
prior
=
peyote
.
prior
.
Sine
()
self
.
__
prior
=
peyote
.
prior
.
Sine
()
elif
self
.
name
==
'
phi1
'
:
self
.
prior
=
peyote
.
prior
.
PowerLaw
(
alpha
=
0
,
bounds
=
(
0
,
2
*
np
.
pi
))
self
.
__
prior
=
peyote
.
prior
.
PowerLaw
(
alpha
=
0
,
bounds
=
(
0
,
2
*
np
.
pi
))
elif
self
.
name
==
'
phi2
'
:
self
.
prior
=
peyote
.
prior
.
PowerLaw
(
alpha
=
0
,
bounds
=
(
0
,
2
*
np
.
pi
))
self
.
__
prior
=
peyote
.
prior
.
PowerLaw
(
alpha
=
0
,
bounds
=
(
0
,
2
*
np
.
pi
))
elif
self
.
name
==
'
luminosity_distance
'
:
self
.
prior
=
peyote
.
prior
.
PowerLaw
(
alpha
=
2
,
bounds
=
(
1e2
,
5e3
))
self
.
__
prior
=
peyote
.
prior
.
PowerLaw
(
alpha
=
2
,
bounds
=
(
1e2
,
5e3
))
elif
self
.
name
==
'
dec
'
:
self
.
prior
=
peyote
.
prior
.
Cosine
()
self
.
__
prior
=
peyote
.
prior
.
Cosine
()
elif
self
.
name
==
'
ra
'
:
self
.
prior
=
peyote
.
prior
.
PowerLaw
(
alpha
=
0
,
bounds
=
(
0
,
2
*
np
.
pi
))
self
.
__
prior
=
peyote
.
prior
.
PowerLaw
(
alpha
=
0
,
bounds
=
(
0
,
2
*
np
.
pi
))
elif
self
.
name
==
'
iota
'
:
self
.
prior
=
peyote
.
prior
.
Sine
()
self
.
__
prior
=
peyote
.
prior
.
Sine
()
elif
self
.
name
==
'
psi
'
:
self
.
prior
=
peyote
.
prior
.
PowerLaw
(
alpha
=
0
,
bounds
=
(
0
,
2
*
np
.
pi
))
self
.
__
prior
=
peyote
.
prior
.
PowerLaw
(
alpha
=
0
,
bounds
=
(
0
,
2
*
np
.
pi
))
elif
self
.
name
==
'
phase
'
:
self
.
prior
=
peyote
.
prior
.
PowerLaw
(
alpha
=
0
,
bounds
=
(
0
,
2
*
np
.
pi
))
self
.
__
prior
=
peyote
.
prior
.
PowerLaw
(
alpha
=
0
,
bounds
=
(
0
,
2
*
np
.
pi
))
else
:
self
.
prior
=
None
self
.
__
prior
=
None
def
set_default_values
(
self
):
# spins
if
self
.
name
==
'
a1
'
:
self
.
value
=
0
self
.
__
value
=
0
elif
self
.
name
==
'
a2
'
:
self
.
value
=
0
self
.
__
value
=
0
elif
self
.
name
==
'
tilt1
'
:
self
.
value
=
0
self
.
__
value
=
0
elif
self
.
name
==
'
tilt2
'
:
self
.
value
=
0
self
.
__
value
=
0
elif
self
.
name
==
'
phi1
'
:
self
.
value
=
0
self
.
__
value
=
0
elif
self
.
name
==
'
phi2
'
:
self
.
value
=
0
self
.
__
value
=
0
else
:
self
.
value
=
np
.
nan
self
.
__
value
=
np
.
nan
def
set_default_latex_label
(
self
):
if
self
.
name
==
'
mass_1
'
:
self
.
latex_label
=
'
$m_1$
'
self
.
__
latex_label
=
'
$m_1$
'
elif
self
.
name
==
'
mass_2
'
:
self
.
latex_label
=
'
$m_2$
'
self
.
__
latex_label
=
'
$m_2$
'
elif
self
.
name
==
'
mchirp
'
:
self
.
latex_label
=
'
$\mathcal{M}$
'
self
.
__
latex_label
=
'
$\mathcal{M}$
'
elif
self
.
name
==
'
q
'
:
self
.
latex_label
=
'
q
'
self
.
__
latex_label
=
'
q
'
elif
self
.
name
==
'
a1
'
:
self
.
latex_label
=
'
a_1
'
self
.
__
latex_label
=
'
a_1
'
elif
self
.
name
==
'
a2
'
:
self
.
latex_label
=
'
a_2
'
self
.
__
latex_label
=
'
a_2
'
elif
self
.
name
==
'
tilt1
'
:
self
.
latex_label
=
'
tilt_1
'
self
.
__
latex_label
=
'
tilt_1
'
elif
self
.
name
==
'
tilt2
'
:
self
.
latex_label
=
'
tilt_2
'
self
.
__
latex_label
=
'
tilt_2
'
elif
self
.
name
==
'
phi1
'
:
self
.
latex_label
=
'
\phi_1
'
self
.
__
latex_label
=
'
\phi_1
'
elif
self
.
name
==
'
phi2
'
:
self
.
latex_label
=
'
\phi_2
'
self
.
__
latex_label
=
'
\phi_2
'
elif
self
.
name
==
'
luminosity_distance
'
:
self
.
latex_label
=
'
d
'
self
.
__
latex_label
=
'
d
'
elif
self
.
name
==
'
dec
'
:
self
.
latex_label
=
'
\mathrm{DEC}
'
self
.
__
latex_label
=
'
\mathrm{DEC}
'
elif
self
.
name
==
'
ra
'
:
self
.
latex_label
=
'
\mathrm{RA}
'
self
.
__
latex_label
=
'
\mathrm{RA}
'
elif
self
.
name
==
'
iota
'
:
self
.
latex_label
=
'
\iota
'
self
.
__
latex_label
=
'
\iota
'
elif
self
.
name
==
'
psi
'
:
self
.
latex_label
=
'
\psi
'
self
.
__
latex_label
=
'
\psi
'
elif
self
.
name
==
'
phase
'
:
self
.
latex_label
=
'
\phi
'
self
.
__
latex_label
=
'
\phi
'
elif
self
.
name
==
'
tc
'
:
self
.
latex_label
=
'
t_c
'
self
.
__
latex_label
=
'
t_c
'
else
:
self
.
latex_label
=
self
.
name
self
.
__
latex_label
=
self
.
name
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