Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Warning

Warning

Stop here for a moment. Make sure you have followed the configuration setup before proceeding any further!

Configuration related tutorial is here -> Click me! <-

 

3.1.1 Method "

...

put"

 

putSlice put()
Code Block
languagepy
titleITM
linenumberstrue
#system libraries
import sys
from pylab import * 

##UAL UAL library
import ual

# Create a new instance of database
itm_obj = ual.itm(1413,43)
itm_obj.create()

cpo


cpoArray = itm_obj.equilibriumequilibriumArray

# allocate the CPO structures
cpoArray.resize(10)


# Filling fields with TIME-INDEPENDENT  data
cpocpoArray[0].codeparam.parameters = 'param'

#Save time independent fields
cpo.putNonTimed()






# SCALARS(!)
# ---- a loop ----
for i in range(10):
      # Setting values of time depended data
cpo 
      cpoArray[i].x.y = VALUEi
    
	  #Do not forget time!!
cpo      cpoArray[i].time = VALUE i
# ---- a loop 
#Append this slice----





#Save data in the database
cpocpoArray.putSliceput() # <= Called outside the loop

#close the pulse file
itm_obj.close()
Code Block
languagepy
titleIMAS
linenumberstrue
#system libraries
import sys
import numpy

# UAL#UAL library
import imas

# Create a new instance of database
imas_obj = imas.ids(11, 22)
imas_obj.create()

# Mandatory to define this property
ids.ids_properties.homogeneous_time = 0

ids = imas_obj.core_profiles

# Mandatoryallocate tothe defineIDS this propertystructures
ids.x.y.resize(10)
ids_properties.homogeneous_time = 1time.resize(10))

# Filling fields with TIME-INDEPENDENT  data
ids.ids_properties.comment = 'TestA test IDS created by putSlicePUT'

#Save# timeSTORE independent fields
ids.putNonTimed()
AS SCALARS(!)
# Allocate all variables, time coordinate of size 1
ids.time.resize(1)
ids.x.y.resize(1)

---- a loop ----
for i in range(10):
      # Setting values of time depended data
      ids.x.y[0i] = VAKUEi 
	  
      #Do not forget time!!
      ids.time[0i] = VALUE

#Append this slice i
# ---- a loop ----

# OR STORE AS VECTORS
ids.x.y = valueVector
ids.time = timeVector

#Save data in the database
ids.putSliceput() # <= Called outside the loop

#close the pulse file
imas_obj.close()

...

3.1.1 Method "

...

putSlice"

 

 putputSlice()
Code Block
languagepy
titleITM
linenumberstrue
#system libraries
import sys
from pylab import * 

#UAL# UAL library
import ual

# Create a new instance of database
itm_obj = ual.itm(1314,34)
itm_obj.create()




cpoArraycpo = itm_obj.equilibriumArrayequilibrium

# allocate the CPO structures
cpoArray.resize(10)


# Filling fields with TIME-INDEPENDENT  data
cpoArray[0]cpo.codeparam.parameters = 'param'

# SCALARS(!)
# ---- a loop ----
for i in range(10):
      #Save time independent fields
cpo.putNonTimed()





# Setting values of time depended data 
      cpoArray[i]
cpo.x.y = iVALUE
    
	  #Do not forget time!!
      cpoArray[i]cpo.time = VALUE i
# ---- a loop ----





#Save data
#Append this slice in the database
cpoArraycpo.putputSlice() # <= Called outside the loop

#close the pulse file
itm_obj.close()
Code Block
languagepy
titleIMAS
linenumberstrue
#system libraries
import sys
import numpy

#UAL# UAL library
import imas

# Create a new instance of database
imas_obj = imas.ids(11, 22)
imas_obj.create()

# Mandatory to define this property
ids.ids_properties.homogeneous_time = 0

ids = imas_obj.core_profiles

# Mandatory allocateto thedefine IDSthis structuresproperty
ids.x.y.resize(10)
ids_properties.time.resize(10))homogeneous_time = 1

# Filling fields with TIME-INDEPENDENT  data
ids.ids_properties.comment = 'A testTest IDS created by PUTputSlice'

##Save STOREtime AS SCALARS(!independent fields
ids.putNonTimed()

# ---- a loop ----
for i in range(10):
       Allocate all variables, time coordinate of size 1
ids.time.resize(1)
ids.x.y.resize(1)

# Setting values of time depended data
      ids.x.y[i0] = iVAKUE 
	  
      #Do not forget time!!
      ids.time[i0] = i
# ---- a loop ----

# OR STORE AS VECTORS
ids.x.y = valueVector
ids.time = timeVector

#Save dataVALUE

#Append this slice in the database
ids.putputSlice() # <= Called outside the loop

#close the pulse file
imas_obj.close()

 

3.1.1 Method "get"

 

get() CPO vs IDS
Code Block
languagepy
titleITM
linenumberstrue
#system libraries
import numpy
import sys

#UAL library
import ual

#Open the database
itm_obj = ual.itm(123,3,123,0)
itm_obj.open() 
        
cpoArray = itm_obj.pfsystemsArray

#Get data
cpoArray.get()

# SCALARS (!)
for i in range(len(cpoArray)):
      print "Time = " + str(cpoArray[i].time)
      print "Value = "+ str(cpoArray[i].x.y)






#close the pulse file
imas_obj.close()
Code Block
languagepy
titleIMAS
linenumberstrue
#system libraries
import sys
import numpy

#UAL library
import imas

#Open a database
imas_obj = imas.ids(11, 22)
imas_obj.open()  

ids = imas_obj.core_profiles

#Get data
ids.get()

# SCALARS (!)
for i in range(len(ids.time)):
    print 'Time   =' + str(ids.time[i]) 
    print 'Value  =' + str(ids.x.y[i])

# VECTORS (!)
print 'Time  = '  + str(ids.time)
print 'Value  = ' + str(ids.x.y)


#close the pulse file
imas_obj.close()

 

 

 

...

 getSlice() CPO vs  IDS
Code Block
languagepy
titleITM
linenumberstrue
#system libraries
import sys
import numpy

#UAL library
import ual

#Open the database
itm_obj = ual.itm(11,22)
itm_obj.open() 
 
cpo = my_itm_obj.pfsystems

#Get data
cpo.getSlice(2, 1)

#SCALARS 
print 'Time : ' + str(cpo.time)
print 'VALUE = ' + str(ids.x.y)

#close the pulse file
itm_obj.close()
Code Block
languagepy
titleIMAS
linenumberstrue
#system libraries
import sys
import numpy

#UAL library
import imas

#Open a database
imas_obj = imas.ids(11,22)
imas_obj.open()  

ids = imas_obj.core_profiles

#Get data
ids.getSlice(2, 1)

#SCALARS 
print 'Time : ' + str(ids.time)
print 'VALUE = ' + str(ids.x.y)

#close the pulse file
imas_obj.close()

 

4