<commit_before>"""
Map is a generic Map class from which all other Map classes inherit from.
"""
from __future__ import absolute_import

#pylint: disable=E1101,E1121,W0404,W0613
__authors__ = ["<NAME>, <NAME>"]
__email__ = "<EMAIL>"

import os
from copy import copy
import warnings

import numpy as np
import matplotlib.pyplot as plt
import scipy.ndimage.interpolation
from matplotlib import patches
from matplotlib import colors
from matplotlib import cm
# import pyfits

try:
    import sunpy.image.Crotate as Crotate
except ImportError:
    pass

import sunpy.wcs as wcs
from sunpy.util import toggle_pylab, to_signed
# from sunpy.io import read_file, read_file_header
from sunpy.sun import constants
from sunpy.time import parse_time, is_time
from sunpy.image.rescale import reshape_image_to_4d_superpixel
from sunpy.image.rescale import resample as sunpy_image_resample

from sunpy.util.cond_dispatch import ConditionalDispatch
from sunpy.util.create import Parent

__all__ = ['MapBase', 'GenericMap']

"""
Questions
---------
* Should we use Helioviewer or VSO's data model? (e.g. map.meas, map.wavelength
or something else?)
* Should 'center' be renamed to 'offset' and crpix1 & 2 be used for 'center'?
"""

class MapBase(object):
    """ This object forms the base for all Map classes, both single and multi
    maps. """

    def __init__(self, data, header):
        """ Instancstanciate a Map class.
        
        Parameters
        ----------
        
        data: ndarray
        
        header: sunpy.map.MapHeader
        
        Returns
        -------
        A MapBase object
        """
        
        self.header = header
        self.data = data
        

    def _add_property(self, attr, header_key):
        """ This method maps a header value to a dynamically updating 
        property """
        def setter(self, value):
            self.header[header_key] = value
        
        def getter(self):
            return self.header[header_key]
        
        setattr(self, attr, property(getter, setter))

    def __getitem__(self, key):
        """ This should allow indexing by physical coordinate """
        raise NotImplementedError(
    "The ability to index Map by physical coordinate is not yet implemented.")

    def __repr__(self):
        if not hasattr(self, 'observatory'):
            return self.data.__repr__()

        return (
"""SunPy Map<commit_msg>stray changes<commit_after>"""
Map is a generic Map class from which all other Map classes inherit from.
"""
from __future__ import absolute_import

#pylint: disable=E1101,E1121,W0404,W0613
__authors__ = ["<NAME>, <NAME>"]
__email__ = "<EMAIL>"

import os
from copy import copy
import warnings

import numpy as np
import matplotlib.pyplot as plt
import scipy.ndimage.interpolation
from matplotlib import patches
from matplotlib import colors
from matplotlib import cm
# import pyfits

try:
    import sunpy.image.Crotate as Crotate
except ImportError:
    pass

import sunpy.wcs as wcs
from sunpy.util import toggle_pylab, to_signed
# from sunpy.io import read_file, read_file_header
from sunpy.sun import constants
from sunpy.time import parse_time, is_time
from sunpy.image.rescale import reshape_image_to_4d_superpixel
from sunpy.image.rescale import resample as sunpy_image_resample

from sunpy.util.cond_dispatch import ConditionalDispatch
from sunpy.util.create import Parent

__all__ = ['MapBase', 'GenericMap']

"""
Questions
---------
* Should we use Helioviewer or VSO's data model? (e.g. map.meas, map.wavelength
or something else?)
* Should 'center' be renamed to 'offset' and crpix1 & 2 be used for 'center'?
"""

class MapBase(object):
    """ This object forms the base for all Map classes, both single and multi
    maps. """

    def __init__(self, data, header):
        """ Instancstanciate a Map class.
        
        Parameters
        ----------
        
        data: ndarray
        
        header: sunpy.map.MapHeader
        
        Returns
        -------
        A MapBase object
        """
        
        self.header = header
        self.data = data
        
    
#    def __getattr__(self, attr):
    def _add_property(self, attr, header_key):
        """ This method maps a header value to a dynamically updating 
        property """
        def setter(self, value):
            self.header[header_key] = value
        
        def getter(self):
            return self.header[header_key]
        
        setattr(self, attr, property(getter, setter))

    def __getitem__(self, key):
        """ This should allow indexing by physical coordinate """
        raise NotImplementedError(
    "The ability to index Map by physical coordinate is not yet implemented.")

    def __repr__(self):
        if not hasattr(self, 'observatory'):
            return self.data.__repr__()

        return (
"""SunPy Map
{'fraction_non_alphanumeric': 0.08800494641384995, 'fraction_numerical': 0.007831821929101401, 'mean_word_length': 2.7417116422513494, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '1498855', 'n_tokens_mistral': 1434, 'n_tokens_neox': 1394, 'n_words': 479}