parameters['rs'] = 0.95 parameters['recoil_prob'] = 0.025 #load obs data peaklist = get_peaks() if False: # test the theoretical model dt_output = 60 tmax = 6*60*60 npts = tmax/dt_output dfmod = tm.detector_model_wrapper(timestep=dt_output, initial_state=np.zeros(tm.N_state), external_radon_conc=np.ones(npts) * onemBq / 100.0, internal_airt_history=np.ones(npts)*(273.15+20), parameters=parameters) chains_list = [] parameters.pop('transform_radon_timeseries') parameters.pop('total_efficiency') parameters.pop('total_efficiency_frac_error') count = 0 for dfss in peaklist: count += 1 import emcee_deconvolve_tm
parameters['variable_parameter_lower_bounds'] = np.array([0.0, 0.0, 0.0, 0.0, -np.inf, 0.0, 3600*4]) parameters['variable_parameter_upper_bounds'] = np.array([np.inf, np.inf, 2.0, np.inf, np.inf, np.inf, 3600*6]) variable_parameters_mu_prior = np.array( [parameters[k] for k in variable_parameter_names]) variable_parameters_sigma_prior = np.array([parameters['Q_external'] * 0.02, parameters['Q']*0.02, 0.05, 1/100.0, 60., 0.2, 10*60.0]) # how does the initial guess look? Y = tm.detector_model_wrapper(np.diff(t)[0], initial_state=np.array([0.,0,0,0,0]), external_radon_conc=dfss.cal_radon_conc.values/lamrn*0.0, internal_airt_history=dfss.airt.values, parameters=parameters, interpolation_mode=1, return_full_state=False) dfss['lldmod'] = np.r_[0.0, Y.Acc_counts.diff().values[1:]] + \ expected_background*tres f, ax = plt.subplots() dfss[['lld','lldmod']].plot(ax=ax) ax.set_title(dfss.index.to_pydatetime()[0].date().strftime('%b %Y')) plt.show() # fit to obs if True: fit_ret = emcee_deconvolve_tm.fit_parameters_to_obs(t, observed_counts=dfss.lld.values,