コード例 #1
0
    #freq_av_binned = freq_av.reshape(-1,4).sum(-1)

    sn = (freq_av - freq_av.mean()) / freq_av.std()
    peaks = np.argwhere(sn > 6)
    with open('giant_pulses.txt', 'a') as f:
        f.writelines(
            ['{0} {1}\n'.format(tsr[peak], sn[peak]) for peak in peaks])
    for peak in peaks:
        np.save(
            'GP%s' % (tsr[peak]),
            power[max(peak - buff, 0):min(peak + buff, power.shape[0]), :, :])
    return power


if __name__ == '__main__':
    args = CL_parser()
    args.verbose = 0 if args.verbose is None else sum(args.verbose)
    if args.fref is None:
        args.fref = _fref

    if args.rfi_filter_raw:
        args.rfi_filter_raw = rfi_filter_raw
    else:
        args.rfi_filter_raw = None

    if args.rfi_filter_power:
        args.rfi_filter_power = rfi_filter_power
    else:
        args.rfi_filter_power = None

    if args.reduction_defaults == 'gmrt':
コード例 #2
0
ファイル: reduce_data.py プロジェクト: ramain/scintellometry
    sn = (profile - profile.mean()) / profile.std()
    peaks = np.argwhere(sn > 6) #peak bins in binned profile
    peaks = peaks*bscrunch #uncrunch peaks
    #take only peaks corresponding to main/inter pulse - phase currently hardcoded
    peaks = peaks[((phase[peaks]>0.06)&(phase[peaks]<0.08))|((phase[peaks]>0.46)&(phase[peaks]<0.50))] 
    #write information
    with open('giant_pulses.txt', 'a') as f:
        f.writelines(['{0} {1} {2} {3}\n'.format(tsr[peak], sn[int(peak/bscrunch)], peak, phase[peak]) for peak in peaks])
    for peak in peaks:
        np.save('GP%s' % (tsr[peak]), power[max(peak-buff,0):min(peak+buff,power.shape[0]),:,:] )
        #np.save('pulse%s' % (tsr[peak]), sn[max(int(peak/bscrunch)-buff,0):min(int(peak/bscrunch)+buff,sn.shape[0])])
    return power


if __name__ == '__main__':
    args = CL_parser()
    args.verbose = 0 if args.verbose is None else sum(args.verbose)
    if args.fref is None:
        args.fref = _fref

    if args.rfi_filter_raw:
        args.rfi_filter_raw = rfi_filter_raw
    else:
        args.rfi_filter_raw = None

    if args.rfi_filter_power:
        args.rfi_filter_power = rfi_filter_power
    else:
        args.rfi_filter_power = None

    if args.reduction_defaults == 'gmrt':
コード例 #3
0
ファイル: reduce_data.py プロジェクト: JHBONN/scintellometry
def rfi_filter_raw(raw, nchan):
    # note this should accomodate all data (including's lofar raw = complex)
    rawbins = raw.reshape(-1, 2**11*nchan)  # note, this is view!
    std = rawbins.std(-1, keepdims=True)
    ok = std < MAX_RMS
    rawbins *= ok
    return raw, ok


def rfi_filter_power(power):
    return np.clip(power, 0., MAX_RMS**2 * power.shape[-1])


if __name__ == '__main__':
    args = CL_parser()
    args.verbose = 0 if args.verbose is None else sum(args.verbose)
    if args.fref is None:
        args.fref = _fref

    if args.rfi_filter_raw:
        args.rfi_filter_raw = rfi_filter_raw
    else:
        args.rfi_filter_raw = None

    if args.reduction_defaults == 'lofar':
        args.telescope = 'lofar'
        # already channelized, determined from filehandle
        # (previously args.nchan = 20)
        args.ntw_min = 1020
        args.waterfall = False