SJICube

class irispy.sji.SJICube(input)[source] [edit on github]

Bases: object

A series of SJI Images

Examples

>>> from irispy.sji import SJICube
>>> from irispy.data import sample
>>> sji = SJICube(sample.SJI_CUBE_1400)   

Creates a new instance

Attributes Summary

date Observation time
detector Detector name
dimensions The dimensions of the array (x axis first, y axis second).
dtype The numpy.dtype of the array of the map.
exposure_time Exposure time of each frame in seconds.
instrument Instrument name
iris_obs_description IRIS Observation Description
iris_obs_id IRIS Observation ID
measurement Measurement name, defaults to the wavelength of image
observatory Observatory or Telescope name
rotation_matrix
scale Image scale along the x and y axes in units/pixel (i.e.
spatial_units Image coordinate units along the x and y axes (i.e.
wavelength wavelength of the observation

Methods Summary

apply_function(function, *function_args, …) Apply a function that operates on the full 3-d data in the mapcube and return a single 2-d map based on that function.
base_difference([base, fraction]) Calculate the base difference of a mapcube.
lightcurve(location_a, location_b[, range_c]) Given a pixel index return a lightcurve.
max() Calculate the maximum value of the data array.
mean() Calculate the mean of the data array.
meta(key) The Meta.
min() Calculate the minimum value of the data array.
peek([resample]) A animation plotting routine that animates each element in the
plot([axes, resample, annotate, interval, …]) A animation plotting routine that animates each element in the
plot_in_notebook() Provides ipython widgets to plot the SJI data.
resample(dimensions[, method]) Returns a new Map that has been resampled up or down
running_difference([offset, use_offset_for_meta]) Calculate the running difference of the mapcube and return a new mapcube
std() Calculate the standard deviation of the data array.
submap(range_a, range_b[, range_c]) Returns a submap of the map with the specified range.
superpixel(dimensions[, offset, func]) Returns a new map consisting of superpixels formed from the original data.
to_html5_video() Output video of the observation

Attributes Documentation

date

Observation time

detector

Detector name

dimensions

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

dtype

The numpy.dtype of the array of the map.

exposure_time

Exposure time of each frame in seconds.

instrument

Instrument name

iris_obs_description

IRIS Observation Description

iris_obs_id

IRIS Observation ID

measurement

Measurement name, defaults to the wavelength of image

observatory

Observatory or Telescope name

rotation_matrix
scale

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

spatial_units

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

wavelength

wavelength of the observation

Methods Documentation

apply_function(function, *function_args, **function_kwargs)[source] [edit on github]

Apply a function that operates on the full 3-d data in the mapcube and return a single 2-d map based on that function.

Parameters:
  • function (a function that takes a 3-d numpy array as its first) – argument.
  • function_args (function arguments) –
  • function_kwargs (function keywords) –
Returns:

SJIMAP – A map that stores the result of applying the function to the 3-d data of the mapcube.

Return type:

sunpy.map.Map

base_difference(base=0, fraction=False)[source] [edit on github]

Calculate the base difference of a mapcube.

Parameters:
  • base (int, sunpy.map.Map) – If base is an integer, this is understood as an index to the input mapcube. Differences are calculated relative to the map at index ‘base’. If base is a sunpy map, then differences are calculated relative to that map
  • fraction (boolean) – If False, then absolute changes relative to the base map are returned. If True, then fractional changes relative to the base map are returned
Returns:

A mapcube containing base difference of the input mapcube.

Return type:

sunpy.map.MapCube

lightcurve(location_a, location_b, range_c=None)[source] [edit on github]

Given a pixel index return a lightcurve.

max()[source] [edit on github]

Calculate the maximum value of the data array.

mean()[source] [edit on github]

Calculate the mean of the data array.

meta(key)[source] [edit on github]

The Meta.

min()[source] [edit on github]

Calculate the minimum value of the data array.

peek(resample=None, **kwargs)[source] [edit on github]

A animation plotting routine that animates each element in the MapCube

Parameters:
  • fig (mpl.figure) – Figure to use to create the explorer
  • resample (list or False) – Draws the map at a lower resolution to increase the speed of animation. Specify a list as a fraction i.e. [0.25, 0.25] to plot at 1/4 resolution. [Note: this will only work where the map arrays are the same size]
  • annotate (bool) – Annotate the figure with scale and titles
  • interval (int) – Animation interval in ms
  • colorbar (bool) – Plot colorbar
  • plot_function (function) – A function to call to overplot extra items on the map plot. For more information see sunpy.visualization.MapCubeAnimator.
Returns:

mapcubeanim – A mapcube animator instance.

Return type:

sunpy.visualization.MapCubeAnimator

See also

sunpy.visualization.mapcubeanimator.MapCubeAnimator()

Examples

>>> import matplotlib.pyplot as plt
>>> from sunpy.map import Map
>>> cube = Map(files, cube=True)   
>>> ani = cube.peek(colorbar=True)   
>>> plt.show()   

Plot the map at 1/2 original resolution

>>> cube = Map(files, cube=True)   
>>> ani = cube.peek(resample=[0.5, 0.5], colorbar=True)   
>>> plt.show()   

Plot the map with the limb at each time step

>>> def myplot(fig, ax, sunpy_map):
...    p = sunpy_map.draw_limb()
...    return p
>>> cube = Map(files, cube=True)   
>>> ani = cube.peek(plot_function=myplot)   
>>> plt.show()   

Decide you want an animation:

>>> cube = Map(files, cube=True)   
>>> ani = cube.peek(resample=[0.5, 0.5], colorbar=True)   
>>> mplani = ani.get_animation()   
plot(axes=None, resample=None, annotate=True, interval=200, plot_function=None, **kwargs)[source] [edit on github]

A animation plotting routine that animates each element in the MapCube

Parameters:
  • gamma (float) – Gamma value to use for the color map
  • axes (mpl axes) – axes to plot the animation on, if none uses current axes
  • resample (list or False) – Draws the map at a lower resolution to increase the speed of animation. Specify a list as a fraction i.e. [0.25, 0.25] to plot at 1/4 resolution. [Note: this will only work where the map arrays are the same size]
  • annotate (bool) – Annotate the figure with scale and titles
  • interval (int) – Animation interval in ms
  • plot_function (function) – A function to be called as each map is plotted. Any variables returned from the function will have their remove() method called at the start of the next frame so that they are removed from the plot.

Examples

>>> import matplotlib.pyplot as plt
>>> import matplotlib.animation as animation
>>> from sunpy.map import Map
>>> cube = Map(files, cube=True)   
>>> ani = cube.plot(colorbar=True)   
>>> plt.show()   

Plot the map at 1/2 original resolution

>>> cube = Map(files, cube=True)   
>>> ani = cube.plot(resample=[0.5, 0.5], colorbar=True)   
>>> plt.show()   

Save an animation of the MapCube

>>> cube = Map(res, cube=True)   
>>> ani = cube.plot()   
>>> Writer = animation.writers['ffmpeg']   
>>> writer = Writer(fps=10, metadata=dict(artist='SunPy'), bitrate=1800)   
>>> ani.save('mapcube_animation.mp4', writer=writer)   

Save an animation with the limb at each time step

>>> def myplot(fig, ax, sunpy_map):
...    p = sunpy_map.draw_limb()
...    return p
>>> cube = Map(files, cube=True)   
>>> ani = cube.peek(plot_function=myplot)   
>>> plt.show()   
plot_in_notebook()[source] [edit on github]

Provides ipython widgets to plot the SJI data.

resample(dimensions, method='linear')[source] [edit on github]

Returns a new Map that has been resampled up or down

running_difference(offset=1, use_offset_for_meta='ahead')[source] [edit on github]

Calculate the running difference of the mapcube and return a new mapcube

Parameters:
  • offset (int) – Calculate the running difference between map ‘i + offset’ and image ‘i’.
  • use_offset_for_meta ({'ahead', 'behind'}) – Which meta header to use in layer ‘i’ in the returned mapcube, either from map ‘i + offset’ (when set to ‘ahead’) and image ‘i’ (when set to ‘behind’).
Returns:

A mapcube containing the running difference of the input mapcube.

Return type:

sunpy.map.MapCube

std()[source] [edit on github]

Calculate the standard deviation of the data array.

submap(range_a, range_b, range_c=None)[source] [edit on github]

Returns a submap of the map with the specified range.

superpixel(dimensions, offset=<Quantity [ 0., 0.] pix>, func=<function sum>)[source] [edit on github]

Returns a new map consisting of superpixels formed from the original data. Useful for increasing signal to noise ratio in images.

to_html5_video()[source] [edit on github]

Output video of the observation