LSST Applications g0f08755f38+9c285cab97,g1635faa6d4+13f3999e92,g1653933729+a8ce1bb630,g1a0ca8cf93+bf6eb00ceb,g28da252d5a+0829b12dee,g29321ee8c0+5700dc9eac,g2bbee38e9b+9634bc57db,g2bc492864f+9634bc57db,g2cdde0e794+c2c89b37c4,g3156d2b45e+41e33cbcdc,g347aa1857d+9634bc57db,g35bb328faa+a8ce1bb630,g3a166c0a6a+9634bc57db,g3e281a1b8c+9f2c4e2fc3,g414038480c+077ccc18e7,g41af890bb2+fde0dd39b6,g5fbc88fb19+17cd334064,g781aacb6e4+a8ce1bb630,g80478fca09+55a9465950,g82479be7b0+d730eedb7d,g858d7b2824+9c285cab97,g9125e01d80+a8ce1bb630,g9726552aa6+10f999ec6a,ga5288a1d22+2a84bb7594,gacf8899fa4+c69c5206e8,gae0086650b+a8ce1bb630,gb58c049af0+d64f4d3760,gc28159a63d+9634bc57db,gcf0d15dbbd+4b7d09cae4,gda3e153d99+9c285cab97,gda6a2b7d83+4b7d09cae4,gdaeeff99f8+1711a396fd,ge2409df99d+5e831397f4,ge79ae78c31+9634bc57db,gf0baf85859+147a0692ba,gf3967379c6+41c94011de,gf3fb38a9a8+8f07a9901b,gfb92a5be7c+9c285cab97,w.2024.46
LSST Data Management Base Package
Loading...
Searching...
No Matches
Classes | Functions | Variables
lsst.afw.display.interface Namespace Reference

Classes

class  Display
 
class  Event
 

Functions

 _makeDisplayImpl (display, backend, *args, **kwargs)
 
 noop_callback (k, x, y)
 
 h_callback (k, x, y)
 
 setDefaultBackend (backend)
 
 getDefaultBackend ()
 
 setDefaultFrame (frame=0)
 
 getDefaultFrame ()
 
 incrDefaultFrame ()
 
 setDefaultMaskTransparency (maskPlaneTransparency={})
 
 setDefaultMaskPlaneColor (name=None, color=None)
 
 getDisplay (frame=None, backend=None, create=True, verbose=False, **kwargs)
 
 delAllDisplays ()
 

Variables

 logger = logging.getLogger(__name__)
 
str WHITE = "white"
 
str BLACK = "black"
 
str RED = "red"
 
str GREEN = "green"
 
str BLUE = "blue"
 
str CYAN = "cyan"
 
str MAGENTA = "magenta"
 
str YELLOW = "yellow"
 
str ORANGE = "orange"
 
str IGNORE = "ignore"
 

Function Documentation

◆ _makeDisplayImpl()

lsst.afw.display.interface._makeDisplayImpl ( display,
backend,
* args,
** kwargs )
protected
Return the ``DisplayImpl`` for the named backend

Parameters
----------
display : `str`
    Name of device. Should be importable, either absolutely or relative to lsst.display
backend : `str`
    The desired backend
*args
    Arguments passed to DisplayImpl.__init__
*kwargs
    Keywords arguments passed to DisplayImpl.__init__

Examples
--------
E.g.

.. code-block:: py

     import lsst.afw.display as afwDisplay
     display = afwDisplay.Display(backend="ds9")

 would call

.. code-block:: py

     _makeDisplayImpl(..., "ds9", 1)

and import the ds9 implementation of ``DisplayImpl`` from `lsst.display.ds9`

Definition at line 53 of file interface.py.

53def _makeDisplayImpl(display, backend, *args, **kwargs):
54 """Return the ``DisplayImpl`` for the named backend
55
56 Parameters
57 ----------
58 display : `str`
59 Name of device. Should be importable, either absolutely or relative to lsst.display
60 backend : `str`
61 The desired backend
62 *args
63 Arguments passed to DisplayImpl.__init__
64 *kwargs
65 Keywords arguments passed to DisplayImpl.__init__
66
67 Examples
68 --------
69 E.g.
70
71 .. code-block:: py
72
73 import lsst.afw.display as afwDisplay
74 display = afwDisplay.Display(backend="ds9")
75
76 would call
77
78 .. code-block:: py
79
80 _makeDisplayImpl(..., "ds9", 1)
81
82 and import the ds9 implementation of ``DisplayImpl`` from `lsst.display.ds9`
83 """
84 _disp = None
85 exc = None
86 candidateBackends = (f"lsst.display.{backend}", backend, f".{backend}", f"lsst.afw.display.{backend}")
87 for dt in candidateBackends:
88 exc = None
89 # only specify the root package if we are not doing an absolute import
90 impargs = {}
91 if dt.startswith("."):
92 impargs["package"] = "lsst.display"
93 try:
94 _disp = importlib.import_module(dt, **impargs)
95 # If _disp doesn't have a DisplayImpl attribute, we probably
96 # picked up an irrelevant module due to a name collision
97 if hasattr(_disp, "DisplayImpl"):
98 break
99 else:
100 _disp = None
101 except (ImportError, SystemError) as e:
102 # SystemError can be raised in Python 3.5 if a relative import
103 # is attempted when the root package, lsst.display, does not exist.
104 # Copy the exception into outer scope
105 exc = e
106
107 if not _disp or not hasattr(_disp.DisplayImpl, "_show"):
108 # If available, re-use the final exception from above
109 e = ImportError(f"Could not load the requested backend: {backend} "
110 f"(tried {', '.join(candidateBackends)}, but none worked).")
111 if exc is not None:
112 raise e from exc
113 else:
114 raise e
115
116 if display:
117 _impl = _disp.DisplayImpl(display, *args, **kwargs)
118 if not hasattr(_impl, "frame"):
119 _impl.frame = display.frame
120
121 return _impl
122 else:
123 return True
124
125

◆ delAllDisplays()

lsst.afw.display.interface.delAllDisplays ( )
Delete and close all known displays.

Definition at line 1002 of file interface.py.

1002def delAllDisplays():
1003 """Delete and close all known displays.
1004 """
1005 return Display.delAllDisplays()

◆ getDefaultBackend()

lsst.afw.display.interface.getDefaultBackend ( )

Definition at line 937 of file interface.py.

937def getDefaultBackend():
938 return Display.getDefaultBackend()
939
940

◆ getDefaultFrame()

lsst.afw.display.interface.getDefaultFrame ( )
Get the default frame for display.

Definition at line 945 of file interface.py.

945def getDefaultFrame():
946 """Get the default frame for display.
947 """
948 return Display.getDefaultFrame()
949
950

◆ getDisplay()

lsst.afw.display.interface.getDisplay ( frame = None,
backend = None,
create = True,
verbose = False,
** kwargs )
Return a specific `Display`, creating it if need be.

Parameters
----------
frame
    Desired frame (`None` => use defaultFrame (see `setDefaultFrame`)).
backend : `str`
    Create the specified frame using this backend (or the default if
    `None`) if it doesn't already exist. If ``backend == ""``, it's an
    error to specify a non-existent ``frame``.
create : `bool`
    Create the display if it doesn't already exist.
verbose : `bool`
    Allow backend to be chatty.
**kwargs
    Keyword arguments passed to `Display` constructor.

See also
--------
Display.getDisplay

Definition at line 976 of file interface.py.

976def getDisplay(frame=None, backend=None, create=True, verbose=False, **kwargs):
977 """Return a specific `Display`, creating it if need be.
978
979 Parameters
980 ----------
981 frame
982 Desired frame (`None` => use defaultFrame (see `setDefaultFrame`)).
983 backend : `str`
984 Create the specified frame using this backend (or the default if
985 `None`) if it doesn't already exist. If ``backend == ""``, it's an
986 error to specify a non-existent ``frame``.
987 create : `bool`
988 Create the display if it doesn't already exist.
989 verbose : `bool`
990 Allow backend to be chatty.
991 **kwargs
992 Keyword arguments passed to `Display` constructor.
993
994 See also
995 --------
996 Display.getDisplay
997 """
998
999 return Display.getDisplay(frame, backend, create, verbose, **kwargs)
1000
1001

◆ h_callback()

lsst.afw.display.interface.h_callback ( k,
x,
y )

Definition at line 925 of file interface.py.

925def h_callback(k, x, y):
926 print("Enter q or <ESC> to leave interactive mode, h for this help, or a letter to fire a callback")
927 return False
928
929# Handle Displays, including the default one (the frame to use when a user specifies None)
930# If the default frame is None, image display is disabled
931
932

◆ incrDefaultFrame()

lsst.afw.display.interface.incrDefaultFrame ( )
Increment the default frame for display.

Definition at line 951 of file interface.py.

951def incrDefaultFrame():
952 """Increment the default frame for display.
953 """
954 return Display.incrDefaultFrame()
955
956

◆ noop_callback()

lsst.afw.display.interface.noop_callback ( k,
x,
y )
Callback function

Parameters
----------
key
x
y

Definition at line 913 of file interface.py.

913def noop_callback(k, x, y):
914 """Callback function
915
916 Parameters
917 ----------
918 key
919 x
920 y
921 """
922 return False
923
924

◆ setDefaultBackend()

lsst.afw.display.interface.setDefaultBackend ( backend)

Definition at line 933 of file interface.py.

933def setDefaultBackend(backend):
934 Display.setDefaultBackend(backend)
935
936

◆ setDefaultFrame()

lsst.afw.display.interface.setDefaultFrame ( frame = 0)

Definition at line 941 of file interface.py.

941def setDefaultFrame(frame=0):
942 return Display.setDefaultFrame(frame)
943
944

◆ setDefaultMaskPlaneColor()

lsst.afw.display.interface.setDefaultMaskPlaneColor ( name = None,
color = None )
Set the default mapping from mask plane names to colors.

Parameters
----------
name : `str` or `dict`
    Name of mask plane, or a dict mapping names to colors.
    If ``name`` is `None`, use the hard-coded default dictionary.
color : `str`
    Desired color, or `None` if ``name`` is a dict.

Definition at line 961 of file interface.py.

961def setDefaultMaskPlaneColor(name=None, color=None):
962 """Set the default mapping from mask plane names to colors.
963
964 Parameters
965 ----------
966 name : `str` or `dict`
967 Name of mask plane, or a dict mapping names to colors.
968 If ``name`` is `None`, use the hard-coded default dictionary.
969 color : `str`
970 Desired color, or `None` if ``name`` is a dict.
971 """
972
973 return Display.setDefaultMaskPlaneColor(name, color)
974
975

◆ setDefaultMaskTransparency()

lsst.afw.display.interface.setDefaultMaskTransparency ( maskPlaneTransparency = {})

Definition at line 957 of file interface.py.

957def setDefaultMaskTransparency(maskPlaneTransparency={}):
958 return Display.setDefaultMaskTransparency(maskPlaneTransparency)
959
960

Variable Documentation

◆ BLACK

str lsst.afw.display.interface.BLACK = "black"

Definition at line 42 of file interface.py.

◆ BLUE

str lsst.afw.display.interface.BLUE = "blue"

Definition at line 45 of file interface.py.

◆ CYAN

str lsst.afw.display.interface.CYAN = "cyan"

Definition at line 46 of file interface.py.

◆ GREEN

str lsst.afw.display.interface.GREEN = "green"

Definition at line 44 of file interface.py.

◆ IGNORE

str lsst.afw.display.interface.IGNORE = "ignore"

Definition at line 50 of file interface.py.

◆ logger

lsst.afw.display.interface.logger = logging.getLogger(__name__)

Definition at line 38 of file interface.py.

◆ MAGENTA

str lsst.afw.display.interface.MAGENTA = "magenta"

Definition at line 47 of file interface.py.

◆ ORANGE

str lsst.afw.display.interface.ORANGE = "orange"

Definition at line 49 of file interface.py.

◆ RED

str lsst.afw.display.interface.RED = "red"

Definition at line 43 of file interface.py.

◆ WHITE

str lsst.afw.display.interface.WHITE = "white"

Definition at line 41 of file interface.py.

◆ YELLOW

str lsst.afw.display.interface.YELLOW = "yellow"

Definition at line 48 of file interface.py.