Hi,
I want to estimate the probability distribution of the parameters for a spectral modelling code. The parameters goes as input to the spectral modelling code via a dictionary.
The code will look something like this:
# run_spec is the spectra modelling function, which returns the model spectrum1D object
import run_spec
import yaml
import pymc as pm
with pm.Model() as spec_model:
# setting abundance distribution of the species O, Mg and Ne,
# the sum should be 1
O = pm.Uniform("O",
lower = 0.,
upper = 1.
)
Mg = pm.Uniform("Mg",
lower = 0.,
upper = 1.0-O
)
Ne = pm.Deterministic('Ne', 1.0 - (Mg + O))
#### par_list is a dictionary that contains all the model parameters
par_list['model']['abundances']['O'] = O
par_list['model']['abundances']['Mg'] = Mg
par_list['model']['abundances']['Ne'] = Ne
spec_01 = run_spec(par_list)
mu = spec_01.flux
y = pm.Normal("obs", mu, obs=flux)
idata = pm.sample(tune=100,
draws=100,
cores=4,
chains=2,
random_seed=SEED,
target_accept=0.99,
return_inferencedata=True
)
My primary concern is that if such kind of operation can be carried out in pymc. I am getting this obvoius error that the spectral modelling code was expecting a float argument but got a tensor variable.