Welcome, Guest
Username: Password: Remember me

TOPIC: call Telemac in python

call Telemac in python 7 years 7 months ago #25893

  • o.gourgue
  • o.gourgue's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 155
  • Thank you received: 11
Dear,

I'm trying to call Telemac in a Python function. What I'm doing now is:
def run_telemac(self):
  import os
  os.system('python $PYTELPATH/runcode.py telemac2d my_cas_file.cas -c my_configuration_name')

It works, but it is not very elegant. I would like to do something like
def run_telemac(self):
  import runcode
  runcode.main()

But I don't know exactly how to define the options...

I would be very grateful is somebody could help me with that.
The administrator has disabled public write access.

call Telemac in python 7 years 7 months ago #25898

  • yugi
  • yugi's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 851
  • Thank you received: 244
Hi,

With the actual version you can not give it arguments.

Another solution can be to use the TelApy module that contain the Python wrapper over the telemac2d API.
You can find informations here :
wiki.opentelemac.org/doku.php?id=installation_on_linux

On how to install it.
We have notebooks containing examples on how to use them in scripts/python27/TelApy/notebooks
The full documentation will be available in the next release.

Hope it helps
There are 10 types of people in the world: those who understand binary, and those who don't.
The administrator has disabled public write access.
The following user(s) said Thank You: o.gourgue

call Telemac in python 7 years 7 months ago #25902

  • o.gourgue
  • o.gourgue's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 155
  • Thank you received: 11
Thank you Yoann. I think I'm gonna stick with the os.system solution for now... but I need to try to use TelApy some day, for sure!
The administrator has disabled public write access.

call Telemac in python 7 years 7 months ago #25904

  • sebourban
  • sebourban's Avatar
  • OFFLINE
  • Administrator
  • Principal Scientist
  • Posts: 814
  • Thank you received: 219
Hello,

Just for information, recent work on compileTELEMAC.py and runcode.py (for Algorithmic Differentiation) means that compileAPI.py and related could be replaced by compileTELEMAC.py and runcode.py used in a similar way (jsu the systel.cfg will change for that particular use).

I shall have something ready for the trunk before the end of the week.

Sébastien.
The administrator has disabled public write access.
The following user(s) said Thank You: o.gourgue
Moderators: borisb

The open TELEMAC-MASCARET template for Joomla!2.5, the HTML 4 version.