pennmem/ptsa

samplerate should be be an attribute, not a coordinate

Opened this issue · 0 comments

From xarray docs:

The DataArray constructor takes:

  • data: a multi-dimensional array of values (e.g., a numpy ndarray, Series, DataFrame or pandas.Panel)
  • coords: a list or dictionary of coordinates. If a list, it should be a list of tuples where the first element is the dimension name and the second element is the corresponding coordinate array_like object.
  • dims: a list of dimension names. If omitted and coords is a list of tuples, dimension names are taken from coords.
  • attrs: a dictionary of attributes to add to the instance
  • name: a string that names the instance

Coordinates are supposed to be a mapping of a dimension name to coordinates of that dimension. This is fundamentally not at all how sample rate is used. It is misleading for sample rate to be a coordinate, since it is not a dimension. It should simply be an attribute of the instance. Right now it's a singleton numpy array containing the sample rate value.

This could be an easy fix or a difficult one depending on how exactly the filters depend on sample rate being a coordinate.