#NEWLINE# def align_and_scale( energy_list , counts_list , pk_find_fun = None ) : #NEWLINE# #INDENT# '\n\n    Parameters\n    ----------\n    energy_list : iterable of ndarrays\n        list of ndarrays with the energy of each element\n\n    counts_list : iterable of ndarrays\n        list of ndarrays of counts/element\n\n    pk_find_fun : function or None\n       A function which takes two ndarrays and returns parameters\n       about the largest peak.  If None, defaults to `find_largest_peak`.\n       For this demo, the output is (center, height, width), but this sould\n       be pinned down better.\n\n    Returns\n    -------\n    out_e : list of ndarray\n       The aligned/scaled energy arrays\n\n    out_c : list of ndarray\n       The count arrays (should be the same as the input)\n    ' #NEWLINE# if ( pk_find_fun is None ) : #NEWLINE# #INDENT# pk_find_fun = find_largest_peak #NEWLINE# #UNINDENT# base_sigma = None #NEWLINE# ( out_e , out_c ) = ( [ ] , [ ] ) #NEWLINE# for ( e , c ) in zip ( energy_list , counts_list ) : #NEWLINE# #INDENT# ( E0 , max_val , sigma ) = pk_find_fun ( e , c ) #NEWLINE# if ( base_sigma is None ) : #NEWLINE# #INDENT# base_sigma = sigma #NEWLINE# #UNINDENT# out_e . append ( ( ( ( e - E0 ) * base_sigma ) / sigma ) ) #NEWLINE# out_c . append ( c ) #NEWLINE# #UNINDENT# return ( out_e , out_c )