next up previous contents index
Next: The Sic object in Up: Using SIC from Python Previous: Special commands   Contents   Index

The gdict container

Modules have a special attribute named gdict (actually, a class instance) from which all Gildas variables can be easily retrieved and defined:
>>> import pysic
>>> pysic.get()
Importing all SIC variables into Python...
... done.
>>> g = pysic.gdict
>>> g
Container for imported Gildas variables. Variables are accessed as
   attributes of this object.
>>> g.pi           # Get Gildas variable PI
>>> g.a = (1,2,3)  # Set a new Gildas variable A
A               is a      INTEGER*4, 1D (3x0x0x0)   (GLOBAL,RW) -> a
>>> pysic.comm('exa a')
A               is an integer Array      of dimensions      3
            1            2            3
Whatever the name area has been defined by user with setgdict, any gdict instance will allways find the Gildas dictionary8. The variable handling can be found easier than the dictionary equivalent d['pi'].

Gildas manager 2014-07-01