LSST Applications g1653933729+a8ce1bb630,g1a997c3884+a8ce1bb630,g1b393d1bc7+82476ad7c1,g28da252d5a+3d3e1c4204,g2bbee38e9b+97aa061eef,g2bc492864f+97aa061eef,g2cdde0e794+3ad5f2bb52,g2f1216ac18+8615c5b65f,g3156d2b45e+07302053f8,g347aa1857d+97aa061eef,g35bb328faa+a8ce1bb630,g3a166c0a6a+97aa061eef,g3e281a1b8c+693a468c5f,g4005a62e65+17cd334064,g414038480c+56e3b84a79,g41af890bb2+e5200c8fd9,g65afce507f+0106b0cffc,g80478fca09+e9b577042c,g82479be7b0+a273c6d073,g858d7b2824+b43ab392d2,g9125e01d80+a8ce1bb630,ga5288a1d22+3199fccd69,gae0086650b+a8ce1bb630,gb58c049af0+d64f4d3760,gbb4f38f987+b43ab392d2,gc28159a63d+97aa061eef,gcd3f1c0c93+2e89b03209,gcf0d15dbbd+a0207f3e71,gd35896b8e2+3e8344a67c,gda3e153d99+b43ab392d2,gda6a2b7d83+a0207f3e71,gdaeeff99f8+1711a396fd,ge2409df99d+e6e587e663,ge33fd446bb+b43ab392d2,ge79ae78c31+97aa061eef,gf0baf85859+5daf287408,gf5289d68f6+c4f2338d90,gfda6b12a05+3bcad770a9,w.2024.42
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
lsst.display.ds9.ds9.Buffer Class Reference

Public Member Functions

 __init__ (self, size=0)
 
 set (self, size, silent=True)
 
 pushSize (self, size=-1)
 
 popSize (self)
 
 flush (self, silent=True)
 

Protected Member Functions

 _getSize (self)
 

Protected Attributes

 _commands
 
 _lenCommands
 
 _bufsize
 

Detailed Description

Buffer to control sending commands to DS9.

Notes
-----
The usual usage pattern is:

>>> with ds9.Buffering():
...     # bunches of ds9.{dot,line} commands
...     ds9.flush()
...     # bunches more ds9.{dot,line} commands

Definition at line 112 of file ds9.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.display.ds9.ds9.Buffer.__init__ ( self,
size = 0 )

Definition at line 125 of file ds9.py.

125 def __init__(self, size=0):
126 self._commands = "" # list of pending commands
127 self._lenCommands = len(self._commands)
128 self._bufsize = [] # stack of bufsizes
129
130 self._bufsize.append(size) # don't call self.size() as ds9Cmd isn't defined yet
131

Member Function Documentation

◆ _getSize()

lsst.display.ds9.ds9.Buffer._getSize ( self)
protected
Get the current DS9 buffer size.

Returns
-------
size : `int`
    Size of buffer.

Definition at line 159 of file ds9.py.

159 def _getSize(self):
160 """Get the current DS9 buffer size.
161
162 Returns
163 -------
164 size : `int`
165 Size of buffer.
166 """
167 return self._bufsize[-1]
168

◆ flush()

lsst.display.ds9.ds9.Buffer.flush ( self,
silent = True )
Flush the pending commands.

Parameters
----------
silent : `bool`, optional
    Do not print error messages.

Definition at line 198 of file ds9.py.

198 def flush(self, silent=True):
199 """Flush the pending commands.
200
201 Parameters
202 ----------
203 silent : `bool`, optional
204 Do not print error messages.
205 """
206 ds9Cmd(flush=True, silent=silent)
207
208 cmdBuffer = Buffer(0)

◆ popSize()

lsst.display.ds9.ds9.Buffer.popSize ( self)
Switch back to the previous command buffer size.

Notes
-----
See also `pushSize`.

Definition at line 186 of file ds9.py.

186 def popSize(self):
187 """Switch back to the previous command buffer size.
188
189 Notes
190 -----
191 See also `pushSize`.
192 """
193 self.flush(silent=True)
194
195 if len(self._bufsize) > 1:
196 self._bufsize.pop()
197

◆ pushSize()

lsst.display.ds9.ds9.Buffer.pushSize ( self,
size = -1 )
Replace current DS9 command buffer size.

Parameters
----------
size : `int`, optional
    Size of buffer. A negative value sets the largest possible
    buffer.

Notes
-----
See also `popSize`.

Definition at line 169 of file ds9.py.

169 def pushSize(self, size=-1):
170 """Replace current DS9 command buffer size.
171
172 Parameters
173 ----------
174 size : `int`, optional
175 Size of buffer. A negative value sets the largest possible
176 buffer.
177
178 Notes
179 -----
180 See also `popSize`.
181 """
182 self.flush(silent=True)
183 self._bufsize.append(0)
184 self.set(size, silent=True)
185

◆ set()

lsst.display.ds9.ds9.Buffer.set ( self,
size,
silent = True )
Set the ds9 buffer size to size.

Parameters
----------
size : `int`
    Size of buffer. Requesting a negative size provides the
    largest possible buffer given bugs in xpa.
silent : `bool`, optional
    Do not print error messages (default `True`).

Definition at line 132 of file ds9.py.

132 def set(self, size, silent=True):
133 """Set the ds9 buffer size to size.
134
135 Parameters
136 ----------
137 size : `int`
138 Size of buffer. Requesting a negative size provides the
139 largest possible buffer given bugs in xpa.
140 silent : `bool`, optional
141 Do not print error messages (default `True`).
142 """
143 if size < 0:
144 size = XPA_SZ_LINE - 5
145
146 if size > XPA_SZ_LINE:
147 print("xpa silently hardcodes a limit of %d for buffer sizes (you asked for %d) " %
148 (XPA_SZ_LINE, size), file=sys.stderr)
149 self.set(-1) # use max buffersize
150 return
151
152 if self._bufsize:
153 self._bufsize[-1] = size # change current value
154 else:
155 self._bufsize.append(size) # there is no current value; set one
156
157 self.flush(silent=silent)
158
daf::base::PropertySet * set
Definition fits.cc:931

Member Data Documentation

◆ _bufsize

lsst.display.ds9.ds9.Buffer._bufsize
protected

Definition at line 128 of file ds9.py.

◆ _commands

lsst.display.ds9.ds9.Buffer._commands
protected

Definition at line 126 of file ds9.py.

◆ _lenCommands

lsst.display.ds9.ds9.Buffer._lenCommands
protected

Definition at line 127 of file ds9.py.


The documentation for this class was generated from the following file: