qspec logo qspec logo

A physics toolbox for laser spectroscopy.

Static Badge Static Badge Static Badge

Static Badge Static Badge

© 2026 Patrick Müller. All rights reserved.

qspec. convolve_dict  (  a ,  *key_lists ,  operator='+' ,  short_keys=True  )[source]

Combine the values of a dictionary with the given operator, e.g., for operator == "+", the dictionary {key_lists[0][i] + key_lists[1][i] + ...: a[key_lists[0][i]] + a[key_lists[1][i]] + ...}.

Parameters:
adict

A dictionary to be convolved.

key_listsIterable

An arbitrary number of iterables of the same length which include keys from a.

operatorstr

The operator which is used to combine the values. Can be one of "+", "-", "*", "/", "%" or "gauss" (the square root of the sum of squares).

short_keysbool

Whether to use the keys of the first key list or representations of the entire operations as the new keys.

Returns:
a_convdict

The dictionary with the combined values.

Raises:
ValueError

If operator is not supported.