# or can compute the cp data manually: #th, r = ctf.cart2pol(xx, yy) #cpx, cpy = ctf.pol2cart(th, 1.1) # no banding in this code, so just set band to everything band = range(0, len(x1d)*len(y1d)) #x = xx[band] #y = yy[band] #xy = xy[band,:] x = xx y = yy g1 = cpGrid.cpGrid(x1d, y1d, [dx,dy]) g1.cpx = cpx g1.cpy = cpy g1.band = band g1.dist = dist g1.x = x g1.y = y g1.xy = xy #IJ = cpGrid.i2s(xxg.shape,band) # a grid nows how to convert subscripts to linear indices and vice-versa g1.ij = g1.ind2sub(band) # double check #band_check = g1.sub2ind(g1.ij)
# or can compute the cp data manually: # th, r = ctf.cart2pol(xx, yy) # cpx, cpy = ctf.pol2cart(th, 1.1) # no banding in this code, so just set band to everything band = range(0, len(x1d) * len(y1d)) # x = xx[band] # y = yy[band] # xy = xy[band,:] x = xx y = yy g1 = cpGrid.cpGrid(x1d, y1d, [dx, dy]) g1.cpx = cpx g1.cpy = cpy g1.band = band g1.dist = dist g1.x = x g1.y = y g1.xy = xy # IJ = cpGrid.i2s(xxg.shape,band) # a grid nows how to convert subscripts to linear indices and vice-versa g1.ij = g1.ind2sub(band) # double check # band_check = g1.sub2ind(g1.ij)
# band. The formula for bw is found in [Ruuth & Merriman 2008] and # the 1.0001 is a safety factor. bw = 1.0001 * np.sqrt((dim - 1) * ((p + 1) / 2)**2 + ((1 + (p + 1) / 2)**2)) # this comma is signficant band, = np.nonzero(np.abs(dist) <= bw * dx) cpx = cpx[band] cpy = cpy[band] dist = dist[band] #bdy = bdy[band] x = xx[band] y = yy[band] xy = xy[band, :] g1 = cpGrid.cpGrid(x1d, y1d, dx) g1.cpx = cpx g1.cpy = cpy g1.band = band g1.dist = dist g1.x = x g1.y = y g1.xy = xy #IJ = cpGrid.i2s(xxg.shape,band) # a grid nows how to convert subscripts to linear indices and vice-versa g1.ij = g1.ind2sub(band) # double check #band_check = g1.sub2ind(g1.ij)
# band. The formula for bw is found in [Ruuth & Merriman 2008] and # the 1.0001 is a safety factor. bw = 1.0001 * np.sqrt((dim - 1) * ((p + 1) / 2) ** 2 + ((1 + (p + 1) / 2) ** 2)) # this comma is signficant band, = np.nonzero(np.abs(dist) <= bw * dx) cpx = cpx[band] cpy = cpy[band] dist = dist[band] # bdy = bdy[band] x = xx[band] y = yy[band] xy = xy[band, :] g1 = cpGrid.cpGrid(x1d, y1d, dx) g1.cpx = cpx g1.cpy = cpy g1.band = band g1.dist = dist g1.x = x g1.y = y g1.xy = xy # IJ = cpGrid.i2s(xxg.shape,band) # a grid nows how to convert subscripts to linear indices and vice-versa g1.ij = g1.ind2sub(band) # double check # band_check = g1.sub2ind(g1.ij)