Analysis of VLA burst spectra from FRB 121102

Includes modeling for best flux density, MCMC modeling of dynamic spectra, and plot generation for paper


In [1]:
%matplotlib inline

In [2]:
from __future__ import print_function
import pylab as pl
import numpy as np
import rtpipe
import rtlib_cython as rtlib
from astropy import coordinates
from scipy.optimize import curve_fit
import scipy.stats
import emcee, corner


2017-05-20 16:30:55,236 - py.warnings - WARNING - /Users/caseyjlaw/anaconda/lib/python2.7/site-packages/matplotlib/__init__.py:1401: UserWarning:  This call to matplotlib.use() has no effect
because the backend has already been chosen;
matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.

  warnings.warn(_use_error_msg)

VLA gain table


In [3]:
# SNR from realfast using telcal gain solutions
snrdet = {'57623': 35.2, '57633_scan7': 119.3, '57633_scan13': 16.3, '57638': 9.9, '57643': 69.9,
         '57645': 11.1, '57646': 16.0, '57648': 17.6, '57649': 25.2} 

# flux scale from Bryan
calstring = """2.0520    2.89698    0.00279
2.1800    *******    *******
2.3080    *******    *******
2.4360    3.53585    0.00377
2.5640    3.69554    0.00376
2.6920    3.85507    0.00423
2.8200    4.00438    0.00486
2.9480    4.11069    0.00562
3.0520    4.20375    0.00631
3.1800    4.29385    0.00662
3.3080    4.36557    0.00715
3.4360    4.43684    0.00786
3.5640    4.46937    0.00850
3.6920    4.52488    0.00860
3.8200    4.53571    0.00969
3.9480    4.54625    0.00859""" 
# parse flux scale
freq = []
flux = []
eflux = []
for line in calstring.split('\n'): 
    if '*' not in line:
        result = line.split()
        freq.append(float(result[0]))
        flux.append(float(result[1]))
        eflux.append(float(result[2]))
calfreq = np.array(freq)
calflux = np.array(flux)
print(calfreq, calflux)


[ 2.052  2.436  2.564  2.692  2.82   2.948  3.052  3.18   3.308  3.436
  3.564  3.692  3.82   3.948] [ 2.89698  3.53585  3.69554  3.85507  4.00438  4.11069  4.20375  4.29385
  4.36557  4.43684  4.46937  4.52488  4.53571  4.54625]

Functions to read and analyze data


In [4]:
def getscannum(sdmfile):
    sdm = rtpipe.parsesdm.getsdm(sdmfile)
    for scan in sdm.scans():
        try:
            print('Scan {0} binary data file: {1}'.format(scan.idx, scan.bdf.fname))
            bdfscan = int(scan.idx)
        except IOError:
            pass
    return bdfscan

def read_cut(sdmfile, scan, segment, dm=558., dt=1, gainfile=None, **kwargs):
    if not gainfile:
        gainfile = '.'.join(sdmfile.split('.')[:-1] + ['GN'])

    st = rtpipe.RT.set_pipeline(sdmfile, scan, dmarr=[dm], dtarr=[dt], flaglist=[('badap', 3., 0.2)], 
                                uvoversample=1.5, gainfile=gainfile, flagantsol=True, 
                                timesub='mean', logfile=False, savecands=False,
                                savenoise=False, **kwargs)
        
    data = rtpipe.RT.pipeline_reproduce(st, candloc=[segment,0,0,0,0], product='data')
    u, v, w = rtpipe.parsesdm.get_uvw_segment(st, segment)

    return st, data, u, v, w

def imloc(st, data, u, v, w, integ, verbose=0, weight='uniform'):
    if weight == 'uniform':
        weightarr = np.ones_like(data)
    elif weight == 'uvdist':
        uvd = np.sqrt(u**2+v**2)
        weightarr = np.ones_like(data)
        for bl in range(st['nbl']):
            weightarr[:,bl] *= uvd[bl]/uvd.max()

    im = rtpipe.RT.sample_image(st, data*weightarr, u, v, w, i=integ)
    l,m = rtpipe.RT.calc_lm(st, im)
    ra_center, dec_center = st['radec']
    ra, dec = rtpipe.reproduce.source_location(ra_center, dec_center, l, m)
    ras = ra.split()
    decs = dec.split()
    loc = coordinates.SkyCoord('{0}h{1}m{2}s'.format(ras[0], ras[1], ras[2]),
                               '{0}d{1}m{2}s'.format(decs[0], decs[1], decs[2]), frame='icrs')

    if verbose:
        print('Peak location:')
        print(l, m)
        print(loc.ra.hms, loc.dec.dms)
    return im, loc

def correctdata(st, data, u, v, w, corr='ph,dm', lm = (-3.835e-04,5.406e-04)):
    """ lm gives (ra, dec) = (5 31 58.703708986 33 8 52.5067634154)
    as quoted in Chatterjee et al (2017)
    """
    data2 = data.copy()
    
    if 'ph' in corr:
        l1, m1 = lm
        rtlib.phaseshift_threaded(data2, st, l1, m1, u, v)

    if 'dm' in corr:
        rtlib.dedisperse_par(data2, st['freq'], st['inttime'], st['dmarr'][0], [0, st['nbl']])
    
    return data2

# get array2 for bin in array near value
def find_nearest(array, array2, value):
    idx = (np.abs(array-value)).argmin()
    return array2[idx]

def getscale(st):
    # get flux scaling at nearest frequency
    scale = []
    for i in range(len(st['freq'])):
        freq = st['freq'][i]
        scale.append(find_nearest(calfreq, calflux, freq))
#         print(i, st['freq'][i], scale)
    scale = np.array(scale, dtype='complex64')[None,None,:,None]
    return scale

def correct_all(st, data, u, v, w):
    scale = getscale(st)
    dataph = correctdata(st, data*scale, u, v, w, corr='ph')
    dataphdm = correctdata(st, dataph, u, v, w, corr='dm')
    return dataphdm

def correct_and_plot(st, data, u, v, w, integ):
    scale = getscale(st)
    dataph = correctdata(st, data*scale, u, v, w, corr='ph')
    dataphdm = correctdata(st, dataph, u, v, w, corr='dm')

    fig = pl.figure(figsize=(15,8))
    ax = fig.add_subplot(131)
    sgram = dataphdm[integ-10:integ+10].mean(axis=3).mean(axis=1).real.transpose()
    pl.imshow(sgram, interpolation='nearest', origin='lower', cmap='viridis')
    pl.xlabel('Integration')
    pl.ylabel('Channel')
    ax = fig.add_subplot(132)
    spectra = dataphdm[integ-10:integ+10].mean(axis=2).mean(axis=1).real
    pl.plot(spectra[:,0], 'c.', label='RR')
    pl.plot(spectra[:,1], 'm.', label='LL')
    pl.legend()
    pl.xlabel('Integration')
    pl.ylabel('Amplitude')
    ax = fig.add_subplot(133)
    datadm = correctdata(st, data*scale, u, v, w, corr='dm')
    im, loc = imloc(st, datadm, u, v, w, integ, verbose=1)
    pl.imshow(im.transpose(), interpolation='nearest', cmap='viridis', aspect='equal')
    print('Image SNR {0}'.format(im.max()/im.std()))
    pl.xlabel('RA offset (pix)', fontsize=20)
    pl.ylabel('Dec offset (pix)', fontsize=20)
    xt = pl.setp(ax.get_xticklabels(), fontsize=14)
    yt = pl.setp(ax.get_yticklabels(), fontsize=14)
    ax.xaxis.set_tick_params(width=3, color='w')
    ax.yaxis.set_tick_params(width=3, color='w')

    fig = pl.figure(figsize=(3,6))
    ax = fig.add_subplot(111)
    sgram = dataph[integ-10:integ+50].mean(axis=3).mean(axis=1).real.transpose()
    extent = (0, 60*st['inttime'], st['freq'][0], st['freq'][-1])
    pl.imshow(sgram, interpolation='nearest', origin='lower', cmap='viridis',
              vmax=sgram.max()*0.8, extent=extent)
    pl.xlabel('Time (s, relative)', fontsize=14)
    pl.ylabel('Frequency (GHz)', fontsize=14)
    xt = pl.setp(ax.get_xticklabels(), fontsize=14)
    yt = pl.setp(ax.get_yticklabels(), fontsize=14)
    ax.xaxis.set_tick_params(width=2, color='k')
    ax.yaxis.set_tick_params(width=2, color='k')
    pl.xticks(np.linspace(0, 60*st['inttime'], 4))
    pl.colorbar()

    fig = pl.figure(figsize=(6,3))
    ax = fig.add_subplot(111)
    spectra = dataphdm[integ].mean(axis=0).real
    print('(RR-LL)/(RR+LL): {0}'.format(np.mean((spectra[:,0]-spectra[:,1])).real/np.mean((spectra[:,0]+spectra[:,1])).real))
    print('(RR+LL): {0}'.format(np.mean((spectra[:,0]+spectra[:,1])).real))
    nint, nbl, nch, npol = data.shape
    pl.scatter(range(0, nch), spectra[:,0], marker='.', c='c', label='RR', edgecolors='none')
    pl.scatter(range(0, nch), spectra[:,1], marker='.', c='m', label='LL', edgecolors='none')
    resamp = 16
    minch = 0
    if nch < 256:
        minch = resamp - (256-nch)
    print(minch, nch, resamp, spectra[minch:,0].shape)
    pl.scatter(range(minch, nch, resamp), spectra[minch:,0].reshape((256-minch)/resamp, resamp).mean(axis=1), 
               marker='_', c='c', s=500, edgecolors='c')
    pl.scatter(range(minch, nch, resamp), spectra[minch:,1].reshape((256-minch)/resamp, resamp).mean(axis=1), 
               marker='_', c='m', s=500, edgecolors='m')

    off = np.ma.masked_equal(dataphdm.mean(axis=1).real[range(0,integ-2)+range(integ+3,len(dataphdm))], 0)
    noise = off.std(axis=0)
    noiseRR = np.median(noise[:,0])
    noiseLL = np.median(noise[:,1])
    pl.errorbar(230, spectra.max(), yerr=noiseRR, fmt='c.', ecolor='c')
    pl.text(230, spectra.max(), s='RR', verticalalignment='center', horizontalalignment='left')
    pl.errorbar(240, spectra.max(), yerr=noiseLL, fmt='m.', ecolor='m')
    pl.text(240, spectra.max(), s='LL', verticalalignment='center', horizontalalignment='left')
#    pl.errorbar(range(nch), spectra[:,0], yerr=noise[:,0], fmt='c.', ecolor='c')
#    pl.errorbar(range(nch), spectra[:,1], yerr=noise[:,1], fmt='m.', ecolor='m')
#    pl.legend()
    pl.xlabel('Frequency (GHz)', fontsize=14)
    pl.ylabel('Flux density (Jy)', fontsize=14)
    pl.xlim(-5, nch+5)
    pl.xticks(range(0, nch+1, 32), [str(np.round(st['freq'][0]+ch*0.004, 2)) for ch in range(0, nch+1, 32)])
    xt = pl.setp(ax.get_xticklabels(), fontsize=14)
    yt = pl.setp(ax.get_yticklabels(), fontsize=14)
    ax.xaxis.set_tick_params(width=2, color='k')
    ax.yaxis.set_tick_params(width=2, color='k')
    return spectra

def getwidespectrum(st, data, u, v, w, i0, i1):
    scale = getscale(st)
    dataph = correctdata(st, data*scale, u, v, w, corr='ph')
    dataphdm = correctdata(st, dataph, u, v, w, corr='dm')
    spectrum = dataphdm[i0:i1].mean(axis=3).mean(axis=1).real
    return spectrum

def find_dm(st, data, u, v, w):
    scale = getscale(st)

    dmorig = st['dmarr']
    snrs = []
    for dm in range(530, 600, 2):
        st['dmarr'] = [dm]
        datadm = correctdata(st, data*scale, u, v, w, corr='dm')
        datadmph = correctdata(st, datadm, u, v, w, corr='ph')
        lc = datadmph.mean(axis=3).mean(axis=2).mean(axis=1).real
        integ = np.where(lc.max() == lc)[0][0]
        im, loc = imloc(st, datadm, u, v, w, integ)
        imc = im.transpose()[-1000:, 1000:]
        mad = np.median(np.abs(imc - np.median(imc)))
        std = mad/0.67
        snr = im.max()/std
        snrs.append((dm, integ, snr))
    st['dmarr'] = dmorig

    snrs = np.array(snrs)
    snrmax_ind = np.where(snrs[:,2] == snrs[:,2].max())[0][0]
    print('SNR vs DM: {0}'.format(snrs))
    print('Max SNR of {0} at DM={1}'.format(snrs[snrmax_ind, 2], snrs[snrmax_ind, 0]))
    return snrs[snrmax_ind]

sc = lambda sig: np.sqrt(2*sig**2*np.pi)
lum_s = lambda ld, s: s*1e-23 * (4*np.pi*ld**2) * 5e-3 * 1.024e9 # lum in erg, s in Jy, ld in cm
lum_ext = lambda ld, po: po[0]/sc(po[2])*1e-23 * (4*np.pi*ld**2) * 5e-3 * 2.355*fbin*4*po[2]*1e6 # lum in erg, s is norm fit peak in Jy, ld in cm

Set a few dictionaries to keep track of data read and to be modeled


In [5]:
read = {}
spectrum = {}
spectrumwide = {}
dmmax = {}

Get data for first burst


In [6]:
sdmfile = '16A-459_TEST_1hr.57623.72670021991.cut'
key = '57623'
scannum = getscannum(sdmfile)
read[key] = read_cut(sdmfile, scannum, 2, npix_max=4096)


2017-05-20 16:30:56,810 - rtpipe.parsesdm - INFO - Setting (standard) key logfile to False
2017-05-20 16:30:56,810 - rtpipe.parsesdm - INFO - Setting (standard) key timesub to mean
2017-05-20 16:30:56,811 - rtpipe.parsesdm - INFO - Setting (standard) key gainfile to 16A-459_TEST_1hr.57623.72670021991.GN
2017-05-20 16:30:56,811 - rtpipe.parsesdm - INFO - Setting (standard) key dmarr to [558.0]
2017-05-20 16:30:56,812 - rtpipe.parsesdm - INFO - Setting (standard) key dtarr to [1]
2017-05-20 16:30:56,812 - rtpipe.parsesdm - INFO - Setting (standard) key npix_max to 4096
2017-05-20 16:30:56,813 - rtpipe.parsesdm - INFO - Setting (standard) key savecands to False
2017-05-20 16:30:56,813 - rtpipe.parsesdm - INFO - Setting (standard) key flaglist to [('badap', 3.0, 0.2)]
2017-05-20 16:30:56,814 - rtpipe.parsesdm - INFO - Setting (standard) key savenoise to False
2017-05-20 16:30:56,815 - rtpipe.parsesdm - INFO - Setting (standard) key flagantsol to True
2017-05-20 16:30:56,815 - rtpipe.parsesdm - INFO - Setting (standard) key uvoversample to 1.5
2017-05-20 16:30:56,911 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14]
Scan 6 binary data file: /Users/caseyjlaw/code/FRB121102_private/16A-459_TEST_1hr.57623.72670021991.cut/ASDMBinary/uid____evla_bdf_1471974264507
2017-05-20 16:30:57,230 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14]
2017-05-20 16:30:57,314 - rtpipe.parsesdm - INFO - Calculating uvw for first integration of scan 6 of source FRB121102-off
2017-05-20 16:30:57,471 - rtpipe.parsesdm - INFO - 

2017-05-20 16:30:57,472 - rtpipe.parsesdm - INFO - Metadata summary:
2017-05-20 16:30:57,472 - rtpipe.parsesdm - INFO - 	 Working directory and data at /Users/caseyjlaw/code/FRB121102_private, 16A-459_TEST_1hr.57623.72670021991.cut
2017-05-20 16:30:57,473 - rtpipe.parsesdm - INFO - 	 Using scan 6, source FRB121102-off
2017-05-20 16:30:57,473 - rtpipe.parsesdm - INFO - 	 nants, nbl: 27, 351
2017-05-20 16:30:57,474 - rtpipe.parsesdm - INFO - 	 Freq range (2.489 -- 3.509). 8 spw with 256 chans.
2017-05-20 16:30:57,474 - rtpipe.parsesdm - INFO - 	 Scan has 800 ints (4.0 s) and inttime 0.005 s
2017-05-20 16:30:57,475 - rtpipe.parsesdm - INFO - 	 2 polarizations: ['RR', 'LL']
2017-05-20 16:30:57,475 - rtpipe.parsesdm - INFO - 	 Ideal uvgrid npix=(2592,3456) and res=104 (oversample 1.5)
2017-05-20 16:30:57,490 - rtpipe - INFO - 
2017-05-20 16:30:57,491 - rtpipe - INFO - Pipeline summary:
2017-05-20 16:30:57,492 - rtpipe - INFO - 	 Products saved with 16A-459_TEST_1hr.57623.72670021991.cut. telcal calibration with 16A-459_TEST_1hr.57623.72670021991.GN
2017-05-20 16:30:57,492 - rtpipe - INFO - 	 Using 5 segments of 190 ints (1.0 s) with overlap of 0.2 s
2017-05-20 16:30:57,492 - rtpipe - INFO - 	 Downsampling in time/freq by 1/1 and skipping 0 ints from start of scan.
2017-05-20 16:30:57,493 - rtpipe - INFO - 	 Excluding ants []
2017-05-20 16:30:57,493 - rtpipe - INFO - 	 Using pols ['RR', 'LL']
2017-05-20 16:30:57,494 - rtpipe - INFO - 
2017-05-20 16:30:57,494 - rtpipe - INFO - 	 Search with image1 and threshold 7.0.
2017-05-20 16:30:57,495 - rtpipe - INFO - 	 Using 1 DMs from 558.0 to 558.0 and dts [1].
2017-05-20 16:30:57,495 - rtpipe - INFO - 	 Using uvgrid npix=(2592,3456) and res=104.
2017-05-20 16:30:57,496 - rtpipe - INFO - 	 Expect 0 thermal false positives per segment.
2017-05-20 16:30:57,496 - rtpipe - INFO - 
2017-05-20 16:30:57,497 - rtpipe - INFO - 	 Visibility memory usage is 1.0 GB/segment
2017-05-20 16:30:57,497 - rtpipe - INFO - 	 Imaging in 1 chunks using max of 12.7 GB/segment
2017-05-20 16:30:57,497 - rtpipe - INFO - 	 Grand total memory usage: 13.7 GB/segment
2017-05-20 16:30:57,881 - rtpipe.parsesdm - INFO - Reading scan 6, segment 2/4, times 17:51:23.444 to 17:51:24.396
2017-05-20 16:30:58,000 - rtpipe.parsesdm - INFO - Reading 190 ints starting at int 304
2017-05-20 16:30:59,264 - rtpipe.parsesdm - INFO - Found online flags for 144 antenna/time ranges.
2017-05-20 16:30:59,271 - rtpipe.parsesdm - INFO - Applied online flags to 0 ints.
2017-05-20 16:31:00,049 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14]
2017-05-20 16:31:00,135 - rtpipe.parsesdm - INFO - Calculating uvw at 2016/08/23/17:51:23.920 for scan 6 of source FRB121102-off
2017-05-20 16:31:00,239 - rtpipe.parsecal - INFO - Read telcalfile 16A-459_TEST_1hr.57623.72670021991.GN
2017-05-20 16:31:00,250 - rtpipe.parsecal - INFO - Frequency selection cut down to 1296 solutions
2017-05-20 16:31:00,253 - rtpipe.parsecal - INFO - Selection down to 432 solutions separated from given time by 4 minutes
2017-05-20 16:31:00,256 - rtpipe.parsecal - INFO - MJD: [ 57623.74748264]
2017-05-20 16:31:00,258 - rtpipe.parsecal - INFO - Source: ['J0555+3948']
2017-05-20 16:31:00,260 - rtpipe.parsecal - INFO - Solutions for 8 spw: ([ 2553.  2681.  2809.  2937.  3065.  3193.  3321.  3449.])
2017-05-20 16:31:00,261 - rtpipe.parsecal - INFO - Applying gain solution for chans from 0-31
2017-05-20 16:31:00,400 - rtpipe.parsecal - INFO - Applying gain solution for chans from 32-63
2017-05-20 16:31:00,543 - rtpipe.parsecal - INFO - Applying gain solution for chans from 64-95
2017-05-20 16:31:00,691 - rtpipe.parsecal - INFO - Applying gain solution for chans from 96-127
2017-05-20 16:31:00,820 - rtpipe.parsecal - INFO - Applying gain solution for chans from 128-159
2017-05-20 16:31:00,958 - rtpipe.parsecal - INFO - Applying gain solution for chans from 160-191
2017-05-20 16:31:01,087 - rtpipe.parsecal - INFO - Applying gain solution for chans from 192-223
2017-05-20 16:31:01,236 - rtpipe.parsecal - INFO - Applying gain solution for chans from 224-255
2017-05-20 16:31:01,377 - rtpipe - INFO - Flagging with flaglist: [('badap', 3.0, 0.2)]
2017-05-20 16:31:01,642 - rtpipe - INFO - Bad basepol flagging for chans 0-31 at 3.0 sigma: ants/pols [14]/[1], 0.46 % of total flagged
2017-05-20 16:31:01,824 - rtpipe - INFO - Bad basepol flagging for chans 0-31 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:31:02,099 - rtpipe - INFO - Bad basepol flagging for chans 32-63 at 3.0 sigma: ants/pols [14]/[1], 0.46 % of total flagged
2017-05-20 16:31:02,283 - rtpipe - INFO - Bad basepol flagging for chans 32-63 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:31:02,564 - rtpipe - INFO - Bad basepol flagging for chans 64-95 at 3.0 sigma: ants/pols [14]/[1], 0.46 % of total flagged
2017-05-20 16:31:02,751 - rtpipe - INFO - Bad basepol flagging for chans 64-95 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:31:03,030 - rtpipe - INFO - Bad basepol flagging for chans 96-127 at 3.0 sigma: ants/pols [14]/[1], 0.46 % of total flagged
2017-05-20 16:31:03,221 - rtpipe - INFO - Bad basepol flagging for chans 96-127 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:31:03,405 - rtpipe - INFO - Bad basepol flagging for chans 128-159 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:31:03,589 - rtpipe - INFO - Bad basepol flagging for chans 128-159 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:31:03,783 - rtpipe - INFO - Bad basepol flagging for chans 160-191 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:31:03,964 - rtpipe - INFO - Bad basepol flagging for chans 160-191 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:31:04,141 - rtpipe - INFO - Bad basepol flagging for chans 192-223 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:31:04,317 - rtpipe - INFO - Bad basepol flagging for chans 192-223 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:31:04,493 - rtpipe - INFO - Bad basepol flagging for chans 224-255 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:31:04,677 - rtpipe - INFO - Bad basepol flagging for chans 224-255 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:31:04,679 - rtpipe - INFO - Subtracting mean visibility in time...
2017-05-20 16:31:05,222 - rtpipe - INFO - Returning prepared data...
2017-05-20 16:31:05,360 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14]
2017-05-20 16:31:05,456 - rtpipe.parsesdm - INFO - Calculating uvw at 2016/08/23/17:51:23.920 for scan 6 of source FRB121102-off

Optimize image SNR over fine grid of DM


In [7]:
key = '57623'
st, data, u, v, w = read[key]
snrmax = find_dm(st, data, u, v, w)


Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
SNR vs DM: [[ 530.           97.           26.36794927]
 [ 532.           97.           28.13886798]
 [ 534.           97.           31.3614527 ]
 [ 536.           97.           32.39580909]
 [ 538.           97.           33.40401604]
 [ 540.           97.           32.62130487]
 [ 542.           97.           31.0170661 ]
 [ 544.           97.           29.27695388]
 [ 546.           97.           25.67836133]
 [ 548.           97.           24.62919041]
 [ 550.           96.           21.94754591]
 [ 552.           96.           23.76299415]
 [ 554.           96.           29.28366463]
 [ 556.           96.           32.28822625]
 [ 558.           96.           36.88653137]
 [ 560.           96.           37.6682611 ]
 [ 562.           96.           37.43060886]
 [ 564.           96.           36.41910998]
 [ 566.           96.           33.8082721 ]
 [ 568.           96.           30.18560388]
 [ 570.           96.           27.94985215]
 [ 572.           96.           24.25596712]
 [ 574.           95.           21.5302647 ]
 [ 576.           95.           24.09697273]
 [ 578.           95.           28.29503126]
 [ 580.           95.           31.36662187]
 [ 582.           95.           32.46517387]
 [ 584.           95.           33.12005019]
 [ 586.           95.           31.97530082]
 [ 588.           95.           32.05098515]
 [ 590.           95.           30.22953616]
 [ 592.           95.           27.72476567]
 [ 594.           95.           24.39580579]
 [ 596.           95.           20.49046729]
 [ 598.           94.           21.34373241]]
Max SNR of 37.6682610981 at DM=560.0

Extract spectrum for optimal DM


In [8]:
dmmax[key] = snrmax
dm = snrmax[0]
integ = int(snrmax[1])
st['dmarr'] = [dm]
spectrum[key] = correct_and_plot(st, data, u, v, w, integ)
st['dmarr'] = [560.5]
_ = correct_and_plot(st, data, u, v, w, integ)
#i0 = integ - 1
#i1 = integ + 2
#spectrumwide[key] = getwidespectrum(st, data, u, v, w, i0, i1)
print('Image SNR (orig): {0}'.format(snrdet[key]))


Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Peak location:
-0.000382092830009 0.000539752492877
hms_tuple(h=5.0, m=31.0, s=58.726811858099168) dms_tuple(d=33.0, m=8.0, s=52.331952522986285)
Image SNR 36.0422501186
(RR-LL)/(RR+LL): 0.0162286423147
(RR+LL): 0.389014154673
0 256 16 (256,)
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Peak location:
-0.000382092830009 0.000539752492877
hms_tuple(h=5.0, m=31.0, s=58.726811858099168) dms_tuple(d=33.0, m=8.0, s=52.331952522986285)
Image SNR 36.1401798601
(RR-LL)/(RR+LL): 0.0173398572952
(RR+LL): 0.389824181795
0 256 16 (256,)
Image SNR (orig): 35.2

Get data for second burst


In [9]:
sdmfile = '16A-459_TEST_1hr_000.57633.66130137732.scan7.cut'
key = '57633_scan7'
scannum = getscannum(sdmfile)
read[key] = read_cut(sdmfile, scannum, 2, gainfile='16A-459_TEST_1hr_000.57633.66130137732.GN',
                               npix_max=4096)


2017-05-20 16:32:55,608 - rtpipe.parsesdm - INFO - Setting (standard) key logfile to False
2017-05-20 16:32:55,608 - rtpipe.parsesdm - INFO - Setting (standard) key timesub to mean
2017-05-20 16:32:55,609 - rtpipe.parsesdm - INFO - Setting (standard) key gainfile to 16A-459_TEST_1hr_000.57633.66130137732.GN
2017-05-20 16:32:55,609 - rtpipe.parsesdm - INFO - Setting (standard) key dmarr to [558.0]
2017-05-20 16:32:55,610 - rtpipe.parsesdm - INFO - Setting (standard) key dtarr to [1]
2017-05-20 16:32:55,610 - rtpipe.parsesdm - INFO - Setting (standard) key npix_max to 4096
2017-05-20 16:32:55,611 - rtpipe.parsesdm - INFO - Setting (standard) key savecands to False
2017-05-20 16:32:55,611 - rtpipe.parsesdm - INFO - Setting (standard) key flaglist to [('badap', 3.0, 0.2)]
2017-05-20 16:32:55,612 - rtpipe.parsesdm - INFO - Setting (standard) key savenoise to False
2017-05-20 16:32:55,612 - rtpipe.parsesdm - INFO - Setting (standard) key flagantsol to True
2017-05-20 16:32:55,613 - rtpipe.parsesdm - INFO - Setting (standard) key uvoversample to 1.5
2017-05-20 16:32:55,695 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14]
Scan 7 binary data file: /Users/caseyjlaw/code/FRB121102_private/16A-459_TEST_1hr_000.57633.66130137732.scan7.cut/ASDMBinary/uid____evla_bdf_1472832853393
2017-05-20 16:32:55,937 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14]
2017-05-20 16:32:56,020 - rtpipe.parsesdm - INFO - Calculating uvw for first integration of scan 7 of source FRB121102-off
2017-05-20 16:32:56,112 - rtpipe.parsesdm - INFO - 

2017-05-20 16:32:56,113 - rtpipe.parsesdm - INFO - Metadata summary:
2017-05-20 16:32:56,113 - rtpipe.parsesdm - INFO - 	 Working directory and data at /Users/caseyjlaw/code/FRB121102_private, 16A-459_TEST_1hr_000.57633.66130137732.scan7.cut
2017-05-20 16:32:56,114 - rtpipe.parsesdm - INFO - 	 Using scan 7, source FRB121102-off
2017-05-20 16:32:56,114 - rtpipe.parsesdm - INFO - 	 nants, nbl: 27, 351
2017-05-20 16:32:56,115 - rtpipe.parsesdm - INFO - 	 Freq range (2.489 -- 3.509). 8 spw with 256 chans.
2017-05-20 16:32:56,115 - rtpipe.parsesdm - INFO - 	 Scan has 800 ints (4.0 s) and inttime 0.005 s
2017-05-20 16:32:56,116 - rtpipe.parsesdm - INFO - 	 2 polarizations: ['RR', 'LL']
2017-05-20 16:32:56,116 - rtpipe.parsesdm - INFO - 	 Ideal uvgrid npix=(2916,3456) and res=104 (oversample 1.5)
2017-05-20 16:32:56,135 - rtpipe - INFO - 
2017-05-20 16:32:56,135 - rtpipe - INFO - Pipeline summary:
2017-05-20 16:32:56,136 - rtpipe - INFO - 	 Products saved with 16A-459_TEST_1hr_000.57633.66130137732.scan7.cut. telcal calibration with 16A-459_TEST_1hr_000.57633.66130137732.GN
2017-05-20 16:32:56,136 - rtpipe - INFO - 	 Using 5 segments of 190 ints (1.0 s) with overlap of 0.2 s
2017-05-20 16:32:56,137 - rtpipe - INFO - 	 Downsampling in time/freq by 1/1 and skipping 0 ints from start of scan.
2017-05-20 16:32:56,137 - rtpipe - INFO - 	 Excluding ants []
2017-05-20 16:32:56,138 - rtpipe - INFO - 	 Using pols ['RR', 'LL']
2017-05-20 16:32:56,138 - rtpipe - INFO - 
2017-05-20 16:32:56,138 - rtpipe - INFO - 	 Search with image1 and threshold 7.0.
2017-05-20 16:32:56,139 - rtpipe - INFO - 	 Using 1 DMs from 558.0 to 558.0 and dts [1].
2017-05-20 16:32:56,139 - rtpipe - INFO - 	 Using uvgrid npix=(2916,3456) and res=104.
2017-05-20 16:32:56,140 - rtpipe - INFO - 	 Expect 0 thermal false positives per segment.
2017-05-20 16:32:56,140 - rtpipe - INFO - 
2017-05-20 16:32:56,141 - rtpipe - INFO - 	 Visibility memory usage is 1.0 GB/segment
2017-05-20 16:32:56,141 - rtpipe - INFO - 	 Imaging in 1 chunks using max of 14.3 GB/segment
2017-05-20 16:32:56,141 - rtpipe - INFO - 	 Grand total memory usage: 15.3 GB/segment
2017-05-20 16:32:56,326 - rtpipe.parsesdm - INFO - Reading scan 7, segment 2/4, times 16:18:59.744 to 16:19:00.696
2017-05-20 16:32:56,427 - rtpipe.parsesdm - INFO - Reading 190 ints starting at int 304
2017-05-20 16:32:57,570 - rtpipe.parsesdm - INFO - Found online flags for 186 antenna/time ranges.
2017-05-20 16:32:57,575 - rtpipe.parsesdm - INFO - Applied online flags to 0 ints.
2017-05-20 16:32:58,177 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14]
2017-05-20 16:32:58,257 - rtpipe.parsesdm - INFO - Calculating uvw at 2016/09/02/16:19:00.220 for scan 7 of source FRB121102-off
2017-05-20 16:32:58,356 - rtpipe.parsecal - INFO - Read telcalfile 16A-459_TEST_1hr_000.57633.66130137732.GN
2017-05-20 16:32:58,368 - rtpipe.parsecal - INFO - Frequency selection cut down to 1296 solutions
2017-05-20 16:32:58,370 - rtpipe.parsecal - INFO - Selection down to 432 solutions separated from given time by 3 minutes
2017-05-20 16:32:58,374 - rtpipe.parsecal - INFO - MJD: [ 57633.68208333]
2017-05-20 16:32:58,376 - rtpipe.parsecal - INFO - Source: ['J0555+3948']
2017-05-20 16:32:58,378 - rtpipe.parsecal - INFO - Solutions for 8 spw: ([ 2553.  2681.  2809.  2937.  3065.  3193.  3321.  3449.])
2017-05-20 16:32:58,379 - rtpipe.parsecal - INFO - Applying gain solution for chans from 0-31
2017-05-20 16:32:58,518 - rtpipe.parsecal - INFO - Applying gain solution for chans from 32-63
2017-05-20 16:32:58,644 - rtpipe.parsecal - INFO - Applying gain solution for chans from 64-95
2017-05-20 16:32:58,772 - rtpipe.parsecal - INFO - Applying gain solution for chans from 96-127
2017-05-20 16:32:58,901 - rtpipe.parsecal - INFO - Applying gain solution for chans from 128-159
2017-05-20 16:32:59,027 - rtpipe.parsecal - INFO - Applying gain solution for chans from 160-191
2017-05-20 16:32:59,154 - rtpipe.parsecal - INFO - Applying gain solution for chans from 192-223
2017-05-20 16:32:59,282 - rtpipe.parsecal - INFO - Applying gain solution for chans from 224-255
2017-05-20 16:32:59,407 - rtpipe - INFO - Flagging with flaglist: [('badap', 3.0, 0.2)]
2017-05-20 16:32:59,721 - rtpipe - INFO - Bad basepol flagging for chans 0-31 at 3.0 sigma: ants/pols [14 19]/[1 0], 0.93 % of total flagged
2017-05-20 16:32:59,872 - rtpipe - INFO - Bad basepol flagging for chans 0-31 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:33:00,177 - rtpipe - INFO - Bad basepol flagging for chans 32-63 at 3.0 sigma: ants/pols [14 19]/[1 0], 0.93 % of total flagged
2017-05-20 16:33:00,336 - rtpipe - INFO - Bad basepol flagging for chans 32-63 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:33:00,639 - rtpipe - INFO - Bad basepol flagging for chans 64-95 at 3.0 sigma: ants/pols [14 19]/[1 0], 0.93 % of total flagged
2017-05-20 16:33:00,798 - rtpipe - INFO - Bad basepol flagging for chans 64-95 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:33:01,032 - rtpipe - INFO - Bad basepol flagging for chans 96-127 at 3.0 sigma: ants/pols [19]/[0], 0.46 % of total flagged
2017-05-20 16:33:01,182 - rtpipe - INFO - Bad basepol flagging for chans 96-127 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:33:01,410 - rtpipe - INFO - Bad basepol flagging for chans 128-159 at 3.0 sigma: ants/pols [19]/[0], 0.46 % of total flagged
2017-05-20 16:33:01,556 - rtpipe - INFO - Bad basepol flagging for chans 128-159 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:33:01,861 - rtpipe - INFO - Bad basepol flagging for chans 160-191 at 3.0 sigma: ants/pols [14 19]/[1 0], 0.93 % of total flagged
2017-05-20 16:33:02,008 - rtpipe - INFO - Bad basepol flagging for chans 160-191 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:33:02,314 - rtpipe - INFO - Bad basepol flagging for chans 192-223 at 3.0 sigma: ants/pols [14 19]/[1 0], 0.93 % of total flagged
2017-05-20 16:33:02,476 - rtpipe - INFO - Bad basepol flagging for chans 192-223 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:33:02,784 - rtpipe - INFO - Bad basepol flagging for chans 224-255 at 3.0 sigma: ants/pols [14 19]/[1 0], 0.93 % of total flagged
2017-05-20 16:33:02,933 - rtpipe - INFO - Bad basepol flagging for chans 224-255 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:33:02,934 - rtpipe - INFO - Subtracting mean visibility in time...
2017-05-20 16:33:03,381 - rtpipe - INFO - Returning prepared data...
2017-05-20 16:33:03,500 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14]
2017-05-20 16:33:03,581 - rtpipe.parsesdm - INFO - Calculating uvw at 2016/09/02/16:19:00.220 for scan 7 of source FRB121102-off

In [10]:
key = '57633_scan7'
st, data, u, v, w = read[key]
snrmax = find_dm(st, data, u, v, w)

dmmax[key] = snrmax
dm = snrmax[0]
integ = int(snrmax[1])
st['dmarr'] = [dm]
spectrum[key] = correct_and_plot(st, data, u, v, w, integ)
st['dmarr'] = [560.5]
_ = correct_and_plot(st, data, u, v, w, integ)
#i0 = integ - 1
#i1 = integ + 2
#spectrumwide[key] = getwidespectrum(st, data, u, v, w, i0, i1)
print('Image SNR (orig): {0}'.format(snrdet[key]))


Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
SNR vs DM: [[ 530.           96.          137.1448671 ]
 [ 532.           96.          141.44289835]
 [ 534.           96.          143.58207737]
 [ 536.           96.          146.14436774]
 [ 538.           96.          151.86673337]
 [ 540.           96.          152.89529014]
 [ 542.           96.          158.68808313]
 [ 544.           96.          162.75316645]
 [ 546.           96.          169.05970347]
 [ 548.           96.          171.26491324]
 [ 550.           96.          175.05100613]
 [ 552.           96.          176.79680777]
 [ 554.           96.          179.00600668]
 [ 556.           96.          178.02973668]
 [ 558.           96.          176.73523216]
 [ 560.           96.          174.93607367]
 [ 562.           96.          167.29332667]
 [ 564.           96.          163.81845147]
 [ 566.           96.          159.58362973]
 [ 568.           96.          150.47191566]
 [ 570.           96.          145.83776629]
 [ 572.           96.          138.62426258]
 [ 574.           96.          130.06628197]
 [ 576.           96.          125.98389697]
 [ 578.           96.          122.50527956]
 [ 580.           95.          130.63761528]
 [ 582.           95.          132.53016123]
 [ 584.           95.          136.20651615]
 [ 586.           95.          137.09630683]
 [ 588.           95.          138.7071352 ]
 [ 590.           95.          137.18458756]
 [ 592.           95.          138.62223144]
 [ 594.           95.          138.91089723]
 [ 596.           95.          136.74061681]
 [ 598.           95.          137.80379133]]
Max SNR of 179.006006678 at DM=554.0
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Peak location:
-0.000382505012135 0.000539752492877
hms_tuple(h=5.0, m=31.0, s=58.720044665104396) dms_tuple(d=33.0, m=8.0, s=52.331952522986285)
Image SNR 118.855416626
(RR-LL)/(RR+LL): -0.0239983517677
(RR+LL): 2.99423503876
0 256 16 (256,)
Gridded 1.000 of data. Scaling fft by = 60.0
Pixel sizes (1.4", 1.1"), Field size 1983.3"
Peak location:
-0.000382505012135 0.000539752492877
hms_tuple(h=5.0, m=31.0, s=58.720044665104396) dms_tuple(d=33.0, m=8.0, s=52.331952522986285)
Image SNR 117.64678648
(RR-LL)/(RR+LL): -0.0225797668099
(RR+LL): 2.88847875595
0 256 16 (256,)
Image SNR (orig): 119.3

Get data for third burst


In [11]:
sdmfile = '16A-459_TEST_1hr_000.57633.66130137732.scan13.cut'
key = '57633_scan13'
scannum = getscannum(sdmfile)
read[key] = read_cut(sdmfile, scannum, 2, gainfile='16A-459_TEST_1hr_000.57633.66130137732.GN', npix_max=4096)


2017-05-20 16:35:00,778 - rtpipe.parsesdm - INFO - Setting (standard) key logfile to False
2017-05-20 16:35:00,778 - rtpipe.parsesdm - INFO - Setting (standard) key timesub to mean
2017-05-20 16:35:00,779 - rtpipe.parsesdm - INFO - Setting (standard) key gainfile to 16A-459_TEST_1hr_000.57633.66130137732.GN
2017-05-20 16:35:00,779 - rtpipe.parsesdm - INFO - Setting (standard) key dmarr to [558.0]
2017-05-20 16:35:00,780 - rtpipe.parsesdm - INFO - Setting (standard) key dtarr to [1]
2017-05-20 16:35:00,780 - rtpipe.parsesdm - INFO - Setting (standard) key npix_max to 4096
2017-05-20 16:35:00,780 - rtpipe.parsesdm - INFO - Setting (standard) key savecands to False
2017-05-20 16:35:00,781 - rtpipe.parsesdm - INFO - Setting (standard) key flaglist to [('badap', 3.0, 0.2)]
2017-05-20 16:35:00,781 - rtpipe.parsesdm - INFO - Setting (standard) key savenoise to False
2017-05-20 16:35:00,782 - rtpipe.parsesdm - INFO - Setting (standard) key flagantsol to True
2017-05-20 16:35:00,782 - rtpipe.parsesdm - INFO - Setting (standard) key uvoversample to 1.5
2017-05-20 16:35:00,867 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14]
Scan 13 binary data file: /Users/caseyjlaw/code/FRB121102_private/16A-459_TEST_1hr_000.57633.66130137732.scan13.cut/ASDMBinary/uid____evla_bdf_1472834169774
2017-05-20 16:35:01,100 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14]
2017-05-20 16:35:01,182 - rtpipe.parsesdm - INFO - Calculating uvw for first integration of scan 13 of source FRB121102-off
2017-05-20 16:35:01,269 - rtpipe.parsesdm - INFO - 

2017-05-20 16:35:01,269 - rtpipe.parsesdm - INFO - Metadata summary:
2017-05-20 16:35:01,270 - rtpipe.parsesdm - INFO - 	 Working directory and data at /Users/caseyjlaw/code/FRB121102_private, 16A-459_TEST_1hr_000.57633.66130137732.scan13.cut
2017-05-20 16:35:01,270 - rtpipe.parsesdm - INFO - 	 Using scan 13, source FRB121102-off
2017-05-20 16:35:01,271 - rtpipe.parsesdm - INFO - 	 nants, nbl: 27, 351
2017-05-20 16:35:01,271 - rtpipe.parsesdm - INFO - 	 Freq range (2.489 -- 3.509). 8 spw with 256 chans.
2017-05-20 16:35:01,272 - rtpipe.parsesdm - INFO - 	 Scan has 800 ints (4.0 s) and inttime 0.005 s
2017-05-20 16:35:01,272 - rtpipe.parsesdm - INFO - 	 2 polarizations: ['RR', 'LL']
2017-05-20 16:35:01,272 - rtpipe.parsesdm - INFO - 	 Ideal uvgrid npix=(2592,3456) and res=104 (oversample 1.5)
2017-05-20 16:35:01,290 - rtpipe - INFO - 
2017-05-20 16:35:01,291 - rtpipe - INFO - Pipeline summary:
2017-05-20 16:35:01,291 - rtpipe - INFO - 	 Products saved with 16A-459_TEST_1hr_000.57633.66130137732.scan13.cut. telcal calibration with 16A-459_TEST_1hr_000.57633.66130137732.GN
2017-05-20 16:35:01,292 - rtpipe - INFO - 	 Using 5 segments of 190 ints (1.0 s) with overlap of 0.2 s
2017-05-20 16:35:01,292 - rtpipe - INFO - 	 Downsampling in time/freq by 1/1 and skipping 0 ints from start of scan.
2017-05-20 16:35:01,292 - rtpipe - INFO - 	 Excluding ants []
2017-05-20 16:35:01,293 - rtpipe - INFO - 	 Using pols ['RR', 'LL']
2017-05-20 16:35:01,293 - rtpipe - INFO - 
2017-05-20 16:35:01,294 - rtpipe - INFO - 	 Search with image1 and threshold 7.0.
2017-05-20 16:35:01,294 - rtpipe - INFO - 	 Using 1 DMs from 558.0 to 558.0 and dts [1].
2017-05-20 16:35:01,295 - rtpipe - INFO - 	 Using uvgrid npix=(2592,3456) and res=104.
2017-05-20 16:35:01,295 - rtpipe - INFO - 	 Expect 0 thermal false positives per segment.
2017-05-20 16:35:01,295 - rtpipe - INFO - 
2017-05-20 16:35:01,296 - rtpipe - INFO - 	 Visibility memory usage is 1.0 GB/segment
2017-05-20 16:35:01,296 - rtpipe - INFO - 	 Imaging in 1 chunks using max of 12.7 GB/segment
2017-05-20 16:35:01,297 - rtpipe - INFO - 	 Grand total memory usage: 13.7 GB/segment
2017-05-20 16:35:01,478 - rtpipe.parsesdm - INFO - Reading scan 13, segment 2/4, times 16:41:01.294 to 16:41:02.246
2017-05-20 16:35:01,578 - rtpipe.parsesdm - INFO - Reading 190 ints starting at int 304
2017-05-20 16:35:02,724 - rtpipe.parsesdm - INFO - Found online flags for 186 antenna/time ranges.
2017-05-20 16:35:02,729 - rtpipe.parsesdm - INFO - Applied online flags to 0 ints.
2017-05-20 16:35:03,333 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14]
2017-05-20 16:35:03,415 - rtpipe.parsesdm - INFO - Calculating uvw at 2016/09/02/16:41:01.770 for scan 13 of source FRB121102-off
2017-05-20 16:35:03,512 - rtpipe.parsecal - INFO - Read telcalfile 16A-459_TEST_1hr_000.57633.66130137732.GN
2017-05-20 16:35:03,524 - rtpipe.parsecal - INFO - Frequency selection cut down to 1296 solutions
2017-05-20 16:35:03,526 - rtpipe.parsecal - INFO - Selection down to 432 solutions separated from given time by 3 minutes
2017-05-20 16:35:03,530 - rtpipe.parsecal - INFO - MJD: [ 57633.69731944]
2017-05-20 16:35:03,532 - rtpipe.parsecal - INFO - Source: ['J0555+3948']
2017-05-20 16:35:03,534 - rtpipe.parsecal - INFO - Solutions for 8 spw: ([ 2553.  2681.  2809.  2937.  3065.  3193.  3321.  3449.])
2017-05-20 16:35:03,535 - rtpipe.parsecal - INFO - Applying gain solution for chans from 0-31
2017-05-20 16:35:03,679 - rtpipe.parsecal - INFO - Applying gain solution for chans from 32-63
2017-05-20 16:35:03,804 - rtpipe.parsecal - INFO - Applying gain solution for chans from 64-95
2017-05-20 16:35:03,932 - rtpipe.parsecal - INFO - Applying gain solution for chans from 96-127
2017-05-20 16:35:04,056 - rtpipe.parsecal - INFO - Applying gain solution for chans from 128-159
2017-05-20 16:35:04,182 - rtpipe.parsecal - INFO - Applying gain solution for chans from 160-191
2017-05-20 16:35:04,307 - rtpipe.parsecal - INFO - Applying gain solution for chans from 192-223
2017-05-20 16:35:04,436 - rtpipe.parsecal - INFO - Applying gain solution for chans from 224-255
2017-05-20 16:35:04,561 - rtpipe - INFO - Flagging with flaglist: [('badap', 3.0, 0.2)]
2017-05-20 16:35:04,787 - rtpipe - INFO - Bad basepol flagging for chans 0-31 at 3.0 sigma: ants/pols [14]/[1], 0.46 % of total flagged
2017-05-20 16:35:04,938 - rtpipe - INFO - Bad basepol flagging for chans 0-31 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:35:05,177 - rtpipe - INFO - Bad basepol flagging for chans 32-63 at 3.0 sigma: ants/pols [14]/[1], 0.46 % of total flagged
2017-05-20 16:35:05,326 - rtpipe - INFO - Bad basepol flagging for chans 32-63 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:35:05,552 - rtpipe - INFO - Bad basepol flagging for chans 64-95 at 3.0 sigma: ants/pols [14]/[1], 0.46 % of total flagged
2017-05-20 16:35:05,710 - rtpipe - INFO - Bad basepol flagging for chans 64-95 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:35:05,947 - rtpipe - INFO - Bad basepol flagging for chans 96-127 at 3.0 sigma: ants/pols [14]/[1], 0.46 % of total flagged
2017-05-20 16:35:06,098 - rtpipe - INFO - Bad basepol flagging for chans 96-127 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:35:06,327 - rtpipe - INFO - Bad basepol flagging for chans 128-159 at 3.0 sigma: ants/pols [14]/[1], 0.46 % of total flagged
2017-05-20 16:35:06,477 - rtpipe - INFO - Bad basepol flagging for chans 128-159 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:35:06,705 - rtpipe - INFO - Bad basepol flagging for chans 160-191 at 3.0 sigma: ants/pols [14]/[1], 0.46 % of total flagged
2017-05-20 16:35:06,859 - rtpipe - INFO - Bad basepol flagging for chans 160-191 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:35:07,085 - rtpipe - INFO - Bad basepol flagging for chans 192-223 at 3.0 sigma: ants/pols [14]/[1], 0.46 % of total flagged
2017-05-20 16:35:07,231 - rtpipe - INFO - Bad basepol flagging for chans 192-223 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:35:07,460 - rtpipe - INFO - Bad basepol flagging for chans 224-255 at 3.0 sigma: ants/pols [14]/[1], 0.46 % of total flagged
2017-05-20 16:35:07,607 - rtpipe - INFO - Bad basepol flagging for chans 224-255 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:35:07,609 - rtpipe - INFO - Subtracting mean visibility in time...
2017-05-20 16:35:08,057 - rtpipe - INFO - Returning prepared data...
2017-05-20 16:35:08,176 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14]
2017-05-20 16:35:08,261 - rtpipe.parsesdm - INFO - Calculating uvw at 2016/09/02/16:41:01.770 for scan 13 of source FRB121102-off

In [12]:
key = '57633_scan13'
st, data, u, v, w = read[key]
snrmax = find_dm(st, data, u, v, w)

dmmax[key] = snrmax
dm = snrmax[0]
integ = int(snrmax[1])
st['dmarr'] = [dm]
spectrum[key] = correct_and_plot(st, data, u, v, w, integ)
st['dmarr'] = [560.5]
_ = correct_and_plot(st, data, u, v, w, integ)
#i0 = integ - 1
#i1 = integ + 2
#spectrumwide[key] = getwidespectrum(st, data, u, v, w, i0, i1)
print('Image SNR (orig): {0}'.format(snrdet[key]))


Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
SNR vs DM: [[ 530.           98.           13.02652385]
 [ 532.           98.           10.94227848]
 [ 534.           97.            9.54215199]
 [ 536.           97.           11.59512718]
 [ 538.           97.           13.54123943]
 [ 540.           97.           14.17368601]
 [ 542.           97.           13.83425701]
 [ 544.           97.           13.82390521]
 [ 546.           97.           12.95446312]
 [ 548.           97.           11.40998347]
 [ 550.           97.           10.05516829]
 [ 552.           96.           10.39680337]
 [ 554.           96.           11.51299518]
 [ 556.           96.           13.10912844]
 [ 558.           96.           14.67024573]
 [ 560.           96.           14.42460489]
 [ 562.           96.           13.73418429]
 [ 564.           96.           12.13416877]
 [ 566.           96.           11.29416991]
 [ 568.           96.            9.2449376 ]
 [ 570.           95.           10.6843617 ]
 [ 572.           95.           12.15160813]
 [ 574.           95.           13.43114451]
 [ 576.           95.           14.0793852 ]
 [ 578.           95.           14.2337518 ]
 [ 580.           95.           13.24885175]
 [ 582.           95.           11.93585926]
 [ 584.           95.           10.5003216 ]
 [ 586.           94.           10.43430468]
 [ 588.           94.           11.69127484]
 [ 590.           94.           13.1624357 ]
 [ 592.           94.           13.77883851]
 [ 594.           94.           13.87740865]
 [ 596.           94.           13.48459729]
 [ 598.           94.           13.36961126]]
Max SNR of 14.6702457313 at DM=558.0
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Peak location:
-0.000385802469136 0.000539752492877
hms_tuple(h=5.0, m=31.0, s=58.665907121002334) dms_tuple(d=33.0, m=8.0, s=52.331952522986285)
Image SNR 14.6790952804
(RR-LL)/(RR+LL): 0.0196851026267
(RR+LL): 0.136823013425
0 256 16 (256,)
Gridded 1.000 of data. Scaling fft by = 51.8
Pixel sizes (1.5", 1.1"), Field size 1983.3"
Peak location:
-0.000382092830009 0.000539752492877
hms_tuple(h=5.0, m=31.0, s=58.726811858099168) dms_tuple(d=33.0, m=8.0, s=52.331952522986285)
Image SNR 14.3164079936
(RR-LL)/(RR+LL): 0.00538807269186
(RR+LL): 0.136880576611
0 256 16 (256,)
Image SNR (orig): 16.3

Get data for fourth burst


In [13]:
sdmfile = '16A-496_sb32698778_1_02h00m.57638.42695471065.cut'
key = '57638'
scannum = getscannum(sdmfile)
read[key] = read_cut(sdmfile, scannum, 4, npix_max=5500, chans=range(2,256))


2017-05-20 16:36:46,174 - rtpipe.parsesdm - INFO - Setting (standard) key logfile to False
2017-05-20 16:36:46,175 - rtpipe.parsesdm - INFO - Setting (standard) key timesub to mean
2017-05-20 16:36:46,176 - rtpipe.parsesdm - INFO - Setting (standard) key gainfile to 16A-496_sb32698778_1_02h00m.57638.42695471065.GN
2017-05-20 16:36:46,176 - rtpipe.parsesdm - INFO - Setting (standard) key dmarr to [558.0]
2017-05-20 16:36:46,177 - rtpipe.parsesdm - INFO - Setting (standard) key dtarr to [1]
2017-05-20 16:36:46,177 - rtpipe.parsesdm - INFO - Setting (standard) key chans to [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255]
2017-05-20 16:36:46,177 - rtpipe.parsesdm - INFO - Setting (standard) key savecands to False
2017-05-20 16:36:46,178 - rtpipe.parsesdm - INFO - Setting (standard) key flaglist to [('badap', 3.0, 0.2)]
2017-05-20 16:36:46,178 - rtpipe.parsesdm - INFO - Setting (standard) key savenoise to False
2017-05-20 16:36:46,179 - rtpipe.parsesdm - INFO - Setting (standard) key flagantsol to True
2017-05-20 16:36:46,179 - rtpipe.parsesdm - INFO - Setting (standard) key npix_max to 5500
2017-05-20 16:36:46,180 - rtpipe.parsesdm - INFO - Setting (standard) key uvoversample to 1.5
Scan 29 binary data file: /Users/caseyjlaw/code/FRB121102_private/16A-496_sb32698778_1_02h00m.57638.42695471065.cut/ASDMBinary/uid____evla_bdf_1473249228150
2017-05-20 16:36:46,360 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 31, 32, 33]
2017-05-20 16:36:46,869 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 31, 32, 33]
2017-05-20 16:36:47,052 - rtpipe.parsesdm - INFO - Calculating uvw for first integration of scan 29 of source FRB121102-off
2017-05-20 16:36:47,236 - rtpipe.parsesdm - INFO - 

2017-05-20 16:36:47,236 - rtpipe.parsesdm - INFO - Metadata summary:
2017-05-20 16:36:47,237 - rtpipe.parsesdm - INFO - 	 Working directory and data at /Users/caseyjlaw/code/FRB121102_private, 16A-496_sb32698778_1_02h00m.57638.42695471065.cut
2017-05-20 16:36:47,237 - rtpipe.parsesdm - INFO - 	 Using scan 29, source FRB121102-off
2017-05-20 16:36:47,238 - rtpipe.parsesdm - INFO - 	 nants, nbl: 26, 325
2017-05-20 16:36:47,238 - rtpipe.parsesdm - INFO - 	 Freq range (2.497 -- 3.509). 8 spw with 254 chans.
2017-05-20 16:36:47,239 - rtpipe.parsesdm - INFO - 	 Scan has 800 ints (4.0 s) and inttime 0.005 s
2017-05-20 16:36:47,239 - rtpipe.parsesdm - INFO - 	 2 polarizations: ['RR', 'LL']
2017-05-20 16:36:47,239 - rtpipe.parsesdm - INFO - 	 Ideal uvgrid npix=(3456,7776) and res=104 (oversample 1.5)
2017-05-20 16:36:47,261 - rtpipe - INFO - 
2017-05-20 16:36:47,261 - rtpipe - INFO - Pipeline summary:
2017-05-20 16:36:47,262 - rtpipe - INFO - 	 Products saved with 16A-496_sb32698778_1_02h00m.57638.42695471065.cut. telcal calibration with 16A-496_sb32698778_1_02h00m.57638.42695471065.GN
2017-05-20 16:36:47,262 - rtpipe - INFO - 	 Using 9 segments of 122 ints (0.6 s) with overlap of 0.2 s
2017-05-20 16:36:47,263 - rtpipe - INFO - 	 Downsampling in time/freq by 1/1 and skipping 0 ints from start of scan.
2017-05-20 16:36:47,263 - rtpipe - INFO - 	 Excluding ants []
2017-05-20 16:36:47,264 - rtpipe - INFO - 	 Using pols ['RR', 'LL']
2017-05-20 16:36:47,264 - rtpipe - INFO - 
2017-05-20 16:36:47,265 - rtpipe - INFO - 	 Search with image1 and threshold 7.0.
2017-05-20 16:36:47,265 - rtpipe - INFO - 	 Using 1 DMs from 558.0 to 558.0 and dts [1].
2017-05-20 16:36:47,265 - rtpipe - INFO - 	 Using uvgrid npix=(3456,5500) and res=104.
2017-05-20 16:36:47,266 - rtpipe - INFO - 	 Expect 0 thermal false positives per segment.
2017-05-20 16:36:47,266 - rtpipe - INFO - 
2017-05-20 16:36:47,267 - rtpipe - INFO - 	 Visibility memory usage is 0.6 GB/segment
2017-05-20 16:36:47,267 - rtpipe - INFO - 	 Imaging in 1 chunks using max of 17.3 GB/segment
2017-05-20 16:36:47,268 - rtpipe - INFO - 	 Grand total memory usage: 17.9 GB/segment
2017-05-20 16:36:47,375 - rtpipe.parsesdm - INFO - Reading scan 29, segment 4/8, times 11:59:05.636 to 11:59:06.244
2017-05-20 16:36:47,540 - rtpipe.parsesdm - INFO - Reading 122 ints starting at int 339
2017-05-20 16:36:48,369 - rtpipe.parsesdm - INFO - Found online flags for 351 antenna/time ranges.
2017-05-20 16:36:48,377 - rtpipe.parsesdm - INFO - Applied online flags to 0 ints.
2017-05-20 16:36:48,866 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 31, 32, 33]
2017-05-20 16:36:49,053 - rtpipe.parsesdm - INFO - Calculating uvw at 2016/09/07/11:59:05.940 for scan 29 of source FRB121102-off
2017-05-20 16:36:49,260 - rtpipe.parsecal - INFO - Read telcalfile 16A-496_sb32698778_1_02h00m.57638.42695471065.GN
2017-05-20 16:36:49,263 - py.warnings - WARNING - /Users/caseyjlaw/anaconda/lib/python2.7/site-packages/rtpipe/parsecal.py:418: RuntimeWarning: divide by zero encountered in divide
  badsols = n.where( (n.median(self.amp)/self.amp > threshold) & (self.flagged == False))[0]

2017-05-20 16:36:49,287 - rtpipe.parsecal - INFO - Frequency selection cut down to 2912 solutions
2017-05-20 16:36:49,291 - rtpipe.parsecal - INFO - Selection down to 416 solutions separated from given time by 7 minutes
2017-05-20 16:36:49,295 - rtpipe.parsecal - INFO - MJD: [ 57638.49431019]
2017-05-20 16:36:49,297 - rtpipe.parsecal - INFO - Source: ['J0555+3948']
2017-05-20 16:36:49,299 - rtpipe.parsecal - INFO - Solutions for 8 spw: ([ 2553.  2681.  2809.  2937.  3065.  3193.  3321.  3449.])
2017-05-20 16:36:49,300 - rtpipe.parsecal - INFO - Applying gain solution for chans from 0-30
2017-05-20 16:36:49,395 - rtpipe.parsecal - INFO - Applying gain solution for chans from 31-62
2017-05-20 16:36:49,480 - rtpipe.parsecal - INFO - Applying gain solution for chans from 63-94
2017-05-20 16:36:49,567 - rtpipe.parsecal - INFO - Applying gain solution for chans from 95-126
2017-05-20 16:36:49,656 - rtpipe.parsecal - INFO - Applying gain solution for chans from 127-157
2017-05-20 16:36:49,740 - rtpipe.parsecal - INFO - Applying gain solution for chans from 158-189
2017-05-20 16:36:49,830 - rtpipe.parsecal - INFO - Applying gain solution for chans from 190-221
2017-05-20 16:36:49,916 - rtpipe.parsecal - INFO - Applying gain solution for chans from 222-253
2017-05-20 16:36:50,003 - rtpipe - INFO - Flagging with flaglist: [('badap', 3.0, 0.2)]
2017-05-20 16:36:50,125 - rtpipe - INFO - Bad basepol flagging for chans 0-29 at 3.0 sigma: ants/pols [14]/[1], 0.45 % of total flagged
2017-05-20 16:36:50,186 - rtpipe - INFO - Bad basepol flagging for chans 0-29 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:36:50,308 - rtpipe - INFO - Bad basepol flagging for chans 30-61 at 3.0 sigma: ants/pols [14]/[1], 0.48 % of total flagged
2017-05-20 16:36:50,385 - rtpipe - INFO - Bad basepol flagging for chans 30-61 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:36:50,600 - rtpipe - INFO - Bad basepol flagging for chans 62-93 at 3.0 sigma: ants/pols [ 9  9 14]/[0 1 1], 1.45 % of total flagged
2017-05-20 16:36:50,671 - rtpipe - INFO - Bad basepol flagging for chans 62-93 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:36:50,887 - rtpipe - INFO - Bad basepol flagging for chans 94-125 at 3.0 sigma: ants/pols [ 9  9 14]/[0 1 1], 1.45 % of total flagged
2017-05-20 16:36:50,959 - rtpipe - INFO - Bad basepol flagging for chans 94-125 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:36:51,180 - rtpipe - INFO - Bad basepol flagging for chans 126-157 at 3.0 sigma: ants/pols [ 9  9 14]/[0 1 1], 1.45 % of total flagged
2017-05-20 16:36:51,251 - rtpipe - INFO - Bad basepol flagging for chans 126-157 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:36:51,474 - rtpipe - INFO - Bad basepol flagging for chans 158-189 at 3.0 sigma: ants/pols [ 9  9 14]/[0 1 1], 1.45 % of total flagged
2017-05-20 16:36:51,547 - rtpipe - INFO - Bad basepol flagging for chans 158-189 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:36:51,758 - rtpipe - INFO - Bad basepol flagging for chans 190-221 at 3.0 sigma: ants/pols [ 9  9 14]/[0 1 1], 1.45 % of total flagged
2017-05-20 16:36:51,838 - rtpipe - INFO - Bad basepol flagging for chans 190-221 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:36:52,057 - rtpipe - INFO - Bad basepol flagging for chans 222-253 at 3.0 sigma: ants/pols [ 9  9 14]/[0 1 1], 1.45 % of total flagged
2017-05-20 16:36:52,130 - rtpipe - INFO - Bad basepol flagging for chans 222-253 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:36:52,132 - rtpipe - INFO - Subtracting mean visibility in time...
2017-05-20 16:36:52,343 - rtpipe - INFO - Returning prepared data...
2017-05-20 16:36:52,546 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 31, 32, 33]
2017-05-20 16:36:52,733 - rtpipe.parsesdm - INFO - Calculating uvw at 2016/09/07/11:59:05.940 for scan 29 of source FRB121102-off

In [14]:
key = '57638'
st, data, u, v, w = read[key]
snrmax = find_dm(st, data, u, v, w)

dmmax[key] = snrmax
dm = snrmax[0]
integ = int(snrmax[1])
st['dmarr'] = [dm]
spectrum[key] = correct_and_plot(st, data, u, v, w, integ)
st['dmarr'] = [560.5]
_ = correct_and_plot(st, data, u, v, w, integ)
#i0 = integ - 1
#i1 = integ + 2
#spectrumwide[key] = getwidespectrum(st, data, u, v, w, i0, i1)
print('Image SNR (orig): {0}'.format(snrdet[key]))


Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
SNR vs DM: [[ 530.           62.            5.8495732 ]
 [ 532.           61.            6.3565378 ]
 [ 534.           61.            6.24683984]
 [ 536.           61.            7.03675865]
 [ 538.           61.            7.21504648]
 [ 540.           61.            7.36360894]
 [ 542.           61.            8.21633361]
 [ 544.           61.            8.81246797]
 [ 546.           61.            9.55475303]
 [ 548.           61.            9.47521849]
 [ 550.           61.           10.44884411]
 [ 552.           61.           11.02831819]
 [ 554.           61.           11.7576235 ]
 [ 556.           61.           11.76328617]
 [ 558.           61.           11.26010143]
 [ 560.           61.           11.2463703 ]
 [ 562.           61.           10.39392164]
 [ 564.           61.           10.40063829]
 [ 566.           61.           10.32035064]
 [ 568.           61.            9.29747414]
 [ 570.           61.            9.11905652]
 [ 572.           61.            8.46640105]
 [ 574.           61.            8.19733653]
 [ 576.           61.            7.69686086]
 [ 578.           61.            6.54277481]
 [ 580.           61.            6.18217456]
 [ 582.           61.            6.18358934]
 [ 584.           60.            7.00552076]
 [ 586.           60.            7.18492963]
 [ 588.           60.            7.33297343]
 [ 590.           60.            7.25337065]
 [ 592.           60.            7.81162661]
 [ 594.           60.            7.35119417]
 [ 596.           60.            6.92712227]
 [ 598.           60.            7.39037895]]
Max SNR of 11.7632861742 at DM=556.0
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Peak location:
-0.000383947649573 0.000541958041958
hms_tuple(h=5.0, m=31.0, s=58.696359489501191) dms_tuple(d=33.0, m=8.0, s=52.786879676700664)
Image SNR 11.8913429226
(RR-LL)/(RR+LL): 0.0926638096571
(RR+LL): 0.110782206059
14 254 16 (240,)
Gridded 1.000 of data. Scaling fft by = 127.3
Pixel sizes (1.1", 0.7"), Field size 1983.3"
Peak location:
-0.000383947649573 0.000541958041958
hms_tuple(h=5.0, m=31.0, s=58.696359489501191) dms_tuple(d=33.0, m=8.0, s=52.786879676700664)
Image SNR 11.4146487553
(RR-LL)/(RR+LL): 0.0575494915247
(RR+LL): 0.106906622648
14 254 16 (240,)
Image SNR (orig): 9.9

Get data for fifth burst


In [15]:
sdmfile = '16A-496_sb32698778_1_02h00m_001.57643.38562630787.cut/'
key = '57643'
scannum = getscannum(sdmfile)
read[key] = read_cut(sdmfile, scannum, 4, npix_max=5500)


2017-05-20 16:39:25,205 - rtpipe.parsesdm - INFO - Setting (standard) key logfile to False
2017-05-20 16:39:25,205 - rtpipe.parsesdm - INFO - Setting (standard) key timesub to mean
2017-05-20 16:39:25,206 - rtpipe.parsesdm - INFO - Setting (standard) key gainfile to 16A-496_sb32698778_1_02h00m_001.57643.38562630787.GN
2017-05-20 16:39:25,206 - rtpipe.parsesdm - INFO - Setting (standard) key dmarr to [558.0]
2017-05-20 16:39:25,207 - rtpipe.parsesdm - INFO - Setting (standard) key dtarr to [1]
2017-05-20 16:39:25,207 - rtpipe.parsesdm - INFO - Setting (standard) key npix_max to 5500
2017-05-20 16:39:25,207 - rtpipe.parsesdm - INFO - Setting (standard) key savecands to False
2017-05-20 16:39:25,208 - rtpipe.parsesdm - INFO - Setting (standard) key flaglist to [('badap', 3.0, 0.2)]
2017-05-20 16:39:25,208 - rtpipe.parsesdm - INFO - Setting (standard) key savenoise to False
2017-05-20 16:39:25,209 - rtpipe.parsesdm - INFO - Setting (standard) key flagantsol to True
2017-05-20 16:39:25,209 - rtpipe.parsesdm - INFO - Setting (standard) key uvoversample to 1.5
2017-05-20 16:39:25,379 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 31, 32, 33]
Scan 29 binary data file: /Users/caseyjlaw/code/FRB121102_private/16A-496_sb32698778_1_02h00m_001.57643.38562630787.cut/ASDMBinary/uid____evla_bdf_1473677657337
2017-05-20 16:39:25,853 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 31, 32, 33]
2017-05-20 16:39:26,027 - rtpipe.parsesdm - INFO - Calculating uvw for first integration of scan 29 of source FRB121102-off
2017-05-20 16:39:26,201 - rtpipe.parsesdm - INFO - 

2017-05-20 16:39:26,202 - rtpipe.parsesdm - INFO - Metadata summary:
2017-05-20 16:39:26,202 - rtpipe.parsesdm - INFO - 	 Working directory and data at /Users/caseyjlaw/code/FRB121102_private, 16A-496_sb32698778_1_02h00m_001.57643.38562630787.cut
2017-05-20 16:39:26,202 - rtpipe.parsesdm - INFO - 	 Using scan 29, source FRB121102-off
2017-05-20 16:39:26,203 - rtpipe.parsesdm - INFO - 	 nants, nbl: 26, 325
2017-05-20 16:39:26,204 - rtpipe.parsesdm - INFO - 	 Freq range (2.489 -- 3.509). 8 spw with 256 chans.
2017-05-20 16:39:26,204 - rtpipe.parsesdm - INFO - 	 Scan has 800 ints (4.0 s) and inttime 0.005 s
2017-05-20 16:39:26,204 - rtpipe.parsesdm - INFO - 	 2 polarizations: ['RR', 'LL']
2017-05-20 16:39:26,205 - rtpipe.parsesdm - INFO - 	 Ideal uvgrid npix=(4608,7776) and res=104 (oversample 1.5)
2017-05-20 16:39:26,227 - rtpipe - INFO - 
2017-05-20 16:39:26,228 - rtpipe - INFO - Pipeline summary:
2017-05-20 16:39:26,229 - rtpipe - INFO - 	 Products saved with 16A-496_sb32698778_1_02h00m_001.57643.38562630787.cut. telcal calibration with 16A-496_sb32698778_1_02h00m_001.57643.38562630787.GN
2017-05-20 16:39:26,229 - rtpipe - INFO - 	 Using 9 segments of 123 ints (0.6 s) with overlap of 0.2 s
2017-05-20 16:39:26,230 - rtpipe - INFO - 	 Downsampling in time/freq by 1/1 and skipping 0 ints from start of scan.
2017-05-20 16:39:26,230 - rtpipe - INFO - 	 Excluding ants []
2017-05-20 16:39:26,230 - rtpipe - INFO - 	 Using pols ['RR', 'LL']
2017-05-20 16:39:26,231 - rtpipe - INFO - 
2017-05-20 16:39:26,231 - rtpipe - INFO - 	 Search with image1 and threshold 7.0.
2017-05-20 16:39:26,231 - rtpipe - INFO - 	 Using 1 DMs from 558.0 to 558.0 and dts [1].
2017-05-20 16:39:26,232 - rtpipe - INFO - 	 Using uvgrid npix=(4608,5500) and res=104.
2017-05-20 16:39:26,232 - rtpipe - INFO - 	 Expect 0 thermal false positives per segment.
2017-05-20 16:39:26,233 - rtpipe - INFO - 
2017-05-20 16:39:26,233 - rtpipe - INFO - 	 Visibility memory usage is 0.6 GB/segment
2017-05-20 16:39:26,234 - rtpipe - INFO - 	 Imaging in 1 chunks using max of 23.2 GB/segment
2017-05-20 16:39:26,234 - rtpipe - INFO - 	 Grand total memory usage: 23.8 GB/segment
2017-05-20 16:39:26,375 - rtpipe.parsesdm - INFO - Reading scan 29, segment 4/8, times 10:58:30.638 to 10:58:31.252
2017-05-20 16:39:26,527 - rtpipe.parsesdm - INFO - Reading 123 ints starting at int 338
2017-05-20 16:39:27,337 - rtpipe.parsesdm - INFO - Found online flags for 314 antenna/time ranges.
2017-05-20 16:39:27,344 - rtpipe.parsesdm - INFO - Applied online flags to 0 ints.
2017-05-20 16:39:27,812 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 31, 32, 33]
2017-05-20 16:39:27,986 - rtpipe.parsesdm - INFO - Calculating uvw at 2016/09/12/10:58:30.945 for scan 29 of source FRB121102-off
2017-05-20 16:39:28,178 - rtpipe.parsecal - INFO - Read telcalfile 16A-496_sb32698778_1_02h00m_001.57643.38562630787.GN
2017-05-20 16:39:28,181 - py.warnings - WARNING - /Users/caseyjlaw/anaconda/lib/python2.7/site-packages/rtpipe/parsecal.py:418: RuntimeWarning: divide by zero encountered in divide
  badsols = n.where( (n.median(self.amp)/self.amp > threshold) & (self.flagged == False))[0]

2017-05-20 16:39:28,185 - rtpipe.parsecal - INFO - Solutions [  94  146  276  510  562  614  692  926  978 1030 1290 1342 1394 1446 1524
 1758 1810 1862 2122 2174 2226 2278 2356 2590 2642 2694 2772] flagged (times [ 57643.38909433  57643.38909433  57643.38909433  57643.39342303
  57643.39342303  57643.39342303  57643.39342303  57643.40987095
  57643.40987095  57643.40987095  57643.42424132  57643.42424132
  57643.42424132  57643.42424132  57643.42424132  57643.43861169
  57643.43861169  57643.43861169  57643.45298206  57643.45298206
  57643.45298206  57643.45298206  57643.45298206  57643.46735243
  57643.46735243  57643.46735243  57643.46735243], ants ['ea19' 'ea19' 'ea19' 'ea19' 'ea19' 'ea19' 'ea19' 'ea19' 'ea19' 'ea19'
 'ea19' 'ea19' 'ea19' 'ea19' 'ea19' 'ea19' 'ea19' 'ea19' 'ea19' 'ea19'
 'ea19' 'ea19' 'ea19' 'ea19' 'ea19' 'ea19' 'ea19'], freqs ['C-1' 'C-2' 'B-1' 'C-1' 'C-2' 'C-3' 'B-1' 'C-1' 'C-2' 'C-3' 'C-0' 'C-1'
 'C-2' 'C-3' 'B-1' 'C-1' 'C-2' 'C-3' 'C-0' 'C-1' 'C-2' 'C-3' 'B-1' 'C-1'
 'C-2' 'C-3' 'B-1']) for low gain amplitude.
2017-05-20 16:39:28,209 - rtpipe.parsecal - INFO - Frequency selection cut down to 2912 solutions
2017-05-20 16:39:28,212 - rtpipe.parsecal - INFO - Selection down to 416 solutions separated from given time by 6 minutes
2017-05-20 16:39:28,215 - rtpipe.parsecal - INFO - MJD: [ 57643.45298206]
2017-05-20 16:39:28,217 - rtpipe.parsecal - INFO - Source: ['J0555+3948']
2017-05-20 16:39:28,219 - rtpipe.parsecal - INFO - Solutions for 8 spw: ([ 2553.  2681.  2809.  2937.  3065.  3193.  3321.  3449.])
2017-05-20 16:39:28,221 - rtpipe.parsecal - INFO - Applying gain solution for chans from 0-31
2017-05-20 16:39:28,325 - rtpipe.parsecal - INFO - Applying gain solution for chans from 32-63
2017-05-20 16:39:28,421 - rtpipe.parsecal - INFO - Applying gain solution for chans from 64-95
2017-05-20 16:39:28,519 - rtpipe.parsecal - INFO - Applying gain solution for chans from 96-127
2017-05-20 16:39:28,615 - rtpipe.parsecal - INFO - Applying gain solution for chans from 128-159
2017-05-20 16:39:28,709 - rtpipe.parsecal - INFO - Applying gain solution for chans from 160-191
2017-05-20 16:39:28,804 - rtpipe.parsecal - INFO - Applying gain solution for chans from 192-223
2017-05-20 16:39:28,901 - rtpipe.parsecal - INFO - Applying gain solution for chans from 224-255
2017-05-20 16:39:29,001 - rtpipe - INFO - Flagging with flaglist: [('badap', 3.0, 0.2)]
2017-05-20 16:39:29,132 - rtpipe - INFO - Bad basepol flagging for chans 0-31 at 3.0 sigma: ants/pols [17]/[0], 0.48 % of total flagged
2017-05-20 16:39:29,205 - rtpipe - INFO - Bad basepol flagging for chans 0-31 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:39:29,280 - rtpipe - INFO - Bad basepol flagging for chans 32-63 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:39:29,356 - rtpipe - INFO - Bad basepol flagging for chans 32-63 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:39:29,431 - rtpipe - INFO - Bad basepol flagging for chans 64-95 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:39:29,509 - rtpipe - INFO - Bad basepol flagging for chans 64-95 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:39:29,635 - rtpipe - INFO - Bad basepol flagging for chans 96-127 at 3.0 sigma: ants/pols [17]/[0], 0.48 % of total flagged
2017-05-20 16:39:29,710 - rtpipe - INFO - Bad basepol flagging for chans 96-127 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:39:29,840 - rtpipe - INFO - Bad basepol flagging for chans 128-159 at 3.0 sigma: ants/pols [19]/[0], 0.48 % of total flagged
2017-05-20 16:39:29,915 - rtpipe - INFO - Bad basepol flagging for chans 128-159 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:39:29,991 - rtpipe - INFO - Bad basepol flagging for chans 160-191 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:39:30,064 - rtpipe - INFO - Bad basepol flagging for chans 160-191 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:39:30,185 - rtpipe - INFO - Bad basepol flagging for chans 192-223 at 3.0 sigma: ants/pols [19]/[0], 0.48 % of total flagged
2017-05-20 16:39:30,260 - rtpipe - INFO - Bad basepol flagging for chans 192-223 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:39:30,380 - rtpipe - INFO - Bad basepol flagging for chans 224-255 at 3.0 sigma: ants/pols [19]/[0], 0.48 % of total flagged
2017-05-20 16:39:30,455 - rtpipe - INFO - Bad basepol flagging for chans 224-255 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:39:30,457 - rtpipe - INFO - Subtracting mean visibility in time...
2017-05-20 16:39:30,746 - rtpipe - INFO - Returning prepared data...
2017-05-20 16:39:30,936 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 31, 32, 33]
2017-05-20 16:39:31,111 - rtpipe.parsesdm - INFO - Calculating uvw at 2016/09/12/10:58:30.945 for scan 29 of source FRB121102-off

In [16]:
key = '57643'
st, data, u, v, w = read[key]
snrmax = find_dm(st, data, u, v, w)

dmmax[key] = snrmax
dm = snrmax[0]
integ = int(snrmax[1])
st['dmarr'] = [dm]
spectrum[key] = correct_and_plot(st, data, u, v, w, integ)
st['dmarr'] = [560.5]
_ = correct_and_plot(st, data, u, v, w, integ)
#i0 = integ - 1
#i1 = integ + 2
#spectrumwide[key] = getwidespectrum(st, data, u, v, w, i0, i1)
print('Image SNR (orig): {0}'.format(snrdet[key]))


Gridded 1.000 of data. Scaling fft by = 180.2
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 179.9
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 180.0
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 179.6
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 180.1
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 180.0
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 179.8
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 180.0
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 179.8
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 179.8
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 178.9
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 178.8
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 179.2
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 179.2
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 179.1
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 179.2
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 179.1
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 179.2
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 179.3
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 179.4
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 179.4
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 179.4
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 178.7
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 178.7
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 178.6
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 178.9
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 178.6
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 178.7
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 178.8
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 178.5
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 178.9
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 178.9
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 178.6
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 178.9
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 178.7
Pixel sizes (0.9", 0.7"), Field size 1983.3"
SNR vs DM: [[ 530.           63.           70.65938973]
 [ 532.           63.           74.06898777]
 [ 534.           63.           78.04538775]
 [ 536.           63.           81.95042403]
 [ 538.           63.           80.422441  ]
 [ 540.           63.           78.80954292]
 [ 542.           63.           75.54052336]
 [ 544.           63.           72.3522705 ]
 [ 546.           63.           64.64831409]
 [ 548.           63.           60.07135739]
 [ 550.           62.           69.05417692]
 [ 552.           62.           76.73266959]
 [ 554.           62.           87.14314066]
 [ 556.           62.           92.12110436]
 [ 558.           62.           98.65283406]
 [ 560.           62.          100.02396716]
 [ 562.           62.           97.68393566]
 [ 564.           62.           93.80415157]
 [ 566.           62.           85.53145001]
 [ 568.           62.           76.93046761]
 [ 570.           62.           70.04992152]
 [ 572.           62.           60.48077398]
 [ 574.           61.           66.89971044]
 [ 576.           61.           70.89218298]
 [ 578.           61.           75.92046015]
 [ 580.           61.           78.189298  ]
 [ 582.           61.           79.62081774]
 [ 584.           61.           78.35374243]
 [ 586.           61.           75.02387304]
 [ 588.           61.           74.06917318]
 [ 590.           61.           69.49239172]
 [ 592.           61.           65.90146807]
 [ 594.           61.           61.38598219]
 [ 596.           61.           56.13799769]
 [ 598.           60.           54.4721026 ]]
Max SNR of 100.023967157 at DM=560.0
Gridded 1.000 of data. Scaling fft by = 179.2
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Peak location:
-0.000383947649573 0.000541958041958
hms_tuple(h=5.0, m=31.0, s=58.696359489501191) dms_tuple(d=33.0, m=8.0, s=52.786879676700664)
Image SNR 87.7647681331
(RR-LL)/(RR+LL): -0.0114331906661
(RR+LL): 1.01677632332
0 256 16 (256,)
Gridded 1.000 of data. Scaling fft by = 179.2
Pixel sizes (0.9", 0.7"), Field size 1983.3"
Peak location:
-0.000383947649573 0.000541958041958
hms_tuple(h=5.0, m=31.0, s=58.696359489501191) dms_tuple(d=33.0, m=8.0, s=52.786879676700664)
Image SNR 87.6936732443
(RR-LL)/(RR+LL): -0.010981829837
(RR+LL): 1.01488769054
0 256 16 (256,)
Image SNR (orig): 69.9

Get data for sixth burst


In [17]:
sdmfile = '16A-496_sb32698778_1_02h00m.57645.38915079861.cut'
key = '57645'
scannum = getscannum(sdmfile)
read[key] = read_cut(sdmfile, scannum, 6, npix_max=6500, chans=range(4,256))


2017-05-20 16:42:34,565 - rtpipe.parsesdm - INFO - Setting (standard) key logfile to False
2017-05-20 16:42:34,565 - rtpipe.parsesdm - INFO - Setting (standard) key timesub to mean
2017-05-20 16:42:34,566 - rtpipe.parsesdm - INFO - Setting (standard) key gainfile to 16A-496_sb32698778_1_02h00m.57645.38915079861.GN
2017-05-20 16:42:34,566 - rtpipe.parsesdm - INFO - Setting (standard) key dmarr to [558.0]
2017-05-20 16:42:34,567 - rtpipe.parsesdm - INFO - Setting (standard) key dtarr to [1]
2017-05-20 16:42:34,567 - rtpipe.parsesdm - INFO - Setting (standard) key chans to [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255]
2017-05-20 16:42:34,568 - rtpipe.parsesdm - INFO - Setting (standard) key savecands to False
2017-05-20 16:42:34,568 - rtpipe.parsesdm - INFO - Setting (standard) key flaglist to [('badap', 3.0, 0.2)]
2017-05-20 16:42:34,569 - rtpipe.parsesdm - INFO - Setting (standard) key savenoise to False
2017-05-20 16:42:34,569 - rtpipe.parsesdm - INFO - Setting (standard) key flagantsol to True
2017-05-20 16:42:34,570 - rtpipe.parsesdm - INFO - Setting (standard) key npix_max to 6500
2017-05-20 16:42:34,570 - rtpipe.parsesdm - INFO - Setting (standard) key uvoversample to 1.5
Scan 16 binary data file: /Users/caseyjlaw/code/FRB121102_private/16A-496_sb32698778_1_02h00m.57645.38915079861.cut/ASDMBinary/uid____evla_bdf_1473848163356
2017-05-20 16:42:34,783 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33]
2017-05-20 16:42:35,386 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33]
2017-05-20 16:42:35,590 - rtpipe.parsesdm - INFO - Calculating uvw for first integration of scan 16 of source FRB121102-off
2017-05-20 16:42:35,809 - rtpipe.parsesdm - INFO - 

2017-05-20 16:42:35,810 - rtpipe.parsesdm - INFO - Metadata summary:
2017-05-20 16:42:35,810 - rtpipe.parsesdm - INFO - 	 Working directory and data at /Users/caseyjlaw/code/FRB121102_private, 16A-496_sb32698778_1_02h00m.57645.38915079861.cut
2017-05-20 16:42:35,811 - rtpipe.parsesdm - INFO - 	 Using scan 16, source FRB121102-off
2017-05-20 16:42:35,811 - rtpipe.parsesdm - INFO - 	 nants, nbl: 27, 351
2017-05-20 16:42:35,812 - rtpipe.parsesdm - INFO - 	 Freq range (2.505 -- 3.509). 8 spw with 252 chans.
2017-05-20 16:42:35,812 - rtpipe.parsesdm - INFO - 	 Scan has 800 ints (4.0 s) and inttime 0.005 s
2017-05-20 16:42:35,813 - rtpipe.parsesdm - INFO - 	 2 polarizations: ['RR', 'LL']
2017-05-20 16:42:35,813 - rtpipe.parsesdm - INFO - 	 Ideal uvgrid npix=(7776,7776) and res=104 (oversample 1.5)
2017-05-20 16:42:35,842 - rtpipe - INFO - 
2017-05-20 16:42:35,842 - rtpipe - INFO - Pipeline summary:
2017-05-20 16:42:35,843 - rtpipe - INFO - 	 Products saved with 16A-496_sb32698778_1_02h00m.57645.38915079861.cut. telcal calibration with 16A-496_sb32698778_1_02h00m.57645.38915079861.GN
2017-05-20 16:42:35,843 - rtpipe - INFO - 	 Using 12 segments of 101 ints (0.5 s) with overlap of 0.2 s
2017-05-20 16:42:35,844 - rtpipe - INFO - 		 Lots of segments needed, since Max DM sweep (0.2 s) close to segment size (0.50 s)
2017-05-20 16:42:35,844 - rtpipe - INFO - 	 Downsampling in time/freq by 1/1 and skipping 0 ints from start of scan.
2017-05-20 16:42:35,845 - rtpipe - INFO - 	 Excluding ants []
2017-05-20 16:42:35,845 - rtpipe - INFO - 	 Using pols ['RR', 'LL']
2017-05-20 16:42:35,846 - rtpipe - INFO - 
2017-05-20 16:42:35,846 - rtpipe - INFO - 	 Search with image1 and threshold 7.0.
2017-05-20 16:42:35,846 - rtpipe - INFO - 	 Using 1 DMs from 558.0 to 558.0 and dts [1].
2017-05-20 16:42:35,847 - rtpipe - INFO - 	 Using uvgrid npix=(6500,6500) and res=104.
2017-05-20 16:42:35,847 - rtpipe - INFO - 	 Expect 0 thermal false positives per segment.
2017-05-20 16:42:35,848 - rtpipe - INFO - 
2017-05-20 16:42:35,848 - rtpipe - INFO - 	 Visibility memory usage is 0.5 GB/segment
2017-05-20 16:42:35,848 - rtpipe - INFO - 	 Imaging in 1 chunks using max of 31.8 GB/segment
2017-05-20 16:42:35,849 - rtpipe - INFO - 	 Grand total memory usage: 32.3 GB/segment
2017-05-20 16:42:35,952 - rtpipe.parsesdm - INFO - Reading scan 16, segment 6/11, times 10:18:36.137 to 10:18:36.640
2017-05-20 16:42:36,146 - rtpipe.parsesdm - INFO - Reading 101 ints starting at int 381
2017-05-20 16:42:36,913 - rtpipe.parsesdm - INFO - Found online flags for 357 antenna/time ranges.
2017-05-20 16:42:36,921 - rtpipe.parsesdm - INFO - Applied online flags to 0 ints.
2017-05-20 16:42:37,441 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33]
2017-05-20 16:42:37,670 - rtpipe.parsesdm - INFO - Calculating uvw at 2016/09/14/10:18:36.389 for scan 16 of source FRB121102-off
2017-05-20 16:42:37,894 - rtpipe.parsecal - INFO - Read telcalfile 16A-496_sb32698778_1_02h00m.57645.38915079861.GN
2017-05-20 16:42:37,921 - rtpipe.parsecal - INFO - Frequency selection cut down to 3024 solutions
2017-05-20 16:42:37,924 - rtpipe.parsecal - INFO - Selection down to 432 solutions separated from given time by 2 minutes
2017-05-20 16:42:37,928 - rtpipe.parsecal - INFO - MJD: [ 57645.42776562]
2017-05-20 16:42:37,931 - rtpipe.parsecal - INFO - Source: ['J0555+3948']
2017-05-20 16:42:37,933 - rtpipe.parsecal - INFO - Solutions for 8 spw: ([ 2553.  2681.  2809.  2937.  3065.  3193.  3321.  3449.])
2017-05-20 16:42:37,934 - rtpipe.parsecal - INFO - Applying gain solution for chans from 0-30
2017-05-20 16:42:38,026 - rtpipe.parsecal - INFO - Applying gain solution for chans from 31-62
2017-05-20 16:42:38,112 - rtpipe.parsecal - INFO - Applying gain solution for chans from 63-93
2017-05-20 16:42:38,197 - rtpipe.parsecal - INFO - Applying gain solution for chans from 94-125
2017-05-20 16:42:38,278 - rtpipe.parsecal - INFO - Applying gain solution for chans from 126-156
2017-05-20 16:42:38,364 - rtpipe.parsecal - INFO - Applying gain solution for chans from 157-188
2017-05-20 16:42:38,449 - rtpipe.parsecal - INFO - Applying gain solution for chans from 189-219
2017-05-20 16:42:38,547 - rtpipe.parsecal - INFO - Applying gain solution for chans from 220-251
2017-05-20 16:42:38,639 - rtpipe - INFO - Flagging with flaglist: [('badap', 3.0, 0.2)]
2017-05-20 16:42:38,781 - rtpipe - INFO - Bad basepol flagging for chans 0-27 at 3.0 sigma: ants/pols [ 8 17]/[1 0], 0.82 % of total flagged
2017-05-20 16:42:38,831 - rtpipe - INFO - Bad basepol flagging for chans 0-27 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:42:38,938 - rtpipe - INFO - Bad basepol flagging for chans 28-59 at 3.0 sigma: ants/pols [14]/[1], 0.47 % of total flagged
2017-05-20 16:42:38,997 - rtpipe - INFO - Bad basepol flagging for chans 28-59 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:42:39,106 - rtpipe - INFO - Bad basepol flagging for chans 60-91 at 3.0 sigma: ants/pols [14]/[1], 0.47 % of total flagged
2017-05-20 16:42:39,174 - rtpipe - INFO - Bad basepol flagging for chans 60-91 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:42:39,332 - rtpipe - INFO - Bad basepol flagging for chans 92-123 at 3.0 sigma: ants/pols [ 8 17]/[1 0], 0.94 % of total flagged
2017-05-20 16:42:39,396 - rtpipe - INFO - Bad basepol flagging for chans 92-123 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:42:39,504 - rtpipe - INFO - Bad basepol flagging for chans 124-155 at 3.0 sigma: ants/pols [14]/[1], 0.47 % of total flagged
2017-05-20 16:42:39,572 - rtpipe - INFO - Bad basepol flagging for chans 124-155 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:42:39,684 - rtpipe - INFO - Bad basepol flagging for chans 156-187 at 3.0 sigma: ants/pols [14]/[1], 0.47 % of total flagged
2017-05-20 16:42:39,747 - rtpipe - INFO - Bad basepol flagging for chans 156-187 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:42:39,855 - rtpipe - INFO - Bad basepol flagging for chans 188-219 at 3.0 sigma: ants/pols [14]/[1], 0.47 % of total flagged
2017-05-20 16:42:39,914 - rtpipe - INFO - Bad basepol flagging for chans 188-219 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:42:40,020 - rtpipe - INFO - Bad basepol flagging for chans 220-251 at 3.0 sigma: ants/pols [14]/[1], 0.47 % of total flagged
2017-05-20 16:42:40,083 - rtpipe - INFO - Bad basepol flagging for chans 220-251 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:42:40,085 - rtpipe - INFO - Subtracting mean visibility in time...
2017-05-20 16:42:40,253 - rtpipe - INFO - Returning prepared data...
2017-05-20 16:42:40,473 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33]
2017-05-20 16:42:40,673 - rtpipe.parsesdm - INFO - Calculating uvw at 2016/09/14/10:18:36.389 for scan 16 of source FRB121102-off

In [18]:
key = '57645'
st, data, u, v, w = read[key]
snrmax = find_dm(st, data, u, v, w)

dmmax[key] = snrmax
dm = snrmax[0]
integ = int(snrmax[1])
st['dmarr'] = [dm]
spectrum[key] = correct_and_plot(st, data, u, v, w, integ)
st['dmarr'] = [560.5]
_ = correct_and_plot(st, data, u, v, w, integ)
#i0 = integ - 1
#i1 = integ + 2
#spectrumwide[key] = getwidespectrum(st, data, u, v, w, i0, i1)
print('Image SNR (orig): {0}'.format(snrdet[key]))


Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
SNR vs DM: [[ 530.           19.            8.65498778]
 [ 532.           19.            9.19326901]
 [ 534.           19.            9.5396931 ]
 [ 536.           19.           10.46164557]
 [ 538.           19.           11.33691742]
 [ 540.           19.           12.2552472 ]
 [ 542.           19.           12.96063782]
 [ 544.           19.           13.51797766]
 [ 546.           19.           14.06402509]
 [ 548.           19.           13.56527231]
 [ 550.           19.           11.48270974]
 [ 552.           19.           10.51629701]
 [ 554.           19.            8.58783888]
 [ 556.           19.            8.48156757]
 [ 558.           18.            7.79006949]
 [ 560.           18.            8.61156937]
 [ 562.           18.           10.18369618]
 [ 564.           18.           11.12896887]
 [ 566.           18.           11.56806358]
 [ 568.           18.           12.22187305]
 [ 570.           18.           12.16772733]
 [ 572.           18.           12.90211419]
 [ 574.           18.           12.35813192]
 [ 576.           18.           11.57679342]
 [ 578.           18.           10.4750619 ]
 [ 580.           18.           10.18375104]
 [ 582.           18.            8.26454747]
 [ 584.           18.            8.51223117]
 [ 586.           17.            7.77617881]
 [ 588.           17.            8.65474466]
 [ 590.           17.            8.92208559]
 [ 592.           17.            9.45255702]
 [ 594.           17.            9.22560404]
 [ 596.           17.            8.60516106]
 [ 598.           17.            7.97797176]]
Max SNR of 14.064025094 at DM=546.0
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Peak location:
-0.000384615384615 0.000541420118343
hms_tuple(h=5.0, m=31.0, s=58.685396636901075) dms_tuple(d=33.0, m=8.0, s=52.675924966500247)
Image SNR 14.1664032286
(RR-LL)/(RR+LL): 0.0554475411773
(RR+LL): 0.128113433719
12 252 16 (240,)
Gridded 1.000 of data. Scaling fft by = 250.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Peak location:
-0.000384615384615 0.000541420118343
hms_tuple(h=5.0, m=31.0, s=58.685396636901075) dms_tuple(d=33.0, m=8.0, s=52.675924966500247)
Image SNR 7.032020536
(RR-LL)/(RR+LL): -0.015258859843
(RR+LL): 0.0628441721201
12 252 16 (240,)
Image SNR (orig): 11.1

Get data for seventh burst


In [19]:
sdmfile = '16A-496_sb32698778_1_02h00m_000.57646.38643644676.cut'
key = '57646'
scannum = getscannum(sdmfile)
read[key] = read_cut(sdmfile, scannum, 6, npix_max=7000, chans=range(3,256))


2017-05-20 16:47:32,084 - rtpipe.parsesdm - INFO - Setting (standard) key logfile to False
2017-05-20 16:47:32,084 - rtpipe.parsesdm - INFO - Setting (standard) key timesub to mean
2017-05-20 16:47:32,085 - rtpipe.parsesdm - INFO - Setting (standard) key gainfile to 16A-496_sb32698778_1_02h00m_000.57646.38643644676.GN
2017-05-20 16:47:32,085 - rtpipe.parsesdm - INFO - Setting (standard) key dmarr to [558.0]
2017-05-20 16:47:32,085 - rtpipe.parsesdm - INFO - Setting (standard) key dtarr to [1]
2017-05-20 16:47:32,086 - rtpipe.parsesdm - INFO - Setting (standard) key chans to [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255]
2017-05-20 16:47:32,086 - rtpipe.parsesdm - INFO - Setting (standard) key savecands to False
2017-05-20 16:47:32,087 - rtpipe.parsesdm - INFO - Setting (standard) key flaglist to [('badap', 3.0, 0.2)]
2017-05-20 16:47:32,087 - rtpipe.parsesdm - INFO - Setting (standard) key savenoise to False
2017-05-20 16:47:32,088 - rtpipe.parsesdm - INFO - Setting (standard) key flagantsol to True
2017-05-20 16:47:32,088 - rtpipe.parsesdm - INFO - Setting (standard) key npix_max to 7000
2017-05-20 16:47:32,089 - rtpipe.parsesdm - INFO - Setting (standard) key uvoversample to 1.5
2017-05-20 16:47:32,255 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33]
Scan 32 binary data file: /Users/caseyjlaw/code/FRB121102_private/16A-496_sb32698778_1_02h00m_000.57646.38643644676.cut/ASDMBinary/uid____evla_bdf_1473937600955
2017-05-20 16:47:32,729 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33]
2017-05-20 16:47:32,902 - rtpipe.parsesdm - INFO - Calculating uvw for first integration of scan 32 of source FRB121102-off
2017-05-20 16:47:33,089 - rtpipe.parsesdm - INFO - 

2017-05-20 16:47:33,090 - rtpipe.parsesdm - INFO - Metadata summary:
2017-05-20 16:47:33,091 - rtpipe.parsesdm - INFO - 	 Working directory and data at /Users/caseyjlaw/code/FRB121102_private, 16A-496_sb32698778_1_02h00m_000.57646.38643644676.cut
2017-05-20 16:47:33,091 - rtpipe.parsesdm - INFO - 	 Using scan 32, source FRB121102-off
2017-05-20 16:47:33,092 - rtpipe.parsesdm - INFO - 	 nants, nbl: 27, 351
2017-05-20 16:47:33,092 - rtpipe.parsesdm - INFO - 	 Freq range (2.501 -- 3.509). 8 spw with 253 chans.
2017-05-20 16:47:33,093 - rtpipe.parsesdm - INFO - 	 Scan has 800 ints (4.0 s) and inttime 0.005 s
2017-05-20 16:47:33,094 - rtpipe.parsesdm - INFO - 	 2 polarizations: ['RR', 'LL']
2017-05-20 16:47:33,094 - rtpipe.parsesdm - INFO - 	 Ideal uvgrid npix=(7776,8192) and res=104 (oversample 1.5)
2017-05-20 16:47:33,120 - rtpipe - INFO - 
2017-05-20 16:47:33,120 - rtpipe - INFO - Pipeline summary:
2017-05-20 16:47:33,121 - rtpipe - INFO - 	 Products saved with 16A-496_sb32698778_1_02h00m_000.57646.38643644676.cut. telcal calibration with 16A-496_sb32698778_1_02h00m_000.57646.38643644676.GN
2017-05-20 16:47:33,121 - rtpipe - INFO - 	 Using 13 segments of 96 ints (0.5 s) with overlap of 0.2 s
2017-05-20 16:47:33,122 - rtpipe - INFO - 		 Lots of segments needed, since Max DM sweep (0.2 s) close to segment size (0.48 s)
2017-05-20 16:47:33,122 - rtpipe - INFO - 	 Downsampling in time/freq by 1/1 and skipping 0 ints from start of scan.
2017-05-20 16:47:33,123 - rtpipe - INFO - 	 Excluding ants []
2017-05-20 16:47:33,123 - rtpipe - INFO - 	 Using pols ['RR', 'LL']
2017-05-20 16:47:33,124 - rtpipe - INFO - 
2017-05-20 16:47:33,124 - rtpipe - INFO - 	 Search with image1 and threshold 7.0.
2017-05-20 16:47:33,125 - rtpipe - INFO - 	 Using 1 DMs from 558.0 to 558.0 and dts [1].
2017-05-20 16:47:33,125 - rtpipe - INFO - 	 Using uvgrid npix=(7000,7000) and res=104.
2017-05-20 16:47:33,125 - rtpipe - INFO - 	 Expect 0 thermal false positives per segment.
2017-05-20 16:47:33,126 - rtpipe - INFO - 
2017-05-20 16:47:33,126 - rtpipe - INFO - 	 Visibility memory usage is 0.5 GB/segment
2017-05-20 16:47:33,127 - rtpipe - INFO - 	 Imaging in 1 chunks using max of 35.0 GB/segment
2017-05-20 16:47:33,127 - rtpipe - INFO - 	 Grand total memory usage: 35.6 GB/segment
2017-05-20 16:47:33,175 - rtpipe.parsesdm - INFO - Reading scan 32, segment 6/12, times 11:11:02.721 to 11:11:03.199
2017-05-20 16:47:33,334 - rtpipe.parsesdm - INFO - Reading 96 ints starting at int 352
2017-05-20 16:47:34,019 - rtpipe.parsesdm - INFO - Found online flags for 359 antenna/time ranges.
2017-05-20 16:47:34,028 - rtpipe.parsesdm - INFO - Applied online flags to 0 ints.
2017-05-20 16:47:34,445 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33]
2017-05-20 16:47:34,612 - rtpipe.parsesdm - INFO - Calculating uvw at 2016/09/15/11:11:02.960 for scan 32 of source FRB121102-off
2017-05-20 16:47:34,801 - rtpipe.parsecal - INFO - Read telcalfile 16A-496_sb32698778_1_02h00m_000.57646.38643644676.GN
2017-05-20 16:47:34,822 - rtpipe.parsecal - INFO - Frequency selection cut down to 2592 solutions
2017-05-20 16:47:34,826 - rtpipe.parsecal - INFO - Selection down to 432 solutions separated from given time by 3 minutes
2017-05-20 16:47:34,829 - rtpipe.parsecal - INFO - MJD: [ 57646.46816609]
2017-05-20 16:47:34,832 - rtpipe.parsecal - INFO - Source: ['J0555+3948']
2017-05-20 16:47:34,833 - rtpipe.parsecal - INFO - Solutions for 8 spw: ([ 2553.  2681.  2809.  2937.  3065.  3193.  3321.  3449.])
2017-05-20 16:47:34,835 - rtpipe.parsecal - INFO - Applying gain solution for chans from 0-30
2017-05-20 16:47:34,927 - rtpipe.parsecal - INFO - Applying gain solution for chans from 31-62
2017-05-20 16:47:35,014 - rtpipe.parsecal - INFO - Applying gain solution for chans from 63-93
2017-05-20 16:47:35,099 - rtpipe.parsecal - INFO - Applying gain solution for chans from 94-125
2017-05-20 16:47:35,184 - rtpipe.parsecal - INFO - Applying gain solution for chans from 126-157
2017-05-20 16:47:35,269 - rtpipe.parsecal - INFO - Applying gain solution for chans from 158-188
2017-05-20 16:47:35,353 - rtpipe.parsecal - INFO - Applying gain solution for chans from 189-220
2017-05-20 16:47:35,437 - rtpipe.parsecal - INFO - Applying gain solution for chans from 221-252
2017-05-20 16:47:35,524 - rtpipe - INFO - Flagging with flaglist: [('badap', 3.0, 0.2)]
2017-05-20 16:47:35,665 - rtpipe - INFO - Bad basepol flagging for chans 0-28 at 3.0 sigma: ants/pols [ 8 17]/[1 0], 0.85 % of total flagged
2017-05-20 16:47:35,721 - rtpipe - INFO - Bad basepol flagging for chans 0-28 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:47:35,830 - rtpipe - INFO - Bad basepol flagging for chans 29-60 at 3.0 sigma: ants/pols [14]/[1], 0.47 % of total flagged
2017-05-20 16:47:35,895 - rtpipe - INFO - Bad basepol flagging for chans 29-60 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:47:35,960 - rtpipe - INFO - Bad basepol flagging for chans 61-92 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:47:36,026 - rtpipe - INFO - Bad basepol flagging for chans 61-92 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:47:36,177 - rtpipe - INFO - Bad basepol flagging for chans 93-124 at 3.0 sigma: ants/pols [ 8 17]/[1 0], 0.94 % of total flagged
2017-05-20 16:47:36,249 - rtpipe - INFO - Bad basepol flagging for chans 93-124 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:47:36,353 - rtpipe - INFO - Bad basepol flagging for chans 125-156 at 3.0 sigma: ants/pols [14]/[1], 0.47 % of total flagged
2017-05-20 16:47:36,419 - rtpipe - INFO - Bad basepol flagging for chans 125-156 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:47:36,484 - rtpipe - INFO - Bad basepol flagging for chans 157-188 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:47:36,548 - rtpipe - INFO - Bad basepol flagging for chans 157-188 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:47:36,651 - rtpipe - INFO - Bad basepol flagging for chans 189-220 at 3.0 sigma: ants/pols [21]/[0], 0.47 % of total flagged
2017-05-20 16:47:36,716 - rtpipe - INFO - Bad basepol flagging for chans 189-220 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:47:36,820 - rtpipe - INFO - Bad basepol flagging for chans 221-252 at 3.0 sigma: ants/pols [14]/[1], 0.47 % of total flagged
2017-05-20 16:47:36,886 - rtpipe - INFO - Bad basepol flagging for chans 221-252 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:47:36,888 - rtpipe - INFO - Subtracting mean visibility in time...
2017-05-20 16:47:37,080 - rtpipe - INFO - Returning prepared data...
2017-05-20 16:47:37,255 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33]
2017-05-20 16:47:37,432 - rtpipe.parsesdm - INFO - Calculating uvw at 2016/09/15/11:11:02.960 for scan 32 of source FRB121102-off

In [20]:
key = '57646'
st, data, u, v, w = read[key]
snrmax = find_dm(st, data, u, v, w)

dmmax[key] = snrmax
dm = snrmax[0]
integ = int(snrmax[1])
st['dmarr'] = [dm]
spectrum[key] = correct_and_plot(st, data, u, v, w, integ)
st['dmarr'] = [560.5]
_ = correct_and_plot(st, data, u, v, w, integ)
#i0 = integ - 1
#i1 = integ + 2
#spectrumwide[key] = getwidespectrum(st, data, u, v, w, i0, i1)
print('Image SNR (orig): {0}'.format(snrdet[key]))


Gridded 1.000 of data. Scaling fft by = 304.7
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 304.4
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 304.7
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 304.6
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 304.6
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 304.7
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 304.8
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 304.8
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 302.7
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 303.1
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 302.9
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 303.2
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 302.8
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 303.1
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 302.8
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 303.0
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 303.0
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 302.9
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 302.6
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 302.9
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 302.7
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 302.8
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 302.5
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 302.7
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 302.4
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 302.7
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 302.5
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 304.3
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 304.1
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 304.2
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 303.9
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 304.0
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 303.9
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 304.0
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 304.0
Pixel sizes (0.6", 0.6"), Field size 1983.3"
SNR vs DM: [[ 530.           49.           13.70156212]
 [ 532.           49.           15.17390207]
 [ 534.           49.           15.41066331]
 [ 536.           49.           17.40198762]
 [ 538.           49.           16.56303787]
 [ 540.           49.           15.83611229]
 [ 542.           49.           13.40952493]
 [ 544.           49.           12.33734559]
 [ 546.           48.           13.68610728]
 [ 548.           48.           15.99903859]
 [ 550.           48.           17.1710383 ]
 [ 552.           48.           18.49150769]
 [ 554.           48.           19.42390116]
 [ 556.           48.           18.85520439]
 [ 558.           48.           16.56277239]
 [ 560.           48.           15.28466389]
 [ 562.           48.           13.75657593]
 [ 564.           47.           11.66092509]
 [ 566.           47.           15.12510707]
 [ 568.           47.           17.05018762]
 [ 570.           47.           18.60992842]
 [ 572.           47.           19.28975398]
 [ 574.           47.           19.22956451]
 [ 576.           47.           18.77511787]
 [ 578.           47.           16.44561575]
 [ 580.           47.           15.01038229]
 [ 582.           47.           12.51526506]
 [ 584.           46.           13.12911164]
 [ 586.           46.           15.65240648]
 [ 588.           46.           15.81900811]
 [ 590.           46.           15.88480325]
 [ 592.           46.           16.64214462]
 [ 594.           46.           15.91520565]
 [ 596.           46.           15.23690613]
 [ 598.           46.           13.94523501]]
Max SNR of 19.4239011622 at DM=554.0
Gridded 1.000 of data. Scaling fft by = 302.8
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Peak location:
-0.000383241758242 0.000541208791209
hms_tuple(h=5.0, m=31.0, s=58.707948790901341) dms_tuple(d=33.0, m=8.0, s=52.632335616105479)
Image SNR 19.4421166843
(RR-LL)/(RR+LL): 0.0100877983496
(RR+LL): 0.173438191414
13 253 16 (240,)
Gridded 1.000 of data. Scaling fft by = 303.0
Pixel sizes (0.6", 0.6"), Field size 1983.3"
Peak location:
-0.000383241758242 0.000541208791209
hms_tuple(h=5.0, m=31.0, s=58.707948790901341) dms_tuple(d=33.0, m=8.0, s=52.632335616105479)
Image SNR 15.2086768207
(RR-LL)/(RR+LL): 0.0082363942638
(RR+LL): 0.132542520761
13 253 16 (240,)
Image SNR (orig): 16.0

Get data for eighth burst


In [21]:
sdmfile = '16A-496_sb32698778_1_02h00m_000.57648.37452900463.cut/'
key = '57648'
scannum = getscannum(sdmfile)
read[key] = read_cut(sdmfile, scannum, 7, npix_max=7400, chans=range(2,256))


2017-05-20 16:52:39,469 - rtpipe.parsesdm - INFO - Setting (standard) key logfile to False
2017-05-20 16:52:39,470 - rtpipe.parsesdm - INFO - Setting (standard) key timesub to mean
2017-05-20 16:52:39,470 - rtpipe.parsesdm - INFO - Setting (standard) key gainfile to 16A-496_sb32698778_1_02h00m_000.57648.37452900463.GN
2017-05-20 16:52:39,471 - rtpipe.parsesdm - INFO - Setting (standard) key dmarr to [558.0]
2017-05-20 16:52:39,471 - rtpipe.parsesdm - INFO - Setting (standard) key dtarr to [1]
2017-05-20 16:52:39,472 - rtpipe.parsesdm - INFO - Setting (standard) key chans to [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255]
2017-05-20 16:52:39,472 - rtpipe.parsesdm - INFO - Setting (standard) key savecands to False
2017-05-20 16:52:39,473 - rtpipe.parsesdm - INFO - Setting (standard) key flaglist to [('badap', 3.0, 0.2)]
2017-05-20 16:52:39,473 - rtpipe.parsesdm - INFO - Setting (standard) key savenoise to False
2017-05-20 16:52:39,473 - rtpipe.parsesdm - INFO - Setting (standard) key flagantsol to True
2017-05-20 16:52:39,474 - rtpipe.parsesdm - INFO - Setting (standard) key npix_max to 7400
2017-05-20 16:52:39,474 - rtpipe.parsesdm - INFO - Setting (standard) key uvoversample to 1.5
Scan 25 binary data file: /Users/caseyjlaw/code/FRB121102_private/16A-496_sb32698778_1_02h00m_000.57648.37452900463.cut/ASDMBinary/uid____evla_bdf_1474107905881
2017-05-20 16:52:39,662 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 31, 32, 33]
2017-05-20 16:52:40,191 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 31, 32, 33]
2017-05-20 16:52:40,381 - rtpipe.parsesdm - INFO - Calculating uvw for first integration of scan 25 of source FRB121102-off
2017-05-20 16:52:40,574 - rtpipe.parsesdm - INFO - 

2017-05-20 16:52:40,575 - rtpipe.parsesdm - INFO - Metadata summary:
2017-05-20 16:52:40,575 - rtpipe.parsesdm - INFO - 	 Working directory and data at /Users/caseyjlaw/code/FRB121102_private, 16A-496_sb32698778_1_02h00m_000.57648.37452900463.cut
2017-05-20 16:52:40,576 - rtpipe.parsesdm - INFO - 	 Using scan 25, source FRB121102-off
2017-05-20 16:52:40,576 - rtpipe.parsesdm - INFO - 	 nants, nbl: 27, 351
2017-05-20 16:52:40,577 - rtpipe.parsesdm - INFO - 	 Freq range (2.497 -- 3.509). 8 spw with 254 chans.
2017-05-20 16:52:40,578 - rtpipe.parsesdm - INFO - 	 Scan has 800 ints (4.0 s) and inttime 0.005 s
2017-05-20 16:52:40,578 - rtpipe.parsesdm - INFO - 	 2 polarizations: ['RR', 'LL']
2017-05-20 16:52:40,579 - rtpipe.parsesdm - INFO - 	 Ideal uvgrid npix=(7776,7776) and res=104 (oversample 1.5)
2017-05-20 16:52:40,607 - rtpipe - INFO - 
2017-05-20 16:52:40,607 - rtpipe - INFO - Pipeline summary:
2017-05-20 16:52:40,608 - rtpipe - INFO - 	 Products saved with 16A-496_sb32698778_1_02h00m_000.57648.37452900463.cut. telcal calibration with 16A-496_sb32698778_1_02h00m_000.57648.37452900463.GN
2017-05-20 16:52:40,608 - rtpipe - INFO - 	 Using 15 segments of 88 ints (0.4 s) with overlap of 0.2 s
2017-05-20 16:52:40,608 - rtpipe - INFO - 		 Lots of segments needed, since Max DM sweep (0.2 s) close to segment size (0.44 s)
2017-05-20 16:52:40,609 - rtpipe - INFO - 	 Downsampling in time/freq by 1/1 and skipping 0 ints from start of scan.
2017-05-20 16:52:40,609 - rtpipe - INFO - 	 Excluding ants []
2017-05-20 16:52:40,610 - rtpipe - INFO - 	 Using pols ['RR', 'LL']
2017-05-20 16:52:40,610 - rtpipe - INFO - 
2017-05-20 16:52:40,610 - rtpipe - INFO - 	 Search with image1 and threshold 7.0.
2017-05-20 16:52:40,611 - rtpipe - INFO - 	 Using 1 DMs from 558.0 to 558.0 and dts [1].
2017-05-20 16:52:40,611 - rtpipe - INFO - 	 Using uvgrid npix=(7400,7400) and res=104.
2017-05-20 16:52:40,612 - rtpipe - INFO - 	 Expect 0 thermal false positives per segment.
2017-05-20 16:52:40,612 - rtpipe - INFO - 
2017-05-20 16:52:40,613 - rtpipe - INFO - 	 Visibility memory usage is 0.5 GB/segment
2017-05-20 16:52:40,613 - rtpipe - INFO - 	 Imaging in 1 chunks using max of 35.9 GB/segment
2017-05-20 16:52:40,613 - rtpipe - INFO - 	 Grand total memory usage: 36.4 GB/segment
2017-05-20 16:52:40,715 - rtpipe.parsesdm - INFO - Reading scan 25, segment 7/14, times 10:29:09.225 to 10:29:09.665
2017-05-20 16:52:40,886 - rtpipe.parsesdm - INFO - Reading 88 ints starting at int 356
2017-05-20 16:52:41,585 - rtpipe.parsesdm - INFO - Found online flags for 387 antenna/time ranges.
2017-05-20 16:52:41,594 - rtpipe.parsesdm - INFO - Applied online flags to 0 ints.
2017-05-20 16:52:42,015 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 31, 32, 33]
2017-05-20 16:52:42,216 - rtpipe.parsesdm - INFO - Calculating uvw at 2016/09/17/10:29:09.445 for scan 25 of source FRB121102-off
2017-05-20 16:52:42,421 - rtpipe.parsecal - INFO - Read telcalfile 16A-496_sb32698778_1_02h00m_000.57648.37452900463.GN
2017-05-20 16:52:42,424 - py.warnings - WARNING - /Users/caseyjlaw/anaconda/lib/python2.7/site-packages/rtpipe/parsecal.py:418: RuntimeWarning: divide by zero encountered in divide
  badsols = n.where( (n.median(self.amp)/self.amp > threshold) & (self.flagged == False))[0]

2017-05-20 16:52:42,446 - rtpipe.parsecal - INFO - Frequency selection cut down to 2592 solutions
2017-05-20 16:52:42,449 - rtpipe.parsecal - INFO - Selection down to 432 solutions separated from given time by 7 minutes
2017-05-20 16:52:42,453 - rtpipe.parsecal - INFO - MJD: [ 57648.44188426]
2017-05-20 16:52:42,456 - rtpipe.parsecal - INFO - Source: ['J0555+3948']
2017-05-20 16:52:42,458 - rtpipe.parsecal - INFO - Solutions for 8 spw: ([ 2553.  2681.  2809.  2937.  3065.  3193.  3321.  3449.])
2017-05-20 16:52:42,459 - rtpipe.parsecal - INFO - Applying gain solution for chans from 0-30
2017-05-20 16:52:42,554 - rtpipe.parsecal - INFO - Applying gain solution for chans from 31-62
2017-05-20 16:52:42,638 - rtpipe.parsecal - INFO - Applying gain solution for chans from 63-94
2017-05-20 16:52:42,721 - rtpipe.parsecal - INFO - Applying gain solution for chans from 95-126
2017-05-20 16:52:42,805 - rtpipe.parsecal - INFO - Applying gain solution for chans from 127-157
2017-05-20 16:52:42,888 - rtpipe.parsecal - INFO - Applying gain solution for chans from 158-189
2017-05-20 16:52:42,972 - rtpipe.parsecal - INFO - Applying gain solution for chans from 190-221
2017-05-20 16:52:43,060 - rtpipe.parsecal - INFO - Applying gain solution for chans from 222-253
2017-05-20 16:52:43,148 - rtpipe - INFO - Flagging with flaglist: [('badap', 3.0, 0.2)]
2017-05-20 16:52:43,237 - rtpipe - INFO - Bad basepol flagging for chans 0-29 at 3.0 sigma: ants/pols [8]/[1], 0.44 % of total flagged
2017-05-20 16:52:43,284 - rtpipe - INFO - Bad basepol flagging for chans 0-29 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:52:43,378 - rtpipe - INFO - Bad basepol flagging for chans 30-61 at 3.0 sigma: ants/pols [14]/[1], 0.47 % of total flagged
2017-05-20 16:52:43,438 - rtpipe - INFO - Bad basepol flagging for chans 30-61 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:52:43,530 - rtpipe - INFO - Bad basepol flagging for chans 62-93 at 3.0 sigma: ants/pols [14]/[1], 0.47 % of total flagged
2017-05-20 16:52:43,583 - rtpipe - INFO - Bad basepol flagging for chans 62-93 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:52:43,675 - rtpipe - INFO - Bad basepol flagging for chans 94-125 at 3.0 sigma: ants/pols [8]/[1], 0.47 % of total flagged
2017-05-20 16:52:43,730 - rtpipe - INFO - Bad basepol flagging for chans 94-125 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:52:43,824 - rtpipe - INFO - Bad basepol flagging for chans 126-157 at 3.0 sigma: ants/pols [14]/[1], 0.47 % of total flagged
2017-05-20 16:52:43,878 - rtpipe - INFO - Bad basepol flagging for chans 126-157 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:52:43,970 - rtpipe - INFO - Bad basepol flagging for chans 158-189 at 3.0 sigma: ants/pols [14]/[1], 0.47 % of total flagged
2017-05-20 16:52:44,026 - rtpipe - INFO - Bad basepol flagging for chans 158-189 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:52:44,113 - rtpipe - INFO - Bad basepol flagging for chans 190-221 at 3.0 sigma: ants/pols [14]/[1], 0.47 % of total flagged
2017-05-20 16:52:44,168 - rtpipe - INFO - Bad basepol flagging for chans 190-221 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:52:44,261 - rtpipe - INFO - Bad basepol flagging for chans 222-253 at 3.0 sigma: ants/pols [14]/[1], 0.47 % of total flagged
2017-05-20 16:52:44,317 - rtpipe - INFO - Bad basepol flagging for chans 222-253 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 16:52:44,319 - rtpipe - INFO - Subtracting mean visibility in time...
2017-05-20 16:52:44,459 - rtpipe - INFO - Returning prepared data...
2017-05-20 16:52:44,661 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 31, 32, 33]
2017-05-20 16:52:44,856 - rtpipe.parsesdm - INFO - Calculating uvw at 2016/09/17/10:29:09.445 for scan 25 of source FRB121102-off

In [22]:
key = '57648'
st, data, u, v, w = read[key]
snrmax = find_dm(st, data, u, v, w)

dmmax[key] = snrmax
dm = snrmax[0]
integ = int(snrmax[1])
st['dmarr'] = [dm]
spectrum[key] = correct_and_plot(st, data, u, v, w, integ)
st['dmarr'] = [560.5]
_ = correct_and_plot(st, data, u, v, w, integ)
#i0 = integ - 1
#i1 = integ + 2
#spectrumwide[key] = getwidespectrum(st, data, u, v, w, i0, i1)
print('Image SNR (orig): {0}'.format(snrdet[key]))


Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
SNR vs DM: [[ 530.           45.           20.20626923]
 [ 532.           45.           20.16534632]
 [ 534.           45.           20.99774783]
 [ 536.           45.           20.80749088]
 [ 538.           45.           20.27529177]
 [ 540.           45.           20.00434252]
 [ 542.           45.           17.89795124]
 [ 544.           45.           16.69392868]
 [ 546.           44.           15.09191279]
 [ 548.           44.           16.21158878]
 [ 550.           44.           19.03478319]
 [ 552.           44.           20.59819271]
 [ 554.           44.           22.34609974]
 [ 556.           44.           23.74402718]
 [ 558.           44.           25.14216458]
 [ 560.           44.           24.97880476]
 [ 562.           44.           23.97444691]
 [ 564.           44.           21.80141672]
 [ 566.           44.           19.75961631]
 [ 568.           44.           16.92705434]
 [ 570.           44.           15.53895039]
 [ 572.           44.           13.9999734 ]
 [ 574.           43.           14.66137134]
 [ 576.           43.           15.57860425]
 [ 578.           43.           17.22732803]
 [ 580.           43.           17.95893405]
 [ 582.           43.           18.39201778]
 [ 584.           43.           18.17874658]
 [ 586.           43.           17.58946856]
 [ 588.           43.           17.68859142]
 [ 590.           43.           16.56199132]
 [ 592.           43.           15.69658811]
 [ 594.           43.           14.67150599]
 [ 596.           43.           13.67551729]
 [ 598.           43.           13.40597356]]
Max SNR of 25.1421645794 at DM=558.0
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Peak location:
-0.000383316008316 0.000540540540541
hms_tuple(h=5.0, m=31.0, s=58.706729755599838) dms_tuple(d=33.0, m=8.0, s=52.4944990214874)
Image SNR 25.0685793656
(RR-LL)/(RR+LL): 0.0815230160952
(RR+LL): 0.222928419709
14 254 16 (240,)
Gridded 1.000 of data. Scaling fft by = 318.9
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Peak location:
-0.000383316008316 0.000540540540541
hms_tuple(h=5.0, m=31.0, s=58.706729755599838) dms_tuple(d=33.0, m=8.0, s=52.4944990214874)
Image SNR 24.8936700356
(RR-LL)/(RR+LL): 0.102751992643
(RR+LL): 0.222094088793
14 254 16 (240,)
Image SNR (orig): 17.6

Get data for ninth burst


In [23]:
sdmfile = '16A-496_sb32698778_1_02h00m_001.57649.37461215278.cut/'
key = '57649'
scannum = getscannum(sdmfile)
read[key] = read_cut(sdmfile, scannum, 7, npix_max=7400)


2017-05-20 17:01:02,748 - rtpipe.parsesdm - INFO - Setting (standard) key logfile to False
2017-05-20 17:01:02,749 - rtpipe.parsesdm - INFO - Setting (standard) key timesub to mean
2017-05-20 17:01:02,749 - rtpipe.parsesdm - INFO - Setting (standard) key gainfile to 16A-496_sb32698778_1_02h00m_001.57649.37461215278.GN
2017-05-20 17:01:02,750 - rtpipe.parsesdm - INFO - Setting (standard) key dmarr to [558.0]
2017-05-20 17:01:02,750 - rtpipe.parsesdm - INFO - Setting (standard) key dtarr to [1]
2017-05-20 17:01:02,751 - rtpipe.parsesdm - INFO - Setting (standard) key npix_max to 7400
2017-05-20 17:01:02,751 - rtpipe.parsesdm - INFO - Setting (standard) key savecands to False
2017-05-20 17:01:02,752 - rtpipe.parsesdm - INFO - Setting (standard) key flaglist to [('badap', 3.0, 0.2)]
2017-05-20 17:01:02,752 - rtpipe.parsesdm - INFO - Setting (standard) key savenoise to False
2017-05-20 17:01:02,753 - rtpipe.parsesdm - INFO - Setting (standard) key flagantsol to True
2017-05-20 17:01:02,753 - rtpipe.parsesdm - INFO - Setting (standard) key uvoversample to 1.5
Scan 31 binary data file: /Users/caseyjlaw/code/FRB121102_private/16A-496_sb32698778_1_02h00m_001.57649.37461215278.cut/ASDMBinary/uid____evla_bdf_1474195554648
2017-05-20 17:01:02,939 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 32, 33]
2017-05-20 17:01:03,772 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 32, 33]
2017-05-20 17:01:03,956 - rtpipe.parsesdm - INFO - Calculating uvw for first integration of scan 31 of source FRB121102-off
2017-05-20 17:01:04,143 - rtpipe.parsesdm - INFO - 

2017-05-20 17:01:04,143 - rtpipe.parsesdm - INFO - Metadata summary:
2017-05-20 17:01:04,144 - rtpipe.parsesdm - INFO - 	 Working directory and data at /Users/caseyjlaw/code/FRB121102_private, 16A-496_sb32698778_1_02h00m_001.57649.37461215278.cut
2017-05-20 17:01:04,144 - rtpipe.parsesdm - INFO - 	 Using scan 31, source FRB121102-off
2017-05-20 17:01:04,145 - rtpipe.parsesdm - INFO - 	 nants, nbl: 26, 325
2017-05-20 17:01:04,145 - rtpipe.parsesdm - INFO - 	 Freq range (2.489 -- 3.509). 8 spw with 256 chans.
2017-05-20 17:01:04,146 - rtpipe.parsesdm - INFO - 	 Scan has 800 ints (4.0 s) and inttime 0.005 s
2017-05-20 17:01:04,146 - rtpipe.parsesdm - INFO - 	 2 polarizations: ['RR', 'LL']
2017-05-20 17:01:04,147 - rtpipe.parsesdm - INFO - 	 Ideal uvgrid npix=(7776,8192) and res=104 (oversample 1.5)
2017-05-20 17:01:04,175 - rtpipe - INFO - 
2017-05-20 17:01:04,176 - rtpipe - INFO - Pipeline summary:
2017-05-20 17:01:04,177 - rtpipe - INFO - 	 Products saved with 16A-496_sb32698778_1_02h00m_001.57649.37461215278.cut. telcal calibration with 16A-496_sb32698778_1_02h00m_001.57649.37461215278.GN
2017-05-20 17:01:04,177 - rtpipe - INFO - 	 Using 15 segments of 89 ints (0.4 s) with overlap of 0.2 s
2017-05-20 17:01:04,177 - rtpipe - INFO - 		 Lots of segments needed, since Max DM sweep (0.2 s) close to segment size (0.44 s)
2017-05-20 17:01:04,178 - rtpipe - INFO - 	 Downsampling in time/freq by 1/1 and skipping 0 ints from start of scan.
2017-05-20 17:01:04,178 - rtpipe - INFO - 	 Excluding ants []
2017-05-20 17:01:04,179 - rtpipe - INFO - 	 Using pols ['RR', 'LL']
2017-05-20 17:01:04,179 - rtpipe - INFO - 
2017-05-20 17:01:04,180 - rtpipe - INFO - 	 Search with image1 and threshold 7.0.
2017-05-20 17:01:04,180 - rtpipe - INFO - 	 Using 1 DMs from 558.0 to 558.0 and dts [1].
2017-05-20 17:01:04,181 - rtpipe - INFO - 	 Using uvgrid npix=(7400,7400) and res=104.
2017-05-20 17:01:04,181 - rtpipe - INFO - 	 Expect 0 thermal false positives per segment.
2017-05-20 17:01:04,182 - rtpipe - INFO - 
2017-05-20 17:01:04,182 - rtpipe - INFO - 	 Visibility memory usage is 0.4 GB/segment
2017-05-20 17:01:04,182 - rtpipe - INFO - 	 Imaging in 1 chunks using max of 36.3 GB/segment
2017-05-20 17:01:04,183 - rtpipe - INFO - 	 Grand total memory usage: 36.8 GB/segment
2017-05-20 17:01:04,282 - rtpipe.parsesdm - INFO - Reading scan 31, segment 7/14, times 10:50:31.578 to 10:50:32.022
2017-05-20 17:01:04,450 - rtpipe.parsesdm - INFO - Reading 89 ints starting at int 355
2017-05-20 17:01:05,120 - rtpipe.parsesdm - INFO - Found online flags for 356 antenna/time ranges.
2017-05-20 17:01:05,128 - rtpipe.parsesdm - INFO - Applied online flags to 0 ints.
2017-05-20 17:01:05,524 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 32, 33]
2017-05-20 17:01:05,720 - rtpipe.parsesdm - INFO - Calculating uvw at 2016/09/18/10:50:31.800 for scan 31 of source FRB121102-off
2017-05-20 17:01:05,931 - rtpipe.parsecal - INFO - Read telcalfile 16A-496_sb32698778_1_02h00m_001.57649.37461215278.GN
2017-05-20 17:01:05,955 - rtpipe.parsecal - INFO - Frequency selection cut down to 2912 solutions
2017-05-20 17:01:05,959 - rtpipe.parsecal - INFO - Selection down to 416 solutions separated from given time by 6 minutes
2017-05-20 17:01:05,963 - rtpipe.parsecal - INFO - MJD: [ 57649.45633738]
2017-05-20 17:01:05,966 - rtpipe.parsecal - INFO - Source: ['J0555+3948']
2017-05-20 17:01:05,968 - rtpipe.parsecal - INFO - Solutions for 8 spw: ([ 2553.  2681.  2809.  2937.  3065.  3193.  3321.  3449.])
2017-05-20 17:01:05,970 - rtpipe.parsecal - INFO - Applying gain solution for chans from 0-31
2017-05-20 17:01:06,061 - rtpipe.parsecal - INFO - Applying gain solution for chans from 32-63
2017-05-20 17:01:06,149 - rtpipe.parsecal - INFO - Applying gain solution for chans from 64-95
2017-05-20 17:01:06,240 - rtpipe.parsecal - INFO - Applying gain solution for chans from 96-127
2017-05-20 17:01:06,324 - rtpipe.parsecal - INFO - Applying gain solution for chans from 128-159
2017-05-20 17:01:06,405 - rtpipe.parsecal - INFO - Applying gain solution for chans from 160-191
2017-05-20 17:01:06,487 - rtpipe.parsecal - INFO - Applying gain solution for chans from 192-223
2017-05-20 17:01:06,571 - rtpipe.parsecal - INFO - Applying gain solution for chans from 224-255
2017-05-20 17:01:06,654 - rtpipe - INFO - Flagging with flaglist: [('badap', 3.0, 0.2)]
2017-05-20 17:01:06,746 - rtpipe - INFO - Bad basepol flagging for chans 0-31 at 3.0 sigma: ants/pols [8]/[1], 0.48 % of total flagged
2017-05-20 17:01:06,799 - rtpipe - INFO - Bad basepol flagging for chans 0-31 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 17:01:06,898 - rtpipe - INFO - Bad basepol flagging for chans 32-63 at 3.0 sigma: ants/pols [14]/[1], 0.48 % of total flagged
2017-05-20 17:01:06,952 - rtpipe - INFO - Bad basepol flagging for chans 32-63 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 17:01:07,038 - rtpipe - INFO - Bad basepol flagging for chans 64-95 at 3.0 sigma: ants/pols [14]/[1], 0.48 % of total flagged
2017-05-20 17:01:07,096 - rtpipe - INFO - Bad basepol flagging for chans 64-95 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 17:01:07,195 - rtpipe - INFO - Bad basepol flagging for chans 96-127 at 3.0 sigma: ants/pols [8]/[1], 0.48 % of total flagged
2017-05-20 17:01:07,260 - rtpipe - INFO - Bad basepol flagging for chans 96-127 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 17:01:07,351 - rtpipe - INFO - Bad basepol flagging for chans 128-159 at 3.0 sigma: ants/pols [14]/[1], 0.48 % of total flagged
2017-05-20 17:01:07,405 - rtpipe - INFO - Bad basepol flagging for chans 128-159 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 17:01:07,503 - rtpipe - INFO - Bad basepol flagging for chans 160-191 at 3.0 sigma: ants/pols [14]/[1], 0.48 % of total flagged
2017-05-20 17:01:07,561 - rtpipe - INFO - Bad basepol flagging for chans 160-191 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 17:01:07,663 - rtpipe - INFO - Bad basepol flagging for chans 192-223 at 3.0 sigma: ants/pols [14]/[1], 0.48 % of total flagged
2017-05-20 17:01:07,721 - rtpipe - INFO - Bad basepol flagging for chans 192-223 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 17:01:07,814 - rtpipe - INFO - Bad basepol flagging for chans 224-255 at 3.0 sigma: ants/pols [14]/[1], 0.48 % of total flagged
2017-05-20 17:01:07,867 - rtpipe - INFO - Bad basepol flagging for chans 224-255 at 3.0 sigma: ants/pols []/[], 0.00 % of total flagged
2017-05-20 17:01:07,869 - rtpipe - INFO - Subtracting mean visibility in time...
2017-05-20 17:01:08,062 - rtpipe - INFO - Returning prepared data...
2017-05-20 17:01:08,261 - rtpipe.parsesdm - WARNING - No BDF found for scans [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 32, 33]
2017-05-20 17:01:08,449 - rtpipe.parsesdm - INFO - Calculating uvw at 2016/09/18/10:50:31.800 for scan 31 of source FRB121102-off

In [24]:
key = '57649'
st, data, u, v, w = read[key]
snrmax = find_dm(st, data, u, v, w)

dmmax[key] = snrmax
dm = snrmax[0]
integ = int(snrmax[1])
st['dmarr'] = [dm]
spectrum[key] = correct_and_plot(st, data, u, v, w, integ)
st['dmarr'] = [560.5]
_ = correct_and_plot(st, data, u, v, w, integ)
#i0 = integ - 1
#i1 = integ + 2
#spectrumwide[key] = getwidespectrum(st, data, u, v, w, i0, i1)
print('Image SNR (orig): {0}'.format(snrdet[key]))


Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
SNR vs DM: [[ 530.           45.           20.91870975]
 [ 532.           45.           22.73852528]
 [ 534.           45.           23.90656472]
 [ 536.           45.           26.03346616]
 [ 538.           45.           27.64639207]
 [ 540.           45.           28.61902585]
 [ 542.           45.           30.45046858]
 [ 544.           45.           31.22516365]
 [ 546.           45.           33.30410249]
 [ 548.           45.           34.37256814]
 [ 550.           45.           35.8556611 ]
 [ 552.           45.           36.03023197]
 [ 554.           45.           34.34835911]
 [ 556.           45.           33.30927419]
 [ 558.           45.           31.19274171]
 [ 560.           45.           29.29797406]
 [ 562.           45.           25.46930492]
 [ 564.           45.           23.96698617]
 [ 566.           45.           21.52602385]
 [ 568.           44.           23.69331723]
 [ 570.           44.           25.42075027]
 [ 572.           44.           26.91541139]
 [ 574.           44.           28.52353846]
 [ 576.           44.           29.25378119]
 [ 578.           44.           28.42463348]
 [ 580.           44.           29.74896599]
 [ 582.           44.           28.88635494]
 [ 584.           44.           28.09933396]
 [ 586.           44.           27.44573973]
 [ 588.           44.           26.4734698 ]
 [ 590.           44.           25.33118556]
 [ 592.           44.           24.19748167]
 [ 594.           44.           23.22498762]
 [ 596.           44.           21.22136508]
 [ 598.           44.           20.36156535]]
Max SNR of 36.0302319661 at DM=552.0
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Peak location:
-0.000383316008316 0.000540540540541
hms_tuple(h=5.0, m=31.0, s=58.706729755599838) dms_tuple(d=33.0, m=8.0, s=52.4944990214874)
Image SNR 35.8626724972
(RR-LL)/(RR+LL): 0.00417251465842
(RR+LL): 0.334005028009
0 256 16 (256,)
Gridded 1.000 of data. Scaling fft by = 342.2
Pixel sizes (0.5", 0.5"), Field size 1983.3"
Peak location:
-0.000383316008316 0.000540540540541
hms_tuple(h=5.0, m=31.0, s=58.706729755599838) dms_tuple(d=33.0, m=8.0, s=52.4944990214874)
Image SNR 29.2557980106
(RR-LL)/(RR+LL): 0.00425855768844
(RR+LL): 0.27061766386
0 256 16 (256,)
Image SNR (orig): 25.2

Set first estimate of burst spectrum Gaussian model (from scipy.optimize)


In [25]:
# full-res spectral fits to norm function
mul = 1
poptg = {'57623': [ mul*33.18660225 , 68.6786758  , 31.97989185],
        '57633_scan7': [ mul*261.01468348,  163.37613653 ,  54.94315806],
        '57633_scan13': [ mul*25.91234327 ,  0. , 36.83456147],
        '57643': [ mul*54.70339027 , 68.70560927,  55.53711055],
        '57649': [ mul*17.31563655, 104.88902813 ,  93.62882441],
        '57638': [ mul*8.03104856,  159.12796452,   43.9087101 ],
        '57646': [ mul*1.67436907e+01, 0.,  4.26219468e+01],
        '57645': [ mul*3.63342113,  85.9990355,   22.58927418],
        '57648': [ mul*12.25215549,  87.65698285,  44.20621731]}

# same, but bin spectra by 4
poptg4 = {'57633_scan7': [ 65.34364137,  40.53096697,  13.78088794],
       '57649': [  4.3092322,   25.87960046,  23.20757215],
       '57643': [ 13.77221702,  16.65750292,  13.9484172 ],
       '57638': [  2.02851581,  39.29549388,  11.28088088],
       '57646': [  3.98608102e+00, 0,   1.00213376e+01],
       '57633_scan13': [  6.40875573e+00,   0,   9.26735728e+00],
       '57645': [  1.17831665, 17.02810437,   9.24786317],
       '57648': [  3.05757414,  21.54651779, 11.21822984],
       '57623': [  8.30028279,  16.80016577 ,  8.00799541]}

MCMC Spectro-temporal modeling


In [26]:
spec_ci = {}
thetas = {}
post = {}

In [27]:
samples = {}

In [28]:
#######
# 2d modeling with emcee
######

def normdm(freq, dx, dy, a, loc, scale, i0, dm, di, index=2, inttime=0.005):
    model = np.zeros((dy, dx), dtype='float')
    chans = np.arange(dy)
    normarr = a*scipy.stats.norm(loc, scale).pdf(chans)

# old way
#    delay = (4.1488e-3 * dm * (1./freq**index - 1./freq[-1]**index))/inttime
#    i = np.round(i0 + delay, 0).astype(int) # or np.floor?

# new way
    i = i0 + (4.1488e-3 * dm * (1./freq**index - 1./freq[-1]**index))/inttime
    i_f = np.floor(i).astype(int)
    imax = np.ceil(i + di).astype(int)
    imin = i_f
    i_r = imax - imin
#    print(i_r)
    if np.any(i_r == 1):
        ir1 = np.where(i_r == 1)
#        print(ir1)
        model[chans[ir1], i_f[ir1]] += normarr[ir1]

    if np.any(i_r == 2):
        ir2 = np.where(i_r == 2)
        i_c = np.ceil(i).astype(int)
        f1 = (di - (i_c - i))/di
        f0 = 1 - f1
#        print(np.vstack((ir2, f0[ir2], f1[ir2])).transpose())
        model[chans[ir2], i_f[ir2]] += f0[ir2]*normarr[ir2]
        model[chans[ir2], i_f[ir2]+1] += f1[ir2]*normarr[ir2]

    if np.any(i_r == 3):
        ir3 = np.where(i_r == 3)
        f2 = (i + di - (imax - 1))/di
        f0 = ((i_f + 1) - i)/di
        f1 = 1 - f2 - f0
#        print(np.vstack((ir3, f0[ir3], f1[ir3], f2[ir3])).transpose())
        model[chans[ir3], i_f[ir3]] += f0[ir3]*normarr[ir3]
        model[chans[ir3], i_f[ir3]+1] += f1[ir3]*normarr[ir3]
        model[chans[ir3], i_f[ir3]+2] += f2[ir3]*normarr[ir3]

    return model

def lnlike(theta, freq, z, zerr):
    a, loc, scale, i0, dm, di = theta
    dy, dx = z.shape
    model = normdm(freq, dx, dy, a, loc, scale, i0, dm, di)
#    return -0.5*(np.sum(((z-model)/np.where(model > zerr, model, zerr))**2))
    return -0.5*(np.sum(((z-model)/zerr)**2))

def lnprior(theta, imin=0, imax=150, sigma_im=8):
    index = 2
    a, loc, scale, i0, dm, di = theta

    if ((np.sqrt(di/1)*a/sc(scale)/0.005 > sigma_im) and (1 < a < 1000) and (0 < loc < 256) and (1 < scale < 256) and 
        (imin < i0 < imax) and (530 < dm < 600) and (0.01 < di < 2) and (1.5 < index < 2.5)):
        return 0.
    return -np.inf

def lnprob(theta, freq, z, zerr, sigma_im):
    imin = 0
    imax = z.shape[1]-40 # sweep for dm~560
    lp = lnprior(theta, imin=imin, imax=imax, sigma_im=sigma_im)
    if not np.isfinite(lp):
        return -np.inf
    return lp + lnlike(theta, freq, z, zerr)

def madstd(sgram, imax):
    return np.ma.median(np.ma.abs(sgram[:,:imax] - np.ma.median(sgram[:,:imax])))/0.67

delay = lambda dm, index, freq: (4.1488e-3 * dm * (1./freq**index - 1./freq[-1]**index))

ndim, nwalkers, nsteps = 6, 100, 700
sigma_im = 8
pct = [16, 50, 84]
#pct = [2.5, 50, 97.5]
di = 0.5

Show dynamic spectrum of burst and model for initial guess


In [29]:
key = '57623'
st, data, u, v, w = read[key]
scale = getscale(st)
sgram = correctdata(st, data*scale, u, v, w, corr='ph').mean(axis=3).mean(axis=1).real.transpose()
dm, i0, snr = dmmax[key]
a, loc, scale = poptg[key]
thetas[key] = a, loc, scale, i0, dm, di

dy, dx = sgram.shape
model = normdm(st['freq'], dx, dy, *thetas[key])
fig = pl.figure(figsize=(15,8))
ax = fig.add_subplot(121)
pl.imshow(model, interpolation='nearest', origin='bottom')
ax = fig.add_subplot(122)
pl.imshow(sgram, interpolation='nearest', origin='bottom')
pl.tight_layout()


Run sampler


In [30]:
key = '57623'
pos = [np.array(thetas[key]) + 1e-4*np.random.randn(ndim) for i in range(nwalkers)]
std = madstd(sgram, 10)
print('Noise from MAD: {0}'.format(std))
sampler = emcee.EnsembleSampler(nwalkers, ndim, lnprob, args=(st['freq'], sgram, std, sigma_im))

end = sampler.run_mcmc(pos, nsteps)
fig = pl.figure(figsize=(12,7))
ax = fig.add_subplot(611)
plot = ax.plot(sampler.chain[::10,::10,0].transpose(), ',k')
ax = fig.add_subplot(612)
plot = ax.plot(sampler.chain[::10,::10,1].transpose(), ',k')
ax = fig.add_subplot(613)
plot = ax.plot(sampler.chain[::10,::10,2].transpose(), ',k')
ax = fig.add_subplot(614)
plot = ax.plot(sampler.chain[::10,::10,3].transpose(), ',k')
ax = fig.add_subplot(615)
plot = ax.plot(sampler.chain[::10,::10,4].transpose(), ',k')
ax = fig.add_subplot(616)
plot = ax.plot(sampler.chain[::10,::10,5].transpose(), ',k')


Noise from MAD: 0.0756894474599
2017-05-20 17:09:05,246 - py.warnings - WARNING - /Users/caseyjlaw/anaconda/lib/python2.7/site-packages/ipykernel/__main__.py:58: RuntimeWarning: invalid value encountered in sqrt

Cut out burn-in period and make corner plot


In [31]:
samples[key] = sampler.chain[:, 250:, :].reshape((-1, ndim))
fig = corner.corner(samples[key], labels=["a", "loc", "scale", "i0", "dm", "di"], show_titles=True)

print(sampler.acceptance_fraction.mean())
post[key] = zip(*np.percentile(samples[key], pct, axis=0))


0.507814285714

Plot model from a random iteration


In [32]:
#key = '57623'
#a, loc, scale, i0, dm, di = thetas[key]
a, loc, scale, i0, dm, di = samples[key][100]
dy, dx = sgram.shape
model = normdm(st['freq'], dx, dy, a, loc, scale, i0, dm, di)
zerr = 0.066
err = np.where(model <= zerr, zerr, model)
to = 1
weight = ((sgram-model)/np.where(model > to*zerr, model, zerr))**2

fig = pl.figure(figsize=(12,12))
ax = fig.add_subplot(141)
pl.imshow(model[:,95:135], origin='bottom', aspect='auto')
ax = fig.add_subplot(142)
pl.imshow(sgram[:,95:135], origin='bottom', aspect='auto')
ax = fig.add_subplot(143)
pl.imshow(err[:,95:135], origin='bottom', aspect='auto')
ax = fig.add_subplot(144)
pl.imshow(weight[:,95:135], origin='bottom', aspect='auto')
pl.tight_layout()
print(-0.5*np.sum(weight))


-31244.2714565

Model second burst


In [33]:
key = '57633_scan7'
st, data, u, v, w = read[key]
scale = getscale(st)
sgram = correctdata(st, data*scale, u, v, w, corr='ph').mean(axis=3).mean(axis=1).real.transpose()
dm, i0, snr = dmmax[key]
a, loc, scale = poptg[key]
thetas[key] = a, loc, scale, i0, dm, di

dy, dx = sgram.shape
model = normdm(st['freq'], dx, dy, *thetas[key])
fig = pl.figure(figsize=(13,5))
ax = fig.add_subplot(121)
pl.imshow(model, interpolation='nearest', origin='bottom')
ax = fig.add_subplot(122)
pl.imshow(sgram, interpolation='nearest', origin='bottom')


Out[33]:
<matplotlib.image.AxesImage at 0x123b5d490>

In [34]:
pos = [np.array(thetas[key]) + 1e-2*np.random.randn(ndim) for i in range(nwalkers)]
std = madstd(sgram, 10)
print('Noise from MAD: {0}'.format(std))
sampler = emcee.EnsembleSampler(nwalkers, ndim, lnprob, args=(st['freq'], sgram, std, sigma_im))

end = sampler.run_mcmc(pos, nsteps)
fig = pl.figure(figsize=(10,5))
ax = fig.add_subplot(611)
plot = ax.plot(sampler.chain[::10,::10,0].transpose(), ',k')
ax = fig.add_subplot(612)
plot = ax.plot(sampler.chain[::10,::10,1].transpose(), ',k')
ax = fig.add_subplot(613)
plot = ax.plot(sampler.chain[::10,::10,2].transpose(), ',k')
ax = fig.add_subplot(614)
plot = ax.plot(sampler.chain[::10,::10,3].transpose(), ',k')
ax = fig.add_subplot(615)
plot = ax.plot(sampler.chain[::10,::10,4].transpose(), ',k')
ax = fig.add_subplot(616)
plot = ax.plot(sampler.chain[::10,::10,5].transpose(), ',k')


Noise from MAD: 0.0664504717535
2017-05-20 17:10:27,907 - py.warnings - WARNING - /Users/caseyjlaw/anaconda/lib/python2.7/site-packages/ipykernel/__main__.py:58: RuntimeWarning: invalid value encountered in sqrt


In [35]:
samples[key] = sampler.chain[:, 380:, :].reshape((-1, ndim))
fig = corner.corner(samples[key], labels=["a", "loc", "scale", "i0", "dm", "di"], show_titles=True)

print(sampler.acceptance_fraction.mean())
post[key] = zip(*np.percentile(samples[key], pct, axis=0))


0.471457142857

Model third burst


In [36]:
key = '57633_scan13'
st, data, u, v, w = read[key]
scale = getscale(st)
sgram = correctdata(st, data*scale, u, v, w, corr='ph').mean(axis=3).mean(axis=1).real.transpose()
dm, i0, snr = dmmax[key]
a, loc, scale = poptg[key]
thetas[key] = a, loc, scale, i0, dm, di

dy, dx = sgram.shape
model = normdm(st['freq'], dx, dy, *thetas[key])
fig = pl.figure(figsize=(13,5))
ax = fig.add_subplot(121)
pl.imshow(model, interpolation='nearest', origin='bottom')
ax = fig.add_subplot(122)
pl.imshow(sgram, interpolation='nearest', origin='bottom')


Out[36]:
<matplotlib.image.AxesImage at 0x1208b8d10>

In [37]:
pos = [np.array(thetas[key]) + 1e-3*np.random.randn(ndim) for i in range(nwalkers)]
std = madstd(sgram, 10)
print('Noise from MAD: {0}'.format(std))
sampler = emcee.EnsembleSampler(nwalkers, ndim, lnprob, args=(st['freq'], sgram, std, sigma_im))

end = sampler.run_mcmc(pos, nsteps)
fig = pl.figure(figsize=(10,5))
ax = fig.add_subplot(611)
plot = ax.plot(sampler.chain[::10,::10,0].transpose(), ',k')
ax = fig.add_subplot(612)
plot = ax.plot(sampler.chain[::10,::10,1].transpose(), ',k')
ax = fig.add_subplot(613)
plot = ax.plot(sampler.chain[::10,::10,2].transpose(), ',k')
ax = fig.add_subplot(614)
plot = ax.plot(sampler.chain[::10,::10,3].transpose(), ',k')
ax = fig.add_subplot(615)
plot = ax.plot(sampler.chain[::10,::10,4].transpose(), ',k')
ax = fig.add_subplot(616)
plot = ax.plot(sampler.chain[::10,::10,5].transpose(), ',k')


2017-05-20 17:11:50,422 - py.warnings - WARNING - /Users/caseyjlaw/anaconda/lib/python2.7/site-packages/emcee/ensemble.py:335: RuntimeWarning: invalid value encountered in subtract
  lnpdiff = (self.dim - 1.) * np.log(zz) + newlnprob - lnprob0

2017-05-20 17:11:50,423 - py.warnings - WARNING - /Users/caseyjlaw/anaconda/lib/python2.7/site-packages/emcee/ensemble.py:336: RuntimeWarning: invalid value encountered in greater
  accept = (lnpdiff > np.log(self._random.rand(len(lnpdiff))))

Noise from MAD: 0.0667905629571
2017-05-20 17:11:52,019 - py.warnings - WARNING - /Users/caseyjlaw/anaconda/lib/python2.7/site-packages/ipykernel/__main__.py:58: RuntimeWarning: invalid value encountered in sqrt


In [38]:
samples[key] = sampler.chain[:, 300:, :].reshape((-1, ndim))
fig = corner.corner(samples[key], labels=["a", "loc", "scale", "i0", "dm", "di"], show_titles=True)

print(sampler.acceptance_fraction.mean())
post[key] = zip(*np.percentile(samples[key], pct, axis=0))


0.4742

Model fourth burst


In [39]:
key = '57638'
st, data, u, v, w = read[key]
scale = getscale(st)
sgram = correctdata(st, data*scale, u, v, w, corr='ph').mean(axis=3).mean(axis=1).real.transpose()
dm, i0, snr = dmmax[key]
a, loc, scale = poptg[key]
thetas[key] = a, loc, scale, i0, dm, di

dy, dx = sgram.shape
model = normdm(st['freq'], dx, dy, *thetas[key])
fig = pl.figure(figsize=(13,5))
ax = fig.add_subplot(121)
pl.imshow(model, interpolation='nearest', origin='bottom')
ax = fig.add_subplot(122)
pl.imshow(sgram, interpolation='nearest', origin='bottom')


Out[39]:
<matplotlib.image.AxesImage at 0x12736bc90>

In [40]:
pos = [np.array(thetas[key]) + 1e-2*np.random.randn(ndim) for i in range(nwalkers)]
std = madstd(sgram, 10)
print('Noise from MAD: {0}'.format(std))
sampler = emcee.EnsembleSampler(nwalkers, ndim, lnprob, args=(st['freq'], sgram, std, sigma_im))

end = sampler.run_mcmc(pos, nsteps)
fig = pl.figure(figsize=(10,5))
ax = fig.add_subplot(611)
plot = ax.plot(sampler.chain[::10,::10,0].transpose(), ',k')
ax = fig.add_subplot(612)
plot = ax.plot(sampler.chain[::10,::10,1].transpose(), ',k')
ax = fig.add_subplot(613)
plot = ax.plot(sampler.chain[::10,::10,2].transpose(), ',k')
ax = fig.add_subplot(614)
plot = ax.plot(sampler.chain[::10,::10,3].transpose(), ',k')
ax = fig.add_subplot(615)
plot = ax.plot(sampler.chain[::10,::10,4].transpose(), ',k')
ax = fig.add_subplot(616)
plot = ax.plot(sampler.chain[::10,::10,5].transpose(), ',k')


Noise from MAD: 0.0715220041239
2017-05-20 17:13:08,094 - py.warnings - WARNING - /Users/caseyjlaw/anaconda/lib/python2.7/site-packages/ipykernel/__main__.py:58: RuntimeWarning: invalid value encountered in sqrt


In [41]:
samples[key] = sampler.chain[:, 150:, :].reshape((-1, ndim))
fig = corner.corner(samples[key], labels=["a", "loc", "scale", "i0", "dm", "di"], show_titles=True)

print(sampler.acceptance_fraction.mean())
post[key] = zip(*np.percentile(samples[key], pct, axis=0))


0.486842857143

Model fifth burst


In [42]:
key = '57643'
st, data, u, v, w = read[key]
scale = getscale(st)
sgram = correctdata(st, data*scale, u, v, w, corr='ph').mean(axis=3).mean(axis=1).real.transpose()
dm, i0, snr = dmmax[key]
a, loc, scale = poptg[key]
thetas[key] = a, loc, scale, i0, dm, di

dy, dx = sgram.shape
model = normdm(st['freq'], dx, dy, *thetas[key])
fig = pl.figure(figsize=(13,5))
ax = fig.add_subplot(121)
pl.imshow(model, interpolation='nearest', origin='bottom')
ax = fig.add_subplot(122)
pl.imshow(sgram, interpolation='nearest', origin='bottom')


Out[42]:
<matplotlib.image.AxesImage at 0x1224e3190>

In [43]:
pos = [np.array(thetas[key]) + 1e-2*np.random.randn(ndim) for i in range(nwalkers)]
std = madstd(sgram, 10)
print('Noise from MAD: {0}'.format(std))
sampler = emcee.EnsembleSampler(nwalkers, ndim, lnprob, args=(st['freq'], sgram, std, sigma_im))

end = sampler.run_mcmc(pos, nsteps)
fig = pl.figure(figsize=(10,5))
ax = fig.add_subplot(611)
plot = ax.plot(sampler.chain[::10,::10,0].transpose(), ',k')
ax = fig.add_subplot(612)
plot = ax.plot(sampler.chain[::10,::10,1].transpose(), ',k')
ax = fig.add_subplot(613)
plot = ax.plot(sampler.chain[::10,::10,2].transpose(), ',k')
ax = fig.add_subplot(614)
plot = ax.plot(sampler.chain[::10,::10,3].transpose(), ',k')
ax = fig.add_subplot(615)
plot = ax.plot(sampler.chain[::10,::10,4].transpose(), ',k')
ax = fig.add_subplot(616)
plot = ax.plot(sampler.chain[::10,::10,5].transpose(), ',k')


Noise from MAD: 0.0681433048266
2017-05-20 17:14:15,923 - py.warnings - WARNING - /Users/caseyjlaw/anaconda/lib/python2.7/site-packages/ipykernel/__main__.py:58: RuntimeWarning: invalid value encountered in sqrt


In [44]:
samples[key] = sampler.chain[:, 300:, :].reshape((-1, ndim))
fig = corner.corner(samples[key], labels=["a", "loc", "scale", "i0", "dm", "di"], show_titles=True)

print(sampler.acceptance_fraction.mean())
post[key] = zip(*np.percentile(samples[key], pct, axis=0))


0.479071428571

Model sixth burst


In [45]:
key = '57645'
st, data, u, v, w = read[key]
scale = getscale(st)
sgram = correctdata(st, data*scale, u, v, w, corr='ph').mean(axis=3).mean(axis=1).real.transpose()
dm, i0, snr = dmmax[key]
a, loc, scale = (10, 90, 40) # poptg[key]  # force to wider value than nominal Gaussian fit
thetas[key] = a, loc, scale, i0, dm, di

dy, dx = sgram.shape
model = normdm(st['freq'], dx, dy, *thetas[key])
fig = pl.figure(figsize=(13,5))
ax = fig.add_subplot(121)
pl.imshow(model, interpolation='nearest', origin='bottom')
ax = fig.add_subplot(122)
pl.imshow(sgram, interpolation='nearest', origin='bottom')


Out[45]:
<matplotlib.image.AxesImage at 0x1217ad290>

In [46]:
pos = [np.array(thetas[key]) + 1e-2*np.random.randn(ndim) for i in range(nwalkers)]
std = madstd(sgram, 10)
print('Noise from MAD: {0}'.format(std))
sampler = emcee.EnsembleSampler(nwalkers, ndim, lnprob, args=(st['freq'], sgram, std, sigma_im))

end = sampler.run_mcmc(pos, nsteps)
fig = pl.figure(figsize=(10,5))
ax = fig.add_subplot(611)
plot = ax.plot(sampler.chain[::10,::10,0].transpose(), ',k')
ax = fig.add_subplot(612)
plot = ax.plot(sampler.chain[::10,::10,1].transpose(), ',k')
ax = fig.add_subplot(613)
plot = ax.plot(sampler.chain[::10,::10,2].transpose(), ',k')
ax = fig.add_subplot(614)
plot = ax.plot(sampler.chain[::10,::10,3].transpose(), ',k')
ax = fig.add_subplot(615)
plot = ax.plot(sampler.chain[::10,::10,4].transpose(), ',k')
ax = fig.add_subplot(616)
plot = ax.plot(sampler.chain[::10,::10,5].transpose(), ',k')


Noise from MAD: 0.0702135709684
2017-05-20 17:15:30,860 - py.warnings - WARNING - /Users/caseyjlaw/anaconda/lib/python2.7/site-packages/ipykernel/__main__.py:58: RuntimeWarning: invalid value encountered in sqrt


In [47]:
samples[key] = sampler.chain[:, 250:, :].reshape((-1, ndim))
fig = corner.corner(samples[key], labels=["a", "loc", "scale", "i0", "dm", "di"], show_titles=True)

print(sampler.acceptance_fraction.mean())
post[key] = zip(*np.percentile(samples[key], pct, axis=0))


0.488114285714

Model seventh burst


In [48]:
key = '57646'
di = 0.5
st, data, u, v, w = read[key]
scale = getscale(st)
sgram = correctdata(st, data*scale, u, v, w, corr='ph').mean(axis=3).mean(axis=1).real.transpose()
dm, i0, snr = dmmax[key]
a, loc, scale = poptg[key]
thetas[key] = a, loc, scale, i0, dm, di

dy, dx = sgram.shape
model = normdm(st['freq'], dx, dy, *thetas[key])
fig = pl.figure(figsize=(13,5))
ax = fig.add_subplot(121)
pl.imshow(model, interpolation='nearest', origin='bottom')
ax = fig.add_subplot(122)
pl.imshow(sgram, interpolation='nearest', origin='bottom')


Out[48]:
<matplotlib.image.AxesImage at 0x123cdeb50>

In [49]:
key = '57646'
pos = [np.array(thetas[key]) + 1e-2*np.random.randn(ndim) for i in range(nwalkers)]
std = madstd(sgram, 10)
print('Noise from MAD: {0}'.format(std))
sampler = emcee.EnsembleSampler(nwalkers, ndim, lnprob, args=(st['freq'], sgram, std, sigma_im))

end = sampler.run_mcmc(pos, nsteps)
fig = pl.figure(figsize=(10,5))
ax = fig.add_subplot(611)
plot = ax.plot(sampler.chain[::10,::10,0].transpose(), ',k')
ax = fig.add_subplot(612)
plot = ax.plot(sampler.chain[::10,::10,1].transpose(), ',k')
ax = fig.add_subplot(613)
plot = ax.plot(sampler.chain[::10,::10,2].transpose(), ',k')
ax = fig.add_subplot(614)
plot = ax.plot(sampler.chain[::10,::10,3].transpose(), ',k')
ax = fig.add_subplot(615)
plot = ax.plot(sampler.chain[::10,::10,4].transpose(), ',k')
ax = fig.add_subplot(616)
plot = ax.plot(sampler.chain[::10,::10,5].transpose(), ',k')


Noise from MAD: 0.0662998199018
2017-05-20 17:16:39,153 - py.warnings - WARNING - /Users/caseyjlaw/anaconda/lib/python2.7/site-packages/ipykernel/__main__.py:58: RuntimeWarning: invalid value encountered in sqrt


In [50]:
key = '57646'
samples[key] = sampler.chain[:, 250:, :].reshape((-1, ndim))
fig = corner.corner(samples[key], labels=["amp", "center", "$\sigma_{ch}$", "i0", "DM", "W$_{int}$"], 
                    label_kwargs={"fontsize": 16})

print(sampler.acceptance_fraction.mean())
post[key] = zip(*np.percentile(samples[key], pct, axis=0))
fig.savefig('corner57646.pdf', format='pdf')


0.4227

In [51]:
a, loc, scale, i0, dm, di = samples[key][100]
print(a, loc, scale, i0, dm, di)
dy, dx = sgram.shape
model = normdm(st['freq'], dx, dy, a, loc, scale, i0, dm, di)
zerr = std
err = np.where(model <= zerr, zerr, model)
weight = ((sgram-model)/zerr)**2

fig = pl.figure(figsize=(12,12))
ax = fig.add_subplot(141)
pl.imshow(model, origin='bottom', aspect='auto')
ax = fig.add_subplot(142)
pl.imshow(sgram, origin='bottom', aspect='auto')
ax = fig.add_subplot(143)
pl.imshow(err, origin='bottom', aspect='auto')
ax = fig.add_subplot(144)
pl.imshow(weight, origin='bottom', aspect='auto')
pl.tight_layout()
print(-0.5*np.sum(weight))


43.9829495566 9.91646895539 43.0135438079 47.5525113431 572.334762216 0.629119982118
-12506.2216706

Model eighth burst


In [52]:
key = '57648'
st, data, u, v, w = read[key]
scale = getscale(st)
sgram = correctdata(st, data*scale, u, v, w, corr='ph').mean(axis=3).mean(axis=1).real.transpose()
dm, i0, snr = dmmax[key]
a, loc, scale = poptg[key]
thetas[key] = a, loc, scale, i0, dm, di

dy, dx = sgram.shape
model = normdm(st['freq'], dx, dy, *thetas[key])
fig = pl.figure(figsize=(13,5))
ax = fig.add_subplot(121)
pl.imshow(model, interpolation='nearest', origin='bottom')
ax = fig.add_subplot(122)
pl.imshow(sgram, interpolation='nearest', origin='bottom')


Out[52]:
<matplotlib.image.AxesImage at 0x120b43890>

In [53]:
pos = [np.array(thetas[key]) + 1e-2*np.random.randn(ndim) for i in range(nwalkers)]
std = madstd(sgram, 10)
print('Noise from MAD: {0}'.format(std))
sampler = emcee.EnsembleSampler(nwalkers, ndim, lnprob, args=(st['freq'], sgram, std, sigma_im))

end = sampler.run_mcmc(pos, nsteps)
fig = pl.figure(figsize=(10,5))
ax = fig.add_subplot(611)
plot = ax.plot(sampler.chain[::10,::10,0].transpose(), ',k')
ax = fig.add_subplot(612)
plot = ax.plot(sampler.chain[::10,::10,1].transpose(), ',k')
ax = fig.add_subplot(613)
plot = ax.plot(sampler.chain[::10,::10,2].transpose(), ',k')
ax = fig.add_subplot(614)
plot = ax.plot(sampler.chain[::10,::10,3].transpose(), ',k')
ax = fig.add_subplot(615)
plot = ax.plot(sampler.chain[::10,::10,4].transpose(), ',k')
ax = fig.add_subplot(616)
plot = ax.plot(sampler.chain[::10,::10,5].transpose(), ',k')


Noise from MAD: 0.0682377214752
2017-05-20 17:17:45,893 - py.warnings - WARNING - /Users/caseyjlaw/anaconda/lib/python2.7/site-packages/ipykernel/__main__.py:58: RuntimeWarning: invalid value encountered in sqrt


In [54]:
samples[key] = sampler.chain[:, 200:, :].reshape((-1, ndim))
fig = corner.corner(samples[key], labels=["a", "loc", "scale", "i0", "dm", "di"], show_titles=True)

print(sampler.acceptance_fraction.mean())
post[key] = zip(*np.percentile(samples[key], pct, axis=0))


0.507914285714

In [55]:
a, loc, scale, i0, dm, di = samples[key][100]
dy, dx = sgram.shape
model = normdm(st['freq'], dx, dy, a, loc, scale, i0, dm, di)
zerr = std
err = np.where(model <= zerr, zerr, model)
to = 1
weight = ((sgram-model)/np.where(model > to*zerr, model, zerr))**2

fig = pl.figure(figsize=(12,12))
ax = fig.add_subplot(141)
pl.imshow(model, origin='bottom', aspect='auto')
ax = fig.add_subplot(142)
pl.imshow(sgram, origin='bottom', aspect='auto')
ax = fig.add_subplot(143)
pl.imshow(err, origin='bottom', aspect='auto')
ax = fig.add_subplot(144)
pl.imshow(weight, origin='bottom', aspect='auto')
pl.tight_layout()
print(-0.5*np.sum(weight))


-11532.2774838

Model ninth burst


In [56]:
key = '57649'
st, data, u, v, w = read[key]
scale = getscale(st)
sgram = correctdata(st, data*scale, u, v, w, corr='ph').mean(axis=3).mean(axis=1).real.transpose()
dm, i0, snr = dmmax[key]
a, loc, scale = poptg[key]
thetas[key] = a, loc, scale, i0, dm, di

dy, dx = sgram.shape
model = normdm(st['freq'], dx, dy, *thetas[key])
fig = pl.figure(figsize=(13,5))
ax = fig.add_subplot(121)
pl.imshow(model, interpolation='nearest', origin='bottom')
ax = fig.add_subplot(122)
pl.imshow(sgram, interpolation='nearest', origin='bottom')


Out[56]:
<matplotlib.image.AxesImage at 0x1235e5d10>

In [57]:
pos = [np.array(thetas[key]) + 1e-2*np.random.randn(ndim) for i in range(nwalkers)]
std = madstd(sgram, 10)
print('Noise from MAD: {0}'.format(std))
sampler = emcee.EnsembleSampler(nwalkers, ndim, lnprob, args=(st['freq'], sgram, std, sigma_im))

end = sampler.run_mcmc(pos, nsteps)
fig = pl.figure(figsize=(10,5))
ax = fig.add_subplot(611)
plot = ax.plot(sampler.chain[::10,::10,0].transpose(), ',k')
ax = fig.add_subplot(612)
plot = ax.plot(sampler.chain[::10,::10,1].transpose(), ',k')
ax = fig.add_subplot(613)
plot = ax.plot(sampler.chain[::10,::10,2].transpose(), ',k')
ax = fig.add_subplot(614)
plot = ax.plot(sampler.chain[::10,::10,3].transpose(), ',k')
ax = fig.add_subplot(615)
plot = ax.plot(sampler.chain[::10,::10,4].transpose(), ',k')
ax = fig.add_subplot(616)
plot = ax.plot(sampler.chain[::10,::10,5].transpose(), ',k')


Noise from MAD: 0.0699504987517
2017-05-20 17:18:57,776 - py.warnings - WARNING - /Users/caseyjlaw/anaconda/lib/python2.7/site-packages/ipykernel/__main__.py:58: RuntimeWarning: invalid value encountered in sqrt


In [58]:
samples[key] = sampler.chain[:, 300:, :].reshape((-1, ndim))
fig = corner.corner(samples[key], labels=["Amp", "Center", "$\sigma_ch$", "int", "DM", "dint"], 
                    show_titles=True, label_kwargs={"fontsize": 16})

print(sampler.acceptance_fraction.mean())
post[key] = zip(*np.percentile(samples[key], pct, axis=0))


0.491042857143

Inspect and visualize modeled temporal width and dm


In [59]:
dts = np.array([(5*post[key][5][1], 5*(post[key][5][1]-post[key][5][0]),
                5*(post[key][5][2]-post[key][5][1])) for key in sorted(post)])
dms = np.array([(post[key][4][1], post[key][4][1]-post[key][4][0],
                post[key][4][2]-post[key][4][1]) for key in sorted(post)])

print(dms, sorted(post.keys()))
print(dts, sorted(post.keys()))

[(key, post[key][5]) for key in post]


[[  5.68921217e+02   8.57865799e-01   8.64750309e-01]
 [  5.62371646e+02   2.64684556e+00   3.26285381e+00]
 [  5.68226771e+02   1.17861322e-01   1.10463654e-01]
 [  5.66257563e+02   3.77403918e+00   4.89974429e+00]
 [  5.65570954e+02   2.69208228e-01   2.56835865e-01]
 [  5.62686783e+02   2.66162274e+00   2.35976700e+00]
 [  5.68717171e+02   2.34886805e+00   2.81170664e+00]
 [  5.64347817e+02   1.07304537e+00   1.07724767e+00]
 [  5.66705557e+02   8.06722950e-01   8.41577653e-01]] ['57623', '57633_scan13', '57633_scan7', '57638', '57643', '57645', '57646', '57648', '57649']
[[ 2.01973677  0.08768145  0.07830553]
 [ 2.46615806  0.38854533  0.27699632]
 [ 2.05097192  0.0100679   0.01059643]
 [ 1.29683521  0.50990089  0.73375782]
 [ 1.86666387  0.04598048  0.03988636]
 [ 1.07049722  0.43774649  0.3280575 ]
 [ 1.97744469  0.50198001  1.17832926]
 [ 1.42170876  0.18991527  0.17169483]
 [ 2.09205496  0.2502721   0.24662906]] ['57623', '57633_scan13', '57633_scan7', '57638', '57643', '57645', '57646', '57648', '57649']
Out[59]:
[('57633_scan13',
  (0.41552254609571115, 0.49323161190071113, 0.5486308766674528)),
 ('57649', (0.36835657293415891, 0.41841099284804956, 0.46773680434270959)),
 ('57648', (0.24635869803464586, 0.28434175190242827, 0.3186807185143522)),
 ('57646', (0.29509293704362549, 0.39548893834332327, 0.6311547895394225)),
 ('57645', (0.12655014556783367, 0.21409944449136004, 0.27971094351851555)),
 ('57643', (0.36413667934399935, 0.37333277489144878, 0.38131004760212922)),
 ('57638', (0.15738686346280487, 0.25936704137960104, 0.40611860608182493)),
 ('57633_scan7',
  (0.40818080331117551, 0.41019438318500034, 0.41231366888151416)),
 ('57623', (0.38641106371812711, 0.40394735348354593, 0.41960845867361418))]

In [60]:
fig= pl.figure(figsize=(10,10))
ax = fig.add_subplot(211)
i=0
keys = ['57623', '57633_scan7', '57633_scan13', '57638', '57643', '57645', '57646', '57648', '57649']
times = [57623, 57633.6, 57633.8, 57638, 57643, 57645, 57646, 57648, 57649]
labels = dict(zip(keys, times))
#dms = []
#for key in keys:
#    a, loc, scale, i0, dm, di = post[key]
#    dms.append(dm)
#dms = np.array(dms)

#dmerr = np.array([(dm[1]-dm[0], dm[2]-dm[1]) for dm in dms]).transpose()
pl.errorbar(dms[:,0], times, xerr=dms[:,1:].transpose(), fmt='kx')
pl.plot([560.5, 560.5], [times[0], times[-1]], 'k--')
#ax.axhspan(556, 562, alpha=0.3, color='k')
#pl.xlim(-0.3,8.8)
ax.set_xlim(555, 575)
#pl.xlabel('DM (pc cm$^{-3}$)', fontsize=14)
pl.ylabel('Burst Epoch (MJD)', fontsize=16)
xt = pl.setp(ax.get_xticklabels(), fontsize=0)
yt = pl.setp(ax.get_yticklabels(), fontsize=16)
ax.xaxis.set_tick_params(width=3, color='k')
ax.yaxis.set_tick_params(width=3, color='k')

ax2 = fig.add_subplot(212, sharex=ax)
ax2.errorbar(dms[:,0], dts[:,0], yerr=dts[:,1:].transpose(), xerr=dms[:,1:].transpose(), fmt='k.')
ymin, ymax = ax2.get_ylim()
pl.plot([560.5, 560.5], [ymin, ymax], 'k--')
pl.ylabel('Temporal width (ms)', fontsize=16)
pl.xlabel('DM (pc/cm$^3$)', fontsize=16)
xt = pl.setp(ax2.get_xticklabels(), fontsize=16)
yt = pl.setp(ax2.get_yticklabels(), fontsize=16)
ax2.xaxis.set_tick_params(width=3, color='k')
ax2.yaxis.set_tick_params(width=3, color='k')
pl.tight_layout()
fig.savefig('burst_dmdt.pdf', format='pdf')



In [61]:
dme = dms[:,1:].mean(axis=1)
print( (dms[:,0]/dme**2).sum()/(1./dme**2).sum(), np.sqrt(1./(1./dme**2).sum()))


567.758686721 0.102412220606

In [62]:
((st['freq'][-1]-st['freq'][0])/delay(5, 2, st['freq'])[0])**(-1)


Out[62]:
0.0016311071567912706

Plot spectra and model


In [63]:
def norm(x, a, loc, scale):
    return a*scipy.stats.norm(loc, scale).pdf(x)

def fitandplot(spectrum, f0, popt_fixed=None, axis=(), label=None, noise=None):

    # create binned spectrum
    nch0 = len(spectrum)
    spec = []
    for ch in range(0, nch0, fbin):
        spec.append(spectrum[ch:ch+fbin].mean())  # last bin may have fewer than 4 channels. go with it.
    spec = np.array(spec)
    nch = len(spec)
    print('Binned from {0} to {1} channels'.format(nch0, nch))
    
    if not popt_fixed:
        bounds = ([1, 0, 1], [2000, 256/fbin, 50])
        popt, pcov = curve_fit(norm, np.arange(nch), spec, bounds=bounds)
    else:
        popt = popt_fixed

    normsol = norm(np.linspace(0, nch, nch0), *popt)

    fig = pl.figure(figsize=(15,7))
    ax = fig.add_subplot(111)
    pl.plot(range(nch0), spectrum, 'k.')
    pl.plot(np.arange(nch0), normsol, 'k')
    if label:
        pl.text(0.85, 0.89, label, horizontalalignment='left', fontsize=24,
                verticalalignment='center', transform=ax.transAxes)
    if noise:
        pl.errorbar(0.85*nch0, 0.93*spectrum.max(), yerr=noise, fmt='k.', ecolor='k')
        
    if len(axis):
        pl.axis(axis)
    pl.xlabel('Frequency (GHz)', fontsize=18)
    pl.ylabel('Flux density (Jy)', fontsize=18)
    pl.xlim(-4, nch0+4)
    pl.xticks(range(0, nch0+1, 32), [str(np.round(f0+ch*0.004, 2)) for ch in range(0, nch0+1, 32)])
    xt = pl.setp(ax.get_xticklabels(), fontsize=18)
    yt = pl.setp(ax.get_yticklabels(), fontsize=18)
    ax.xaxis.set_tick_params(width=4, color='k')
    ax.yaxis.set_tick_params(width=4, color='k')
    fig.savefig('spec_{0}.pdf'.format(label), format='pdf')
    return popt

In [64]:
fbin = 1
noise = 0.07 # typical 1 sigma noise per channel per integration in Jy
for key in sorted(snrdet.keys()):
    print(key)
    st, data, u, v, w = read[key]
    spec = spectrum[key].mean(axis=1)

    a, loc, scale, i0, dm, di = post[key]
    fitandplot(spec, st['freq'][0], popt_fixed=(a[1], loc[1], scale[1]), noise=noise, label=labels[key])
    print('Already fit {0} (E, DM, peak, center, fwhm): {1:2.1f} & {2:.1f} & {3:3.0f} & {4:1.1f} & {5:.0f}'.format(
            key,
            np.round(lum_ext(972e6*3.1e18, (a[1], loc[1], scale[1]))/1e38, 1),
            dm[1],
            np.round(1e3*a[1]/sc(scale[1]), -1),
            2.5+fbin*0.004*loc[1],
            np.round(2.355*fbin*4*scale[1], -1)))


57623
Binned from 256 to 256 channels
Already fit 57623 (E, DM, peak, center, fwhm): 11.4 & 568.9 & 700 & 2.8 & 290
57633_scan13
Binned from 256 to 256 channels
Already fit 57633_scan13 (E, DM, peak, center, fwhm): 7.2 & 562.4 & 440 & 2.5 & 290
57633_scan7
Binned from 256 to 256 channels
Already fit 57633_scan7 (E, DM, peak, center, fwhm): 97.5 & 568.2 & 3350 & 3.2 & 510
57638
Binned from 254 to 254 channels
Already fit 57638 (E, DM, peak, center, fwhm): 3.1 & 566.3 & 130 & 3.1 & 410
57643
Binned from 256 to 256 channels
Already fit 57643 (E, DM, peak, center, fwhm): 34.0 & 565.6 & 1170 & 2.8 & 510
57645
Binned from 252 to 252 channels
Already fit 57645 (E, DM, peak, center, fwhm): 3.7 & 562.7 & 170 & 2.8 & 380
57646
Binned from 253 to 253 channels
Already fit 57646 (E, DM, peak, center, fwhm): 10.0 & 568.7 & 410 & 2.5 & 420
57648
Binned from 254 to 254 channels
Already fit 57648 (E, DM, peak, center, fwhm): 6.9 & 564.3 & 260 & 2.8 & 470
57649
Binned from 256 to 256 channels
Already fit 57649 (E, DM, peak, center, fwhm): 11.6 & 566.7 & 300 & 3.0 & 690

Playing with difference between model and data


In [65]:
def fitanddiff(spectrum, popt, noise=0.07):

    # create binned spectrum
    nch = len(spectrum)
    spec = spectrum.mean(axis=1)
    
    normsol = norm(np.linspace(0, nch, nch), *popt)
#    diff = (spec-normsol)/(normsol+noise)
#    diff = (spec-normsol)/normsol
    diff = spec/normsol

    return diff[np.where(normsol > 5*noise)]

In [66]:
fluxes = []
diffs = []
for key in snrdet.keys():
    a, loc, scale, i0, dm, di = post[key]
    popt = (a[1], loc[1], scale[1])
    diff = fitanddiff(spectrum[key], popt)
    diffs.append(diff)
#    fluxes.append(spectrum[key].mean(axis=1))
diffs = np.concatenate(diffs)
#fluxes = np.concatenate(fluxes)

In [67]:
counts, bins = pl.histogram(diffs, bins=50)
binc = [(bins[i+1]+bins[i])/2 for i in range(len(bins)-1)]
pl.plot(binc, counts.astype(float)/counts.sum(), 'k.')


Out[67]:
[<matplotlib.lines.Line2D at 0x120aa0150>]

A negative mean and positive skew in the difference relative to the model.

This may point to how the model is biased upwards by the exponential distribution of scintillation amplification


In [68]:
# https://en.wikipedia.org/wiki/Exponentially_modified_Gaussian_distribution
from scipy.special import erfc
emnd = lambda x, mu, sig, ll: (ll/2.)*np.exp((ll/2.)*(2*mu+ll*sig**2 - 2.*x))*erfc((mu+ll*sig**2-x)/(np.sqrt(2)*sig))

In [69]:
counts, bins = pl.histogram(diffs, bins=50)
binc = [(bins[i+1]+bins[i])/2 for i in range(len(bins)-1)]
pl.plot(binc, counts.astype(float)/counts.sum(), 'k.')
model = emnd(np.array(binc), 0.4, 0.3, 2)
pl.plot(binc, model/model.sum(), 'k')
model2 = emnd(np.array(binc), 1, 1, 20) # sig=1?
pl.plot(binc, model2/model2.sum(), 'r')


Out[69]:
[<matplotlib.lines.Line2D at 0x128301490>]

In [70]:
# how much of Gaussian model is actually measured within S band?
for key in sorted(snrdet.keys()):
    a, loc, scale, i0, dm, di = post[key]
    nch = len(spectrum[key])
    popt = (a[1], loc[1], scale[1])
    inband = norm(np.linspace(0, nch, nch), *popt)
    total = norm(np.linspace(-100, nch+100, nch+200), *popt)
    print(labels[key], inband.sum()/total.sum())


57623 0.987756442493
57633.8 0.576481493141
57633.6 0.943276552622
57638 0.991884018813
57643 0.910261478478
57645 0.97657643873
57646 0.538984388697
57648 0.949379337951
57649 0.920268335761

Spectral autocorrelation


In [71]:
def plot_acf(st, data, u, v, w, integ, popt=None):
    fig = pl.figure(figsize=(8,5))
    ax = fig.add_subplot(111)

    dataphdm = correct_all(st, data, u, v, w)
    spec = dataphdm[integ].mean(axis=2).mean(axis=0).real
    spec_off = dataphdm[integ+3].mean(axis=2).mean(axis=0).real
    nch = len(spec)
    if popt:
        spec_mod = norm(np.arange(nch), *popt)

    ac = np.correlate(spec, spec, mode='same')
    if popt:
        ac_mod = np.correlate(spec_mod, spec_mod, mode='same')
    ac_off = np.correlate(spec_off, spec_off, mode='same')

    pl.plot(ac, 'k.', label="Burst {0}".format(labels[key]))
    pl.plot(ac_off, 'k--', label="Off burst")
    if popt:
        pl.plot(ac_mod, 'k.', label="Model burst", ms=2)   

    pl.xlabel('Delay (MHz)', fontsize=14)
    pl.ylabel('Autocorrelation power (Jy$^2$)', fontsize=14)
    xt = pl.setp(ax.get_xticklabels(), fontsize=14)
    yt = pl.setp(ax.get_yticklabels(), fontsize=14)
    ax.xaxis.set_tick_params(width=2, color='k')
    ax.yaxis.set_tick_params(width=2, color='k')
    pl.xticks(np.linspace(0, 256, 8), [str(int(4.0*(ch-128))) for ch in np.linspace(0, 256, 8)])
    pl.xlim(127.,256)
    pl.legend()

In [72]:
for key in snrdet.keys():
    print(key)
    integ = int(dmmax[key][1])
    st, data, u, v, w = read[key]
    a, loc, scale, i0, dm, di = post[key]
    popt = (a[1], loc[1], scale[1])
    plot_acf(st, data, u, v, w, integ, popt=popt)
    break


57633_scan7

Spectral modulation


In [73]:
win = 16
specmod = lambda da: np.sqrt((np.mean(da**2) - np.mean(da)**2)/(np.mean(da)**2))
modi = lambda da: da.mean()/da.std()

In [74]:
sms = {}
mis = {}
mns = {}
keys = sorted(spectrum.keys())
for key in keys:
    spec = spectrum[key].mean(axis=1)
    sm = np.array([specmod(spec[i*win:(i+1)*win]) for i in range(256/win)])
    mi = np.array([modi(spec[i*win:(i+1)*win]) for i in range(256/win)])
    mn = np.array([spec[i*win:(i+1)*win].mean() for i in range(256/win)])
    sms[key] = sm
    mis[key] = mi
    mns[key] = mn

In [75]:
fig = pl.figure(figsize=(12,12))
for i in range(len(keys)):
    ax = fig.add_subplot(3,3,i+1)
    if i in [0, 3, 6]:
        pl.ylabel('Flux (black) and log10(specmod) (blue))')
    if i in  [6, 7, 8]:
        pl.xlabel('Freq bin')
    ax.plot(spectrum[keys[i]].mean(axis=1), 'k')
    ax.plot(8+np.arange(win)*16, np.log10(sms[keys[i]]), 'b*')
    ax.plot(8+np.arange(win)*16, np.log10(mis[keys[i]]), 'r*')
    ax.set_title(labels[keys[i]])


2017-05-20 17:20:12,394 - py.warnings - WARNING - /Users/caseyjlaw/anaconda/lib/python2.7/site-packages/ipykernel/__main__.py:10: RuntimeWarning: invalid value encountered in log10


In [76]:
for key in keys:
    print(key, mis[key][np.where(mns[key] > 0.1)].mean())


57623 1.65497
57633_scan13 1.76116
57633_scan7 1.83987
57638 1.3979
57643 1.98928
57645 1.70024
57646 1.92683
57648 1.54553
57649 1.47389