Lv2_ps_method.py
def padding(counts):
    """
    For use in the function manual. Recall: The optimal number of bins is 2^n,
    n being some natural number. We pad 0s onto the original data set, where
    the number of 0s to pad is determined by the difference between the optimal
    number of bins and the length of the data set (where the former should be
    greater than the latter!)

    counts - array of counts from the binned data
    """
    if type(counts) != list and type(counts) != np.ndarray:
        raise TypeError("counts should either be a list or an array!")

    data_size = len(counts)
    diff = [np.abs(data_size-2**n) for n in range(0,30)]
    min_diff_index = np.argmin(diff)

    optimal_bins = 2**(min_diff_index)
    if optimal_bins < data_size: #if the number of optimal bins for FFT is less
    #than that of the number of data bins in the data set, *2 to get 2^N bins
    #that will yield it
        optimal_bins *= 2

    ### padding the data set
    len_diff = optimal_bins - data_size
    if len_diff < 0:
        raise ValueError("For some reason, the number of optimal bins is less than that of the data size, CHECK program!")

    padded_counts = list(counts) + list(np.zeros(len_diff))
    padded_counts = np.array(padded_counts)

    return padded_counts

    For use in the function manual. Recall: The optimal number of bins is 2^n,
    n being some natural number. We pad 0s onto the original data set, where
    the number of 0s to pad is determined by the difference between the optimal
    number of bins and the length of the data set (where the former should be
    greater than the latter!)

    counts - array of counts from the binned data
    
For use in the function manual. Recall: The optimal number of bins is 2^n,
n being some natural number. We pad 0s onto the original data set, where
the number of 0s to pad is determined by the difference between the optimal
number of bins and the length of the data set (where the former should be
greater than the latter!)

array of counts from the binned data
For use in the function manual . Recall : The optimal number of bins is 2^n n being some natural number . We pad 0s onto the original data set where the number of 0s to pad is determined by the difference between the optimal number of bins and the length of the data set ( where the former should be greater than the latter! ) array of counts from the binned data
def padding(counts):
    if type(counts) != list and type(counts) != np.ndarray:
        raise TypeError("counts should either be a list or an array!")
    data_size = len(counts)
    diff = [np.abs(data_size-2**n) for n in range(0,30)]
    min_diff_index = np.argmin(diff)
    optimal_bins = 2**(min_diff_index)
    if optimal_bins < data_size: 
        optimal_bins *= 2
    len_diff = optimal_bins - data_size
    if len_diff < 0:
        raise ValueError("For some reason, the number of optimal bins is less than that of the data size, CHECK program!")
    padded_counts = list(counts) + list(np.zeros(len_diff))
    padded_counts = np.array(padded_counts)
    return padded_counts
def padding ( counts ) : if type ( counts ) != list and type ( counts ) != np . ndarray : raise TypeError ( "counts should either be a list or an array!" ) data_size = len ( counts ) diff = [ np . abs ( data_size - 2 ** n ) for n in range ( 0 , 30 ) ] min_diff_index = np . argmin ( diff ) optimal_bins = 2 ** ( min_diff_index ) if optimal_bins < data_size : optimal_bins *= 2 len_diff = optimal_bins - data_size if len_diff < 0 : raise ValueError ( "For some reason, the number of optimal bins is less than that of the data size, CHECK program!" ) padded_counts = list ( counts ) + list ( np . zeros ( len_diff ) ) padded_counts = np . array ( padded_counts ) return padded_counts
For use in the function manual.
For use in the function manual .
"""
    For use in the function manual. Recall: The optimal number of bins is 2^n,
    n being some natural number. We pad 0s onto the original data set, where
    the number of 0s to pad is determined by the difference between the optimal
    number of bins and the length of the data set (where the former should be
    greater than the latter!)

    counts - array of counts from the binned data
    """ #if the number of optimal bins for FFT is less #than that of the number of data bins in the data set, *2 to get 2^N bins #that will yield it ### padding the data set
counts