config_loader
- class ConfigLoader(file_name, vm=None, share_dict=None)[source]
Bases:
BaseConfig
class for loading config.yml
- attach_fix_params_error(params: dict, V_b=None) ndarray [source]
The minimal condition
\[-\frac{\partial\ln L(a,b)}{\partial a} = 0,\]can be treated as a implect function \(a(b)\). The gradients is
\[\frac{\partial a }{\partial b} = - (\frac{\partial^2 \ln L(a,b)}{\partial a \partial a })^{-1} \frac{\partial \ln L(a,b)}{\partial a\partial b }.\]The uncertanties from b with error matrix \(V_b\) can propagate to a as
\[V_a = \frac{\partial a }{\partial b} V_b \frac{\partial a }{\partial b}\]This matrix will be added to the config.inv_he.
- cal_bins_numbers(adapter, data, phsp, read_data, bg=None, bg_weight=None)
- cal_chi2(read_data=None, bins=[[2, 2], [2, 2], [2, 2]], mass=['R_BD', 'R_CD'])
- cal_fitfractions(params={}, mcdata=None, res=None, exclude_res=[], batch=25000, method='old')[source]
- fit(data=None, phsp=None, bg=None, inmc=None, batch=65000, method='BFGS', check_grad=False, improve=False, reweight=False, maxiter=None, jac=True, print_init_nll=True, callback=None, grad_scale=1.0, gtol=0.001)[source]
- generate_SDP(node, N=1000, include_charge=False, legacy=True)
- generate_SDP_p(node, N=1000, legacy=False)
- generate_phsp(N=1000, include_charge=False, cal_max=False)
- generate_phsp_p(N=1000, cal_max=False)
- generate_toy(N=1000, force=True, gen=None, gen_p=None, importance_f=None, max_N=100000, include_charge=False, cal_phsp_max=False)
A more accurate method for generating toy data.
- Parameters:
N – number of events.
force – if romove extra data generated.
gen – optional function for generate phase space, the return value is same as config.get_data.
gen_p – optional function for generate phase space, the return value is dict as
{B: pb, C: pc, D: pd}
.max_N – max number of events for every try.
- generate_toy2(*args, **kwargs)
- generate_toy_o(N=1000, force=True, max_N=100000)
- generate_toy_p(N=1000, force=True, gen_p=None, importance_f=None, max_N=100000, include_charge=False, cal_phsp_max=False)
generate toy data momentum.
- get_SDP_generator(node, include_charge=False, legacy=True)
- get_SDP_p_generator(node, legacy=True)
- get_all_frame()
- get_all_plotdatas(data=None, phsp=None, bg=None, res=None, use_weighted=False)
- get_chain_property(idx, display=True)
Get chain name and curve style in plot
- get_dalitz(a, b)
- get_dalitz_boundary(a, b, N=1000)
- get_params_error(params=None, data=None, phsp=None, bg=None, inmc=None, batch=10000, using_cached=False, method=None, force_pos=True, correct_params=None)[source]
calculate parameters error
- get_particle_function(name, d_norm=False)
- get_phsp_generator(include_charge=False, nodes=[])
- get_phsp_p_generator(nodes=[])
- get_plotter(legend_file=None, res=None, datasets=None, use_weighted=False)
- plot_adaptive_2dpull(var1, var2, binning=[[2, 2], [2, 2], [2, 2]], ax=<module 'matplotlib.pyplot' from '/home/docs/checkouts/readthedocs.org/user_builds/tf-pwa/envs/latest/lib/python3.10/site-packages/matplotlib/pyplot.py'>, where={}, cut_zero=True, plot_scatter=True, scatter_style={'c': 'black', 's': 1}, **kwargs)
- plot_partial_wave(params=None, data=None, phsp=None, bg=None, prefix='figure/', res=None, save_root=False, chains_id_method=None, phsp_rec=None, cut_function=<function <lambda>>, plot_function=None, **kwargs)
plot partial wave plots
- Parameters:
self – ConfigLoader object
params – params, dict or FitResutls
data – data sample, a list of CalAngleData
phsp – phase space sample, a list of CalAngleData (the same size as data)
bg – background sample, a list of CalAngleData (the same size as data)
prefix – figure saving folder and nameing prefix
res – combination of resonaces in partial wave, list of (list of (string for resoances name or int for decay chain index))
save_root – if save weights in a root file, bool
chains_id_method – method of how legend label display, string
bin_scale – more binning in partial waves for a smooth histogram. int
batch – batching in calculating weights, int
smooth – if plot smooth binned kde shape or histogram, bool
single_legend – if save all legend in a file “legend.pdf”, bool
plot_pull – if plot the pull distribution, bool
format – save figure with image format, string (such as “.png”, “.jpeg”)
linestyle_file – legend linestyle configuration file name (YAML format), string (such as “legend.yml”)
- plot_partial_wave_interf(res1, res2, **kwargs)