cobaya
cobaya copied to clipboard
Simple implementation for vector parameters
@cmbant do you want to take a look before merge? Should be done.
It's just documentation and better error control.
Only actual change needed is in getdist (see https://github.com/cmbant/getdist/pull/68)
Minimal working example:
from scipy import stats
def gauss_band(x_vector):
return stats.norm.logpdf(
x_vector[0] + x_vector[1], loc=1, scale=0.02)
# NB: don't forget the 'drop: True' in the individual parameters
# and 'derived: False' in the vector parameters
info = {
"likelihood": {"band": gauss_band},
"params": {
"x": {"prior": {"min": 0, "max": 2}, "proposal": 0.1, "drop": True},
"y": {"prior": {"min": 0, "max": 2}, "proposal": 0.1, "drop": True},
"x_vector": {"value": lambda x, y: [x, y], "derived": False}},
"sampler": {"mcmc": None}}
info["force"] = True
info["output"] = "chains/band"
from cobaya.run import run
updated_info, sampler = run(info)
Interesting that just works, looks OK to me though have not tested.
Yeah, surprisingly easy. I vaguely remember seeing this applied to some weird "vector is string form" of CLASS by @nataliehogg in some issue that I cannot find at the moment (so @nataliehogg, if you see this and can confirm, I am happy to give you credit in the changelog). (EDIT: it was actually @lukashergt, sorry!)
As for mergning, I would wait until the next GetDist release, since it's a requirement.
Yeah, surprisingly easy.
To a big part that is down to the nice flexible input setup of Cobaya. Glad #110 proved helpful.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 81.82%. Comparing base (
50309b2
) to head (cf0cbd8
).
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@ Coverage Diff @@
## master #191 +/- ##
==========================================
+ Coverage 81.81% 81.82% +0.01%
==========================================
Files 146 146
Lines 11172 11173 +1
==========================================
+ Hits 9140 9142 +2
+ Misses 2032 2031 -1
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.