xdas-dev / xdas

Python framework for Distributed Acoustic Sensing (DAS).
https://xdas.readthedocs.io
GNU General Public License v3.0
29 stars 2 forks source link

Add support for numpy ufuncs, some regular functions and add xarray style dim aware funcs. #9

Closed atrabattoni closed 7 months ago

atrabattoni commented 8 months ago

(1) This allows the use of all ufuncs on database objects:

np.sin(db) # will return a Database

I did not reexported those functions through xdas (I do not see the point).

(2) A set of regular numpy functions can be used directly on database objects:

np.sum(db, axis=0) # will return a Database

The list of available functions can obtained like this:

from xdas.database import NUMPY_HANDLED_FUNCTIONS
print([func.__name__ for func in NUMPY_HANDLED_FUNCTIONS])

(3) A set of dim aware numpy/xarray like functions are reexported:

xp.sum(db, dim="time"). 

To Do (maybe in another pull request):