astropy: Have a counter in SkyCoord initializations and raise a warning in the event of a lot of scalar initializations

Idea from @astrofrog from the 2019 coordination meeting: have a “counter” in SkyCoord that keeps track of how many times a scalar SkyCoord it’s initialized and raises a warning along the lines of “Are you doing scalar initialization of SkyCoord in for loops? Maybe you should use vectors - see LINK”.

Suggestion from @perrygreenfield - is it really a “rate” (initializations / time) vs “total count” that we care about?

cc @adrn @taldcroft @perrygreenfield

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (13 by maintainers)

Most upvoted comments

But, I kind of disagree. If we make it easy to disable, can’t the person who needs to initialize many skycoords just disable this? I still think it could help many other users…

I’m worried about the case where someone has a long running script that starts raising warnings after a month unexpectadly

One certain outcome of doing this idea would be to make initializing SkyCoord a little bit slower…