When and Why to use the python API

The python API can be a powerful allay in your analysis if used in the correct way, but it can turn against you by making your scripts slow and inefficient if not correctly applied.

So, when do I want to use the python API? When you are aiming at:

  1. Saving time if you need to do the same analysis over and over again to different datasets / parts of your dataset or if you want to create an animation 
  2. Personilize your EnSight for the kind of analysis you perform. Indeed you can create new tools (functions), and call them whenever you need them. So, if there is a kind of analysis you perform often, but it is not pre-defined in EnSight, you can create it and save it as a new tool. 
  3. Save your steps, so that you can uniform all your analysis by re-running the same steps. 

Briefly: the python interpreter is designed to control and better organize the flow of analysis, not to substitute it completely.

One very appealing feature of the python interface is that it can run in batch, which means that you can launch it, go home for the night / weekend, and come back to work and find all your analysis ready.
Moreover, python is a human-friendly language, while the command language is pretty obscure and not elastic. So, while it is easy to create lists, modify numbers and variables, doing if cycles, writing out / reading in files with python, it can be a nightmare to do the same simple tasks with the command language.

On the other hand, the python API works on the client, not on the server. This means that it can be slow, especially if you are doing a lot of calls from the server, as every time you need to do a client -> server -> client exchange of information.
So, if you are doing analysis over large amount of nodes / if you are doing heavy calculations, the python interpreter can be very slow. Also, as it runs on the client and not on the server, it can not be used in parallel.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request