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
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: