Skip to content
Snippets Groups Projects
Commit 7554e698 authored by Vlad Kondratiev's avatar Vlad Kondratiev
Browse files

new commissioning scripts added together with some updates

parent 2b7fb2ad
Branches
Tags
No related merge requests found
...@@ -48,7 +48,7 @@ echo " \"use_pdmp\": false," ...@@ -48,7 +48,7 @@ echo " \"use_pdmp\": false,"
echo " \"use_paz\": true," echo " \"use_paz\": true,"
echo " \"use_clfd\": true," echo " \"use_clfd\": true,"
echo " \"nozap\": false," echo " \"nozap\": false,"
echo " \"tsubint\": 5," echo " \"tsubint\": 10,"
echo " \"sp_subint\": false," echo " \"sp_subint\": false,"
echo " \"remove_dm_delays\": false," echo " \"remove_dm_delays\": false,"
echo " \"nbins\": 256," echo " \"nbins\": 256,"
......
...@@ -17,7 +17,8 @@ if __name__=="__main__": ...@@ -17,7 +17,8 @@ if __name__=="__main__":
# #
usage = "Usage: %prog [options] <ar-file>" usage = "Usage: %prog [options] <ar-file>"
cmdline = opt.OptionParser(usage) cmdline = opt.OptionParser(usage)
cmdline.add_option('-v', '--verbose', dest='is_verbose', action="store_true", help="Verbose output, print extra info", default=False) cmdline.add_option('--percent', dest='is_percent', action="store_true", help="print RFI fraction in %", default=False)
cmdline.add_option('-v', '--verbose', dest='is_verbose', action="store_true", help="verbose output, print extra info", default=False)
# reading cmd options # reading cmd options
(opts,args) = cmdline.parse_args() (opts,args) = cmdline.parse_args()
...@@ -69,5 +70,6 @@ if __name__=="__main__": ...@@ -69,5 +70,6 @@ if __name__=="__main__":
# re-reading weights again and calculate the RFI fraction # re-reading weights again and calculate the RFI fraction
weights=raw.get_weights() weights=raw.get_weights()
rfi_fraction=1.-np.sum(weights)/(orig_nsubint*orig_nchan) rfi_fraction=1.-np.sum(weights)/(orig_nsubint*orig_nchan)
if opts.is_verbose: print ("RFI fraction = %f Bad subints/chans = %d (%d)" % (rfi_fraction, badpoints, orig_nsubint * orig_nchan)) if opts.is_percent: rfi_fraction *= 100.
else: print (rfi_fraction) if opts.is_verbose: print ("RFI fraction = %g %s Bad subints/chans = %d (%d)" % (rfi_fraction, opts.is_percent and "%" or "", badpoints, orig_nsubint * orig_nchan))
else: print ("%g %s" % (rfi_fraction, opts.is_percent and "%" or ""))
This diff is collapsed.
...@@ -42,19 +42,20 @@ if __name__ == "__main__": ...@@ -42,19 +42,20 @@ if __name__ == "__main__":
args = parser.parse_args() args = parser.parse_args()
note="Frequency vs. Phase" note="Frequency vs. Phase"
binshift=20
stokes=["I", "Q", "U", "V"] stokes=["I", "Q", "U", "V"]
binshift=50
# Read data # Read data
raw = pc.Archive_load(args.arfile) raw = pc.Archive_load(args.arfile)
if not(raw.get_dedispersed()): if not(raw.get_dedispersed()):
raw.dedisperse() raw.dedisperse()
raw.remove_baseline() raw.remove_baseline()
raw.centre_max_bin() raw.centre_max_bin()
nchan = raw.get_nchan()
nsubint = raw.get_nsubint()
if args.fscrunch > 1: raw.fscrunch(args.fscrunch) if args.fscrunch > 1: raw.fscrunch(args.fscrunch)
nsubint = raw.get_nsubint()
if nsubint > 1: raw.tscrunch() if nsubint > 1: raw.tscrunch()
nchan = raw.get_nchan()
nbins = raw.get_nbin() nbins = raw.get_nbin()
r = raw.get_data() r = raw.get_data()
#time stokes f phase #time stokes f phase
...@@ -66,9 +67,11 @@ if __name__ == "__main__": ...@@ -66,9 +67,11 @@ if __name__ == "__main__":
ax = fig.add_subplot(2,2,pol+1) ax = fig.add_subplot(2,2,pol+1)
lbin=nbins//2-binshift lbin=nbins//2-binshift
rbin=nbins//2+binshift rbin=nbins//2+binshift
sp=normalize(data[pol,:,lbin:rbin], nchan) sp=normalize(data[pol,:,:], nchan)
gmax = np.max([np.abs(np.min(sp)), np.abs(np.max(sp))]) v=sp[:,lbin:rbin]
ax.imshow(sp, interpolation='none', aspect='auto', origin='lower', cmap="bwr", vmax=gmax, vmin=-gmax) gmin, gmax = np.nanpercentile(v[(v!=-np.inf) & (v!=np.nan)], (0.05, 99.95))
gmax = np.max([np.abs(gmin), np.abs(gmax)])
ax.imshow(sp[:,lbin:rbin], interpolation='none', aspect='auto', origin='lower', cmap="bwr", vmax=gmax, vmin=-gmax)
ax.set_xticklabels([]) ax.set_xticklabels([])
ax.set_yticklabels([]) ax.set_yticklabels([])
#plt.xlabel("Phase") #plt.xlabel("Phase")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment