CaImAn icon indicating copy to clipboard operation
CaImAn copied to clipboard

Remove pylab imports

Open EricThomson opened this issue 11 months ago • 1 comments

Description

Will close out item on Roadmap (#1142 ).

Pylab is a relic of the days when Python was trying to be like Matlab and its use is strongly discouraged even in its source code. This gets rid of it.

It includes things like:

from numpy import *
from numpy.fft import *
from numpy.random import *
from numpy.linalg import *

And it makes Caiman less readable with pl.foo() syntax whereas people expect plt.foo() when using the recommended api.

Type of change

  • [X] Nnon-breaking change which fixes an issue

I'll be testing out things as I go through the different modules.

One question: should we change the name of the back end in movies.py from pylab to matplotlib? It seems yes. And, should we warn people?

My guess is nobody uses it, I have tested it (it works): the quality is horrible, we never recommend it -- in fact we literally throw a warning when people even try to use it. My inclination is just to make this change in the name of the back end. But if others thing we should give warnings at first, and change the name in a couple of cycles, I'd listen.

(Aside: I think a more important question is whether we even want this matplotlib interface for movies in there in the first place, but that's a bigger issue outside the scope of this PR. It seems like a maintenance burden not worth having.)

EricThomson avatar Mar 21 '24 13:03 EricThomson