<commit_before># Author: <NAME>
#
# Testing functions for a mapcube solar derotation functionality.
#
# TODO: finish this!
<commit_msg>adding in test code for solar derotate<commit_after># Author: <NAME>
#
# Testing functions for a mapcube solar derotation functionality.
#
import numpy as np
from astropy import units as u
from numpy.testing import assert_allclose, assert_array_almost_equal
from scipy.ndimage.interpolation import shift
from sunpy import AIA_171_IMAGE
from sunpy import map
from sunpy.image.solar_differental_rotation import mapcube_solar_derotate

def test_mapcube_solar_derotate():

    # Test that a mapcube is returned
    test_output = mapcube_solar_derotate(mc)
    # Assert
    assert(isinstance(test_output, map.MapCube))

    # Test the return of the only the displacements.
    test_displacements = mapcube_solar_derotate(mc, return_displacements_only=True)
    # Assert
    assert(isinstance(test_displacements, dict))
    assert_allclose(test_displacements['x'], known_displacements['x'], rtol=5e-2, atol=0)
    assert_allclose(test_displacements['y'], known_displacements['y'], rtol=5e-2, atol=0 )

    # Test returning using the "with_displacements" option
    test_output = mapcube_solar_derotate(mc, with_displacements=True)
    # Assert
    assert(isinstance(test_output[0], map.MapCube))
    assert(isinstance(test_output[1], dict))
    assert_allclose(test_output[1]['x'], known_displacements['x'], rtol=5e-2, atol=0)
    assert_allclose(test_output[1]['y'], known_displacements['y'], rtol=5e-2, atol=0 )


{'fraction_non_alphanumeric': 0.09715025906735751, 'fraction_numerical': 0.012305699481865285, 'mean_word_length': 5.866666666666666, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5708630', 'n_tokens_mistral': 535, 'n_tokens_neox': 524, 'n_words': 119}