blimpy/calib_utils/fluxcal.py
def integrate_chans(spec,freqs,chan_per_coarse):
    '''
    Integrates over each core channel of a given spectrum.
    Important for calibrating data with frequency/time resolution different from noise diode data

    Parameters
    ----------
    spec : 1D Array (float)
        Spectrum (any Stokes parameter) to be integrated
    freqs : 1D Array (float)
        Frequency values for each bin of the spectrum
    chan_per_coarse: int
        Number of frequency bins per coarse channel
    '''

    num_coarse = spec.size/chan_per_coarse     #Calculate total number of coarse channels

    #Rearrange spectrum by coarse channel
    spec_shaped = np.array(np.reshape(spec,(num_coarse,chan_per_coarse)))
    freqs_shaped = np.array(np.reshape(freqs,(num_coarse,chan_per_coarse)))

    #Average over coarse channels
    return np.mean(spec_shaped[:,1:-1],axis=1)
def integrate_chans(spec,freqs,chan_per_coarse):
    '''
    Integrates over each core channel of a given spectrum.
    Important for calibrating data with frequency/time resolution different from noise diode data

    Parameters
    ----------
    spec : 1D Array (float)
        Spectrum (any Stokes parameter) to be integrated
    freqs : 1D Array (float)
        Frequency values for each bin of the spectrum
    chan_per_coarse: int
        Number of frequency bins per coarse channel
    '''

    num_coarse = spec.size/chan_per_coarse     #Calculate total number of coarse channels

    #Rearrange spectrum by coarse channel
    spec_shaped = np.array(np.reshape(spec,(num_coarse,chan_per_coarse)))
    freqs_shaped = np.array(np.reshape(freqs,(num_coarse,chan_per_coarse)))

    #Average over coarse channels
    return np.mean(spec_shaped[:,1:-1],axis=1)
Integrates over each core channel of a given spectrum.
    Important for calibrating data with frequency/time resolution different from noise diode data

    Parameters
    ----------
    spec : 1D Array (float)
        Spectrum (any Stokes parameter) to be integrated
    freqs : 1D Array (float)
        Frequency values for each bin of the spectrum
    chan_per_coarse: int
        Number of frequency bins per coarse channel