LSST Applications  21.0.0+04719a4bac,21.0.0-1-ga51b5d4+f5e6047307,21.0.0-11-g2b59f77+a9c1acf22d,21.0.0-11-ga42c5b2+86977b0b17,21.0.0-12-gf4ce030+76814010d2,21.0.0-13-g1721dae+760e7a6536,21.0.0-13-g3a573fe+768d78a30a,21.0.0-15-g5a7caf0+f21cbc5713,21.0.0-16-g0fb55c1+b60e2d390c,21.0.0-19-g4cded4ca+71a93a33c0,21.0.0-2-g103fe59+bb20972958,21.0.0-2-g45278ab+04719a4bac,21.0.0-2-g5242d73+3ad5d60fb1,21.0.0-2-g7f82c8f+8babb168e8,21.0.0-2-g8f08a60+06509c8b61,21.0.0-2-g8faa9b5+616205b9df,21.0.0-2-ga326454+8babb168e8,21.0.0-2-gde069b7+5e4aea9c2f,21.0.0-2-gecfae73+1d3a86e577,21.0.0-2-gfc62afb+3ad5d60fb1,21.0.0-25-g1d57be3cd+e73869a214,21.0.0-3-g357aad2+ed88757d29,21.0.0-3-g4a4ce7f+3ad5d60fb1,21.0.0-3-g4be5c26+3ad5d60fb1,21.0.0-3-g65f322c+e0b24896a3,21.0.0-3-g7d9da8d+616205b9df,21.0.0-3-ge02ed75+a9c1acf22d,21.0.0-4-g591bb35+a9c1acf22d,21.0.0-4-g65b4814+b60e2d390c,21.0.0-4-gccdca77+0de219a2bc,21.0.0-4-ge8a399c+6c55c39e83,21.0.0-5-gd00fb1e+05fce91b99,21.0.0-6-gc675373+3ad5d60fb1,21.0.0-64-g1122c245+4fb2b8f86e,21.0.0-7-g04766d7+cd19d05db2,21.0.0-7-gdf92d54+04719a4bac,21.0.0-8-g5674e7b+d1bd76f71f,master-gac4afde19b+a9c1acf22d,w.2021.13
LSST Data Management Base Package
Public Member Functions | List of all members
lsst.gdb.afw.printers.GdbOptionParser.PrintEigenCommand Class Reference
Inheritance diagram for lsst.gdb.afw.printers.GdbOptionParser.PrintEigenCommand:

Public Member Functions

def __init__ (self)
 
def invoke (self, args, fromTty)
 

Detailed Description

Print an eigen Matrix or Vector
Usage: show eigen <matrix> [x0 y0 [nx ny]]
   show eigen <vector> [x0 [nx]]

Definition at line 194 of file printers.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.gdb.afw.printers.GdbOptionParser.PrintEigenCommand.__init__ (   self)

Definition at line 200 of file printers.py.

200  def __init__(self):
201  super(PrintEigenCommand, self).__init__("show eigen",
202  gdb.COMMAND_DATA,
203  gdb.COMPLETE_SYMBOL)
204 

Member Function Documentation

◆ invoke()

def lsst.gdb.afw.printers.GdbOptionParser.PrintEigenCommand.invoke (   self,
  args,
  fromTty 
)

Definition at line 211 of file printers.py.

211  def invoke(self, args, fromTty):
212  self.dont_repeat()
213 
214  parser = GdbOptionParser("show eigen")
215  parser.add_option("-d", "--dataFmt", default="%.2f",
216  help="Format for values")
217  parser.add_option("-f", "--formatWidth", type="int",
218  default=8, help="Field width for values")
219  parser.add_option("-o", "--origin", type="str", nargs="+",
220  help="Origin of the part of the object to print")
221  if False:
222  parser.add_option(
223  "eigenObject", help="Expression giving Eigen::Matrix/Vector to show")
224  parser.add_option(
225  "nx", help="Width of patch to print", type="int", default=0, nargs="?")
226  parser.add_option(
227  "ny", help="Height of patch to print", type="int", default=0, nargs="?")
228 
229  opts = parser.parse_args(args)
230  if opts.help:
231  return
232  else:
233  (opts, args) = parser.parse_args(args)
234  if opts.help:
235  return
236 
237  if not args:
238  raise gdb.GdbError("Please specify an object")
239  opts.eigenObject = args.pop(0)
240 
241  opts.nx, opts.ny = 0, 0
242  if args:
243  opts.nx = int(args.pop(0))
244  if args:
245  opts.ny = int(args.pop(0))
246 
247  if args:
248  raise gdb.GdbError(
249  "Unrecognised trailing arguments: %s" % " ".join(args))
250 
251  var = gdb.parse_and_eval(opts.eigenObject)
252 
253  if not re.search(r"(Eigen|LinearTransform)::(Matrix|Vector)", str(var.type)):
254  raise gdb.GdbError(
255  "Please specify an eigen matrix or vector, not %s" % var.type)
256 
257  if re.search(r"shared_ptr<", str(var.type)):
258  var = var["px"].dereference()
259 
260  if var.type.code == gdb.TYPE_CODE_PTR:
261  var = var.dereference() # be nice
262 
263  isMatrix = re.search(r"Matrix", str(var.type))
264  if isMatrix:
265  NX, NY = getEigenMatrixDimensions(var)
266 
267  if opts.origin:
268  if len(opts.origin) != 2:
269  raise gdb.GdbError("Please specify both x0 and y0")
270 
271  x0 = gdb.parse_and_eval(opts.origin[0])
272  y0 = gdb.parse_and_eval(opts.origin[1])
273  else:
274  x0, y0 = 0, 0
275 
276  nx = opts.nx
277  ny = opts.ny
278  if nx == 0:
279  nx = NX
280  if ny == 0:
281  ny = NY
282 
283  if nx == 1 and ny == 1:
284  print("%g" % self._vget(var, x0))
285  return
286  else:
287  NX = 0, var["m_storage"]["n"]
288 
289  if opts.origin:
290  if len(opts.origin) != 1:
291  raise gdb.GdbError("Please only specify x0")
292 
293  x0 = gdb.parse_and_eval(opts.origin[0])
294  else:
295  x0 = 0
296 
297  nx = opts.nx
298  if nx == 0:
299  nx = NX
300 
301  if nx == 1:
302  print("%g" % self._vget(var, x0))
303  return
304  #
305  # OK, finally time to print
306  #
307  if isMatrix:
308  print("%-4s" % "", end=' ')
309  for x in range(x0, min(NX, x0 + nx)):
310  print("%*d" % (opts.formatWidth, x), end=' ')
311  print("")
312 
313  for y in range(y0, min(NY, y0 + ny)):
314  print("%-4d" % y, end=' ')
315  for x in range(x0, min(NX, x0 + nx)):
316  print("%*s" % (opts.formatWidth, (opts.dataFmt %
317  self._mget(var, x, y))), end=' ')
318  print("")
319  else:
320  for x in range(x0, min(NX, x0 + nx)):
321  print("%*s" % (opts.formatWidth, (opts.dataFmt %
322  self._vget(var, x))), end=' ')
323  print("")
324 
325  PrintEigenCommand()
int min

The documentation for this class was generated from the following file: