ArtificialStellarPopulations / ArtPop

✨ ArtPop – Building artificial galaxies one star at a time.
https://artpop.readthedocs.io/en/latest/
MIT License
61 stars 10 forks source link

warning when sampling grid is large #2

Closed johnnygreco closed 3 years ago

johnnygreco commented 3 years ago

We should add a user warning when the sampling grid size of xy_from_grid reaches some large value.

irvin2492 commented 3 years ago

I would like to work on this. Is there a certain dimension size value at which the sample grid should raise a warning or should the warning be used to keep the user from inputting large values?

johnnygreco commented 3 years ago

Thanks for your interest @irvin2492!

This is somewhat arbitrary, but I'd say it would be good to warn the user if image, defined on line 54, will take up more than 1 Gb of memory. Assuming np.float64 pixels, this will happen when memory_in_Gb > 1, where memory_in_Gb is defined like this:

npix = 2 * sample_dim**2
byte_per_pixel = 8 # for np.float64
memory_in_Gb = byte_per_pixel * npix / 1e9

And the check should happen before xx and yy are created.

johnnygreco commented 3 years ago

Issue closed by #3.