sdf_xarray.dataarray_accessor.EpochAccessor#

class sdf_xarray.dataarray_accessor.EpochAccessor(xarray_obj)[source]#

Bases: object

Parameters:

xarray_obj (xr.DataArray)

__init__(xarray_obj)[source]#
Parameters:

xarray_obj (DataArray)

Methods

__init__(xarray_obj)

animate(*args, **kwargs)

Generate animations of Epoch data.

limit(limits[, drop])

Drops values outside the specified limits.

plot([hist])

Builds upon xarray.DataArray.plot while changing some of its default behaviours.

resize(new_shape)

Resizes a xarray.DataArray to another shape.

animate(*args, **kwargs)[source]#

Generate animations of Epoch data.

Parameters:
  • args – Positional arguments passed to animation().

  • kwargs – Keyword arguments passed to animation().

Return type:

FuncAnimation

Examples

>>> anim = ds["Electric_Field_Ey"].epoch.animate()
>>> anim.save("animation.gif")
>>> # Or in a jupyter notebook:
>>> anim.show()
limit(limits, drop=True)[source]#

Drops values outside the specified limits.

Parameters:
  • limits – Array-like list of limits.

  • drop (bool) – Bool specifying whether to drop the co-ordinates outside the limits (default = True).

Return type:

DataArray

plot(hist=False, *args, **kwargs)[source]#

Builds upon xarray.DataArray.plot while changing some of its default behaviours.

These changes are:

  • Flips the default axes order for 2D plots so that x and y are on the correct axes. This exists because plotting of 2D data in xarray uses the xarray.plot.pcolormesh function which takes assumes that x = dim[1] and y = dim[0].

Parameters:
  • hist – If True, will plot a histogram regardless of dimensionality (default = False).

  • args – Positional arguments passed to xarray.DataArray.plot.

  • kwargs – Keyword arguments passed to xarray.DataArray.plot.

Return type:

DataArrayPlotAccessor

resize(new_shape)[source]#

Resizes a xarray.DataArray to another shape. The returned array must have the same dimensionality as the input array.

Parameters:

new_shape – The shape of the new xarray.DataArray, must be the same length as self.shape.

Return type:

DataArray