...
Code Block |
---|
homogeneous_time = 1 Frame : 0 [[0 1 2 3 4] [1 2 3 4 5] [2 3 4 5 6]] ----- Frame : 1 [[1 2 3 4 5] [2 3 4 5 6] [3 4 5 6 7]] ----- Frame : 2 [[2 3 4 5 6] [3 4 5 6 7] [4 5 6 7 8]] ----- |
get_slice
The get_slice() operation has the following signature:
Code Block |
---|
get_slice(<idsname>, time_requested, interpolation_method, occurrence = 0) |
Let's consider an IDS containing dynamic data as the 'camera_visible' IDS described above.
Calling get_slice('camera_visible', t, interpolation_method, 0) will take a slice (at a given time 't' and for a given interpolation method) of each dynamic data structure contained in the IDS, static data structures are ignored.
Therefore, get_slice() returns just a a time slice over all IDS dynamic data structures.
The following code takes a slice of the IDS dynamic data at time=1s:
Code Block |
---|
import imas
import getpass
import numpy as np
from imas import imasdef
data_entry = imas.DBEntry(imasdef.MDSPLUS_BACKEND, 'data_access_tutorial', 15000, 1, user_name=getpass.getuser())
#opens the pulse file associated to the Data Entry object 'data_entry' previously created
data_entry.open()
time_requested=1.
slice = data_entry.get_slice('camera_visible', time_requested, imasdef.CLOSEST_INTERP)
print("Slice time : ", time_requested)
print("Image raw:")
print(slice.channel[0].detector[0].frame[0].image_raw)
print("-----")
data_entry.close() |
Running the code above gives the following output:
Code Block |
---|
Slice time : 1.0
Image raw:
[[1 2 3 4 5]
[2 3 4 5 6]
[3 4 5 6 7]]
----- |