@@ -1386,7 +1386,7 @@ def get_q(self,psi=None,psi_pad=0.02,npsi=50,compute_geo=False):
13861386 @param psi_pad End padding (axis and edge) for uniform sampling (ignored if `psi` is not None)
13871387 @param npsi Number of points for uniform sampling (ignored if `psi` is not None)
13881388 @param compute_geo Compute geometric values for LCFS
1389- @result \f$\hat{\psi}\f$, \f$q(\hat{\psi})\f$, \f$[ <R>,<1/R>,dV/dPsi] \f$, length of last surface,
1389+ @result \f$\hat{\psi}\f$, \f$q(\hat{\psi})\f$, \f${ <R>,<1/R>,dV/dPsi} \f$, length of last surface,
13901390 [r(R_min),r(R_max)], [r(z_min),r(z_max)]
13911391 '''
13921392 if self ._tMaker_equil is None :
@@ -1399,7 +1399,7 @@ def sauter_fc(self,psi=None,psi_pad=0.02,npsi=50):
13991399 @param psi Explicit sampling locations in \f$\hat{\psi}\f$
14001400 @param psi_pad End padding (axis and edge) for uniform sampling (ignored if `psi` is not None)
14011401 @param npsi Number of points for uniform sampling (ignored if `psi` is not None)
1402- @result \f$ f_c \f$, [ \f$<R>,<1/R>,<a>\f$], [ \f$<|B|>,<|B|^2>\f$]
1402+ @result \f$ f_c \f$, \f${ <R>,<1/R>,<a>} \f$, \f$[ <|B|>,<|B|^2>] \f$
14031403 '''
14041404 if self ._tMaker_equil is None :
14051405 raise ValueError ("Equilibrium object is `None`" )
@@ -2723,7 +2723,7 @@ def get_q(self,psi=None,psi_pad=0.02,npsi=50,compute_geo=False):
27232723 @param psi_pad End padding (axis and edge) for uniform sampling (ignored if `psi` is not None)
27242724 @param npsi Number of points for uniform sampling (ignored if `psi` is not None)
27252725 @param compute_geo Compute geometric values for LCFS
2726- @result \f$\hat{\psi}\f$, \f$q(\hat{\psi})\f$, \f$[ <R>,<1/R>,dV/dPsi] \f$, length of last surface,
2726+ @result \f$\hat{\psi}\f$, \f$q(\hat{\psi})\f$, \f${ <R>,<1/R>,<1/R^2>, dV/dPsi} \f$, length of last surface,
27272727 [r(R_min),r(R_max)], [r(z_min),r(z_max)]
27282728 '''
27292729 if psi is None :
@@ -2736,7 +2736,7 @@ def get_q(self,psi=None,psi_pad=0.02,npsi=50,compute_geo=False):
27362736 psi_save = numpy .copy (psi )
27372737 psi = numpy .ascontiguousarray (1.0 - psi , dtype = numpy .float64 )
27382738 qvals = numpy .zeros ((psi .shape [0 ],), dtype = numpy .float64 )
2739- ravgs = numpy .zeros ((3 ,psi .shape [0 ]), dtype = numpy .float64 )
2739+ ravgs = numpy .zeros ((4 ,psi .shape [0 ]), dtype = numpy .float64 )
27402740 if compute_geo :
27412741 dl = c_double (1.0 )
27422742 else :
@@ -2747,16 +2747,22 @@ def get_q(self,psi=None,psi_pad=0.02,npsi=50,compute_geo=False):
27472747 tokamaker_get_q (self ._equil_ptr ,psi .shape [0 ],psi ,qvals ,ravgs ,ctypes .byref (dl ),rbounds ,zbounds ,error_string )
27482748 if error_string .value != b'' :
27492749 raise Exception (error_string .value )
2750+ ravg_dict = {
2751+ '<R>' : ravgs [0 ,:],
2752+ '<1/R>' : ravgs [1 ,:],
2753+ '<1/R^2>' : ravgs [2 ,:],
2754+ 'dV/dPsi' : ravgs [3 ,:]
2755+ }
27502756 if self .psi_convention == 0 :
27512757 if compute_geo :
2752- return psi_save ,qvals ,ravgs ,dl .value ,rbounds ,zbounds
2758+ return psi_save ,qvals ,ravg_dict ,dl .value ,rbounds ,zbounds
27532759 else :
2754- return psi_save ,qvals ,ravgs ,None ,None ,None
2760+ return psi_save ,qvals ,ravg_dict ,None ,None ,None
27552761 else :
27562762 if compute_geo :
2757- return psi ,qvals ,ravgs ,dl .value ,rbounds ,zbounds
2763+ return psi ,qvals ,ravg_dict ,dl .value ,rbounds ,zbounds
27582764 else :
2759- return psi ,qvals ,ravgs ,None ,None ,None
2765+ return psi ,qvals ,ravg_dict ,None ,None ,None
27602766
27612767 def trace_surf (self ,psi ):
27622768 r'''! Trace surface for a given poloidal flux
@@ -2849,7 +2855,7 @@ def get_stats(self,lcfs_pad=None,axis_pad=0.02,li_normalization='std',geom_type=
28492855 lcfs_pad = 0.0
28502856 if self .diverted or (not self .free_boundary ):
28512857 lcfs_pad = 0.01
2852- _ ,qvals ,_ , dl ,rbounds ,zbounds = self .get_q (numpy .r_ [1.0 - lcfs_pad ,0.95 ,axis_pad ],compute_geo = True ) # Given backward so last point is LCFS (for dl)
2858+ _ , qvals , _ , dl ,rbounds ,zbounds = self .get_q (numpy .r_ [1.0 - lcfs_pad ,0.95 ,axis_pad ],compute_geo = True ) # Given backward so last point is LCFS (for dl)
28532859 # Get diverted topology information
28542860 if self .diverted :
28552861 x_points , _ = self .get_xpoints ()
@@ -2978,7 +2984,7 @@ def calc_sauter_fc(self,psi=None,psi_pad=0.02,npsi=50):
29782984 @param psi Explicit sampling locations in \f$\hat{\psi}\f$
29792985 @param psi_pad End padding (axis and edge) for uniform sampling (ignored if `psi` is not None)
29802986 @param npsi Number of points for uniform sampling (ignored if `psi` is not None)
2981- @result \f$ f_c \f$, [ \f$<R>,<1/R>,<a>\f$], [ \f$<|B|>,<|B|^2>\f$]
2987+ @result \f$ f_c \f$, \f${ <R>,<1/R>,<a>} \f$, \f$[ <|B|>,<|B|^2>] \f$
29822988 '''
29832989 if psi is None :
29842990 psi = numpy .linspace (psi_pad ,1.0 - psi_pad ,npsi ,dtype = numpy .float64 )
@@ -2996,10 +3002,15 @@ def calc_sauter_fc(self,psi=None,psi_pad=0.02,npsi=50):
29963002 tokamaker_sauter_fc (self ._equil_ptr ,psi .shape [0 ],psi ,fc ,r_avgs ,modb_avgs ,error_string )
29973003 if error_string .value != b'' :
29983004 raise Exception (error_string .value )
3005+ ravg_dict = {
3006+ '<R>' : r_avgs [0 ,:],
3007+ '<1/R>' : r_avgs [1 ,:],
3008+ '<a>' : r_avgs [2 ,:]
3009+ }
29993010 if self .psi_convention == 0 :
3000- return psi_save ,fc ,r_avgs ,modb_avgs
3011+ return psi_save ,fc ,ravg_dict ,modb_avgs
30013012 else :
3002- return psi ,fc ,r_avgs ,modb_avgs
3013+ return psi ,fc ,ravg_dict ,modb_avgs
30033014
30043015 def calc_delstar_curr (self ,psi ):
30053016 r'''! Get toroidal current density from \f$ \psi \f$ through \f$ \Delta^{*} \f$ operator
0 commit comments