home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 169099306

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/706#issuecomment-169099306 https://api.github.com/repos/pydata/xarray/issues/706 169099306 MDEyOklzc3VlQ29tbWVudDE2OTA5OTMwNg== 1217238 2016-01-05T19:05:57Z 2016-01-05T19:06:06Z MEMBER

Back when I was doing spectroscopy in grad school, I wrote some routines to keep track of the units in Fourier transforms. I put this up on GitHub last year: https://github.com/shoyer/fourier-transform. I'm sure I'm not the only person to have written this code, but it still might be a useful point of departure.

As for xray, I agree that the full extent of what you're describing is probably out of scope for xarray itself. However, a basic labeled FFT does seem like it would be a useful addition to the core library.

Nevertheless, I am very interested in supporting external packages like this, either via subclassing or a similar mechanism.

One possibility would be a mechanism for registering "namespace" packages that define additional methods (as I have mentioned previously). You could write something like:

``` python

this code exists in your library "specarray"

class SpecArray(object): def init(self, xray_obj): self.obj = xray_obj

def fft(self):
    ...
    return freq, transformed_obj

xray.register_accessor('spec', SpecArray)

this is what user code looks like

import specarray import xray ds = xray.DataArray(...) ds.spec.fft() # calls the SpecArray.fft method ```

This might be easier than maintaining a full subclass, which tends to require a lot of work and presents backwards compatibility issues when we update internal methods.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  124915222
Powered by Datasette · Queries took 79.234ms · About: xarray-datasette