Grids¶
A “Grid” in spexxy is anything that provides any kind of data in a regularly spaced parameter space. The base class
for all Grids is spexxy.grid.Grid, which also defines some convenience methods.
The usual way of getting data from a grid is by calling it with the requested parameters:
grid = Grid()
data = grid((3.14, 42.))
A class inheriting from Grid must call Grid’s constructor with a list of
GridAxis objects that describe the axes of the grid, i.e. their names and possbile
values. Furthermore it must overwrite all necessary methods, in particular
__call__(), __contains__(), and
all(). See the implementation of ValuesGrid for a
simple example.
spexxy comes with two pre-defined grids:
ValuesGriddefines a simple grid, for which the values are defined in its constructor. This grid is mainly used for unit tests.FilesGridis a grid, where each “value” is a spectrum in its own file. A CSV file must be provided containing filenames and all parameters.