sisl
sisl copied to clipboard
Allow extra dimensions in grid
I think it could be quite useful to facilitate the processing that grids allowed extra dimensions.
My thought arised from the need to have spin
and E
(energy) dimensions, but I think allowing arbitrary dimensions could be a good idea. To me it seems that xarray
would give lots of functionality for free in this respect, but I guess wrapping a numpy
array (the current approach) would also work.
Let me know what you think of it or if there are any reasons for this not to be implemented that I'm missing. Cheers!
Yes, I have also stumbled upon this my self.
The current reason was that there were some cases where it was a bit difficult to make work along side with the supercell + geometry. Also, for spin
and E
arguments you'll probably find that the memory blows up extremely fast. In that sense the grid
would be better of using some kind of lazy loading where stuff could be handled on-disk. I.e. Grid(["file1", "file2"])
and then data would be read as needed. It would be slow for some stuff, but make stuff way more manageable in other cases.
Maybe it would be good to incorporate dask
, which distributes arrays on processes (generalizes to clusters if needed) and does lazy computations, instead of implementing it ourselves. Dask already supports numpy
, pandas
and xarray
, so it is just a matter of thinking how to integrate it with sisl
's functionality.
Agreed. Using dask
is the way forward.