ebe_scripts/average_event_spvn_h5_minimumbias.py
def calculate_vn_distribution(vn_array, outputFileName):
    """This function computes the vn distribution"""
    nbin = 20
    vn_array = array(vn_array)
    vn_dim = len(vn_array[0, :])
    output = []
    for vn_order in range(vn_dim):
        vn_mag_array = abs(vn_array[:, vn_order])
        vn_min = min(vn_mag_array)
        vn_max = max(vn_mag_array)*1.0001
        bin_boundaries = linspace(vn_min, vn_max, nbin+1)
        bin_width = bin_boundaries[1] - bin_boundaries[0]
        bin_center = zeros([nbin])
        bin_value = zeros([nbin])
        for vn_elem in vn_mag_array:
            vn_idx = int(floor((vn_elem - vn_min)/bin_width))
            if (vn_idx == 20):
                print(vn_elem, vn_min, bin_width)
            bin_value[vn_idx] += 1.
            bin_center[vn_idx] += vn_elem
        bin_center = bin_center/(bin_value + 1e-15)
        bin_value = bin_value/len(vn_array)
        bin_value_err = sqrt(bin_value/len(vn_array))
        bin_value = bin_value/bin_width
        bin_value_err = bin_value_err/bin_width
        for i in range(nbin):
            if abs(bin_center[i]) < 1e-15:
                bin_center[i] = (bin_boundaries[i] + bin_boundaries[i+1])/2.
        output.append(bin_center)
        output.append(bin_value)
        output.append(bin_value_err)
    output = array(output).transpose()

    f = open(outputFileName, 'w')
    f.write("#vn  dP(vn)/dvn  dP(vn)/dvn_err\n")
    for ipT in range(len(output[:, 0])):
        for iorder in range(1, n_order):
            f.write("%.10e  %.10e  %.10e  "
                    % (output[ipT, 3*(iorder-1)], 
                       output[ipT, 3*(iorder-1)+1],
                       output[ipT, 3*(iorder-1)+2]))
        f.write("\n")
    f.close()
    return
This function computes the vn distribution
This function computes the vn distribution
This function computes the vn distribution
def calculate_vn_distribution(vn_array, outputFileName):
    nbin = 20
    vn_array = array(vn_array)
    vn_dim = len(vn_array[0, :])
    output = []
    for vn_order in range(vn_dim):
        vn_mag_array = abs(vn_array[:, vn_order])
        vn_min = min(vn_mag_array)
        vn_max = max(vn_mag_array)*1.0001
        bin_boundaries = linspace(vn_min, vn_max, nbin+1)
        bin_width = bin_boundaries[1] - bin_boundaries[0]
        bin_center = zeros([nbin])
        bin_value = zeros([nbin])
        for vn_elem in vn_mag_array:
            vn_idx = int(floor((vn_elem - vn_min)/bin_width))
            if (vn_idx == 20):
                print(vn_elem, vn_min, bin_width)
            bin_value[vn_idx] += 1.
            bin_center[vn_idx] += vn_elem
        bin_center = bin_center/(bin_value + 1e-15)
        bin_value = bin_value/len(vn_array)
        bin_value_err = sqrt(bin_value/len(vn_array))
        bin_value = bin_value/bin_width
        bin_value_err = bin_value_err/bin_width
        for i in range(nbin):
            if abs(bin_center[i]) < 1e-15:
                bin_center[i] = (bin_boundaries[i] + bin_boundaries[i+1])/2.
        output.append(bin_center)
        output.append(bin_value)
        output.append(bin_value_err)
    output = array(output).transpose()
    f = open(outputFileName, 'w')
    f.write("#vn  dP(vn)/dvn  dP(vn)/dvn_err\n")
    for ipT in range(len(output[:, 0])):
        for iorder in range(1, n_order):
            f.write("%.10e  %.10e  %.10e  "
                    % (output[ipT, 3*(iorder-1)], 
                       output[ipT, 3*(iorder-1)+1],
                       output[ipT, 3*(iorder-1)+2]))
        f.write("\n")
    f.close()
    return
def calculate_vn_distribution ( vn_array , outputFileName ) : nbin = 20 vn_array = array ( vn_array ) vn_dim = len ( vn_array [ 0 , : ] ) output = [ ] for vn_order in range ( vn_dim ) : vn_mag_array = abs ( vn_array [ : , vn_order ] ) vn_min = min ( vn_mag_array ) vn_max = max ( vn_mag_array ) * 1.0001 bin_boundaries = linspace ( vn_min , vn_max , nbin + 1 ) bin_width = bin_boundaries [ 1 ] - bin_boundaries [ 0 ] bin_center = zeros ( [ nbin ] ) bin_value = zeros ( [ nbin ] ) for vn_elem in vn_mag_array : vn_idx = int ( floor ( ( vn_elem - vn_min ) / bin_width ) ) if ( vn_idx == 20 ) : print ( vn_elem , vn_min , bin_width ) bin_value [ vn_idx ] += 1. bin_center [ vn_idx ] += vn_elem bin_center = bin_center / ( bin_value + 1e-15 ) bin_value = bin_value / len ( vn_array ) bin_value_err = sqrt ( bin_value / len ( vn_array ) ) bin_value = bin_value / bin_width bin_value_err = bin_value_err / bin_width for i in range ( nbin ) : if abs ( bin_center [ i ] ) < 1e-15 : bin_center [ i ] = ( bin_boundaries [ i ] + bin_boundaries [ i + 1 ] ) / 2. output . append ( bin_center ) output . append ( bin_value ) output . append ( bin_value_err ) output = array ( output ) . transpose ( ) f = open ( outputFileName , 'w' ) f . write ( "#vn  dP(vn)/dvn  dP(vn)/dvn_err\n" ) for ipT in range ( len ( output [ : , 0 ] ) ) : for iorder in range ( 1 , n_order ) : f . write ( "%.10e  %.10e  %.10e  " % ( output [ ipT , 3 * ( iorder - 1 ) ] , output [ ipT , 3 * ( iorder - 1 ) + 1 ] , output [ ipT , 3 * ( iorder - 1 ) + 2 ] ) ) f . write ( "\n" ) f . close ( ) return
This function computes the vn distribution
This function computes the vn distribution
"""This function computes the vn distribution"""
vn_array
outputFileName