Skip to content

Commit

Permalink
Experiment 4 had its own user-defined prior
Browse files Browse the repository at this point in the history
  • Loading branch information
gully committed Apr 12, 2017
1 parent 6916a7a commit 69d9d0f
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions sf/exp4/user_prior.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
def user_defined_lnprior(p):
'''
Takes a vector of stellar parameters and returns the ln prior.
'''
if not ( (p[2] < 0.5) and (p[2] > 0) and
(p[3] < 1000.0) and (p[3] > -1000.0) and
(p[4] < 500.0) and (p[4] > 2.0) and
(p[6] < 1500.0) and (p[6] > 1000.0) and
(p[11] > 0.0) and (p[11] < 2.0) and
(p[12] < -1.0) and (p[12] > -2.0) and
(p[13] > 0.0) and (p[13] < 300 ) ):

return -np.inf

# Solar metalicity to within +/- 0.05 dex
lnp_FeH = -1.0*(p[2] - 0.01)**2/(2.0*0.001**2)
lnp_vz = -1.0*(p[3] - 110.0)**2/(2.0*20.0**2)
lnp_vsini = -1.0*(p[4] - 105.1)**2/(2.0*30.0**2)
lnp_l = -1.0*(p[13] - 124.4)**2/(2.0*10.0**2)
lnp_logAmp = -1.0*(p[12] + 1.40)**2/(2.0*0.03**2)
lnp_T_BB = -1.0*(p[6] - 1100.0)**2/(2.0*10.0**2)
# No prior on v_z.
ln_prior_out = lnp_FeH + lnp_vz + lnp_vsini + lnp_l + lnp_logAmp + lnp_T_BB

return ln_prior_out

0 comments on commit 69d9d0f

Please sign in to comment.