Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework Spectrum classes to use array.array rather than numpy.array #378

Open
CnlPepper opened this issue Mar 28, 2021 · 1 comment
Open
Labels
enhancement v1 Issues relating to the development of V1

Comments

@CnlPepper
Copy link
Member

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.

@CnlPepper CnlPepper added enhancement v1 Issues relating to the development of V1 labels Mar 28, 2021
@CnlPepper
Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement v1 Issues relating to the development of V1
Projects
None yet
Development

No branches or pull requests

1 participant