...
Accessing data from UAL requires some modification to your code. In this part of tutorial, we will take a closer look on how to access IDS via UAL.
...
Warning
Stop here for a moment. Make sure you have followed the configuration setup before proceeding any further!
...
CHEAT SHEET |
ITM | IMAS | |
---|
import ual | import imas | |
ual.itm(shot, run) | imas.ids(shot, run) | |
| | |
| |
| |
| |
| |
| |
| |
3.1.1 Method "put"
put() |
---|
Code Block |
---|
language | py |
---|
title | ITM |
---|
linenumbers | true |
---|
| #system libraries
import sys
from pylab import *
#UAL library
import ual
# Create a new instance of database
itm_obj = ual.itm(13,3)
itm_obj.create()
cpoArray = itm_obj.equilibriumArray
# allocate the CPO structures
cpoArray.resize(10)
# Filling fields with TIME-INDEPENDENT data
cpoArray[0].codeparam.parameters = 'param'
# SCALARS(!)
# ---- a loop ----
for i in range(10):
# Setting values of time depended data
cpoArray[i].x.y = i
#Do not forget time!!
cpoArray[i].time = i
# ---- a loop ----
#Save data in the database
cpoArray.put() # <= Called outside the loop
#close the pulse file
itm_obj.close() |
| Code Block |
---|
language | py |
---|
title | IMAS |
---|
linenumbers | true |
---|
| #system libraries
import sys
import numpy
#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
# allocate the IDS structures
ids.x.y.resize(10)
ids.time.resize(10))
# Filling fields with TIME-INDEPENDENT data
ids.ids_properties.comment = 'A test IDS created by PUT'
# STORE AS SCALARS(!)
# ---- a loop ----
for i in range(10):
# Setting values of time depended data
ids.x.y[i] = i
#Do not forget time!!
ids.time[i] = i
# ---- a loop ----
# OR STORE AS VECTORS
ids.x.y = valueVector
ids.time = timeVector
#Save data in the database
ids.put() # <= Called outside the loop
#close the pulse file
imas_obj.close() |
|
...