Python API

new developments, future functionalities, hints for further applications of MICRESS
Post Reply
sygo
Posts: 3
Joined: Wed Feb 22, 2017 11:45 am
anti_bot: 333

Python API

Post by sygo » Mon Mar 09, 2020 4:26 pm

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.

ralph
Posts: 108
Joined: Wed Apr 27, 2011 4:42 pm
anti_bot: 333

Re: Python API

Post by ralph » Tue Mar 10, 2020 7:35 pm

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

sygo
Posts: 3
Joined: Wed Feb 22, 2017 11:45 am
anti_bot: 333

Re: Python API

Post by sygo » Wed Mar 11, 2020 9:35 am

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'

ralph
Posts: 108
Joined: Wed Apr 27, 2011 4:42 pm
anti_bot: 333

Re: Python API

Post by ralph » Wed Mar 11, 2020 10:49 am

Thanks! I will forward this to Lukas.

Ralph

Post Reply