...
An IDS can contain 0D (scalar) data or/ and arrays with dimensions from 1 to 6.
...
Code Block |
---|
import imas import getpass import numpy as np from imas import imasdef #opens the Data Entry object 'data_entry' associated to the pulse file with shot=54178, run=0, belonging to database 'west' of user 'g2lfleur', using the MDS+ backend data_entry = imas.DBEntry(imasdef.MDSPLUS_BACKEND, 'west, 54178, 0, user_name=getpass.getuser()) #opens the pulse file associated to the Data Entry object 'data_entry' previously created data_entry.open() #reads the 'magnetics' IDS from the data_entry object previously opened magnetics_ids = data_entry.get('magnetics', 0) #The second argument 0 is the so-called IDS occurrence. #close the pulse file associated to the 'data_entry' object data_entry.close() #prints some IDS attributes print('homogeneous_time = ', magnetics_ids.ids_properties.homogeneous_time) print('Number of flux loops = ', len(magnetics_ids.flux_loop)) print('Data of first flux loop = ', magnetics_ids.flux_loop[0].flux.data) print('Homogeneous time basis = ', magnetics_ids.time) |
Running the code above gives the following output:
Code Block |
---|
NumberNumber of flux loops = 17 Data of first flux loop = [ 0.00065229 0.00163073 0.00489218 ... -0.01761185 -0.01663342 -0.01500269] Homogeneous time basis = [ 1.83570397 1.86847198 1.90123999 ... 90.13289642 90.16566467 90.19843292] |
put
In order to write all data (scalars and data arrays) contained in a IDS to the pulse file created previously, we will use the put() operation which writes all static (non time dependent) AND dynamic data present in the IDS.
...