Page 1 of 1

Python API

Posted: Mon Mar 09, 2020 4:26 pm
by sygo
Hi,

I wondered if there is already a Python API available to generate the input file. I have in mind to launch series of simulation varying some parameters and automatically analyzing the results. So it would be useful to have an API. If not, I guess that I will just edit my template input file to modify the specific parameters but it would not be as clean and reusable.

Re: Python API

Posted: Tue Mar 10, 2020 7:35 pm
by ralph
No, there is no general Python API for generating input available. Would be very complex to implement that, I think.

Of course, we made already parameter studies by Python scripts.
I prefer to use place holders in a driving file template and write a script which instances this template with a specific set of parameter in a new driving file, e.g. <cellsx> becomes 100. That's just string replacement and not to complex.

I do not know of published scripts for reading results in general either.
In future, we might publish some work we have done internally. But that is not decided, yet.

For now, I recommend to write VTK results and use the PyVTK package to get NumPy arrays from the results.
See also this project on GitHub for plotting a fraction table in a Jupyter notebook:
https://github.com/lukas-koschmieder/micress-ipynb

More to come!

Ralph

Re: Python API

Posted: Wed Mar 11, 2020 9:35 am
by sygo
Thanks for your answer.
Yes it would be complex to develop an API so I thought it's better to ask before starting to plan ahead.

We have used PyVTK and I agree that it is an easy way to exploit further the results from Micress.

Thanks for the Jupyter Notebook.
Just one comment, I needed to add the following lines to make the plot visible:
import plotly.io as pio
pio.renderers.default='notebook'

Re: Python API

Posted: Wed Mar 11, 2020 10:49 am
by ralph
Thanks! I will forward this to Lukas.

Ralph