Python Scripting

The Python programming language is embedded inside PFC, FLAC3D and 3DEC. Python is a general purpose programming language with good support for scientific and numerical programming. Python has been extended to allow models to be manipulated from Python programs.

Note

  • The FISH programming environment is still available.
  • Python has the advantage of being faster, easy to use and has additional functionality.
  • An important difference between the Python and FISH programming environments is that the Python state is not connected to the model state or saved in the save files. When a model new or model restore command is given the FISH programming state is cleared or restored. The Python state is not affected by the model new or model restore commands and the Python state is not saved in save files.
  • Giving the command python-reset-state false changes this behavior so the Python state is not cleared by the model new or model restore commands. The tutorials and examples here all assume that this command has been given and that the Python state persists after calls to model new or model restore commands.

This section is divided into five major sections.

The introductory section provides an overview of Python and basics that will serve when using Python with Itasca software.

Use of Python with 3DEC, including the programming API for 3DEC, is found here.

Use of Python with FLAC3D, including the programming API for FLAC3D, is found here.

Use of Python with PFC, including the programming API for PFC, is found here.

Itasca (Common) API

The last major major topic in this Python material provides the API common to all Itasca software. It has two principal modules.