LSST Applications g1653933729+34a971ddd9,g28da252d5a+6ecf39ab43,g2bbee38e9b+7117419c07,g2bc492864f+7117419c07,g2cdde0e794+704103fe75,g3156d2b45e+6e87dc994a,g347aa1857d+7117419c07,g35bb328faa+34a971ddd9,g3a166c0a6a+7117419c07,g3e281a1b8c+8ec26ec694,g4005a62e65+ba0306790b,g414038480c+40f8eb5d96,g569e0e2b34+d8e684fe9f,g717e5f8c0f+b9f74a9651,g76fe02a360+28e3f83f63,g80478fca09+fdb1f299e2,g82479be7b0+2fffa722b6,g858d7b2824+b9f74a9651,g8b782ad322+b9f74a9651,g8cd86fa7b1+ed49507c07,g90e5cb8612+3a7ace1691,g9125e01d80+34a971ddd9,g979bb04a14+232ddb636d,g9a700aaafa+34a971ddd9,ga5288a1d22+3504ff4bc9,gae0086650b+34a971ddd9,gae74b0b5c6+761ee125be,gb3d89ef091+14ce01cc3a,gb58c049af0+ace264a4f2,gc28159a63d+7117419c07,gcf0d15dbbd+34f38ce56c,gda6a2b7d83+34f38ce56c,gdaeeff99f8+7774323b41,ge33fd446bb+b9f74a9651,ge5cf12406b+d328917b0a,ge79ae78c31+7117419c07,gf0baf85859+890af219f9,gf5289d68f6+fe3ed47e0d,w.2024.35
LSST Data Management Base Package
Loading...
Searching...
No Matches
printers.py
Go to the documentation of this file.
1import gdb
2import math
3import re
4import sys
5
6try:
7 debug # noqa: F821
8except Exception:
9 debug = False
10
11import optparse
12argparse = None # we're using optparse
13
14
15class GdbOptionParser(optparse.OptionParser):
16 """A subclass of the standard optparse OptionParser for gdb
17
18GdbOptionParser raises GdbError rather than exiting when asked for help, or
19when given an illegal value. E.g.
20
21parser = gdb.printing.GdbOptionParser("show image")
22parser.add_option("-a", "--all", action="store_true",
23 help="Display the whole image")
24parser.add_option("-w", "--width", type="int", default=8,
25 help="Field width for pixels")
26
27opts, args = parser.parse_args(args)
28"""
29
30 def __init__(self, prog, *args, **kwargs):
31 """
32Like optparse.OptionParser's API, but with an initial command name argument
33"""
34 # OptionParser is an old-style class, so no super
35 if not kwargs.get("prog"):
36 kwargs["prog"] = prog
37 optparse.OptionParser.__init__(self, *args, **kwargs)
38
39 def parse_args(self, args, values=None):
40 """Call OptionParser.parse_args after running gdb.string_to_argv"""
41 if args is None: # defaults to sys.argv
42 args = ""
43 try:
44 args = gdb.string_to_argv(args)
45 except TypeError:
46 pass
47
48 help = ("-h" in args or "--help" in args)
49 opts, args = optparse.OptionParser.parse_args(self, args, values)
50 opts.help = help
51 if help:
52 args = []
53
54 return opts, args
55
56 def exit(self, status=0, msg=""):
57 """Raise GdbError rather than exiting"""
58 if status == 0:
59 if msg:
60 print(msg, file=sys.stderr)
61 else:
62 raise gdb.GdbError(msg)
63
64
65try:
66 import gdb.printing
67
69 "Print a shared_ptr"
70
71 def __init__(self, val):
72 self.val = val
73
74 def to_string(self):
75 if self.val["px"]:
76 return "shared_ptr(%s)" % self.val["px"].dereference()
77 else:
78 return "NULL"
79
81 "Print a boost::gil pixel"
82
83 def __init__(self, val):
84 self.val = val
85
86 def to_string(self):
87 import pdb
88 pdb.set_trace()
89 return self.val["_v0"]
90
92 m_storage = val["m_storage"]
93 try:
94 nx, ny = m_storage["m_cols"], m_storage["m_rows"]
95 except gdb.error: # only available for dynamic Matrices
96 try:
97 nx, ny = val.type.template_argument(1), \
98 val.type.template_argument(2)
99 except RuntimeError:
100 # should get dimens from template, but that's gdb bug #11060
101 size = m_storage["m_data"]["array"].type.sizeof
102 size0 = m_storage["m_data"]["array"].dereference().type.sizeof
103 # guess! Assume square
104 nx = int(math.sqrt(size/size0))
105 ny = size/(nx*size0)
106
107 return nx, ny
108
109 def getEigenValue(var, x, y=0):
110 if re.search(r"Matrix", str(var.type)):
111 if False:
112 return var["operator()(int, int)"](x, y)
113
114 NX, NY = getEigenMatrixDimensions(var)
115
116 if x < 0 or x >= NX or y < 0 or y >= NY:
117 raise gdb.GdbError("Element (%d, %d) is out of range 0:%d, 0:%d" %
118 (x, y, NX - 1, NY - 1))
119
120 m_data = var["m_storage"]["m_data"]
121 if False:
122 # convert to a pointer to the start of the array
123 import pdb
124 pdb.set_trace()
125 m_data = m_data.address.cast(m_data.type)
126
127 try:
128 val = m_data[x + y*NX]
129 except Exception:
130 val = m_data["array"][x + y*NX]
131 else: # Vector
132 if False:
133 return var["operator()(int)"](x)
134
135 NX = getEigenMatrixDimensions(var)[0]
136
137 if x < 0 or x >= NX:
138 raise gdb.GdbError(
139 "Element (%d) is out of range 0:%d" % (x, NX - 1))
140
141 m_data = var["m_storage"]["m_data"]
142
143 if False:
144 # convert to a pointer to the start of the array
145 m_data = m_data.address.cast(m_data.type)
146
147 try:
148 val = m_data[x]
149 except Exception:
150 val = m_data["array"][x]
151
152 if val.type.code == gdb.TYPE_CODE_INT:
153 val = int(val)
154 elif val.type.code == gdb.TYPE_CODE_FLT:
155 val = float(val)
156
157 return val
158
160 "Print an Eigen Matrix"
161
162 def __init__(self, val):
163 self.val = val
164
165 def to_string(self):
166 nx, ny = getEigenMatrixDimensions(self.val)
167
168 return "%s{%dx%d}" % (self.val.type, nx, ny)
169
171 "Print an Eigen Vector"
172
173 def __init__(self, val):
174 self.val = val
175
176 def to_string(self):
177 m_storage = self.val["m_storage"]
178
179 try:
180 n = m_storage["n"]
181 except gdb.error: # only available for dynamic Matrices
182 try:
183 n = m_storage.type.template_argument(1)
184 except RuntimeError:
185 # should get dimens from template, but that's gdb bug
186 # #11060
187 size = m_storage["m_data"]["array"].type.sizeof
188 size0 = m_storage["m_data"]["array"].dereference(
189 ).type.sizeof
190 n = math.sqrt(size/size0)
191
192 return "{%d}" % (n)
193
194 class PrintEigenCommand(gdb.Command):
195 """Print an eigen Matrix or Vector
196 Usage: show eigen <matrix> [x0 y0 [nx ny]]
197 show eigen <vector> [x0 [nx]]
198 """
199
200 def __init__(self):
201 super(PrintEigenCommand, self).__init__("show eigen",
202 gdb.COMMAND_DATA,
203 gdb.COMPLETE_SYMBOL)
204
205 def _mget(self, var, x, y=0):
206 return getEigenValue(var, x, y)
207
208 def _vget(self, var, x):
209 return getEigenValue(var, x)
210
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
326
327 # afw
328
330 "Print a BaseSourceAttributes"
331
332 def __init__(self, val):
333 self.val = val
334
335 def to_string(self):
336 return "Base: {id=%d astrom=(%.3f, %.3f)}" % (self.val["_id"],
337 self.val["_xAstrom"],
338 self.val["_yAstrom"])
339
341 "Print a Source"
342
343 def __init__(self, val):
344 self.val = val
345
346 def to_string(self):
347 return "Source{id=%d astrom=(%.3f, %.3f)}" % (self.val["_id"],
348 self.val["_xAstrom"],
349 self.val["_yAstrom"])
350
352 "Print a cameraGeom::Detector"
353
354 def __init__(self, val):
355 self.val = val
356
357 def to_string(self):
358 return "Detector{name: %s id: %s type: %s bbox: %s}" % (self.val["_name"], self.val["_id"],
359 self.val["_type"], self.val["_bbox"])
360
362 "Print a Footprint"
363
364 def __init__(self, val):
365 self.val = val
366
367 def to_string(self):
368 if False:
369 # Fails (as its type is METHOD, not CODE)
370 nspan = self.val["_spans"]["size"]()
371 else:
372 vec_impl = self.val["_spans"]["_M_impl"]
373 nspan = vec_impl["_M_finish"] - vec_impl["_M_start"]
374
375 return "Footprint{id=%d, nspan=%d, area=%d; BBox %s}" % (self.val["_fid"], nspan,
376 self.val["_area"], self.val["_bbox"])
377
379 "Print a FootprintSet"
380
381 def __init__(self, val):
382 self.val = val
383
384 def to_string(self):
385 return "FootprintSet{%s; %s}" % (self.val["_region"], self.val["_footprints"])
386
388 "Print a Peak"
389
390 def __init__(self, val):
391 self.val = val
392
393 def to_string(self):
394 return "Peak{%d, (%.2f, %.2f)}" % (self.val["_id"], self.val["_fx"], self.val["_fy"])
395
397 "Print a Psf"
398
399 def to_string(self):
400 return "%s" % (self.typeName())
401
403 "Print a Box2"
404
405 def __init__(self, val):
406 self.val = val
407
408 def to_string(self):
409 # Make sure &foo works, too.
410 type = self.val.type
411 if type.code == gdb.TYPE_CODE_REF:
412 type = type.target()
413
414 llc = [getEigenValue(self.val["_minimum"]["_vector"], i)
415 for i in range(2)]
416 dims = [getEigenValue(self.val["_dimensions"]["_vector"], i)
417 for i in range(2)]
418
419 return "Box2{(%s,%s)--(%s,%s)}" % (llc[0], llc[1],
420 llc[0] + dims[0] - 1, llc[1] + dims[1] - 1)
421
422 def display_hint(self):
423 return "array"
424
426 "Print a CoordinateBase"
427
428 def __init__(self, val):
429 self.val = val
430
431 def to_string(self):
432 return self.val["_vector"]["m_storage"]["m_data"]["array"]
433
434 def display_hint(self):
435 return "array"
436
438 "Print an ellipse::Axes"
439
440 def __init__(self, val):
441 self.val = val
442
443 def to_string(self):
444 vec = self.val["_vector"]
445 return "[%g, %g, %g]" % (getEigenValue(vec, 0), getEigenValue(vec, 1), getEigenValue(vec, 2))
446
448 "Print an ellipse::Quadrupole"
449
450 def __init__(self, val):
451 self.val = val
452
453 def to_string(self):
454 mat = self.val["_matrix"]
455
456 if False:
457 return mat
458 else:
459 return "[[%g, %g], [%g, %g]]" % (getEigenValue(mat, 0, 0), getEigenValue(mat, 0, 1),
460 getEigenValue(mat, 1, 0), getEigenValue(mat, 1, 1))
461
463 "Print an ImageBase or derived class"
464
465 def dimenStr(self, val=None):
466 if val is None:
467 val = self.val
468
469 # Make sure &foo works, too.
470 type = val.type
471 if type.code == gdb.TYPE_CODE_REF:
472 type = type.target()
473
474 gilView = val["_gilView"]
475 arr = val["_origin"]["_vector"]["m_storage"]["m_data"]["array"]
476
477 x0, y0 = arr[0], arr[1]
478 return "%dx%d%s%d%s%d" % (
479 # val["getWidth"](), val["getHeight"](),
480 gilView["_dimensions"]["x"], gilView["_dimensions"]["y"],
481 # i.e. "+" if x0 >= 0 else "" in python >= 2.5
482 ["", "+"][x0 >= 0], x0,
483 ["", "+"][y0 >= 0], y0)
484
485 def typeName(self):
486 return self.typename.split(":")[-1]
487
488 def __init__(self, val):
489 self.typename = str(val.type)
490 self.val = val
491
492 def to_string(self):
493 return "%s(%s)" % (self.typeName(), self.dimenStr())
494
496 "Print a MaskedImage"
497
498 def to_string(self):
499 return "%s(%s)" % (self.typeName(), self.dimenStr(self.val["_image"]["px"].dereference()))
500
502 "Print an Exposure"
503
504 def to_string(self):
505 return "%s(%s)" % (self.typeName(),
506 self.dimenStr(self.val["_maskedImage"]["_image"]["px"].dereference()))
507
508 class PrintImageCommand(gdb.Command):
509 """Print an Image"""
510
511 def __init__(self):
512 super(PrintImageCommand, self).__init__("show image",
513 gdb.COMMAND_DATA,
514 gdb.COMPLETE_SYMBOL)
515
516 def get(self, var, x, y):
517 if False:
518 return var["operator()(int, int, bool)"](x, y, True)
519 else:
520 dimensions = var["_gilView"]["_dimensions"]
521 if x < 0 or x >= dimensions["x"] or y < 0 or y >= dimensions["y"]:
522 raise gdb.GdbError("Pixel (%d, %d) is out of range 0:%d, 0:%d" %
523 (x, y, dimensions["x"] - 1, dimensions["y"] - 1))
524
525 pixels = var["_gilView"]["_pixels"]["_p"]
526 step = pixels["_step_fn"]["_step"] / \
527 var.type.template_argument(0).sizeof
528
529 return pixels["m_iterator"][x + y*step]["_v0"]
530
531 def invoke(self, args, fromTty):
532 self.dont_repeat()
533
534 parser = GdbOptionParser(
535 "show image" + ("" if argparse else " <image> [<nx> [<ny>]]"))
536 parser.add_option("-a", "--all", action="store_true",
537 help="Display the whole image/mask")
538 parser.add_option("-c", "--center", type="str", nargs=2, default=(None, None,),
539 help="Center the output at (x, y)")
540 parser.add_option("-o", "--origin", type="str", nargs=2, default=(None, None,),
541 help="Print the region starting at (x, y)")
542 parser.add_option("-x", "--xy0", action="store_true",
543 help="Obey the image's (x0, y0)")
544 parser.add_option("-f", "--formatWidth", type="int",
545 default=8, help="Field width for values")
546 parser.add_option("-d", "--dataFmt", default="%.2f",
547 help="Format for values")
548
549 if argparse:
550 parser.add_option(
551 "image", help="Expression giving image to show")
552 parser.add_option(
553 "width", help="Width of patch to print", default=1, nargs="?")
554 parser.add_option(
555 "height", help="Height of patch to print", default=1, nargs="?")
556
557 opts = parser.parse_args(args)
558 if opts.help:
559 return
560 else:
561 opts, args = parser.parse_args(args)
562 if opts.help:
563 return
564
565 if not args:
566 raise gdb.GdbError("Please specify an image")
567
568 opts.image = args.pop(0)
569
570 opts.width, opts.height = 1, 1
571 if args:
572 opts.width = int(args.pop(0))
573 if args:
574 opts.height = int(args.pop(0))
575
576 if args:
577 raise gdb.GdbError(
578 "Unrecognised trailing arguments: %s" % " ".join(args))
579
580 for i in range(2):
581 val = "0"
582 if opts.origin[i] is None:
583 if opts.center[i] is not None:
584 val = opts.center[i]
585 else:
586 val = opts.origin[i]
587 if opts.center[i] is not None:
588 raise gdb.GdbError(
589 "You may not specify both --center and --origin")
590
591 val = gdb.parse_and_eval(val)
592 if i == 0:
593 x0 = val
594 else:
595 y0 = val
596
597 if opts.all:
598 nx, ny = 0, 0
599 else:
600 nx, ny = opts.width, opts.height
601
602 var = gdb.parse_and_eval(opts.image)
603
604 if re.search(r"shared_ptr<", str(var.type)):
605 var = var["px"].dereference()
606
607 if not re.search(r"(lsst::afw::image::)?(Image|Mask|MaskedImage)", str(var.type.unqualified())):
608 raise gdb.GdbError(
609 "Please specify an image, not %s" % var.type)
610
611 if re.search(r"MaskedImage", str(var.type)) and \
612 not re.search(r"::Image(\s*&)?$", str(var.type)):
613 print("N.b. %s is a MaskedImage; showing image" % (opts.image))
614 var = var["_image"]
615
616 if re.search(r"shared_ptr<", str(var.type)):
617 var = var["px"].dereference()
618
619 if var.type.code == gdb.TYPE_CODE_PTR:
620 var = var.dereference() # be nice
621
622 pixelTypeName = str(var.type.template_argument(0))
623 if opts.dataFmt:
624 dataFmt = opts.dataFmt
625 elif pixelTypeName in ["short", "unsigned short"]:
626 dataFmt = "0x%x"
627 elif pixelTypeName in ["int", "unsigned int"]:
628 dataFmt = "%d"
629 else:
630 dataFmt = "%.2f"
631
632 if nx == 0:
633 nx = var["_gilView"]["_dimensions"]["x"]
634 if ny == 0:
635 ny = var["_gilView"]["_dimensions"]["y"]
636
637 if opts.center[0]:
638 x0 -= nx//2
639 y0 -= ny//2
640
641 if opts.xy0 and not opts.all:
642 arr = var["_origin"]["_vector"]["m_storage"]["m_data"]["array"]
643
644 x0 -= arr[0]
645 y0 -= arr[1]
646 #
647 # OK, finally time to print
648 #
649 print("%-4s" % "", end=' ')
650 for x in range(x0, x0 + nx):
651 print("%*d" % (opts.formatWidth, x), end=' ')
652 print("")
653
654 for y in reversed(list(range(y0, y0 + ny))):
655 print("%-4d" % y, end=' ')
656 for x in range(x0, x0 + nx):
657 print("%*s" % (opts.formatWidth, dataFmt %
658 self.get(var, x, y)), end=' ')
659 print("")
660
662
664 "Print a Background"
665
666 def __init__(self, val):
667 self.typename = str(val.type)
668 self.val = val
669
670 def to_string(self):
671 return "Background(%dx%d) %s" % (
672 self.val["_imgWidth"], self.val["_imgHeight"],
673 self.val["_bctrl"])
674
676 "Print a BackgroundControl"
677
678 def __init__(self, val):
679 self.typename = str(val.type)
680 self.val = val
681
682 def to_string(self):
683 return "{%s %s %s %s}" % (re.sub(r"lsst::afw::math::Interpolate::", "", str(self.val["_style"])),
684 re.sub(r"lsst::afw::math::", "",
685 str(self.val["_prop"])),
686 re.sub(r"lsst::afw::math::", "", str(
687 self.val["_undersampleStyle"])),
688 self.val["_sctrl"]["px"].dereference())
689
691 "Print a Kernel"
692
693 def __init__(self, val):
694 self.typename = str(val.type)
695 self.val = val
696
697 def to_string(self):
698 return "%s(%dx%d)" % (self.typename,
699 self.val["_width"], self.val["_height"])
700
702 "Print a StatisticsControl"
703
704 def __init__(self, val):
705 self.typename = str(val.type)
706 self.val = val
707
708 def to_string(self):
709 return "{nSigma=%g nIter=%d ignore=0x%x}" % (self.val["_numSigmaClip"],
710 self.val["_numIter"],
711 self.val["_andMask"])
712
714 "Print a table::Table"
715
716 def __init__(self, val):
717 self.typename = str(val.type)
718 self.val = val
719
720 def to_string(self):
721 return "{schema = %s, md=%s}" % (self.val["_schema"], self.val["_metadata"])
722
724 "Print a table::Schema"
725
726 def __init__(self, val):
727 self.typename = str(val.type)
728 self.val = val
729
730 def to_string(self):
731 names = str(self.val["_impl"]["px"]["_names"])
732 names = re.sub(r"^[^{]*{|}|[\[\]\"\"]|\s*=\s*[^,]*", "", names)
733
734 return "%s" % (names)
735
736 printers = []
737
738 def register(obj=None):
739 "Register my pretty-printers with objfile Obj."
740
741 if obj is None:
742 obj = gdb
743
744 for p in printers:
745 gdb.printing.register_pretty_printer(obj, p, replace=True)
746
748 """Surely this must be somewhere standard?"""
749
750 printer = gdb.printing.RegexpCollectionPrettyPrinter("rhl-boost")
751
752 printer.add_printer('boost::shared_ptr',
753 '^(boost|tr1|std)::shared_ptr', SharedPtrPrinter)
754 printer.add_printer('boost::gil::pixel',
755 'boost::gil::.*pixel_t', GilPixelPrinter)
756
757 return printer
758
759 printers.append(build_boost_dictionary())
760
762 """Surely this must be somewhere standard?"""
763
764 printer = gdb.printing.RegexpCollectionPrettyPrinter("rhl-eigen")
765
766 printer.add_printer('eigen::Matrix',
767 '^Eigen::Matrix', EigenMatrixPrinter)
768 printer.add_printer('eigen::Vector',
769 '^Eigen::Vector', EigenVectorPrinter)
770
771 return printer
772
773 printers.append(build_eigen_dictionary())
774
776 printer = gdb.printing.RegexpCollectionPrettyPrinter("afw")
777
778 printer.add_printer('lsst::afw::cameraGeom::Detector',
779 '^lsst::afw::cameraGeom::(Amp|Ccd|Detector|DetectorMosaic)$', DetectorPrinter)
780
781 printer.add_printer('lsst::afw::detection::Footprint',
782 '^lsst::afw::detection::Footprint$', FootprintPrinter)
783 printer.add_printer('lsst::afw::detection::FootprintSet',
784 '^lsst::afw::detection::FootprintSet', FootprintSetPrinter)
785 printer.add_printer('lsst::afw::detection::Peak',
786 '^lsst::afw::detection::Peak$', PeakPrinter)
787 printer.add_printer('lsst::afw::detection::Psf',
788 '^lsst::afw::detection::Psf$', PsfPrinter)
789 printer.add_printer('lsst::afw::detection::Source',
790 '^lsst::afw::detection::Source$', SourcePrinter)
791 printer.add_printer('lsst::afw::detection::BaseSourceAttributes',
792 '^lsst::afw::detection::BaseSourceAttributes$', BaseSourceAttributesPrinter)
793
794 printer.add_printer('lsst::afw::geom::Box',
795 '^lsst::afw::geom::Box', Box2Printer)
796 printer.add_printer('lsst::afw::geom::Extent',
797 '^lsst::afw::geom::Extent', CoordinateBasePrinter)
798 printer.add_printer('lsst::afw::geom::Point',
799 '^lsst::afw::geom::Point', CoordinateBasePrinter)
800
801 printer.add_printer('lsst::afw::geom::ellipses::Axes',
802 '^lsst::afw::geom::ellipses::Axes', AxesPrinter)
803 printer.add_printer('lsst::afw::geom::ellipses::Quadrupole',
804 '^lsst::afw::geom::ellipses::Quadrupole', QuadrupolePrinter)
805
806 printer.add_printer('lsst::afw::image::ImageBase',
807 'lsst::afw::image::ImageBase<[^>]+>$', ImagePrinter)
808 printer.add_printer('lsst::afw::image::Image',
809 'lsst::afw::image::Image<[^>]+>$', ImagePrinter)
810 printer.add_printer('lsst::afw::image::Mask',
811 '^lsst::afw::image::Mask<[^>]+>$', ImagePrinter)
812 printer.add_printer('lsst::afw::image::MaskedImage',
813 '^lsst::afw::image::MaskedImage<[^>]+>$', MaskedImagePrinter)
814 printer.add_printer('lsst::afw::image::Exposure',
815 '^lsst::afw::image::Exposure', ExposurePrinter)
816
817 printer.add_printer('lsst::afw::math::Background',
818 '^lsst::afw::math::Background$', BackgroundPrinter)
819 printer.add_printer('lsst::afw::math::BackgroundControl',
820 '^lsst::afw::math::BackgroundControl$', BackgroundControlPrinter)
821 printer.add_printer('lsst::afw::math::Kernel',
822 '^lsst::afw::math::.*Kernel', KernelPrinter)
823 printer.add_printer('lsst::afw::math::StatisticsControl',
824 '^lsst::afw::math::StatisticsControl', StatisticsControlPrinter)
825
826 printer.add_printer('lsst::afw::table::Table',
827 '^lsst::afw::table::.*Table$', TablePrinter)
828 printer.add_printer('lsst::afw::table::Schema',
829 '^lsst::afw::table::Schema$', TableSchemaPrinter)
830
831 return printer
832
833 printers.append(build_afw_dictionary())
834
836 printer = gdb.printing.RegexpCollectionPrettyPrinter("daf::base")
837
838 return printer
839
840 printers.append(build_daf_base_dictionary())
841except ImportError as e:
842 print("RHL", e)
843 from .printers_oldgdb import * # noqa: F401, F403
int min
__init__(self, prog, *args, **kwargs)
Definition printers.py:30
parse_args(self, args, values=None)
Definition printers.py:39
exit(self, status=0, msg="")
Definition printers.py:56