Evaluating experimental data with a function whose signature does not strictly match the input variables will raise an error
For instance, replicating the own data generator example will raise TypeError: cannot unpack non-iterable NoneType object.
import numpy as np
from scipy.stats import norm
from f3dasm import ExperimentData
from f3dasm.datageneration import DataGenerator
from f3dasm.design import Domain
def y(seed):
z = norm.rvs(1.5, 0.5, size=1)
y = z*seed + 0.1*seed**2
return y
domain = Domain()
domain.add_float('x', low=0., high=100.)
domain.add_float('z', low=0., high=100.)
N = 33 # number of points to generate
Data_x = np.linspace(3, 83, 100)
experiment_data = ExperimentData(input_data=Data_x, domain=domain)
experiment_data.evaluate(data_generator=y, output_names=['y'])
The only change is the addition of the variable z to the input space.
Likewise, modifying the variable name will raise the same error.
import numpy as np
from scipy.stats import norm
from f3dasm import ExperimentData
from f3dasm.datageneration import DataGenerator
from f3dasm.design import Domain
def y(seed):
z = norm.rvs(1.5, 0.5, size=1)
y = z*seed + 0.1*seed**2
return y
domain = Domain()
domain.add_float('xx', low=0., high=100.)
N = 33 # number of points to generate
Data_x = np.linspace(3, 83, 100)
experiment_data = ExperimentData(input_data=Data_x, domain=domain)
experiment_data.evaluate(data_generator=y, output_names=['y'])
If this behavior is intentional, it is not documented. Raising an explicit error might also help.
Hey Guillaume,
If I understand it correctly, it is not documented that the input arguments of the user-defined data generator function need to correspond to the input domain parameters described in the Domain object
Hi Martin,
Exactly. I don't know if this behavior is intended or should be reworked for more flexibility, but documenting it explicitly will help new users.