def test_calculate_solar_rotate_shift(aia171_test_mapcube, known_displacements_layer_index0, known_displacements_layer_index1): # Test that the default works test_output = calculate_solar_rotate_shift(aia171_test_mapcube) assert_allclose(test_output['x'].to('arcsec').value, known_displacements_layer_index0['x'], rtol=5e-2, atol=0) assert_allclose(test_output['y'].to('arcsec').value, known_displacements_layer_index0['y'], rtol=5e-2, atol=0) # Test that the rotation relative to a nonzero layer_index works test_output = calculate_solar_rotate_shift(aia171_test_mapcube, layer_index=1) assert_allclose(test_output['x'].to('arcsec').value, known_displacements_layer_index1['x'], rtol=5e-2, atol=0) assert_allclose(test_output['y'].to('arcsec').value, known_displacements_layer_index1['y'], rtol=5e-2, atol=0)
def test_calculate_solar_rotate_shift(aia171_test_mapcube, known_displacements_layer_index0, known_displacements_layer_index1): # Test that the default works test_output = calculate_solar_rotate_shift(aia171_test_mapcube) assert_allclose(test_output['x'].to('arcsec').value, known_displacements_layer_index0['x'], rtol=5e-2, atol=0) assert_allclose(test_output['y'].to('arcsec').value, known_displacements_layer_index0['y'], rtol=5e-2, atol=0) # Test that the rotation relative to a nonzero layer_index works test_output = calculate_solar_rotate_shift(aia171_test_mapcube, layer_index=1) assert_allclose(test_output['x'].to('arcsec').value, known_displacements_layer_index1['x'], rtol=5e-2, atol=0) assert_allclose(test_output['y'].to('arcsec').value, known_displacements_layer_index1['y'], rtol=5e-2, atol=0)
def test_mapcube_solar_derotate(aia171_test_mapcube, aia171_test_submap): # Test that a mapcube is returned when the clipping is False tmc = mapcube_solar_derotate(aia171_test_mapcube, clip=False) assert (isinstance(tmc, map.MapCube)) # Test that all entries have the same shape - nothing clipped for m in tmc: assert (m.data.shape == aia171_test_submap.data.shape) # Test that the returned reference pixels are correctly displaced. tmc = mapcube_solar_derotate(aia171_test_mapcube, clip=True) tshift = calculate_solar_rotate_shift(aia171_test_mapcube, layer_index=1) for im, m in enumerate(tmc): for i_s, s in enumerate(['x', 'y']): assert_allclose(m.reference_pixel[i_s], aia171_test_submap.reference_pixel[i_s] + tshift[s][im] / m.scale[i_s] - tshift[s][0] / m.scale[i_s], rtol=5e-2, atol=0) # Test that a mapcube is returned on default clipping (clipping is True) tmc = mapcube_solar_derotate(aia171_test_mapcube) assert (isinstance(tmc, map.MapCube)) # Test that the shape of data is correct when clipped clipped_shape = (25, 19) for m in tmc: assert (m.data.shape == clipped_shape)
def test_mapcube_solar_derotate(aia171_test_mapcube, aia171_test_submap): # Test that a mapcube is returned when the clipping is False tmc = mapcube_solar_derotate(aia171_test_mapcube, clip=False) assert(isinstance(tmc, map.MapCube)) # Test that all entries have the same shape - nothing clipped for m in tmc: assert(m.data.shape == aia171_test_submap.data.shape) # Test that the returned reference pixels are correctly displaced. tmc = mapcube_solar_derotate(aia171_test_mapcube, clip=True) tshift = calculate_solar_rotate_shift(aia171_test_mapcube, layer_index=1) for im, m in enumerate(tmc): for i_s, s in enumerate(['x', 'y']): assert_allclose(m.reference_pixel[i_s], aia171_test_submap.reference_pixel[i_s] + tshift[s][im] / m.scale[i_s] - tshift[s][0] / m.scale[i_s], rtol=5e-2, atol=0) # Test that a mapcube is returned on default clipping (clipping is True) tmc = mapcube_solar_derotate(aia171_test_mapcube) assert(isinstance(tmc, map.MapCube)) # Test that the shape of data is correct when clipped clipped_shape = (24, 20) for m in tmc: assert(m.data.shape == clipped_shape)
def test_mapcube_solar_derotate(aia171_test_mapcube, aia171_test_submap): # Test that a mapcube is returned when the clipping is False tmc = mapcube_solar_derotate(aia171_test_mapcube, clip=False) assert (isinstance(tmc, map.MapCube)) # Test that all entries have the same shape - nothing clipped for m in tmc: assert (m.data.shape == aia171_test_submap.data.shape) # Test that the returned centers are correctly displaced. tshift = calculate_solar_rotate_shift(aia171_test_mapcube) for im, m in enumerate(tmc): for s in ['x', 'y']: assert_allclose(m.center[s], aia171_test_submap.center[s] - tshift[s][im].to('arcsec').value, rtol=5e-2, atol=0) # Test that a mapcube is returned on default clipping (clipping is True) tmc = mapcube_solar_derotate(aia171_test_mapcube) assert (isinstance(tmc, map.MapCube)) # Test that the shape of data is correct when clipped clipped_shape = (24, 20) for m in tmc: assert (m.data.shape == clipped_shape)
def test_mapcube_solar_derotate(aia171_test_mapcube, aia171_test_submap): # Test that a mapcube is returned when the clipping is False tmc = mapcube_solar_derotate(aia171_test_mapcube, clip=False) assert isinstance(tmc, map.MapCube) # Test that all entries have the same shape - nothing clipped for m in tmc: assert m.data.shape == aia171_test_submap.data.shape # Test that the returned centers are correctly displaced. tshift = calculate_solar_rotate_shift(aia171_test_mapcube) for im, m in enumerate(tmc): for i_s, s in enumerate(["x", "y"]): assert_allclose(m.center[i_s], aia171_test_submap.center[i_s] - tshift[s][im], rtol=5e-2, atol=0) # Test that a mapcube is returned on default clipping (clipping is True) tmc = mapcube_solar_derotate(aia171_test_mapcube) assert isinstance(tmc, map.MapCube) # Test that the shape of data is correct when clipped clipped_shape = (24, 20) for m in tmc: assert m.data.shape == clipped_shape