LSST Applications g1cfbe01172+01aa18f939,g20cdd03214+31e6b93548,g28da252d5a+ea8665a95b,g2bbee38e9b+9ec6cc348d,g2bc492864f+9ec6cc348d,g347aa1857d+9ec6cc348d,g3a166c0a6a+9ec6cc348d,g4322eb9e3a+65eff1e020,g461a3dce89+b86e4b8053,g50ff169b8f+f991eae79d,g52b1c1532d+b86e4b8053,g607f77f49a+31e6b93548,g78056777b3+8ae2798781,g858d7b2824+31e6b93548,g8cd86fa7b1+4851e61ca4,g9ddcbc5298+f24b38b85a,ga1e77700b3+3309dba821,gae0086650b+b86e4b8053,gb0e22166c9+6076c0b52b,gbb886bcc26+dccb771098,gbd462c55f0+dc07f8e65d,gc0c51c7ec2+31e6b93548,gc120e1dc64+a417ce3171,gc28159a63d+9ec6cc348d,gc2a6998b7e+f95f64aeae,gcdd4ae20e8+507450c4cd,gcf0d15dbbd+507450c4cd,gd1535ee943+bcf88ba65f,gd598c5cd71+66126f91fb,gdaeeff99f8+006e14e809,gdbce86181e+39d5515b1a,ge3d4d395c2+b12d4d6a95,ge79ae78c31+9ec6cc348d,gf048a9a2f4+d9c36e6b63,gfbcc870c63+ea41c4420b,w.2024.27
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: