#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 = '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() |