@@ -223,7 +223,7 @@ def main(
223223 )[key_coords ]['data' ]
224224
225225 # interpolate
226- q2dy = coll .interpolate_profile2d (
226+ q2dy = coll .interpolate (
227227 keys = key_integrand ,
228228 x0 = Ri ,
229229 x1 = pts_z ,
@@ -239,13 +239,23 @@ def main(
239239 )[key_integrand ]['data' ]
240240
241241 # check shape
242- if q2dx ['data' ].shape != q2dy ['data' ].shape :
243- msg = "The two interpolated quantities must have same shape!"
242+ if q2dx .shape != q2dy .shape :
243+ msg = (
244+ "The two interpolated quantities must have same shape!\n "
245+ f"\t - '{ key_coords } ': { q2dx .shape } \n "
246+ f"\t - '{ key_integrand } ': { q2dy .shape } \n "
247+ )
244248 raise Exception (msg )
245249
250+ # axis_los
251+ wbs = coll ._which_bsplines
252+ kbs = coll .ddata [key_integrand ][wbs ][0 ]
253+ rbs = coll .dobj [wbs ][kbs ]['ref' ]
254+ axis_los = coll .ddata [key_integrand ]['ref' ].index (rbs [0 ])
255+
246256 # prepare
247- dx [kk ] = np .full (q2d .shape , np .nan )
248- dy [kk ] = np .full (q2d .shape , np .nan )
257+ dx [kk ] = np .full (q2dx .shape , np .nan )
258+ dy [kk ] = np .full (q2dx .shape , np .nan )
249259
250260 # isok
251261 isok = np .isfinite (q2dx ) & np .isfinite (q2dy ) & np .isfinite (Ri )
@@ -307,6 +317,7 @@ def main(
307317
308318 dind = _get_dind (
309319 coll = coll ,
320+ key_cam = key_cam ,
310321 doptics = doptics ,
311322 dx = dx ,
312323 dy = dy ,
@@ -574,7 +585,7 @@ def _interpolate_along_los_reshape(
574585 else :
575586 ref [ii ] = 1
576587
577- # None not macthing xdata (e.g.: domain)
588+ # None not matching xdata (e.g.: domain)
578589 xdata = xdata .reshape (ref ) * np .ones (ydata .shape )
579590
580591 return xdata , ydata , axis_los
@@ -587,6 +598,7 @@ def _interpolate_along_los_reshape(
587598
588599def _get_dind (
589600 coll = None ,
601+ key_cam = None ,
590602 doptics = None ,
591603 dx = None ,
592604 dy = None ,
@@ -596,7 +608,7 @@ def _get_dind(
596608 # loop on cameras
597609
598610 dind = {}
599- for kcam in doptics . keys () :
611+ for kcam in key_cam :
600612
601613 klos = doptics [kcam ]['los' ]
602614
@@ -636,8 +648,8 @@ def _get_dind(
636648 # -----------
637649 # safety check
638650
639- lc = [np .any (inan [ind >= 0 ]), (ind == - 1 ).sum () < nnan ]
640- if any (lc ):
651+ lc = [np .any (inan [ind >= 0 ]), (ind == - 1 ).sum () < nnan ]
652+ if any (lc ):
641653 msg = (
642654 "Inconsistent nans!\n "
643655 f"\t - lc: { lc } \n "
@@ -669,7 +681,6 @@ def interpolate_along_los_plot(
669681 dax = None ,
670682):
671683
672-
673684 # -------------
674685 # check inputs
675686 # -------------
@@ -814,4 +825,4 @@ def _plot_check(
814825 ) + str (err )
815826 raise Exception (msg )
816827
817- return dcolor
828+ return dcolor
0 commit comments