f3dasm icon indicating copy to clipboard operation
f3dasm copied to clipboard

Improving usability by implementing helper function to convert arbitrary functions to DataGenerators

Open mpvanderschelling opened this issue 2 years ago • 0 comments

Problem

Constructing a DataGenerator can be quite complex, so in order to improve the usability, it would be great if there was a way to convert the simplest of python functions (e.g. number of arbitraty arguments, number of arbitrary returns) to a DataGenerator object with a helper function:

For example:

def f(x, s):
    return x + s

... where for example x is a parametrized parameter that can be handled by ExperimentSample and s is a parameter that is always given to this function (let's say s=103).

Possible solution

The function should look something like this:

data_generator = convert_function(f=f, input=['x'], output=['y'], kwargs={'s': 103})

The returned object is a f3dasm.DataGenerator that can be used in combination with experiment_data.evaluate()

mpvanderschelling avatar Dec 13 '23 00:12 mpvanderschelling