Skip to content

Commit

Permalink
update doc to clarify lsstDebug behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
leeskelvin committed Mar 26, 2021
1 parent 2d4f3f3 commit b66aca7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
11 changes: 7 additions & 4 deletions doc/mainpage.dox
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ The class \link lsstDebug \endlink can be used to turn on debugging output in a
the variable \c lsstDebug.Info("lsst.meas.astrom.astrom").debug is used to control debugging output from
the lsst.meas.astrom.astrom module.

It is always safe to interrogate \c lsstDebug; for example \c lsstDebug.Info("Robert.Hugh.Lupton").isBadPerson will return False.
You may interrogate \c lsstDebug for any string in \c sys.modules, i.e. for the \c \__name__ of any package
that has been imported; for example, if the \c Robert.Hugh.Lupton package is loaded then
\c lsstDebug.Info("Robert.Hugh.Lupton").parameter will return False for any named parameter that has not
already been set to True elsewhere.

The convention is that the name ("lsst.meas.astrom.astrom") is the \c \__name__ of the module, so the
source code will typically look something like:
Expand All @@ -36,12 +39,12 @@ def DebugInfo(name):
di = lsstDebug.getInfo(name) # N.b. lsstDebug.Info(name) would call us recursively
if name == "foo":
di.display = True

return di

lsstDebug.Info = DebugInfo
\endcode
into a file \b debug.py and
into a file \b debug.py available in the \c PYTHONPATH and
\code
import lsstDebug

Expand Down
7 changes: 6 additions & 1 deletion python/lsstDebug.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,12 @@ def DebugInfo(name):
----------
modname : `str`
Module name.
"""
Raises
------
KeyError :
Raised if ``modname`` is not loaded.
"""
def __init__(self, modname):
import sys
self.__dict__["_dict"] = sys.modules[modname].__dict__
Expand Down

0 comments on commit b66aca7

Please sign in to comment.