Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
snrmask = np.abs(clamparr['camp']/clamparr['sigmaca']) > snrcut
uv1 = np.hstack((clamparr['u1'].reshape(-1,1), clamparr['v1'].reshape(-1,1)))[snrmask]
uv2 = np.hstack((clamparr['u2'].reshape(-1,1), clamparr['v2'].reshape(-1,1)))[snrmask]
uv3 = np.hstack((clamparr['u3'].reshape(-1,1), clamparr['v3'].reshape(-1,1)))[snrmask]
uv4 = np.hstack((clamparr['u4'].reshape(-1,1), clamparr['v4'].reshape(-1,1)))[snrmask]
clamp = clamparr['camp'][snrmask]
sigma = clamparr['sigmaca'][snrmask]
# data weighting
if weighting=='uniform':
sigma = np.median(sigma) * np.ones(len(sigma))
# get NFFT info
npad = int(fft_pad_factor * np.max((Prior.xdim, Prior.ydim)))
A1 = NFFTInfo(Prior.xdim, Prior.ydim, Prior.psize, Prior.pulse, npad, p_rad, uv1)
A2 = NFFTInfo(Prior.xdim, Prior.ydim, Prior.psize, Prior.pulse, npad, p_rad, uv2)
A3 = NFFTInfo(Prior.xdim, Prior.ydim, Prior.psize, Prior.pulse, npad, p_rad, uv3)
A4 = NFFTInfo(Prior.xdim, Prior.ydim, Prior.psize, Prior.pulse, npad, p_rad, uv4)
A = [A1,A2,A3,A4]
return (clamp, sigma, A)
uv2 = np.hstack((clamparr['u2'].reshape(-1,1), clamparr['v2'].reshape(-1,1)))[snrmask]
uv3 = np.hstack((clamparr['u3'].reshape(-1,1), clamparr['v3'].reshape(-1,1)))[snrmask]
uv4 = np.hstack((clamparr['u4'].reshape(-1,1), clamparr['v4'].reshape(-1,1)))[snrmask]
clamp = clamparr['camp'][snrmask]
sigma = clamparr['sigmaca'][snrmask]
# data weighting
if weighting=='uniform':
sigma = np.median(sigma) * np.ones(len(sigma))
# get NFFT info
npad = int(fft_pad_factor * np.max((Prior.xdim, Prior.ydim)))
A1 = NFFTInfo(Prior.xdim, Prior.ydim, Prior.psize, Prior.pulse, npad, p_rad, uv1)
A2 = NFFTInfo(Prior.xdim, Prior.ydim, Prior.psize, Prior.pulse, npad, p_rad, uv2)
A3 = NFFTInfo(Prior.xdim, Prior.ydim, Prior.psize, Prior.pulse, npad, p_rad, uv3)
A4 = NFFTInfo(Prior.xdim, Prior.ydim, Prior.psize, Prior.pulse, npad, p_rad, uv4)
A = [A1,A2,A3,A4]
return (clamp, sigma, A)
uv1 = np.hstack((clphasearr['u1'].reshape(-1,1), clphasearr['v1'].reshape(-1,1)))[snrmask]
uv2 = np.hstack((clphasearr['u2'].reshape(-1,1), clphasearr['v2'].reshape(-1,1)))[snrmask]
uv3 = np.hstack((clphasearr['u3'].reshape(-1,1), clphasearr['v3'].reshape(-1,1)))[snrmask]
clphase = clphasearr['cphase'][snrmask]
sigma = clphasearr['sigmacp'][snrmask]
#add systematic cphase noise (in DEGREES)
sigma = np.linalg.norm([sigma, systematic_cphase_noise*np.ones(len(sigma))], axis=0)
# data weighting
if weighting=='uniform':
sigma = np.median(sigma) * np.ones(len(sigma))
# get NFFT info
npad = int(fft_pad_factor * np.max((Prior.xdim, Prior.ydim)))
A1 = NFFTInfo(Prior.xdim, Prior.ydim, Prior.psize, Prior.pulse, npad, p_rad, uv1)
A2 = NFFTInfo(Prior.xdim, Prior.ydim, Prior.psize, Prior.pulse, npad, p_rad, uv2)
A3 = NFFTInfo(Prior.xdim, Prior.ydim, Prior.psize, Prior.pulse, npad, p_rad, uv3)
A = [A1,A2,A3]
return (clphase, sigma, A)
uv1 = np.hstack((clamparr['u1'].reshape(-1,1), clamparr['v1'].reshape(-1,1)))[snrmask]
uv2 = np.hstack((clamparr['u2'].reshape(-1,1), clamparr['v2'].reshape(-1,1)))[snrmask]
uv3 = np.hstack((clamparr['u3'].reshape(-1,1), clamparr['v3'].reshape(-1,1)))[snrmask]
uv4 = np.hstack((clamparr['u4'].reshape(-1,1), clamparr['v4'].reshape(-1,1)))[snrmask]
clamp = clamparr['camp'][snrmask]
sigma = clamparr['sigmaca'][snrmask]
# data weighting
if weighting=='uniform':
sigma = np.median(sigma) * np.ones(len(sigma))
# get NFFT info
npad = int(fft_pad_factor * np.max((Prior.xdim, Prior.ydim)))
A1 = NFFTInfo(Prior.xdim, Prior.ydim, Prior.psize, Prior.pulse, npad, p_rad, uv1)
A2 = NFFTInfo(Prior.xdim, Prior.ydim, Prior.psize, Prior.pulse, npad, p_rad, uv2)
A3 = NFFTInfo(Prior.xdim, Prior.ydim, Prior.psize, Prior.pulse, npad, p_rad, uv3)
A4 = NFFTInfo(Prior.xdim, Prior.ydim, Prior.psize, Prior.pulse, npad, p_rad, uv4)
A = [A1,A2,A3,A4]
return (clamp, sigma, A)
uv1 = np.hstack((clphasearr['u1'].reshape(-1,1), clphasearr['v1'].reshape(-1,1)))[snrmask]
uv2 = np.hstack((clphasearr['u2'].reshape(-1,1), clphasearr['v2'].reshape(-1,1)))[snrmask]
uv3 = np.hstack((clphasearr['u3'].reshape(-1,1), clphasearr['v3'].reshape(-1,1)))[snrmask]
clphase = clphasearr['cphase'][snrmask]
sigma = clphasearr['sigmacp'][snrmask]
#add systematic cphase noise (in DEGREES)
sigma = np.linalg.norm([sigma, systematic_cphase_noise*np.ones(len(sigma))], axis=0)
# data weighting
if weighting=='uniform':
sigma = np.median(sigma) * np.ones(len(sigma))
# get NFFT info
npad = int(fft_pad_factor * np.max((Prior.xdim, Prior.ydim)))
A1 = NFFTInfo(Prior.xdim, Prior.ydim, Prior.psize, Prior.pulse, npad, p_rad, uv1)
A2 = NFFTInfo(Prior.xdim, Prior.ydim, Prior.psize, Prior.pulse, npad, p_rad, uv2)
A3 = NFFTInfo(Prior.xdim, Prior.ydim, Prior.psize, Prior.pulse, npad, p_rad, uv3)
A = [A1,A2,A3]
return (clphase, sigma, A)
snrcut = kwargs.get('snrcut',0.)
debias = kwargs.get('debias',True)
weighting = kwargs.get('weighting','natural')
fft_pad_factor = kwargs.get('fft_pad_factor',FFT_PAD_DEFAULT)
p_rad = kwargs.get('p_rad', GRIDDER_P_RAD_DEFAULT)
# unpack data
data_arr = Obsdata.unpack(['t1','t2','u','v','vis','amp','sigma'], debias=debias)
(uv, vis, amp, sigma) = apply_systematic_noise_snrcut(data_arr, systematic_noise, snrcut)
# data weighting
if weighting=='uniform':
sigma = np.median(sigma) * np.ones(len(sigma))
# get NFFT info
npad = int(fft_pad_factor * np.max((Prior.xdim, Prior.ydim)))
A1 = NFFTInfo(Prior.xdim, Prior.ydim, Prior.psize, Prior.pulse, npad, p_rad, uv)
A = [A1]
return (vis, sigma, A)
uv2 = np.hstack((clamparr['u2'].reshape(-1,1), clamparr['v2'].reshape(-1,1)))[snrmask]
uv3 = np.hstack((clamparr['u3'].reshape(-1,1), clamparr['v3'].reshape(-1,1)))[snrmask]
uv4 = np.hstack((clamparr['u4'].reshape(-1,1), clamparr['v4'].reshape(-1,1)))[snrmask]
clamp = clamparr['camp'][snrmask]
sigma = clamparr['sigmaca'][snrmask]
# data weighting
if weighting=='uniform':
sigma = np.median(sigma) * np.ones(len(sigma))
# get NFFT info
npad = int(fft_pad_factor * np.max((Prior.xdim, Prior.ydim)))
A1 = NFFTInfo(Prior.xdim, Prior.ydim, Prior.psize, Prior.pulse, npad, p_rad, uv1)
A2 = NFFTInfo(Prior.xdim, Prior.ydim, Prior.psize, Prior.pulse, npad, p_rad, uv2)
A3 = NFFTInfo(Prior.xdim, Prior.ydim, Prior.psize, Prior.pulse, npad, p_rad, uv3)
A4 = NFFTInfo(Prior.xdim, Prior.ydim, Prior.psize, Prior.pulse, npad, p_rad, uv4)
A = [A1,A2,A3,A4]
return (clamp, sigma, A)
uv1 = np.hstack((clamparr['u1'].reshape(-1,1), clamparr['v1'].reshape(-1,1)))[snrmask]
uv2 = np.hstack((clamparr['u2'].reshape(-1,1), clamparr['v2'].reshape(-1,1)))[snrmask]
uv3 = np.hstack((clamparr['u3'].reshape(-1,1), clamparr['v3'].reshape(-1,1)))[snrmask]
uv4 = np.hstack((clamparr['u4'].reshape(-1,1), clamparr['v4'].reshape(-1,1)))[snrmask]
clamp = clamparr['camp'][snrmask]
sigma = clamparr['sigmaca'][snrmask]
# data weighting
if weighting=='uniform':
sigma = np.median(sigma) * np.ones(len(sigma))
# get NFFT info
npad = int(fft_pad_factor * np.max((Prior.xdim, Prior.ydim)))
A1 = NFFTInfo(Prior.xdim, Prior.ydim, Prior.psize, Prior.pulse, npad, p_rad, uv1)
A2 = NFFTInfo(Prior.xdim, Prior.ydim, Prior.psize, Prior.pulse, npad, p_rad, uv2)
A3 = NFFTInfo(Prior.xdim, Prior.ydim, Prior.psize, Prior.pulse, npad, p_rad, uv3)
A4 = NFFTInfo(Prior.xdim, Prior.ydim, Prior.psize, Prior.pulse, npad, p_rad, uv4)
A = [A1,A2,A3,A4]
return (clamp, sigma, A)
uv1 = np.hstack((biarr['u1'].reshape(-1,1), biarr['v1'].reshape(-1,1)))[snrmask]
uv2 = np.hstack((biarr['u2'].reshape(-1,1), biarr['v2'].reshape(-1,1)))[snrmask]
uv3 = np.hstack((biarr['u3'].reshape(-1,1), biarr['v3'].reshape(-1,1)))[snrmask]
bi = biarr['bispec'][snrmask]
sigma = biarr['sigmab'][snrmask]
#add systematic noise
#sigma = np.linalg.norm([biarr['sigmab'], systematic_noise*np.abs(biarr['bispec'])], axis=0)[snrmask]
# data weighting
if weighting=='uniform':
sigma = np.median(sigma) * np.ones(len(sigma))
# get NFFT info
npad = int(fft_pad_factor * np.max((Prior.xdim, Prior.ydim)))
A1 = NFFTInfo(Prior.xdim, Prior.ydim, Prior.psize, Prior.pulse, npad, p_rad, uv1)
A2 = NFFTInfo(Prior.xdim, Prior.ydim, Prior.psize, Prior.pulse, npad, p_rad, uv2)
A3 = NFFTInfo(Prior.xdim, Prior.ydim, Prior.psize, Prior.pulse, npad, p_rad, uv3)
A = [A1,A2,A3]
return (bi, sigma, A)
uv2 = np.hstack((biarr['u2'].reshape(-1,1), biarr['v2'].reshape(-1,1)))[snrmask]
uv3 = np.hstack((biarr['u3'].reshape(-1,1), biarr['v3'].reshape(-1,1)))[snrmask]
bi = biarr['bispec'][snrmask]
sigma = biarr['sigmab'][snrmask]
#add systematic noise
#sigma = np.linalg.norm([biarr['sigmab'], systematic_noise*np.abs(biarr['bispec'])], axis=0)[snrmask]
# data weighting
if weighting=='uniform':
sigma = np.median(sigma) * np.ones(len(sigma))
# get NFFT info
npad = int(fft_pad_factor * np.max((Prior.xdim, Prior.ydim)))
A1 = NFFTInfo(Prior.xdim, Prior.ydim, Prior.psize, Prior.pulse, npad, p_rad, uv1)
A2 = NFFTInfo(Prior.xdim, Prior.ydim, Prior.psize, Prior.pulse, npad, p_rad, uv2)
A3 = NFFTInfo(Prior.xdim, Prior.ydim, Prior.psize, Prior.pulse, npad, p_rad, uv3)
A = [A1,A2,A3]
return (bi, sigma, A)