I have an SDF data file that stores the names of variables and their values in block format.
The values aside varNameListare the names of the variables (lines), according to which the data block is inside the sdf file, and it can be accessed only by specifying these variable names.
I read the data file and variables using the following code in ipython
import sdf
import numpy as np
dataFile = sdf.read('0010.sdf')
varNameList = dir(dataFile)
varSize = np.size(varNameList)
vName = 'dataFile.'+np.str(varNameList[51])+'.data'
The outputs of the variable names are as follows:
In [71]:varNameList[51]
Derived_Number_Density_electron
In [72]:vName
'dataFile.Derived_Number_Density_electron.data'
Now I want to use this line on the right side of the job, for example.
electronDensity = dataFile.Derived_Number_Density_electron.data
If I write this line in a standard Python program, it reads the data and assigns it an electron density.
, dir(), . ,
electronDensity = dataFile.Derived_Number_Density_electron.data