Closed munechika-koyo closed 4 years ago
Error due to the fact tofu is trying to extract some radial profiles. It assumes that radial profiles are always 2d, with time shape (nt, nr) where:
But in this case, there is only one time step, and the extracted array is flat (1d of shape (nr,)), instead of being of shape (1, nr).
=> solution: will implement a safety check, with a more explicit error message
Should be fixed by PR #280 (available in 1.4.2 as soon as the Pull Request is validated and merged). See the PR for more details.
Please note, @munechika-koyo , that you should:
An example is provided below based on your needs:
In [1]: import tofu as tf
/home/ITER/vezined/ToFu_All/tofu/tofu/__init__.py:95: UserWarning:
The following subpackages are not available:
- tofu.mag
=> see tofu.dsub[<subpackage>] for details.
warnings.warn(msg)
In [2]: tf.__version__
Out[2]: '1.4.2-alpha2-28-g806afc5'
In [3]: multi = tf.imas2tofu.MultiIDSLoader(user='public',tokamak='iter',shot=134000,run=28,ids=['core_sources', 'equilibrium'])
Getting ids [occ] tokamak user version shot run refshot refrun
------------ ----- ------- ------ ------- ------ --- ------- ------
core_sources [0] iter public 3 134000 28 -1 -1
equilibrium [0] " " " " " " "
In [4]: _dshort = {'core_sources': {'1drhotn':'source[identifier.name=radiation].profiles_1d[time].grid.rho_tor_norm',
...: ...: '1deEnergy':'source[identifier.name=radiation].profiles_1d[time].electrons.energy'
...: ...: },
...: ...: 'equilibrium': {'2dpsi': 'time_slice[time].profiles_2d[0].psi',
...: ...: '2dmeshR': 'time_slice[time].profiles_2d[0].r',
...: ...: '2dmeshZ': 'time_slice[time].profiles_2d[0].z'}}
...:
In [5]: multi.set_shortcuts(dshort=_dshort)
In [6]: plasma = multi.to_Plasma2D(shapeRZ=('R', 'Z'))
/home/ITER/vezined/ToFu_All/tofu/tofu/imas2tofu/_core.py:484: RuntimeWarning: invalid value encountered in sqrt
return np.sqrt( (psi - psi0[:,None]) / (psisep[:,None] - psi0[:,None]) )
/home/ITER/vezined/ToFu_All/tofu/tofu/imas2tofu/_core.py:1846: RuntimeWarning: invalid value encountered in greater
out[ii][np.abs(out[ii]) > 1.e30] = np.nan
/home/ITER/vezined/ToFu_All/tofu/tofu/imas2tofu/_core.py:1962: UserWarning: The following data could not be retrieved:
- equilibrium:
2dB : '2dBT'
2dBR : list index out of range
2dBT : list index out of range
2dBZ : list index out of range
2djT : list index out of range
2dmeshFaces : list index out of range
2dmeshNodes : list index out of range
2dphi : list index out of range
2drhotn : '2dphi'
2dtheta : '2dmeshNodes'
strike0 : 'strike0R'
strike0R : list index out of range
strike0Z : list index out of range
strike1 : 'strike1R'
strike1R : list index out of range
strike1Z : list index out of range
x0 : 'x0R'
x0R : list index out of range
x0Z : list index out of range
x1 : 'x1R'
x1R : list index out of range
x1Z : list index out of range
- core_sources:
1dbrem : No / several matching signals for: - source[]['identifier', 'name'] = bremsstrahlung - nb.of matches: 0
1dline : No / several matching signals for: - source[]['identifier', 'name'] = lineradiation - nb.of matches: 0
1dprad : '1dbrem'
1dpsi : No / several matching signals for: - source[]['identifier', 'name'] = lineradiation - nb.of matches: 0
1drhopn : '1dpsi'
warnings.warn(msg)
In [7]: npts = 100
In [8]: pts = np.array([np.linspace(4, 8, npts), np.zeros((npts)), np.zeros((npts,))])
In [9]: val, t = plasma.interp_pts2profile(pts, quant='2drhopn')
In [10]: val
Out[10]:
array([[1.00000001, 1.00000001, 1.00000001, 1.00000001, 1.00000001,
1.00000001, 1.00000001, 0.99519379, 0.9823119 , 0.9693463 ,
0.95623018, 0.94737822, 0.93391692, 0.92022385, 0.90629477,
0.89212509, 0.87770741, 0.86303376, 0.84809764, 0.83799228,
0.82261002, 0.8069563 , 0.79102977, 0.77483118, 0.75836272,
0.74162666, 0.72462484, 0.71314399, 0.69570641, 0.67801283,
0.66006675, 0.64187223, 0.62343606, 0.60476769, 0.58587839,
0.57316944, 0.55394466, 0.53454563, 0.51499928, 0.4953385 ,
0.47560473, 0.45585194, 0.44270668, 0.42308562, 0.40366962,
0.3845765 , 0.36591491, 0.34778222, 0.33029443, 0.31358574,
0.30295342, 0.28788942, 0.27405435, 0.26165837, 0.25093208,
0.2421167 , 0.23544763, 0.23113242, 0.2296427 , 0.22955887,
0.23207063, 0.23711526, 0.2445543 , 0.25419447, 0.26581205,
0.27917483, 0.28894178, 0.30472475, 0.32169771, 0.33968939,
0.35854621, 0.37813249, 0.39833154, 0.41905435, 0.43309765,
0.45441556, 0.47594585, 0.497604 , 0.51932443, 0.54105608,
0.56275732, 0.58439388, 0.59876878, 0.62024028, 0.64158581,
0.66278883, 0.68383636, 0.7047192 , 0.72542845, 0.74595545,
0.7595356 , 0.77974593, 0.79976103, 0.81957919, 0.83920331,
0.85864043, 0.87790024, 0.89699693, 0.9096461 , 0.92851068]])
Extracting a Plasma2D from a MultiIDSLoader does not seem to work in my case:
Then the following error message appears:
The configuration:
And the loaded modules are: