Commit 4564ae9
Cache model.parameterization; try interactive matplotlib backends
Two quick-update performance fixes:
1. Cache `AbstractPriorModel.parameterization` via @functools.cached_property.
For MGE models with 40 Gaussians the recursive tree walk triggers 14M
function calls (~2.7s). Since the model structure is immutable during a
search, caching reduces subsequent calls from 2.7s to 0.05s.
2. live_viewer.py: try interactive matplotlib backends (TkAgg, QtAgg, etc.)
before falling back to the inherited Agg backend. The viewer subprocess
inherits the parent's Agg (used for headless PNG rendering) but needs a
GUI backend to display a window.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent ecbebd2 commit 4564ae9
2 files changed
Lines changed: 32 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
1859 | 1860 | | |
1860 | 1861 | | |
1861 | 1862 | | |
1862 | | - | |
| 1863 | + | |
1863 | 1864 | | |
1864 | 1865 | | |
1865 | 1866 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
45 | 56 | | |
46 | 57 | | |
47 | 58 | | |
48 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
49 | 70 | | |
50 | 71 | | |
51 | 72 | | |
| |||
57 | 78 | | |
58 | 79 | | |
59 | 80 | | |
60 | | - | |
| 81 | + | |
| 82 | + | |
61 | 83 | | |
62 | | - | |
63 | 84 | | |
64 | | - | |
65 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
66 | 89 | | |
67 | 90 | | |
68 | 91 | | |
| |||
0 commit comments