Open CnlPepper opened 3 years ago
An alternative is to move to C dynamically allocated arrays and internally manage the memory directly. This would avoid the need for checks that the user has not resized the array.array object, that may be necessary if moving to array.
The array() class in faster to construct and can be accessed via pointer in cython, removing the need for costly memoryview creation. Past experiments indicate that switching to array could lead to a 10-20% uplift in performance.
Access to wavelength and samples would return array objects. This would require users to convert the Spectrum arrays to numpy arrays if they need the richer interface. A helper method could be provided e.g. as_numpy() that returns a tuple containing the sample and wavelength arrays.