photutils icon indicating copy to clipboard operation
photutils copied to clipboard

Confusion between photutils.utils and photutils.psf.utils

Open chrusher opened this issue 5 years ago • 1 comments

If I import photutils and try to use photutils.utils.calc_total_error, I get an AttributeError: module 'photutils.psf.utils' has no attribute 'calc_total_error'. If instead I explicitly import the function (from photutils.utils import calc_total_error, I can use it without issue. What appears to be happening when I import photutils is that the utils submodule of psf becomes photutils.utils since everything in the psf module is becomes part of the photutils name space.

I am using photutils version 0.7.2 under Python 3.7.6.

chrusher avatar Aug 13 '20 15:08 chrusher

As you've found, the photutils.utils submodule functions require an explicit import using from photutils.utils import <func>. They are intended to be explicitly imported from the submodule. Other submodules in photutils are exposed in the top-level namespace, but that may change in the future.

larrybradley avatar Aug 13 '20 20:08 larrybradley