def test_01_01_test_3(self): expected = np.array(((0, 0), (1, 1), (2, 0), (2, 2), (3, 1), (3, 3)), int) result = np.array(z.get_zernike_indexes(4)) order = np.lexsort((result[:, 1], result[:, 0])) result = result[order] self.assertTrue(np.all(expected == result))
def get_zernike_indexes(self, wants_negative = False): '''Get an N x 2 numpy array containing the M and N Zernike degrees Use the radial_degree setting to determine which Zernikes to do. wants_negative - if True, return both positive and negative M, if false return only positive ''' zi = get_zernike_indexes(self.radial_degree.value + 1) if wants_negative: # # np.vstack means concatenate rows of two 2d arrays. # The multiplication by [1, -1] negates every m, but preserves n. # zi[zi[:, 1] != 0] picks out only elements with m not equal to zero. # zi = np.vstack([zi, zi[zi[:, 1] != 0]*np.array([1, -1])]) # # Sort by azimuth degree and radial degree so they are ordered # reasonably # order = np.lexsort((zi[:, 1], zi[:, 0])) zi = zi[order, :] return zi
def get_zernike_indexes(self, wants_negative = False): '''Get an N x 2 numpy array containing the M and N Zernike degrees Use the radial_degree setting to determine which Zernikes to do. wants_negative - if True, return both positive and negative M, if false return only positive ''' zi = get_zernike_indexes(self.radial_degree.value + 1) if wants_negative: # # np.vstack means concatenate rows of two 2d arrays. # The multiplication by [1, -1] negates every m, but preserves n. # zi[zi[:, 1] != 0] picks out only elements with m not equal to zero. # zi = np.vstack([zi, zi[zi[:, 1] != 0]*np.array([1, -1])]) # # Sort by azimuth degree and radial degree so they are ordered # reasonably # order = np.lexsort((zi[:, 1], zi[:, 0])) zi = zi[order, :] return zi
def test_01_01_test_3(self): expected = np.array(((0,0),(1,1),(2,0),(2,2),(3,1),(3,3)),int) result = np.array(z.get_zernike_indexes(4)) order = np.lexsort((result[:,1],result[:,0])) result = result[order] self.assertTrue(np.all(expected == result))
def get_zernike_numbers(self): """The Zernike numbers measured by this module""" if self.calculate_zernikes.value: return cpmz.get_zernike_indexes(ZERNIKE_N+1) else: return []
def get_zernike_numbers(self): """The Zernike numbers measured by this module""" if self.calculate_zernikes.value: return cpmz.get_zernike_indexes(ZERNIKE_N + 1) else: return []