LSST Applications g00d0e8bbd7+8c5ae1fdc5,g013ef56533+603670b062,g083dd6704c+2e189452a7,g199a45376c+0ba108daf9,g1c5cce2383+bc9f6103a4,g1fd858c14a+cd69ed4fc1,g210f2d0738+c4742f2e9e,g262e1987ae+612fa42d85,g29ae962dfc+83d129e820,g2cef7863aa+aef1011c0b,g35bb328faa+8c5ae1fdc5,g3fd5ace14f+5eaa884f2a,g47891489e3+e32160a944,g53246c7159+8c5ae1fdc5,g5b326b94bb+dcc56af22d,g64539dfbff+c4742f2e9e,g67b6fd64d1+e32160a944,g74acd417e5+c122e1277d,g786e29fd12+668abc6043,g87389fa792+8856018cbb,g88cb488625+47d24e4084,g89139ef638+e32160a944,g8d7436a09f+d14b4ff40a,g8ea07a8fe4+b212507b11,g90f42f885a+e1755607f3,g97be763408+34be90ab8c,g98df359435+ec1fa61bf1,ga2180abaac+8c5ae1fdc5,ga9e74d7ce9+43ac651df0,gbf99507273+8c5ae1fdc5,gc2a301910b+c4742f2e9e,gca7fc764a6+e32160a944,gd7ef33dd92+e32160a944,gdab6d2f7ff+c122e1277d,gdb1e2cdc75+1b18322db8,ge410e46f29+e32160a944,ge41e95a9f2+c4742f2e9e,geaed405ab2+0d91c11c6d,w.2025.44
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: