GenericMap

class sunpy.map.GenericMap(data, header, plot_settings=None, **kwargs)[source]

Bases: astropy.nddata.NDData

A Generic spatially-aware 2D data array

Parameters
  • data (numpy.ndarray, list) – A 2d list or ndarray containing the map data.

  • header (dict) – A dictionary of the original image header tags.

  • plot_settings (dict, optional) – Plot settings.

Other Parameters

**kwargs – Additional keyword arguments are passed to NDData init.

Examples

>>> import sunpy.map
>>> import sunpy.data.sample  
>>> aia = sunpy.map.Map(sunpy.data.sample.AIA_171_IMAGE)  
>>> aia   
<sunpy.map.sources.sdo.AIAMap object at 0x...>
SunPy Map
---------
Observatory:                 SDO
Instrument:          AIA 3
Detector:            AIA
Measurement:                 171.0 Angstrom
Wavelength:          171.0 Angstrom
Observation Date:    2011-06-07 06:33:02
Exposure Time:               0.234256 s
Dimension:           [1024. 1024.] pix
Coordinate System:   helioprojective
Scale:                       [2.402792 2.402792] arcsec / pix
Reference Pixel:     [512.5 512.5] pix
Reference Coord:     [3.22309951 1.38578135] arcsec
array([[ -95.92475  ,    7.076416 ,   -1.9656711, ..., -127.96519  ,
        -127.96519  , -127.96519  ],
       [ -96.97533  ,   -5.1167884,    0.       , ...,  -98.924576 ,
        -104.04137  , -127.919716 ],
       [ -93.99607  ,    1.0189276,   -4.0757103, ...,   -5.094638 ,
         -37.95505  , -127.87541  ],
       ...,
       [-128.01454  , -128.01454  , -128.01454  , ..., -128.01454  ,
        -128.01454  , -128.01454  ],
       [-127.899666 , -127.899666 , -127.899666 , ..., -127.899666 ,
        -127.899666 , -127.899666 ],
       [-128.03072  , -128.03072  , -128.03072  , ..., -128.03072  ,
        -128.03072  , -128.03072  ]], dtype=float32)
>>> aia.spatial_units   
SpatialPair(axis1=Unit("arcsec"), axis2=Unit("arcsec"))
>>> aia.peek()   

Notes

A number of the properties of this class are returned as two-value named tuples that can either be indexed by position ([0] or [1]) or be accessed by the names (.x and .y) or (.axis1 and .axis2). Things that refer to pixel axes use the .x, .y convention, where x and y refer to the FITS axes (x for columns y for rows). Spatial axes use .axis1 and .axis2 which correspond to the first and second axes in the header. axis1 corresponds to the coordinate axis for x and axis2 corresponds to y.

This class makes some assumptions about the WCS information contained in the meta data. The first and most extensive assumption is that it is FITS-like WCS information as defined in the FITS WCS papers.

Within this scope it also makes some other assumptions.

  • In the case of APIS convention headers where the CROTAi/j arguments are provided it assumes that these can be converted to the standard PCi_j notation using equations 32 in Thompson (2006).

  • If a CDi_j matrix is provided it is assumed that it can be converted to a PCi_j matrix and CDELT keywords as described in Greisen & Calabretta (2002)

  • The ‘standard’ FITS keywords that are used by this class are the PCi_j matrix and CDELT, along with the other keywords specified in the WCS papers. All subclasses of this class must convert their header information to this formalism. The CROTA to PCi_j conversion is done in this class.

Warning

This class currently assumes that a header with the CDi_j matrix information also includes the CDELT keywords, without these keywords this class will not process the WCS. Also the rotation_matrix does not work if the CDELT1 and CDELT2 keywords are exactly equal. Also, if a file with more than two dimensions is feed into the class, only the first two dimensions (NAXIS1, NAXIS2) will be loaded and the rest will be discarded.

Attributes Summary

bottom_left_coord

The physical coordinate at the center of the bottom left ([0, 0]) pixel.

carrington_latitude

Observer Carrington latitude.

carrington_longitude

Observer Carrington longitude.

center

Return a coordinate object for the center pixel of the array.

cmap

Return the matplotlib.colors.Colormap instance this map uses.

coordinate_frame

An astropy.coordinates.BaseFrame instance created from the coordinate information for this Map, or None if the frame cannot be determined.

coordinate_system

Coordinate system used for x and y axes (ctype1/2).

data

The stored dataset.

date

Image observation time.

detector

Detector name.

dimensions

The dimensions of the array (x axis first, y axis second).

dsun

Observer distance from the center of the Sun.

dtype

The numpy.dtype of the array of the map.

exposure_time

Exposure time of the image in seconds.

fits_header

A Header representation of the meta attribute.

heliographic_latitude

Observer heliographic latitude.

heliographic_longitude

Observer heliographic longitude.

instrument

Instrument name.

latex_name

LaTeX formatted description of the Map.

mask

Mask for the dataset, if any.

measurement

Measurement name, defaults to the wavelength of image.

meta

Additional meta information about the dataset.

name

Human-readable description of the Map.

ndim

The value of numpy.ndarray.ndim of the data array of the map.

nickname

An abbreviated human-readable description of the map-type; part of the Helioviewer data model.

observatory

Observatory or Telescope name.

observer_coordinate

The Heliographic Stonyhurst Coordinate of the observer.

processing_level

Returns the FITS processing level if present.

reference_coordinate

Reference point WCS axes in data units (i.e.

reference_pixel

Pixel of reference coordinate.

rotation_matrix

Matrix describing the rotation required to align solar North with the top of the image.

rsun_meters

Radius of the sun in meters.

rsun_obs

Angular radius of the Sun.

scale

Image scale along the x and y axes in units/pixel (i.e.

shifted_value

The total shift applied to the reference coordinate by past applications of shift.

size

Deprecated since version 2.1.

spatial_units

Image coordinate units along the x and y axes (i.e.

top_right_coord

The physical coordinate at the center of the the top right ([-1, -1]) pixel.

uncertainty

Uncertainty in the dataset, if any.

unit

Unit for the dataset, if any.

wavelength

Wavelength of the observation.

waveunit

The Unit of the wavelength of this observation.

wcs

The WCS property of the map.

Methods Summary

contour(level, **kwargs)

Returns coordinates of the contours for a given level value.

draw_contours(levels[, axes])

Draw contours of the data.

draw_grid([axes, grid_spacing, annotate])

Draws a coordinate overlay on the plot in the Heliographic Stonyhurst coordinate system.

draw_limb([axes])

Draws a circle representing the solar limb

draw_rectangle(bottom_left, *[, width, …])

Draw a rectangle defined in world coordinates on the plot.

max(*args, **kwargs)

Calculate the maximum value of the data array.

mean(*args, **kwargs)

Calculate the mean of the data array.

min(*args, **kwargs)

Calculate the minimum value of the data array.

peek([draw_limb, draw_grid, colorbar])

Displays a graphical overview of the data in this object for user evaluation.

pixel_to_world(x, y[, origin])

Convert a pixel coordinate to a data (world) coordinate by using wcs_pix2world.

plot([annotate, axes, title, clip_interval])

Plots the map object using matplotlib, in a method equivalent to plt.imshow() using nearest neighbour interpolation.

quicklook()

Display a quicklook summary of the Map instance using the default web browser.

resample(dimensions[, method])

Resample to new dimension sizes.

rotate([angle, rmatrix, order, scale, …])

Returns a new rotated and rescaled map.

save(filepath[, filetype])

Saves the SunPy Map object to a file.

shift(axis1, axis2)

Returns a map shifted by a specified amount to, for example, correct for a bad map location.

std(*args, **kwargs)

Calculate the standard deviation of the data array.

submap(bottom_left, *[, top_right, width, …])

Returns a submap defined by a rectangle.

superpixel(dimensions[, offset, func])

Returns a new map consisting of superpixels formed by applying ‘func’ to the original map data.

world_to_pixel(coordinate[, origin])

Convert a world (data) coordinate to a pixel coordinate by using wcs_world2pix.

Attributes Documentation

bottom_left_coord

The physical coordinate at the center of the bottom left ([0, 0]) pixel.

carrington_latitude

Observer Carrington latitude.

carrington_longitude

Observer Carrington longitude.

center

Return a coordinate object for the center pixel of the array.

If the array has an even number of pixels in a given dimension, the coordinate returned lies on the edge between the two central pixels.

cmap

Return the matplotlib.colors.Colormap instance this map uses.

coordinate_frame

An astropy.coordinates.BaseFrame instance created from the coordinate information for this Map, or None if the frame cannot be determined.

coordinate_system

Coordinate system used for x and y axes (ctype1/2).

data

The stored dataset.

Type

ndarray-like

date

Image observation time.

detector

Detector name.

dimensions

The dimensions of the array (x axis first, y axis second).

dsun

Observer distance from the center of the Sun.

dtype

The numpy.dtype of the array of the map.

exposure_time

Exposure time of the image in seconds.

fits_header

A Header representation of the meta attribute.

heliographic_latitude

Observer heliographic latitude.

heliographic_longitude

Observer heliographic longitude.

instrument

Instrument name.

latex_name

LaTeX formatted description of the Map.

mask

Mask for the dataset, if any.

Masks should follow the numpy convention that valid data points are marked by False and invalid ones with True.

Type

any type

measurement

Measurement name, defaults to the wavelength of image.

meta

Additional meta information about the dataset.

Type

dict-like

name

Human-readable description of the Map.

ndim

The value of numpy.ndarray.ndim of the data array of the map.

nickname

An abbreviated human-readable description of the map-type; part of the Helioviewer data model.

observatory

Observatory or Telescope name.

observer_coordinate

The Heliographic Stonyhurst Coordinate of the observer.

processing_level

Returns the FITS processing level if present.

reference_coordinate

Reference point WCS axes in data units (i.e. crval1, crval2). This value includes a shift if one is set.

reference_pixel

Pixel of reference coordinate.

The pixel returned uses zero-based indexing, so will be 1 pixel less than the FITS CRPIX values.

rotation_matrix

Matrix describing the rotation required to align solar North with the top of the image.

rsun_meters

Radius of the sun in meters.

rsun_obs

Angular radius of the Sun.

Notes

This value is taken the 'rsun_obs', 'solar_r', or radius FITS keywords. If none of these keys are present the photospheric limb as seen from the observer coordinate is returned.

scale

Image scale along the x and y axes in units/pixel (i.e. cdelt1, cdelt2).

shifted_value

The total shift applied to the reference coordinate by past applications of shift.

size

Deprecated since version 2.1: Use map.data.size instead

The number of pixels in the array of the map.

spatial_units

Image coordinate units along the x and y axes (i.e. cunit1, cunit2).

top_right_coord

The physical coordinate at the center of the the top right ([-1, -1]) pixel.

uncertainty

Uncertainty in the dataset, if any.

Should have an attribute uncertainty_type that defines what kind of uncertainty is stored, such as 'std' for standard deviation or 'var' for variance. A metaclass defining such an interface is NDUncertainty but isn’t mandatory.

Type

any type

unit

Unit for the dataset, if any.

Type

Unit

wavelength

Wavelength of the observation.

waveunit

The Unit of the wavelength of this observation.

wcs

The WCS property of the map.

Methods Documentation

contour(level, **kwargs)[source]

Returns coordinates of the contours for a given level value.

For details of the contouring algorithm see skimage.measure.find_contours.

Parameters
Returns

contours (list of (n,2) SkyCoord) – Coordinates of each contour.

See also

None()

draw_contours(levels: Unit(‘%’), axes=None, **contour_args)[source]

Draw contours of the data.

Parameters
  • levels (Quantity) – A list of numbers indicating the contours to draw. These are given as a percentage of the maximum value of the map data.

  • axes (matplotlib.axes.Axes) – The axes on which to plot the contours. Defaults to the current axes.

Returns

cs (list) – The QuadContourSet object, after it has been added to axes.

Notes

Extra keyword arguments to this function are passed through to the contour function.

draw_grid(axes=None, grid_spacing: Unit("deg") = <Quantity 15. deg>, annotate=True, **kwargs)[source]

Draws a coordinate overlay on the plot in the Heliographic Stonyhurst coordinate system.

To overlay other coordinate systems see the WCSAxes Documentation

Parameters
  • axes (axes or None) – Axes to plot limb on, or None to use current axes.

  • grid_spacing (Quantity) – Spacing for longitude and latitude grid, if length two it specifies (lon, lat) spacing.

  • annotate (bool) – Passing False disables the axes labels and the ticks on the top and right axes.

Returns

overlay (CoordinatesMap) – The wcsaxes coordinate overlay instance.

Notes

Keyword arguments are passed onto the sunpy.visualization.wcsaxes_compat.wcsaxes_heliographic_overlay function.

draw_limb(axes=None, **kwargs)[source]

Draws a circle representing the solar limb

Parameters

axes (axes or None) – Axes to plot limb on or None to use current axes.

Returns

circ (list) – A list containing the Circle object that has been added to the axes.

Notes

Keyword arguments are passed onto matplotlib.patches.Circle.

draw_rectangle(bottom_left, *, width: Unit(‘deg’) = None, height: Unit(‘deg’) = None, axes=None, top_right=None, **kwargs)[source]

Draw a rectangle defined in world coordinates on the plot.

This draws a rectangle that has corners at (bottom_left, top_right), and has sides parallel to coordinate axes of the map.

If width and height are specified, they are respectively added to the longitude and latitude of the bottom_left coordinate to calculate a top_right coordinate.

Parameters
  • bottom_left (SkyCoord) – The bottom-left coordinate of the rectangle. It can have shape (2,) to simultaneously define top_right.

  • top_right (SkyCoord) – The top-right coordinate of the rectangle. Passing this as a positional argument is deprecated.

  • width (astropy.units.Quantity, optional) – The width of the rectangle. Required if top_right is omitted. Passing this as a positional argument is deprecated.

  • height (astropy.units.Quantity) – The height of the rectangle. Required if top_right is omitted. Passing this as a positional argument is deprecated.

  • axes (matplotlib.axes.Axes) – The axes on which to plot the rectangle, defaults to the current axes.

Returns

rect (list) – A list containing the Rectangle object, after it has been added to axes.

Notes

Extra keyword arguments to this function are passed through to the Rectangle instance.

max(*args, **kwargs)[source]

Calculate the maximum value of the data array.

mean(*args, **kwargs)[source]

Calculate the mean of the data array.

min(*args, **kwargs)[source]

Calculate the minimum value of the data array.

peek(draw_limb=False, draw_grid=False, colorbar=True, **matplot_args)[source]

Displays a graphical overview of the data in this object for user evaluation. For the creation of plots, users should instead use the plot method and Matplotlib’s pyplot framework.

Parameters
  • draw_limb (bool) – Whether the solar limb should be plotted.

  • draw_grid (bool or Quantity) – Whether solar meridians and parallels are plotted. If Quantity then sets degree difference between parallels and meridians.

  • colorbar (bool) – Whether to display a colorbar next to the plot.

  • **matplot_args (dict) – Matplotlib Any additional imshow arguments that should be used when plotting.

pixel_to_world(x: Unit(‘pix’), y: Unit(‘pix’), origin=0)[source]

Convert a pixel coordinate to a data (world) coordinate by using wcs_pix2world.

Parameters
  • x (Quantity) – Pixel coordinate of the CTYPE1 axis. (Normally solar-x).

  • y (Quantity) – Pixel coordinate of the CTYPE2 axis. (Normally solar-y).

  • origin (int) – Origin of the top-left corner. i.e. count from 0 or 1. Normally, origin should be 0 when passing numpy indices, or 1 if passing values from FITS header or map attributes. See wcs_pix2world for more information.

Returns

coord (astropy.coordinates.SkyCoord) – A coordinate object representing the output coordinate.

plot(annotate=True, axes=None, title=True, clip_interval: Unit(‘%’) = None, **imshow_kwargs)[source]

Plots the map object using matplotlib, in a method equivalent to plt.imshow() using nearest neighbour interpolation.

Parameters
  • annotate (bool, optional) – If True, the data is plotted at its natural scale; with title and axis labels.

  • axes (axes or None) – If provided the image will be plotted on the given axes. Else the current matplotlib axes will be used.

  • title (str, bool, optional) – The plot title. If True, uses the default title for this map.

  • clip_interval (two-element Quantity, optional) – If provided, the data will be clipped to the percentile interval bounded by the two numbers.

  • **imshow_kwargs (dict) – Any additional imshow arguments are passed to imshow.

Examples

>>> # Simple Plot with color bar
>>> aia.plot()   
>>> plt.colorbar()   
>>> # Add a limb line and grid
>>> aia.plot()   
>>> aia.draw_limb()   
>>> aia.draw_grid()   
quicklook()[source]

Display a quicklook summary of the Map instance using the default web browser.

Notes

The image colormap uses histogram equalization.

Clicking on the image to switch between pixel space and coordinate space requires Javascript support to be enabled in the web browser.

Examples

>>> from sunpy.map import Map
>>> import sunpy.data.sample  
>>> smap = Map(sunpy.data.sample.AIA_171_IMAGE)  
>>> smap.quicklook()  

(which will open the following content in the default web browser)

<sunpy.map.sources.sdo.AIAMap object at 0x7f4b59b34fa0>
Observatory SDO
Instrument AIA 3
Detector AIA
Measurement 171.0 Angstrom
Wavelength 171.0 Angstrom
Observation Date 2011-06-07 06:33:02
Exposure Time 0.234256 s
Dimension [1024. 1024.] pix
Coordinate System helioprojective
Scale [2.402792 2.402792] arcsec / pix
Reference Pixel [511.5 511.5] pix
Reference Coord [3.22309951 1.38578135] arcsec
Image colormap uses histogram equalization
Click on the image to toggle between units
resample(dimensions: Unit(‘pix’), method='linear')[source]

Resample to new dimension sizes.

Uses the same parameters and creates the same co-ordinate lookup points as IDL’’s congrid routine, which apparently originally came from a VAX/VMS routine of the same name.

Parameters
  • dimensions (Quantity) – Output pixel dimensions. The first argument corresponds to the ‘x’ axis and the second argument corresponds to the ‘y’ axis.

  • method (str) –

    Method to use for resampling interpolation.
    • 'neighbor' - Take closest value from original data.

    • 'nearest' and 'linear' - Use n x 1-D interpolations using scipy.interpolate.interp1d.

    • 'spline' - Uses piecewise polynomials (splines) for mapping the input array to new coordinates by interpolation using ndimage.map_coordinates.

Returns

out (GenericMap or subclass) – Resampled map

References

Rebinning

rotate(angle: Unit(‘deg’) = None, rmatrix=None, order=4, scale=1.0, recenter=False, missing=0.0, use_scipy=False)[source]

Returns a new rotated and rescaled map.

Specify either a rotation angle or a rotation matrix, but not both. If neither an angle or a rotation matrix are specified, the map will be rotated by the rotation angle in the metadata.

The map will be rotated around the reference coordinate defined in the meta data.

This method also updates the rotation_matrix attribute and any appropriate header data so that they correctly describe the new map.

Parameters
  • angle (Quantity) – The angle (degrees) to rotate counterclockwise.

  • rmatrix (2x2) – Linear transformation rotation matrix.

  • order (int 0-5) – Interpolation order to be used. When using scikit-image this parameter is passed into skimage.transform.warp() (e.g., 4 corresponds to bi-quartic interpolation). When using scipy it is passed into scipy.ndimage.interpolation.affine_transform() where it controls the order of the spline. Faster performance may be obtained at the cost of accuracy by using lower values. Default: 4

  • scale (float) – A scale factor for the image, default is no scaling

  • recenter (bool) – If True, position the axis of rotation at the center of the new map Default: False

  • missing (float) – The numerical value to fill any missing points after rotation. Default: 0.0

  • use_scipy (bool) – If True, forces the rotation to use scipy.ndimage.interpolation.affine_transform(), otherwise it uses the skimage.transform.warp(). Default: False, unless scikit-image can’t be imported

Returns

out (GenericMap or subclass) – A new Map instance containing the rotated and rescaled data of the original map.

See also

sunpy.image.transform.affine_transform()

The routine this method calls

for()

Notes

This function will remove old CROTA keywords from the header. This function will also convert a CDi_j matrix to a PCi_j matrix.

See sunpy.image.transform.affine_transform() for details on the transformations, situations when the underlying data is modified prior to rotation, and differences from IDL’s rot().

save(filepath, filetype='auto', **kwargs)[source]

Saves the SunPy Map object to a file.

Currently SunPy can only save files in the FITS format. In the future support will be added for saving to other formats.

Parameters
  • filepath (str) – Location to save file to.

  • filetype (str) – ‘auto’ or any supported file extension.

  • hdu_type (None, CompImageHDU) – None will return a normal FITS file. CompImageHDU will rice compress the FITS file.

  • kwargs – Any additional keyword arguments are passed to write_file.

shift(axis1: Unit(‘deg’), axis2: Unit(‘deg’))[source]

Returns a map shifted by a specified amount to, for example, correct for a bad map location. These values are applied directly to the reference_coordinate. To check how much shift has already been applied see shifted_value

Parameters
  • axis1 (Quantity) – The shift to apply to the Longitude (solar-x) coordinate.

  • axis2 (Quantity) – The shift to apply to the Latitude (solar-y) coordinate

Returns

out (GenericMap or subclass) – A new shifted Map.

std(*args, **kwargs)[source]

Calculate the standard deviation of the data array.

submap(bottom_left, *, top_right=None, width: Unit(‘deg’), Unit(‘pix’) = None, height: Unit(‘deg’), Unit(‘pix’) = None)[source]

Returns a submap defined by a rectangle.

Any pixels which have at least part of their area inside the rectangle are returned.

Parameters
  • bottom_left (astropy.units.Quantity or SkyCoord) – The bottom-left coordinate of the rectangle. If a SkyCoord it can have shape (2,) and simultaneously define top_right. If specifying pixel coordinates it must be given as an Quantity object with units of pixel.

  • top_right (astropy.units.Quantity or SkyCoord, optional) – The top-right coordinate of the rectangle. If top_right is specified width and height must be omitted. Passing this as a positional argument is deprecated, you must pass it as top_right=....

  • width (astropy.units.Quantity, optional) – The width of the rectangle. Required if top_right is omitted.

  • height (astropy.units.Quantity) – The height of the rectangle. Required if top_right is omitted.

Returns

out (GenericMap or subclass) – A new map instance is returned representing to specified sub-region.

Examples

>>> import astropy.units as u
>>> from astropy.coordinates import SkyCoord
>>> import sunpy.map
>>> import sunpy.data.sample  
>>> aia = sunpy.map.Map(sunpy.data.sample.AIA_171_IMAGE)  
>>> bl = SkyCoord(-300*u.arcsec, -300*u.arcsec, frame=aia.coordinate_frame)  
>>> tr = SkyCoord(500*u.arcsec, 500*u.arcsec, frame=aia.coordinate_frame)  
>>> aia.submap(bl, top_right=tr)   
<sunpy.map.sources.sdo.AIAMap object at 0x...>
SunPy Map
---------
Observatory:             SDO
Instrument:              AIA 3
Detector:                AIA
Measurement:             171.0 Angstrom
Wavelength:              171.0 Angstrom
Observation Date:        2011-06-07 06:33:02
Exposure Time:           0.234256 s
Dimension:               [334. 334.] pix
Coordinate System:       helioprojective
Scale:                   [2.402792 2.402792] arcsec / pix
Reference Pixel:         [127.5 126.5] pix
Reference Coord:         [3.22309951 1.38578135] arcsec
array([[ 450.4546 ,  565.81494,  585.0416 , ..., 1178.3234 , 1005.28284,
        977.8161 ],
    [ 474.20004,  516.1865 ,  555.7032 , ..., 1024.9636 , 1010.1449 ,
        1010.1449 ],
    [ 548.1609 ,  620.9256 ,  620.9256 , ...,  933.8139 , 1074.4924 ,
        1108.4492 ],
        ...,
    [ 203.58617,  195.52335,  225.75891, ...,  612.7742 ,  580.52295,
        560.3659 ],
    [ 206.00058,  212.1806 ,  232.78065, ...,  650.96185,  622.12177,
        537.6615 ],
    [ 229.32516,  236.07002,  222.5803 , ...,  517.1058 ,  586.8026 ,
        591.2992 ]], dtype=float32)
>>> aia.submap([0,0]*u.pixel, [5,5]*u.pixel)   
<sunpy.map.sources.sdo.AIAMap object at 0x...>
SunPy Map
---------
Observatory:             SDO
Instrument:              AIA 3
Detector:                AIA
Measurement:             171.0 Angstrom
Wavelength:              171.0 Angstrom
Observation Date:        2011-06-07 06:33:02
Exposure Time:           0.234256 s
Dimension:               [5. 5.] pix
Coordinate System:       helioprojective
Scale:                   [2.402792 2.402792] arcsec / pix
Reference Pixel:         [512.5 512.5] pix
Reference Coord:         [3.22309951 1.38578135] arcsec
array([[-95.92475   ,   7.076416  ,  -1.9656711 ,  -2.9485066 ,
        -0.98283553],
    [-96.97533   ,  -5.1167884 ,   0.        ,   0.        ,
        0.9746264 ],
    [-93.99607   ,   1.0189276 ,  -4.0757103 ,   2.0378551 ,
        -2.0378551 ],
    [-96.97533   ,  -8.040668  ,  -2.9238791 ,  -5.1167884 ,
        -0.9746264 ],
    [-95.92475   ,   6.028058  ,  -4.9797    ,  -1.0483578 ,
        -3.9313421 ]], dtype=float32)
>>> width = 10 * u.arcsec
>>> height = 10 * u.arcsec
>>> aia.submap(bl, width=width, height=height)   
<sunpy.map.sources.sdo.AIAMap object at 0x7f91aecc5438>
SunPy Map
---------
Observatory:             SDO
Instrument:              AIA 3
Detector:                AIA
Measurement:             171.0 Angstrom
Wavelength:              171.0 Angstrom
Observation Date:        2011-06-07 06:33:02
Exposure Time:           0.234256 s
Dimension:               [4. 4.] pix
Coordinate System:       helioprojective
Scale:                   [2.402792 2.402792] arcsec / pix
Reference Pixel:         [126.5 126.5] pix
Reference Coord:         [3.22309951 1.38578135] arcsec
array([[565.81494, 585.0416 , 656.4552 , 670.18854],
    [516.1865 , 555.7032 , 634.7365 , 661.90424],
    [620.9256 , 620.9256 , 654.8825 , 596.6707 ],
    [667.5083 , 560.52094, 651.22766, 530.28534]], dtype=float32)
>>> bottom_left_vector = SkyCoord([0, 10]  * u.arcsec, [0, 10] * u.arcsec, frame='heliographic_stonyhurst')
>>> aia.submap(bottom_left_vector)   
<sunpy.map.sources.sdo.AIAMap object at 0x7f91aece8be0>
SunPy Map
---------
Observatory:             SDO
Instrument:              AIA 3
Detector:                AIA
Measurement:             171.0 Angstrom
Wavelength:              171.0 Angstrom
Observation Date:        2011-06-07 06:33:02
Exposure Time:           0.234256 s
Dimension:               [4. 5.] pix
Coordinate System:       helioprojective
Scale:                   [2.402792 2.402792] arcsec / pix
Reference Pixel:         [1.5 1.5] pix
Reference Coord:         [3.22309951 1.38578135] arcsec
array([[213.9748 , 256.76974, 244.54262, 356.62466],
    [223.74321, 258.0102 , 292.27716, 340.65408],
    [219.53459, 242.31648, 308.5911 , 331.373  ],
    [268.24377, 254.83157, 268.24377, 321.89252],
    [249.99167, 265.14267, 274.61206, 240.5223 ]], dtype=float32)
superpixel(dimensions: Unit("pix"), offset: Unit("pix") = <Quantity [0., 0.] pix>, func=<function sum>)[source]

Returns a new map consisting of superpixels formed by applying ‘func’ to the original map data.

Parameters
  • dimensions (tuple) – One superpixel in the new map is equal to (dimension[0], dimension[1]) pixels of the original map. Note: the first argument corresponds to the ‘x’ axis and the second argument corresponds to the ‘y’ axis.

  • offset (tuple) – Offset from (0,0) in original map pixels used to calculate where the data used to make the resulting superpixel map starts.

  • func (function applied to the original data) – The function ‘func’ must take a numpy array as its first argument, and support the axis keyword with the meaning of a numpy axis keyword (see the description of sum for an example.) The default value of ‘func’ is sum; using this causes superpixel to sum over (dimension[0], dimension[1]) pixels of the original map.

Returns

out (GenericMap or subclass) – A new Map which has superpixels of the required size.

References

world_to_pixel(coordinate, origin=0)[source]

Convert a world (data) coordinate to a pixel coordinate by using wcs_world2pix.

Parameters
  • coordinate (SkyCoord or BaseFrame) – The coordinate object to convert to pixel coordinates.

  • origin (int) – Origin of the top-left corner. i.e. count from 0 or 1. Normally, origin should be 0 when passing numpy indices, or 1 if passing values from FITS header or map attributes. See wcs_world2pix for more information.

Returns

  • x (Quantity) – Pixel coordinate on the CTYPE1 axis.

  • y (Quantity) – Pixel coordinate on the CTYPE2 axis.