core.utils.misc.call_func_strict_output_dim

core.utils.misc.call_func_strict_output_dim(
    func,
    num_request,
    buffer_fraction=0.02,
)

Repeatedly calls a function until the output shape is the size of num_samples. This can be useful when a user requests N samples from a function, but because of failures in that function, only M < N sample are returned.

Parameters

Name Type Description Default
func Callable[[int], Iterable[Iterable]] Function to repeatedly call. This should take an int and iterable of iterables. The int tells the function how many samples to generate. So for example if one passes 10 to the function, a possible output could be, [np.ndarray, pd.DataFrame, dict{“key”:np.array}], where each entry has len of 10. required
num_request int The output size of the function required
buffer_fraction float The fraction of extra samples to generate given we know the fraction of failed waveforms. 0.02

Returns

Name Type Description
final_output Iterable[Iterable] Iterable of iterables where each (sub) iterable has the len equal to num_request.