pyPESTO
pyPESTO copied to clipboard
documentation: plot simulation & data points
Hello, i've followed the setup procedure, and was able to run the notebook example, just as described in:
https://pypesto.readthedocs.io/en/latest/example/petab_import.html
I was now hoping to get a plot for the parameter estimation result like i would get in COPASI which would look like:

is there a function like that in pyPESTO that would plot simulation result vs the data points?
Hi! You obtain the simulated data by calling objective(parameters, return_dict=True), which can then be transformed back to the PEtab format using importer.rdatas_to_measurement_df(), see https://github.com/ICB-DCM/pyPESTO/blob/master/pypesto/objective/petab_import.py#L400. Then, you can directly use the PEtab visualization functions, which are shown in a notebook under petab::doc/example. These already handling splitting up into conditions etc..
This is planned to be integrated more tightly in pyPESTO in the future, as ODE simulations are one main application of this general parameter estimation toolbox.
@yannikschaelte thank you ... unfortunately i'm still having some issues. So theoretically all the information is already present in the data after a run of the pypesto notebook, if I knew ahead of time i could simply plot something like:

if i try to use the petab.visualiza function, i'm struggling. I've tried to write the data to file and then create a list of observables and plot that ... but even though i have 3 observable, i get four plots ... all of them empty.

hm. so from the pypesto/amici side everything seems to work. in your script above I assume that df are the return_dict=True data simulated by amici? yeah I guess the petab functions might still require some improvements :sweat_smile: that 4 not 3 plots are generated is a problem of the plotting routine that will be easy to fix, but all of them being empty I am not so sure about. could you make an issue in the petab repo and also post the data/simulation files there? then it will be visible to those who wrote the visualization functions.
will do ... ideally those plotting functions would also be fine with taking data frames directly (or the petab_problem).
yeah that must definitely become possible. unfortunately we have not had the time yet to extend these things, also regarding user-friendliness. but now that more and more people are using it, things might get accelerated ...