Issue a DS9 command, raising errors as appropriate.
Parameters
----------
cmd : `str`, optional
Command to execute.
trap : `bool`, optional
Trap errors.
flush : `bool`, optional
Flush the output.
silent : `bool`, optional
Do not print trapped error messages.
frame : `int`, optional
Frame number on which to execute command.
get : `bool`, optional
Return xpa response.
Definition at line 225 of file ds9.py.
225 def ds9Cmd(cmd=None, trap=True, flush=False, silent=True, frame=None, get=False):
226 """Issue a DS9 command, raising errors as appropriate.
230 cmd : `str`, optional
232 trap : `bool`, optional
234 flush : `bool`, optional
236 silent : `bool`, optional
237 Do not print trapped error messages.
238 frame : `int`, optional
239 Frame number on which to execute command.
240 get : `bool`, optional
246 if frame
is not None:
254 if cmdBuffer._lenCommands + len(cmd) > XPA_SZ_LINE - 5:
255 ds9Cmd(flush=
True, silent=silent)
257 cmdBuffer._commands +=
";" + cmd
258 cmdBuffer._lenCommands += 1 + len(cmd)
260 if flush
or cmdBuffer._lenCommands >= cmdBuffer._getSize():
261 cmd = (cmdBuffer._commands +
"\n")
262 cmdBuffer._commands =
""
263 cmdBuffer._lenCommands = 0
277 raise Ds9Error(
"XPA: %s, (%s)" % (e, cmd))
279 print(
"Caught ds9 exception processing command \"%s\": %s" % (cmd, e), file=sys.stderr)