#NEWLINE# def lin_gamma( ene , fwhm = 1.0 , linbroad = None ) : #NEWLINE# #INDENT# "returns constant or linear energy-dependent broadening\n\n    Parameters\n    ----------\n    ene : energy array in eV\n    fwhm : first full width at half maximum in eV\n    linbroad : list of 3-elements giving\n               'second full width at half maximum'\n               'energy starting point of the linear increase'\n               'energy ending point of the linear increase'\n    " #NEWLINE# w = np . ones_like ( ene ) #NEWLINE# if ( ene is None ) : #NEWLINE# #INDENT# return ( w * fwhm ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# fwhm2 = linbroad [ 0 ] #NEWLINE# e1 = linbroad [ 1 ] #NEWLINE# e2 = linbroad [ 2 ] #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# raise ValueError ( 'wrong format for linbroad' ) #NEWLINE# #UNINDENT# for ( en , ee ) in enumerate ( ene ) : #NEWLINE# #INDENT# if ( ee < e1 ) : #NEWLINE# #INDENT# w [ en ] *= fwhm #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ee <= e2 ) : #NEWLINE# #INDENT# wlin = ( fwhm + ( ( ( ee - e1 ) * ( fwhm2 - fwhm ) ) / ( e2 - e1 ) ) ) #NEWLINE# w [ en ] *= wlin #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ee >= e2 ) : #NEWLINE# #INDENT# w [ en ] *= fwhm2 #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return w