LSST Applications g04e9c324dd+8c5ae1fdc5,g134cb467dc+b203dec576,g18429d2f64+358861cd2c,g199a45376c+0ba108daf9,g1fd858c14a+dd066899e3,g262e1987ae+ebfced1d55,g29ae962dfc+72fd90588e,g2cef7863aa+aef1011c0b,g35bb328faa+8c5ae1fdc5,g3fd5ace14f+b668f15bc5,g4595892280+3897dae354,g47891489e3+abcf9c3559,g4d44eb3520+fb4ddce128,g53246c7159+8c5ae1fdc5,g67b6fd64d1+abcf9c3559,g67fd3c3899+1f72b5a9f7,g74acd417e5+cb6b47f07b,g786e29fd12+668abc6043,g87389fa792+8856018cbb,g89139ef638+abcf9c3559,g8d7436a09f+bcf525d20c,g8ea07a8fe4+9f5ccc88ac,g90f42f885a+6054cc57f1,g97be763408+06f794da49,g9dd6db0277+1f72b5a9f7,ga681d05dcb+7e36ad54cd,gabf8522325+735880ea63,gac2eed3f23+abcf9c3559,gb89ab40317+abcf9c3559,gbf99507273+8c5ae1fdc5,gd8ff7fe66e+1f72b5a9f7,gdab6d2f7ff+cb6b47f07b,gdc713202bf+1f72b5a9f7,gdfd2d52018+8225f2b331,ge365c994fd+375fc21c71,ge410e46f29+abcf9c3559,geaed405ab2+562b3308c0,gf9a733ac38+8c5ae1fdc5,w.2025.35
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: