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

GridCoords object has many instance attributes that could be made methods decorated with property #152

Closed
iancze opened this issue Feb 15, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@iancze
Copy link
Collaborator

iancze commented Feb 15, 2023

The coordinates.GridCoords class creates an object that stores the dimensions of the image plane grid and many other useful derived grids and quantities. The only real parameters of this class are cell_size and npix---every other quantity is derived.

Rather than instantiate these as real instance attributes in __init__, it would be more memory efficient to make all of these derived quantities their own methods that could be decorated with @property. This might even enable some additional error checking in some cases.

@iancze iancze added the enhancement New feature or request label Feb 15, 2023
@kadri-nizam
Copy link
Contributor

I've been thinking about implementing this. Some of the attributes that require fft computations can be memoized with @functools.cache too so that the results are cached after the first call. This can avoid repeated computations if the attribute is used several times.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants