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
eada0054
There was a problem fetching the pipeline summary.
Commit
eada0054
authored
6 years ago
by
Gregory Ashton
Browse files
Options
Downloads
Plain Diff
Merge branch 'hyper_fix' into 'master'
Hyper fix See merge request Monash/tupak!114
parents
3dc14798
af1429ad
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!114
Hyper fix
Pipeline
#
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tupak/__init__.py
+2
-0
2 additions, 0 deletions
tupak/__init__.py
tupak/core/likelihood.py
+11
-14
11 additions, 14 deletions
tupak/core/likelihood.py
with
13 additions
and
14 deletions
tupak/__init__.py
+
2
−
0
View file @
eada0054
...
...
@@ -21,9 +21,11 @@ from __future__ import print_function, division, absolute_import
# import local files, core utils should be imported first
from
tupak.core
import
utils
,
likelihood
,
prior
,
result
,
sampler
from
tupak.gw
import
detector
,
conversion
,
source
,
waveform_generator
from
tupak.hyper
import
likelihood
,
model
# import a few often-used functions and classes to simplify scripts
from
tupak.core.likelihood
import
Likelihood
from
tupak.gw.likelihood
import
GravitationalWaveTransient
from
tupak.gw.waveform_generator
import
WaveformGenerator
from
tupak.core.sampler
import
run_sampler
from
tupak.hyper.likelihood
import
HyperparameterLikelihood
This diff is collapsed.
Click to expand it.
tupak/core/likelihood.py
+
11
−
14
View file @
eada0054
...
...
@@ -65,9 +65,7 @@ class GaussianLikelihood(Likelihood):
This can either be a single float, or an array with length equal
to that for `x` and `y`.
"""
# These lines of code infer the parameters from the provided function
parameters
=
inspect
.
getargspec
(
function
).
args
parameters
.
pop
(
0
)
parameters
=
self
.
_infer_parameters_from_model
(
function
)
Likelihood
.
__init__
(
self
,
dict
.
fromkeys
(
parameters
))
self
.
x
=
x
...
...
@@ -75,22 +73,21 @@ class GaussianLikelihood(Likelihood):
self
.
sigma
=
sigma
self
.
function
=
function
@property
def
function_keys
(
self
):
return
self
.
parameters
.
keys
()
self
.
parameters
=
dict
.
fromkeys
(
parameters
)
self
.
function_keys
=
self
.
parameters
.
keys
()
if
self
.
sigma
is
None
:
self
.
parameters
[
'
sigma
'
]
=
None
@staticmethod
def
_infer_parameters_from_model
(
model
):
parameters
=
inspect
.
getargspec
(
model
).
args
parameters
.
pop
(
0
)
return
parameters
@property
def
N
(
self
):
return
len
(
self
.
x
)
@property
def
sigma
(
self
):
return
self
.
parameters
.
get
(
'
sigma
'
,
None
)
@sigma.setter
def
sigma
(
self
,
sigma
):
self
.
parameters
[
'
sigma
'
]
=
sigma
def
log_likelihood
(
self
):
model_parameters
=
{
k
:
self
.
parameters
[
k
]
for
k
in
self
.
function_keys
}
res
=
self
.
y
-
self
.
function
(
self
.
x
,
**
model_parameters
)
...
...
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