CompositeMap

class sunpy.map.CompositeMap(map1[, map2, ..])[source]

Bases: object

A Composite Map class

Parameters

args ([Map | string]) – One or more map of filepaths

Examples

>>> import sunpy.map
>>> import sunpy.data.sample  
>>> comp_map = sunpy.map.Map(sunpy.data.sample.AIA_171_IMAGE,
...                          sunpy.data.sample.EIT_195_IMAGE,
...                          composite=True)  
>>> comp_map.add_map(sunpy.map.Map(sunpy.data.sample.RHESSI_IMAGE))  
>>> comp_map.peek()  

Methods Summary

add_map(amap[, zorder, alpha, levels])

Adds a map to the CompositeMap.

draw_grid([index, axes, grid_spacing])

Draws a grid over the surface of the Sun.

draw_limb([index, axes])

Draws a circle representing the solar limb.

get_alpha([index])

Returns the alpha-channel value for a layer in the composite image.

get_levels([index])

Returns the list of contour levels for a map within the composite.

get_map(index)

Returns the map with given index

get_plot_settings([index])

Returns the plot settings for a map within the composite map.

get_zorder([index])

Returns the layering preference (z-order) for a map within the composite.

list_maps()

Prints a list of the currently included maps.

peek([colorbar, basic_plot, draw_limb, …])

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

plot([axes, annotate, title])

Plots the composite map object using matplotlib

remove_map(index)

Removes and returns the map with the given index.

set_alpha(index, alpha)

Sets the alpha-channel value for a layer in the composite image.

set_levels(index, levels[, percent])

Sets the contour levels for a layer in the composite image.

set_plot_settings(index, plot_settings)

Sets the plot settings for a layer in the composite image.

set_zorder(index, zorder)

Set the layering order (z-order) for a map within the composite.

Methods Documentation

add_map(amap, zorder=None, alpha=1, levels=False)[source]

Adds a map to the CompositeMap.

Parameters
  • amap (GenericMap or subclass) – Map instance to be added

  • zorder (int) – The index to use when determining where the map should lie along the z-axis; maps with higher z-orders appear above maps with lower z-orders.

  • alpha (float) – Opacity at which the map should be displayed. An alpha value of 0 results in a fully transparent image while an alpha value of 1 results in a fully opaque image. Values between result in semi- transparent images.

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

Draws a grid over the surface of the Sun.

Parameters
  • index (int) – Index to determine which map to use to draw grid.

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

  • grid_spacing (float) – Spacing (in degrees) for longitude and latitude grid.

Returns

matplotlib.axes.Axes object

Notes

Keyword arguments are passed onto sunpy.map.GenericMap.draw_grid.

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

Draws a circle representing the solar limb.

Parameters
  • index (int) – Map index to use to plot limb.

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

Returns

matplotlib.axes.Axes

Notes

Keyword arguments are passed onto sunpy.map.GenericMap.draw_limb.

get_alpha(index=None)[source]

Returns the alpha-channel value for a layer in the composite image.

get_levels(index=None)[source]

Returns the list of contour levels for a map within the composite.

Parameters

index ({int | None}) – The index of the map in the composite map.

Returns

list – A list of the contour levels of map at index ‘index’ in the composite map. If index is None, then the contour levels of all the maps are returned as a list of lists.

get_map(index)[source]

Returns the map with given index

get_plot_settings(index=None)[source]

Returns the plot settings for a map within the composite map.

Parameters

index ({int | None}) – The index of the map in the composite map.

Returns

{dict | list} – The plot settings of the map(s) in the composite map. If None then the plot settings of all the maps are returned in a list.

get_zorder(index=None)[source]

Returns the layering preference (z-order) for a map within the composite.

Parameters

index ({int | None}) – The index of the map in the composite map.

Returns

{float | list} – The layering order (z-order) of the map(s) in the composite map. If None then the layering order of all the maps is returned in a list.

list_maps()[source]

Prints a list of the currently included maps.

peek(colorbar=True, basic_plot=False, draw_limb=True, draw_grid=False, **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
  • colorbar (bool or int) – Whether to display a colorbar next to the plot. If specified as an integer a colorbar is plotted for that index.

  • basic_plot (bool) – If true, the data is plotted by itself at it’s natural scale; no title, labels, or axes are shown.

  • draw_limb (bool) – If true, draws a circle representing the solar limb.

  • draw_grid (bool) – If true, draws a grid over the surface of the Sun.

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

plot(axes=None, annotate=True, title='SunPy Composite Plot', **matplot_args)[source]

Plots the composite map object using matplotlib

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

  • annotate (bool) – If true, the data is plotted at it’s natural scale; with title and axis labels.

  • title (str) – Title of the composite map.

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

Returns

ret (list) – List of axes image or quad contour sets that have been plotted.

remove_map(index)[source]

Removes and returns the map with the given index.

Parameters

index (int) – The index of the map in the composite map.

Returns

sunpy.map.CompositeMap – A composite map with the map indexed by ‘index’ removed from the composite map.

set_alpha(index, alpha)[source]

Sets the alpha-channel value for a layer in the composite image.

Parameters
  • index (int) – The index of the map in the composite map.

  • alpha (float) – A float in the range 0 to 1. Increasing values of alpha decrease the transparency of the layer (0 is complete transparency, 1 indicates the layer will be completely opaque).

Returns

CompositeMap – A composite map with alpha-channel value ‘alpha’ at layer ‘index’.

set_levels(index, levels, percent=False)[source]

Sets the contour levels for a layer in the composite image.

Parameters
  • index (int) – The index of the map in the composite map.

  • levels (array-like) – The contour levels.

  • percent (bool) – If True, the input ‘levels’ are interpreted as percentages relative to the maximum value of the data in layer ‘index’ of the composite map. If False, the contour levels are set directly from ‘levels’.

Returns

CompositeMap – A composite map with contour levels ‘levels’ at layer ‘index’.

set_plot_settings(index, plot_settings)[source]

Sets the plot settings for a layer in the composite image.

Parameters
  • index (int) – The index of the map in the composite map.

  • plot_settings (dict) – A dictionary of the form

Returns

CompositeMap – A composite map with plot settings ‘plot_settings’ at layer ‘index’.

set_zorder(index, zorder)[source]

Set the layering order (z-order) for a map within the composite.

Parameters
  • index (int) – The index of the map in the composite map.

  • zorder (int) – The layer order.

Returns

CompositeMap – A composite map with the map at layer ‘index’ having layering order ‘zorder’.