LSST Applications g00d0e8bbd7+edbf708997,g03191d30f7+9ce8016dbd,g1955dfad08+0bd186d245,g199a45376c+5137f08352,g1fd858c14a+a888a50aa2,g262e1987ae+45f9aba685,g29ae962dfc+1c7d47a24f,g2cef7863aa+73c82f25e4,g35bb328faa+edbf708997,g3fd5ace14f+eed17d2c67,g47891489e3+6dc8069a4c,g53246c7159+edbf708997,g64539dfbff+c4107e45b5,g67b6fd64d1+6dc8069a4c,g74acd417e5+f452e9c21a,g786e29fd12+af89c03590,g7ae74a0b1c+a25e60b391,g7aefaa3e3d+2025e9ce17,g7cc15d900a+2d158402f9,g87389fa792+a4172ec7da,g89139ef638+6dc8069a4c,g8d4809ba88+c4107e45b5,g8d7436a09f+e96c132b44,g8ea07a8fe4+db21c37724,g98df359435+aae6d409c1,ga2180abaac+edbf708997,gac66b60396+966efe6077,gb632fb1845+88945a90f8,gbaa8f7a6c5+38b34f4976,gbf99507273+edbf708997,gca7fc764a6+6dc8069a4c,gd7ef33dd92+6dc8069a4c,gda68eeecaf+7d1e613a8d,gdab6d2f7ff+f452e9c21a,gdbb4c4dda9+c4107e45b5,ge410e46f29+6dc8069a4c,ge41e95a9f2+c4107e45b5,geaed405ab2+e194be0d2b,w.2025.47
LSST Data Management Base Package
Loading...
Searching...
No Matches
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

str _commands = ""
 
 _lenCommands = len(self._commands)
 
list _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 113 of file ds9.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 126 of file ds9.py.

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

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 160 of file ds9.py.

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

◆ 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 199 of file ds9.py.

199 def flush(self, silent=True):
200 """Flush the pending commands.
201
202 Parameters
203 ----------
204 silent : `bool`, optional
205 Do not print error messages.
206 """
207 ds9Cmd(flush=True, silent=silent)
208
209 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 187 of file ds9.py.

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

◆ 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 170 of file ds9.py.

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

◆ 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 133 of file ds9.py.

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

Member Data Documentation

◆ _bufsize

lsst.display.ds9.ds9.Buffer._bufsize = []
protected

Definition at line 129 of file ds9.py.

◆ _commands

str lsst.display.ds9.ds9.Buffer._commands = ""
protected

Definition at line 127 of file ds9.py.

◆ _lenCommands

lsst.display.ds9.ds9.Buffer._lenCommands = len(self._commands)
protected

Definition at line 128 of file ds9.py.


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