Esempio n. 1
0
def chisq(period, DM):
    folded = timeFolding(obs.data,
                         time_fold_bins,
                         period,
                         flagged=obs.flag,
                         corrected_times=obs.times)
    dedispersed = dedispersion(folded,
                               obs,
                               period,
                               DM,
                               freq_fold_bins=freq_fold_bins)
    chisq = ((dedispersed - dedispersed.mean())**2).sum()
    return chisq
Esempio n. 2
0
# this part should be RFI flagging something like:
# noflag = flagging(twodarray)

print("Flagging bad data")
flag = obs.data == 0 if args.skiprfi else flagData(twodarray)
obs.flag = flag

print("Folding")
# calculate the folded array
foldedarray = timeFolding(twodarray,
                          args.nbins,
                          period,
                          flagged=flag,
                          corrected_times=obs.times)

# make a waterfall plot of the result
waterfall(foldedarray)

print("Dedispersing")
# do the dedispersion
pulse_profile = dedispersion(foldedarray,
                             obs,
                             period,
                             obs.pulsar.DM,
                             freq_fold_bins=args.nbinsdedisp)

# plot the final pulse profile
plt.plot(pulse_profile)
plt.show()
Esempio n. 3
0
                            corrected_times=obs.times)
foldedarray60 = timeFolding(twodarray60,
                            args.nbins,
                            period,
                            corrected_times=obs.times)
foldedarray = timeFolding(twodarray,
                          args.nbins,
                          period,
                          corrected_times=obs.times)

#show the rainfall plot and allow for fiddling with the DM

DM = 8.5

print(DM)
waterfall(dedispersion(foldedarray, DM, frequencyarray))

if DMplay:
    DM2 = DM
    while True:
        disp = foldedarray[:]
        DM1 = input("Input new DM:")
        if DM1 == "":
            DM = float(DM2)
            break
        waterfall(dedispersion(disp, float(DM1), frequencyarray))
        DM2 = float(DM1)

fin10 = pulseProfile(foldedarray10, DM, frequencyarray)
fin30 = pulseProfile(foldedarray30, DM, frequencyarray)
fin60 = pulseProfile(foldedarray60, DM, frequencyarray)