mail[sr #3117] Functionality to inspect interactively after running script - The equivalence to python -i


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by Troels E. Linnet on February 14, 2014 - 12:19:
Update of sr #3117 (project relax):

                  Status:               Need Info => Done                   
             Assigned to:                    None => tlinnet                
             Open/Closed:                    Open => Closed                 

    _______________________________________________________

Follow-up Comment #8:

This support request has now been implemented.

Note, a relevant namespace issue is discussed here:
http://thread.gmane.org/gmane.science.nmr.relax.devel/5012

For getting access to variables after executing a script, the variable should
be saved under: cdp.X, where X define a container.

An example of running relax in interactively mode is the script: test.py which
contains:
------------------
pipe.create(pipe_name='test', pipe_type='relax_disp')
cdp.a = 10
print "helo"
state.save("namespace_test")
-------
Then run relax with:
relax -p test.py

Output
---------------------------------
[tlinnet@tomat relax_trunk]$ ./relax -p test.py

[CUTTED INFO TEXT]

Processor fabric:  Uni-processor.

script = 'test.py'
----------------------------------------------------------------------------------------------------
pipe.create(pipe_name='test', pipe_type='relax_disp')
cdp.a = 10
print "helo"
state.save("namespace_test")
----------------------------------------------------------------------------------------------------
helo
Opening the file 'namespace_test.bz2' for writing.

relax> print cdp.a
10
-------------------------------------------------------

Afterwards, the state can be loaded, and the variable still be accessed.

Output
----------------------------
[tlinnet@tomat relax_trunk]$ ./relax 

[CUTTED INFO TEXT]

Processor fabric:  Uni-processor.

relax> state.load("namespace_test")
Opening the file 'namespace_test.bz2' for reading.
relax> print cdp.a
10
relax> print cdp
The data pipe storage object.

Objects:
  a: 10
  hybrid_pipes: []
  interatomic: The interatomic data list (for the storage of the inter-spin
system data)
  mol: The molecule list (for the storage of the spin system specific data)
  pipe_type: u'relax_disp'

relax> 



    _______________________________________________________

Reply to this item at:

  <http://gna.org/support/?3117>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/




Related Messages


Powered by MHonArc, Updated Fri Feb 14 12:40:19 2014