...
python put_cpo.py
4. Open example file
...
Handling CPOs: put() vs. putSlice() |
---|
|
vi $TUTORIAL_DIR/cpo_basics/python/put_cpo.py
What you can see here is a simple code that stores particular CPO into MDSPlus database using UAL.
...
| title | $TUTORIAL_DIR/cpo_basics/python/put_cpo_array.py |
---|
linenumbers | true |
---|
| import sys
from pylab import *
import ual
cpo = ual.itm( |
|
...
...
3)
cpo.create()
if not cpo.isConnected():
print 'error during itmdb entry creation'
sys.exit(1)
cpo.equilibriumArray.resize( |
|
...
...
equi = cpo.equilibriumArray
|
|
...
for i in range(0, 10):
#Time independent fields
equi.array[ |
|
...
i].datainfo.dataprovider = 'MKO'
equi.array[ |
|
...
...
...
...
...
i].codeparam.parameters = 'param'
|
|
...
...
i].eqgeometry.boundary.resize(1)
equi.array[ |
|
...
i].eqgeometry.boundary[0].r = sin(arange(0,2*pi,2*pi/100)) + (1/float(100-i))
equi.array[ |
|
...
i].eqgeometry.boundary[0].z = cos(arange(0,2*pi,2*pi/100)) + (1/float(100-i))
|
|
...
#Do not forget time!!
equi.array[ |
|
...
i].time = i
equi.put()
#close the pulse file
cpo.close() |
| Code Block |
---|
language | py |
---|
title | $TUTORIAL_DIR/cpo_basics/python/put_cpo_slices.py |
---|
linenumbers | true |
---|
| import sys
from pylab import *
import ual
cpo = ual.itm(14,4)
cpo.create()
if not cpo.isConnected():
print 'error during itmdb entry creation'
sys.exit(1)
equi = cpo.equilibrium
#First fill fields which are not time-dependent.
equi.datainfo.dataprovider = 'MKO'
equi.datainfo.putdate = '20/09/2016'
equi.codeparam.parameters = 'param'
#Save time independent fields
equi.putNonTimed()
for i in range(0, 10):
equi.eqgeometry.boundary.resize(1)
equi.eqgeometry.boundary[0].r |
|
...
= sin(arange(0,2*pi,2*pi/100)) + (1/float(100-i))
equi.eqgeometry.boundary[0].z = cos(arange(0,2*pi,2*pi/100)) + (1/float(100-i))
#Do not forget time!!
equi.time = i
#Append this slice in the database
equi. |
|
...
putSlice()
#close the pulse file
cpo.close() |
|
Image Added | VI related notice I will use VI in every place where text files are modified. If you have any other text file editor of your choice - fell free to use it instead. |
vi $TUTORIAL_DIR/cpo_basics/python/put_cpo.py
What you can see here is a simple code that stores particular CPO into MDSPlus database using UAL.
Let's check how to read these data in Fortran.
...