Array2D#

class gwpy.types.Array2D(
data: QuantityLike,
unit: UnitBase | str | None = None,
x0: QuantityLike | None = None,
dx: QuantityLike | None = None,
xindex: QuantityLike | None = None,
xunit: UnitBase | str | None = None,
y0: QuantityLike | None = None,
dy: QuantityLike | None = None,
yindex: QuantityLike | None = None,
yunit: UnitBase | str | None = None,
**kwargs,
)[source]#

Bases: Series

A two-dimensional array with metadata.

Parameters:
valuearray_like

Input data array.

unitUnit, optional

Physical unit of these data.

x0float, Quantity, optional

The starting value for the x-axis of this array.

dxfloat, Quantity, optional

The step size for the x-axis of this array.

xindexarray-like

The complete array of x-axis values for this array. This argument takes precedence over x0 and dx so should be given in place of these if relevant, not alongside.

xunitUnit, optional

The unit of the x-axis coordinates. If not given explicitly, it will be taken from any of dx, x0, or xindex, or set to a boring default.

y0float, Quantity, optional

The starting value for the y-axis of this array.

dyfloat, Quantity, optional

The step size for the y-axis of this array.

yindexarray-like

The complete array of y-axis values for this array. This argument takes precedence over y0 and dy so should be given in place of these if relevant, not alongside.

yunitUnit, optional

The unit of the y-axis coordinates. If not given explicitly, it will be taken from any of dy, y0, or yindex, or set to a boring default.

epochLIGOTimeGPS, float, str, optional

GPS epoch associated with these data, any input parsable by to_gps is fine.

namestr, optional

Descriptive title for this array.

channelChannel, str, optional

Source data stream for these data.

dtypedtype, optional

Input data type.

copybool, optional

Choose to copy the input data to new memory.

subokbool, optional

Allow passing of sub-classes by the array generator.

Returns:
arrayArray

a new array, with a view of the data, and all associated metadata

Attributes Summary

T

Return the transpose of this Array2D.

dy

Y-axis sample separation.

read

Read data into a Array2D.

write

Write this Array2D to a file.

y0

Y-axis coordinate of the first data point.

yindex

Positions of the data on the y-axis.

yspan

Y-axis [low, high) segment encompassed by these data.

yunit

Unit of Y-axis index.

Methods Summary

imshow(**kwargs)

Render this array on a Plot using imshow.

pcolormesh(**kwargs)

Render this array on a Plot using pcolormesh.

plot([method])

"Render this array on a Plot.

value_at(x, y)

Return the value of this Series at the given (x, y) coordinates.

Attributes Documentation

T[source]#

Return the transpose of this Array2D.

dy[source]#

Y-axis sample separation.

read#

Read data into a Array2D.

Arguments and keywords depend on the output format, see the online documentation for full details for each format, the parameters below are common to most formats.

Parameters:
sourcestr, pathlib.Path, file, list

Source of data, any of the following:

  • open (readable) file object

  • path to a file

  • list of files (open or paths)

formatstr,

Source format identifier. If not given, the format will be detected if possible. See below for list of acceptable formats.

kwargs

Other keywords arguments depend on the format, see the online documentation for details.

Returns:
dataArray2D
Raises:
IndexError

if source is an empty list

write#

Write this Array2D to a file.

Arguments and keywords depend on the output format, see the online documentation for full details for each format, the parameters below are common to most formats.

Parameters:
targetstr, Path, file

Output file path or file opened in write mode.

formatstr, optional

Output format identifier. Default format will be detected if possible. See below for list of acceptable formats.

y0[source]#

Y-axis coordinate of the first data point.

yindex[source]#

Positions of the data on the y-axis.

yspan[source]#

Y-axis [low, high) segment encompassed by these data.

Type:

Segment

yunit[source]#

Unit of Y-axis index.

Methods Documentation

imshow(**kwargs) Plot[source]#

Render this array on a Plot using imshow.

Parameters:
kwargs

All arguments are passed to plot.

See also

plot

For details of plotting this object.

pcolormesh(**kwargs) Plot[source]#

Render this array on a Plot using pcolormesh.

Parameters:
kwargs

All arguments are passed to plot.

See also

plot

For details of plotting this object.

plot(method: str = 'imshow', **kwargs) Plot[source]#

“Render this array on a Plot.

Parameters:
methodstr, optional

The Axes method to call when rendering this array.

kwargs

All arguments are passed to plot.

See also

gwpy.plot.Plot

For details of plotting this object.

value_at(x: QuantityLike, y: QuantityLike) Quantity[source]#

Return the value of this Series at the given (x, y) coordinates.

Parameters:
xfloat, Quantity

The xindex value at which to search.

yfloat, Quantity

The yindex value at which to search.

Returns:
zQuantity

The value of this Series at the given coordinates.

Raises:
IndexError

If x or y` don’t match a value on their respective index.