def test_rotate_submap_edge(aia171_test_map, all_off_disk_map, all_on_disk_map, straddles_limb_map): observer = get_earth(aia171_test_map.date + 2*u.day) # For a map that has all the edges off disk, the function should # return just the edges of the map - no solar rotation applied. for this_map in (aia171_test_map, all_off_disk_map): edges = map_edges(this_map) for this_edge in range(0, 4): pixels = edges[this_edge] res = _rotate_submap_edge(this_map, pixels, observer) assert all(res.Tx == (this_map.pixel_to_world(pixels[:, 0], pixels[:, 1])).Tx) assert all(res.Ty == (this_map.pixel_to_world(pixels[:, 0], pixels[:, 1])).Ty) # For an on disk map, all the edges should change edges = map_edges(all_on_disk_map) for this_edge in range(0, 4): pixels = edges[this_edge] res = _rotate_submap_edge(all_on_disk_map, pixels, observer) assert all(res.Tx != (all_on_disk_map.pixel_to_world(pixels[:, 0], pixels[:, 1])).Tx) assert all(res.Ty != (all_on_disk_map.pixel_to_world(pixels[:, 0], pixels[:, 1])).Ty) # For the limb map, two of the edges move and two do not edges = map_edges(straddles_limb_map) for this_edge in (0, 3): # Top and right edges do not move pixels = edges[this_edge] res = _rotate_submap_edge(straddles_limb_map, pixels, observer) assert all(res.Tx == (straddles_limb_map.pixel_to_world(pixels[:, 0], pixels[:, 1])).Tx) assert all(res.Ty == (straddles_limb_map.pixel_to_world(pixels[:, 0], pixels[:, 1])).Ty) for this_edge in (1, 2): # Bottom and left edges do move pixels = edges[this_edge] res = _rotate_submap_edge(straddles_limb_map, pixels, observer) assert all(res.Tx != (straddles_limb_map.pixel_to_world(pixels[:, 0], pixels[:, 1])).Tx) assert all(res.Ty != (straddles_limb_map.pixel_to_world(pixels[:, 0], pixels[:, 1])).Ty)
def test_rotate_submap_edge(aia171_test_map, all_off_disk_map, all_on_disk_map, straddles_limb_map): observer = get_earth(aia171_test_map.date + 2 * u.day) # For a map that has all the edges off disk, the function should # return just the edges of the map - no solar rotation applied. for this_map in (aia171_test_map, all_off_disk_map): edges = map_edges(this_map) for this_edge in range(0, 4): pixels = edges[this_edge] res = _rotate_submap_edge(this_map, pixels, observer) assert all( res.Tx == (this_map.pixel_to_world(pixels[:, 0], pixels[:, 1])).Tx) assert all( res.Ty == (this_map.pixel_to_world(pixels[:, 0], pixels[:, 1])).Ty) # For an on disk map, all the edges should change edges = map_edges(all_on_disk_map) for this_edge in range(0, 4): pixels = edges[this_edge] res = _rotate_submap_edge(all_on_disk_map, pixels, observer) assert all(res.Tx != ( all_on_disk_map.pixel_to_world(pixels[:, 0], pixels[:, 1])).Tx) assert all(res.Ty != ( all_on_disk_map.pixel_to_world(pixels[:, 0], pixels[:, 1])).Ty) # For the limb map, two of the edges move and two do not edges = map_edges(straddles_limb_map) for this_edge in (0, 3): # Top and right edges do not move pixels = edges[this_edge] res = _rotate_submap_edge(straddles_limb_map, pixels, observer) assert all(res.Tx == ( straddles_limb_map.pixel_to_world(pixels[:, 0], pixels[:, 1])).Tx) assert all(res.Ty == ( straddles_limb_map.pixel_to_world(pixels[:, 0], pixels[:, 1])).Ty) for this_edge in (1, 2): # Bottom and left edges do move pixels = edges[this_edge] res = _rotate_submap_edge(straddles_limb_map, pixels, observer) # Ignore some invalid NaN comparisions within astropy # (fixed in astropy 4.0.1 https://github.com/astropy/astropy/pull/9843) with np.errstate(invalid='ignore'): assert all(res.Tx != ( straddles_limb_map.pixel_to_world(pixels[:, 0], pixels[:, 1])).Tx) assert all(res.Ty != ( straddles_limb_map.pixel_to_world(pixels[:, 0], pixels[:, 1])).Ty)
def test_map_edges(all_off_disk_map): edges = map_edges(all_off_disk_map) assert type(edges) is tuple assert len(edges[2]) == 11 assert np.all(edges[2][0] == [0, 0] * u.pix) assert np.all(edges[2][10] == [0, 10] * u.pix) assert len(edges[3]) == 11 assert np.all(edges[3][0] == [9, 0] * u.pix) assert np.all(edges[3][10] == [9, 10] * u.pix) assert len(edges[1]) == 10 assert np.all(edges[1][0] == [0, 0] * u.pix) assert np.all(edges[1][9] == [9, 0] * u.pix) assert len(edges[0]) == 10 assert np.all(edges[0][0] == [0, 10] * u.pix) assert np.all(edges[0][9] == [9, 10] * u.pix)