config_loader

class ConfigLoader(file_name, vm=None, share_dict=None)[source]

Bases: BaseConfig

class for loading config.yml

add_constraints(amp)[source]
add_decay_constraints(amp, dic=None)[source]
add_fix_var_constraints(amp, dic=None)[source]
add_free_var_constraints(amp, dic=None)[source]
add_from_trans_constraints(amp, dic=None)[source]
add_gauss_constr_constraints(amp, dic=None)[source]
add_particle_constraints(amp, dic=None)[source]
add_pre_trans_constraints(amp, dic=None)[source]
add_var_equal_constraints(amp, dic=None)[source]
add_var_range_constraints(amp, dic=None)[source]
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.

batch_sum_var(*args, **kwargs)[source]
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]
cal_signal_yields(params={}, mcdata=None, batch=25000)[source]
check_valid_jp(decay_group)[source]
eval_amplitude(*p, extra=None)[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]
fitNtimes(N, *args, **kwargs)[source]
free_for_extended(amp)[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_data()[source]
get_all_frame()
get_all_plotdatas(data=None, phsp=None, bg=None, res=None, use_weighted=False)
get_amplitude(vm=None, name='')[source]
get_chain(idx)[source]
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_dat_order(standard=False)[source]
get_data(idx)[source]
get_data_file(idx)[source]
get_data_index(sub, name)[source]
get_data_rec(name)[source]
get_decay(full=True)[source]
get_fcn(all_data=None, batch=65000, vm=None, name='')[source]
get_ndf()[source]
get_params(trainable_only=False)[source]
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_noeff()[source]
get_phsp_p_generator(nodes=[])
get_phsp_plot(tail='')[source]
get_plotter(legend_file=None, res=None, datasets=None, use_weighted=False)
likelihood_profile(var, var_min, var_max, N=100)[source]
load_cached_data(file_name=None)[source]
static load_config(file_name, share_dict={})[source]
mask_params(params)[source]
params_trans()[source]
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)
register_extra_constrains(name, f=None)[source]

add extra_constrains

classmethod register_function(name=None)[source]
reinit_params()[source]
static reweight_init_value(amp, phsp, ns=None)[source]

reset decay chain total and make the integration to be ns

save_cached_data(data, file_name=None)[source]
save_params(file_name)[source]
save_tensorflow_model(dir_name)[source]
set_params(params, neglect_params=None)[source]
class PlotParams(plot_config, decay_struct)[source]

Bases: dict

get_angle_vars(is_align=False)[source]
get_data_index(sub, name)[source]
get_extra_vars()[source]
get_index_vars()[source]
get_mass_vars()[source]
get_params(params=None)[source]
read_plot_config(v)[source]
set_prefix_constrains(vm, base, params_dic, self)[source]
validate_file_name(s)[source]