copasi / basico

A simplified python interface to COPASI.
https://basico.readthedocs.io/
Artistic License 2.0
19 stars 5 forks source link

Mapping bug for multiple experiments in parameter estimation #45

Closed Theo-BRN closed 5 months ago

Theo-BRN commented 6 months ago

Heya Frank, hope you're well!

I found evidence of a possible bug when adding experiments for parameter estimation. I may well be running the code wrong somehow, so would be delighted if you could correct it for me!

The bug arises when I try add multiple experiments to COPASI and when I try map a column in those experiments to a global quantity parameter. Then, when trying to get the experimental mapping it gives me a pandas dataframe error: KeyError: "None of ['column'] are in the columns", resulting from the last line of the get_experiment_mapping function: return pandas.DataFrame(data=rows).set_index('column'). I've attached a notebook, model and experimental data for this in the zip folder.

From some rudimentary digging myself, I think there's something wrong with the experiment object. However, I can't see any difference between when add_experiment does work and when it doesn't.

Interestingly

Let me know if you want any more detail! Thanks, Theo

PE_Bug.zip

fbergmann commented 6 months ago

Thanks for letting me know, this is indeed odd. Especially, that once you save the model after adding the experiment, and open that file in the COPASI UI, you'll find all the data mapped correctly. And indeed, if the test is then simplified, to just load the data and go through the experiments in basico, the experiments 2 and 3 appear to have no mapping.

Theo-BRN commented 6 months ago

Yes exactly! Glad it's not just me!

Theo-BRN commented 6 months ago

Thanks Frank! It looks like those changes work for me now too. Out of curiosity, when will the pip install version be updated with these changes? Is it best practice to wait for more changes before updating that? Or do you foresee a problem with the current version?

fbergmann commented 6 months ago

Hello Theo, the short answer is soon .. definitely within a day or so. While that issue is being fixed, I'll also try to address some incompatibilities with different COPASI versions. But I'm almost there. The release will be out tomorrow Saturday at the latest.

Theo-BRN commented 6 months ago

Thank you! Didn't mean to rush you, was just curious! Thanks for your quick response :-)

fbergmann commented 6 months ago

The release is out now, and solves the issue for creating experiments directly after modifying the model structure.