Now I have a array m_srs and a observed dataset Y.
the number in the dataset Y is num_Conc
In the block (for iteration), I tried to calculate the predicted data result_ConcCal.
For the i th data in result_ConcCal, i will need to find the factor in the m_srs.
here is the error
how can assign the values?
TypeError: float() argument must be a string or a number, not 'TensorVariable'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<ipython-input-56-8947d73df26d>", line 35, in <module>
result_ConcCal[i] = result_ConcCal[i] + releaserate*1000*time_release_interval/3600 * matrix_temp / grid_volume / time_res * 10 ** 9 # 9 ng/m3 6 μBq/m3 3 mBq/m3
ValueError: setting an array element with a sequence.
with basic_model:
# Priors for unknown model parameters
longitude = pm.Uniform("longitude", lower=-10, upper=10,transform=None)
latitude = pm.Uniform("latitude", lower=45, upper=55,transform=None)
releaserate = pm.Uniform("releaserate", lower=0, upper=100,shape=1,transform=None)
sigma=1
m_srs_model = pm.Data('m_srs_model', m_srs)
lon_index=pm.theanof.intX(((longitude)-lon_start)/lon_res)
lat_index=pm.theanof.intX(((latitude)-lat_start)/lat_res)
num_Conc = len(MD_conc)
result_ConcCal = [0] * num_Conc
grid_area = 100 * 1000 * lon_res * 100 * 1000 * lat_res
grid_volume = grid_area * level_height
result_ConcCal=np.zeros(num_Conc)
for i in range(num_Conc):
for j in range(time_dur):
release_time = j
index_matrix = i * time_dur + release_time
matrix_temp = m_srs_model[index_matrix][lat_index][lon_index]
result_ConcCal[i] = result_ConcCal[i] + releaserate*1000*time_release_interval/3600 * matrix_temp / grid_volume / time_res * 10 ** 9 # 9 ng/m3 6 μBq/m3 3 mBq/m3
Y_pre=result_ConcCal
Y_obs=pm.Normal("Y_obs", mu=Y_pre, sigma=sigma, observed=Y)
trace_g=pm.sample(1000,tune=1000)