def main(): # Question 1 sol1 = create_array() print 'The 2-D array is \n', sol1.array print '\n' print 'The new array for question 1a is \n', sol1.picking_row() print '\n' print 'The new array for question 1b is \n', sol1.picking_column() print '\n' print 'The new array for question 1c is \n', sol1.picking_section() print '\n' print 'The new array for question 1d is \n', sol1.picking_range() print '\n' # Question 2 print 'The array for question 2 is \n', divide_array() print '\n' # Question 3 generate_randArray() print '\n' # Question 4 candidate_set = mandelbrot(500) candidate_set.mandelbrot_iter() candidate_set.form_mask()
def test_create_array(self): ans = create_array() # correct array picked manually correct_array = np.array([[1, 6, 11], [2, 7, 12], [3, 8, 13], [4, 9, 14], [5, 10, 15]]) correct_a = np.array([[2, 7, 12], [4, 9, 14]]) correct_b = np.array([[6], [7], [8], [9], [10]]) correct_c = np.array([[2, 7, 12], [3, 8, 13], [4, 9, 14]]) correct_d = np.array([6, 11, 7, 3, 8, 4, 9, 5, 10]) self.assertTrue(np.array_equal(correct_array, ans.array)) self.assertTrue(np.array_equal(correct_a, ans.picking_row())) self.assertTrue(np.array_equal(correct_b, ans.picking_column())) self.assertTrue(np.array_equal(correct_c, ans.picking_section())) self.assertTrue(np.array_equal(correct_d, ans.picking_range()))