#NEWLINE# @ ValidateLarchPlugin #NEWLINE# def fluo_yield( symbol , edge , emission , energy , energy_margin = ( - 150 ) , _larch = None ) : #NEWLINE# #INDENT# "Given\n         atomic_symbol, edge, emission family, and incident energy,\n\n    where 'emission' is the family of emission lines ('Ka', 'Kb', 'Lb', etc)\n    returns\n\n    fluorescence_yield, weighted-average fluorescence energy, net_probability\n\n    fyield = 0  if energy < edge_energy + energy_margin (default=-150)\n\n    > fluo_yield('Fe', 'K', 'Ka', 8000)\n    0.350985, 6400.752419799043, 0.874576096\n\n    > fluo_yield('Fe', 'K', 'Ka', 6800)\n    0.0, 6400.752419799043, 0.874576096\n\n    > fluo_yield('Ag', 'L3', 'La', 6000)\n    0.052, 2982.129655446868, 0.861899000000000\n\n    compare to xray_lines() which gives the full set of emission lines\n    ('Ka1', 'Kb3', etc) and probabilities for each of these.\n\n    Adapted for Larch from code by Yong Choi\n    " #NEWLINE# ( e0 , fyield , jump ) = xray_edge ( symbol , edge , _larch = _larch ) #NEWLINE# trans = xray_lines ( symbol , initial_level = edge , _larch = _larch ) #NEWLINE# lines = [ ] #NEWLINE# ( net_ener , net_prob ) = ( 0.0 , 0.0 ) #NEWLINE# for ( name , vals ) in trans . items ( ) : #NEWLINE# #INDENT# ( en , prob ) = ( vals [ 0 ] , vals [ 1 ] ) #NEWLINE# if name . startswith ( emission ) : #NEWLINE# #INDENT# lines . append ( [ name , en , prob ] ) #NEWLINE# #UNINDENT# #UNINDENT# for ( name , en , prob ) in lines : #NEWLINE# #INDENT# if name . startswith ( emission ) : #NEWLINE# #INDENT# net_ener += ( en * prob ) #NEWLINE# net_prob += prob #NEWLINE# #UNINDENT# #UNINDENT# if ( net_prob <= 0 ) : #NEWLINE# #INDENT# net_prob = 1 #NEWLINE# #UNINDENT# net_ener = ( net_ener / net_prob ) #NEWLINE# if ( energy < ( e0 + energy_margin ) ) : #NEWLINE# #INDENT# fyield = 0 #NEWLINE# #UNINDENT# return ( fyield , net_ener , en )