Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
L
lalsuite
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
109
Issues
109
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
29
Merge Requests
29
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lscsoft
lalsuite
Commits
f7640018
Commit
f7640018
authored
Sep 10, 2018
by
John Douglas Veitch
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'lalinference_o2' into 'lalinference_o2'
Volumetric Spin Prior in lalinference o2 See merge request
!429
parents
b5a157a4
8aba0074
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
80 additions
and
4 deletions
+80
-4
lalinference/src/LALInferencePrior.c
lalinference/src/LALInferencePrior.c
+80
-4
No files found.
lalinference/src/LALInferencePrior.c
View file @
f7640018
...
...
@@ -62,6 +62,7 @@ void LALInferenceInitCBCPrior(LALInferenceRunState *runState)
(--analyticnullprior) Use analytic null prior
\n
\
(--nullprior) Use null prior in the sampled parameters
\n
\
(--alignedspin-zprior) Use prior on z component of spin that corresponds to fully precessing model
\n
\
(--spin-volumetricprior) Use prior on spin components that is uniform inside the sphere
\n
\
\n
"
;
ProcessParamsTable
*
ppt
=
NULL
;
...
...
@@ -141,11 +142,21 @@ void LALInferenceInitCBCPrior(LALInferenceRunState *runState)
LALINFERENCE_REAL8_t
,
LALINFERENCE_PARAM_OUTPUT
);
}
INT4
one
=
1
;
if
(
LALInferenceGetProcParamVal
(
commandLine
,
"--alignedspin-zprior"
))
{
INT4
one
=
1
;
LALInferenceAddVariable
(
runState
->
priorArgs
,
"projected_aligned_spin"
,
&
one
,
LALINFERENCE_INT4_t
,
LALINFERENCE_PARAM_FIXED
);
}
if
(
LALInferenceGetProcParamVal
(
commandLine
,
"--spin-volumetricprior"
))
{
LALInferenceAddVariable
(
runState
->
priorArgs
,
"volumetric_spin"
,
&
one
,
LALINFERENCE_INT4_t
,
LALINFERENCE_PARAM_FIXED
);
}
if
(
LALInferenceGetProcParamVal
(
commandLine
,
"--alignedspin-zprior"
)
&&
LALInferenceGetProcParamVal
(
commandLine
,
"--spin-volumetricprior"
))
{
fprintf
(
stderr
,
"Error: You cannot use both --alignedspin-zprior and --spin-volumetricprior
\n
"
);
exit
(
1
);
}
}
void
LALInferenceInitLIBPrior
(
LALInferenceRunState
*
runState
)
...
...
@@ -533,14 +544,77 @@ REAL8 LALInferenceInspiralPrior(LALInferenceRunState *runState, LALInferenceVari
*
(
UINT4
*
)
LALInferenceGetVariable
(
priorParams
,
"malmquist"
)
&&
!
within_malmquist
(
runState
,
params
,
model
))
return
-
INFINITY
;
}
/* end prior for signal model parameters */
UINT4
volumetric_spins
=
LALInferenceCheckVariable
(
runState
->
priorArgs
,
"volumetric_spin"
)
&&
LALInferenceGetVariable
(
runState
->
priorArgs
,
"volumetric_spin"
);
/* Apply spin priors for precessing case */
if
(
LALInferenceCheckVariable
(
params
,
"tilt_spin1"
))
{
LALInferenceParamVaryType
vtype
=
LALInferenceGetVariableVaryType
(
params
,
"tilt_spin1"
);
if
(
vtype
!=
LALINFERENCE_PARAM_FIXED
&&
vtype
!=
LALINFERENCE_PARAM_OUTPUT
)
{
if
(
volumetric_spins
)
{
/* homogenous inside spin bound */
/* V = (4/3)*pi*(a_max^3 - a_min^3) */
REAL8
a
=
LALInferenceGetREAL8Variable
(
params
,
"a_spin1"
);
REAL8
a_max
,
a_min
;
LALInferenceGetMinMaxPrior
(
runState
->
priorArgs
,
"a_spin1"
,
&
a_min
,
&
a_max
);
REAL8
V
=
(
4
.
/
3
.)
*
LAL_PI
*
(
a_max
*
a_max
*
a_max
-
a_min
*
a_min
*
a_min
);
logPrior
+=
log
(
fabs
(
a
*
a
))
-
log
(
fabs
(
V
));
}
/* Usual case has uniform in a, but both cases have sin(tilt) from volume element */
logPrior
+=
log
(
fabs
(
sin
(
*
(
REAL8
*
)
LALInferenceGetVariable
(
params
,
"tilt_spin1"
))));
}
}
else
{
if
(
volumetric_spins
)
{
/* Volumetric prior marginalised onto z component */
REAL8
a
=
LALInferenceGetREAL8Variable
(
params
,
"a_spin1"
);
REAL8
a_max
,
a_min
;
LALInferenceGetMinMaxPrior
(
runState
->
priorArgs
,
"a_spin1"
,
&
a_min
,
&
a_max
);
REAL8
V
=
(
4
.
/
3
.)
*
LAL_PI
*
(
a_max
*
a_max
*
a_max
);
logPrior
+=
log
(
fabs
((
3
.
/
4
.)
*
(
a_max
*
a_max
-
a
*
a
)))
-
log
(
fabs
(
V
));
}
}
if
(
LALInferenceCheckVariable
(
params
,
"tilt_spin2"
))
{
LALInferenceParamVaryType
vtype
=
LALInferenceGetVariableVaryType
(
params
,
"tilt_spin2"
);
if
(
vtype
!=
LALINFERENCE_PARAM_FIXED
&&
vtype
!=
LALINFERENCE_PARAM_OUTPUT
)
{
if
(
volumetric_spins
)
{
REAL8
a
=
LALInferenceGetREAL8Variable
(
params
,
"a_spin2"
);
REAL8
a_max
,
a_min
;
LALInferenceGetMinMaxPrior
(
runState
->
priorArgs
,
"a_spin2"
,
&
a_min
,
&
a_max
);
REAL8
V
=
(
4
.
/
3
.)
*
LAL_PI
*
(
a_max
*
a_max
*
a_max
-
a_min
*
a_min
*
a_min
);
logPrior
+=
log
(
fabs
(
a
*
a
))
-
log
(
fabs
(
V
));
}
logPrior
+=
log
(
fabs
(
sin
(
*
(
REAL8
*
)
LALInferenceGetVariable
(
params
,
"tilt_spin2"
))));
}
}
else
{
if
(
volumetric_spins
)
{
/* Volumetric prior marginalised onto z component */
REAL8
a
=
LALInferenceGetREAL8Variable
(
params
,
"a_spin1"
);
REAL8
a_max
,
a_min
;
LALInferenceGetMinMaxPrior
(
runState
->
priorArgs
,
"a_spin1"
,
&
a_min
,
&
a_max
);
REAL8
V
=
(
4
.
/
3
.)
*
LAL_PI
*
(
a_max
*
a_max
*
a_max
);
logPrior
+=
log
(
fabs
((
3
.
/
4
.)
*
(
a_max
*
a_max
-
a
*
a
)))
-
log
(
fabs
(
V
));
}
}
/* Optional prior on aligned spin component that corresponds to the effective prior on
that component when using a precessing spin model. p(z) = (1/2)(1/R)log(|z|/R)
Where R is the maximum magnitude of the spin vector max(|a_spin1_max|,|a_spin1_min|).
*/
if
(
LALInferenceCheckVariable
(
priorParams
,
"projected_aligned_spin"
)
&&
LALInference
Check
Variable
(
priorParams
,
"projected_aligned_spin"
))
if
(
LALInferenceCheckVariable
(
priorParams
,
"projected_aligned_spin"
)
&&
LALInference
Get
Variable
(
priorParams
,
"projected_aligned_spin"
))
{
REAL8
z
=
0
.
0
;
/* Double-check for tilts to prevent accidental double-prior */
...
...
@@ -567,6 +641,8 @@ REAL8 LALInferenceInspiralPrior(LALInferenceRunState *runState, LALInferenceVari
return
-
INFINITY
;
}
}
}
/* end prior for signal model parameters */
/* Calibration priors. */
/* Disabled as this is now handled automatically */
...
...
Write
Preview
Markdown
is supported
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