ProtoLife / daptics-api

API documentation and clients for the daptics.ai design of experiments engine
https://daptics.ai
GNU General Public License v3.0
1 stars 1 forks source link

`simulate_experiment_responses` does not install new responses. #34

Open nhpackard opened 3 years ago

nhpackard commented 3 years ago

(cf. #32)

To generate simulated responses and export them I execute:

space = daptics.get_experimental_space()
design = daptics.design
experiments = daptics.random_experiments_with_responses(space, design)
expsim = daptics.simulate_experiment_responses(experiments)
daptics.export_csv(csv_experiments_file, expsim, True)

This works to the extent that csv_experiments_file has the right simulated results

But then when I request next gen design with

newgen = daptics.put_experiments_csv(
    DapticsExperimentsType.DESIGNED_WITH_OPTIONAL_EXTRAS,
    csv_experiments_file)

I get error

Task failed with error(s)!  Messages are:
[0] category:   execution
[0] fatalError: None
[0] message:    Experiments in Experiments1.csv do not match those of generation 1
[0] systemError:    None

My diagnosis is that the call daptics.random_experiments_with_responses installs the random experiments in Experiments1.csv, and then there is a skew between those and the simulated response experiments in csv_experiments_file.

Proposed solution: dispense with current daptics.simulate_experiment_responses, create new daptics.simulated_experiments_with_responses that is exactly like daptics.random_experiments_with_responses (including installation of Experiments1.csv on backend), except using simulated responses instead of random.

Actually better names would be:

daptics.experiments_with_random_responses
daptics.experiments_with_simulated_responses

I will work on this in new branch...

nhpackard commented 3 years ago

Not sure of my diagnosis.

I don't see where the code is fixing Experiments1.csv. Don't see this happening in daptics.random_experiments_with_responses.

nhpackard commented 3 years ago

The problem: in

expsim = daptics.simulate_experiment_responses(experiments)
daptics.export_csv(csv_experiments_file, expsim, True)

The return value expsim does not have the same form as experiments, and so can't be exported with daptics.export_csv.

Instead, needs to be

expsim = daptics.simulate_experiment_responses(experiments)
expsim = expsim['simulateResponses']['table']
daptics.export_csv(csv_experiments_file, expsim, True)

If no objections, I am going to change 'daptics.simulate_experiment_responses(experiments)to return an experiments dictionary of the same form as the argexperiments`

pzingg commented 3 years ago

@nhpackard If you want to put up a pull request with these changes I will review.

nhpackard commented 3 years ago

Will do. Now distracted by workshop.