cicsim 0.2.1__tar.gz → 0.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. {cicsim-0.2.1 → cicsim-0.2.2}/PKG-INFO +1 -1
  2. {cicsim-0.2.1 → cicsim-0.2.2}/cicsim/cicsim.py +87 -10
  3. {cicsim-0.2.1 → cicsim-0.2.2}/cicsim/cmdwave.py +68 -1
  4. {cicsim-0.2.1 → cicsim-0.2.2}/cicsim/cmdwave_pg.py +698 -42
  5. cicsim-0.2.2/cicsim/pivot.py +240 -0
  6. {cicsim-0.2.1 → cicsim-0.2.2}/cicsim/wavebrowser.py +6 -0
  7. {cicsim-0.2.1 → cicsim-0.2.2}/cicsim/wavefiles.py +11 -2
  8. {cicsim-0.2.1 → cicsim-0.2.2}/cicsim/wavegraph.py +31 -0
  9. {cicsim-0.2.1 → cicsim-0.2.2}/cicsim.egg-info/PKG-INFO +1 -1
  10. {cicsim-0.2.1 → cicsim-0.2.2}/cicsim.egg-info/SOURCES.txt +1 -0
  11. {cicsim-0.2.1 → cicsim-0.2.2}/pyproject.toml +1 -1
  12. {cicsim-0.2.1 → cicsim-0.2.2}/LICENSE +0 -0
  13. {cicsim-0.2.1 → cicsim-0.2.2}/README.md +0 -0
  14. {cicsim-0.2.1 → cicsim-0.2.2}/cicsim/__init__.py +0 -0
  15. {cicsim-0.2.1 → cicsim-0.2.2}/cicsim/cdsconf.py +0 -0
  16. {cicsim-0.2.1 → cicsim-0.2.2}/cicsim/cmdarchive.py +0 -0
  17. {cicsim-0.2.1 → cicsim-0.2.2}/cicsim/cmdip.py +0 -0
  18. {cicsim-0.2.1 → cicsim-0.2.2}/cicsim/cmdresults.py +0 -0
  19. {cicsim-0.2.1 → cicsim-0.2.2}/cicsim/cmdrun.py +0 -0
  20. {cicsim-0.2.1 → cicsim-0.2.2}/cicsim/cmdrunng.py +0 -0
  21. {cicsim-0.2.1 → cicsim-0.2.2}/cicsim/cmdsimdir.py +0 -0
  22. {cicsim-0.2.1 → cicsim-0.2.2}/cicsim/cmdsimdirng.py +0 -0
  23. {cicsim-0.2.1 → cicsim-0.2.2}/cicsim/cmdspider.py +0 -0
  24. {cicsim-0.2.1 → cicsim-0.2.2}/cicsim/cmdsummary.py +0 -0
  25. {cicsim-0.2.1 → cicsim-0.2.2}/cicsim/command.py +0 -0
  26. {cicsim-0.2.1 → cicsim-0.2.2}/cicsim/ngraw.py +0 -0
  27. {cicsim-0.2.1 → cicsim-0.2.2}/cicsim/plot.py +0 -0
  28. {cicsim-0.2.1 → cicsim-0.2.2}/cicsim/simcalc.py +0 -0
  29. {cicsim-0.2.1 → cicsim-0.2.2}/cicsim/spec.py +0 -0
  30. {cicsim-0.2.1 → cicsim-0.2.2}/cicsim/spiceparser.py +0 -0
  31. {cicsim-0.2.1 → cicsim-0.2.2}/cicsim.egg-info/dependency_links.txt +0 -0
  32. {cicsim-0.2.1 → cicsim-0.2.2}/cicsim.egg-info/entry_points.txt +0 -0
  33. {cicsim-0.2.1 → cicsim-0.2.2}/cicsim.egg-info/requires.txt +0 -0
  34. {cicsim-0.2.1 → cicsim-0.2.2}/cicsim.egg-info/top_level.txt +0 -0
  35. {cicsim-0.2.1 → cicsim-0.2.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cicsim
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Custom IC Creator Simulation Tools
5
5
  Author-email: Carsten Wulff <carsten@wulff.no>
6
6
  License: MIT
@@ -95,7 +95,11 @@ def archive(ctx,name,runfiles):
95
95
  @click.option("--backend",default="tk",type=click.Choice(["tk","pg"]),
96
96
  help="GUI backend: tk (tkinter+matplotlib) or pg (PySide6+pyqtgraph)")
97
97
  @click.option("--sheet",default=None,help="Sheet name for Excel files (default: first sheet)")
98
- def wave(files,x,backend,sheet):
98
+ @click.option("--pivot",default=None,help="Pivot spec file (YAML/JSON)")
99
+ @click.option("--pivot-info",is_flag=True,default=False,help="Print pivot dimensions and exit")
100
+ @click.option("--session",default=None,help="Load session file (.cicwave.yaml)")
101
+ @click.option("--export",default=None,help="Export plot to file (PDF/PNG/SVG) and exit")
102
+ def wave(files,x,backend,sheet,pivot,pivot_info,session,export):
99
103
  """Open waveform viewer.
100
104
 
101
105
  Interactive waveform viewer for SPICE simulation results (.raw files).
@@ -108,10 +112,19 @@ def wave(files,x,backend,sheet):
108
112
  F Auto scale (fit all)
109
113
  R Reload all waveforms
110
114
  L Toggle legend
115
+ Shift+Z Zoom in
116
+ Ctrl+Z Zoom out
111
117
  Ctrl+O Open raw file
118
+ Ctrl+S Save session
112
119
  Ctrl+P Export to PDF
113
120
  Ctrl+N New plot tab (pg backend)
121
+ Ctrl+L Set axis labels
122
+ Ctrl+T Add annotation
114
123
  Ctrl+Q Quit
124
+ Ctrl+Up Increase line width
125
+ Ctrl+Down Decrease line width
126
+ Ctrl+= Increase font size
127
+ Ctrl+- Decrease font size
115
128
 
116
129
  \b
117
130
  Mouse (pg backend):
@@ -123,8 +136,8 @@ def wave(files,x,backend,sheet):
123
136
 
124
137
  \b
125
138
  Browser (pg backend):
126
- Click wave Add to plot
127
- Right-click Remove from plot
139
+ Double-click Add to plot
140
+ Right-click Context menu (plot, remove, style, analysis)
128
141
  Flat checkbox Toggle hierarchy / flat list
129
142
 
130
143
  \b
@@ -133,12 +146,44 @@ def wave(files,x,backend,sheet):
133
146
  pg Uses PySide6 + pyqtgraph. Install: pip install cicsim[pg]
134
147
  Features: hierarchical wave browser, automatic dual Y-axes
135
148
  (left/right by unit), GPU-accelerated rendering.
149
+
150
+ \b
151
+ Pivot:
152
+ --pivot spec.yaml Reshape data using pivot spec before viewing
153
+ --pivot-info Print unique values per pivot dimension and exit
154
+
155
+ \b
156
+ Session:
157
+ --session plot.cicwave.yaml Load saved session
158
+ --export plot.pdf Export to file and exit (no GUI)
159
+ --session s.yaml --export out.pdf Restore session and export
136
160
  """
137
161
 
138
- _run_wave(files, x, backend, sheet)
162
+ _run_wave(files, x, backend, sheet, pivot, pivot_info,
163
+ session_path=session, export_path=export)
164
+
165
+
166
+ def _run_wave(files, x, backend, sheet, pivot_spec=None,
167
+ pivot_info_flag=False, session_path=None, export_path=None):
168
+ if pivot_spec:
169
+ from cicsim.pivot import load_spec, pivot_info, apply_pivot
170
+ from cicsim.wavefiles import WaveFile
171
+ spec = load_spec(pivot_spec)
172
+
173
+ if pivot_info_flag:
174
+ for f in files:
175
+ wf = WaveFile(f, x or "")
176
+ print("--- %s ---" % f)
177
+ print(pivot_info(wf.df, spec))
178
+ print()
179
+ return
180
+
181
+ if not x and spec.get('columns'):
182
+ x = spec['columns']
139
183
 
184
+ if session_path or export_path:
185
+ backend = "pg"
140
186
 
141
- def _run_wave(files, x, backend, sheet):
142
187
  if backend == "pg":
143
188
  try:
144
189
  from cicsim.cmdwave_pg import CmdWavePg
@@ -156,9 +201,25 @@ def _run_wave(files, x, backend, sheet):
156
201
  sys.exit(1)
157
202
  c = cs.CmdWave(x)
158
203
 
159
- for f in files:
160
- c.openFile(f, sheet_name=sheet)
161
- c.run()
204
+ if session_path:
205
+ c.win.applySession(session_path)
206
+
207
+ if pivot_spec:
208
+ for f in files:
209
+ wf = WaveFile(f, x or "")
210
+ pivoted = apply_pivot(wf.df, spec)
211
+ name = "pivot(%s)" % os.path.basename(f)
212
+ c.openDataFrame(pivoted, name,
213
+ pivot_spec_path=os.path.abspath(pivot_spec),
214
+ original_path=os.path.abspath(f))
215
+ else:
216
+ for f in files:
217
+ c.openFile(f, sheet_name=sheet)
218
+
219
+ if export_path:
220
+ c.exportAndExit(export_path)
221
+ else:
222
+ c.run()
162
223
 
163
224
 
164
225
  @click.command()
@@ -167,7 +228,11 @@ def _run_wave(files, x, backend, sheet):
167
228
  @click.option("--backend", default="pg", type=click.Choice(["tk", "pg"]),
168
229
  help="GUI backend (default: pg)")
169
230
  @click.option("--sheet", default=None, help="Sheet name for Excel files (default: first sheet)")
170
- def cicwave(files, x, backend, sheet):
231
+ @click.option("--pivot", default=None, help="Pivot spec file (YAML/JSON)")
232
+ @click.option("--pivot-info", is_flag=True, default=False, help="Print pivot dimensions and exit")
233
+ @click.option("--session", default=None, help="Load session file (.cicwave.yaml)")
234
+ @click.option("--export", default=None, help="Export plot to file (PDF/PNG/SVG) and exit")
235
+ def cicwave(files, x, backend, sheet, pivot, pivot_info, session, export):
171
236
  """Waveform viewer (standalone).
172
237
 
173
238
  Shortcut for 'cicsim wave --backend pg'. Opens the pyqtgraph-based
@@ -175,8 +240,20 @@ def cicwave(files, x, backend, sheet):
175
240
 
176
241
  Supports: .raw, .csv, .tsv, .xlsx, .json, .parquet, .feather, .h5,
177
242
  .pkl, and more.
243
+
244
+ \b
245
+ Pivot:
246
+ --pivot spec.yaml Reshape data using pivot spec before viewing
247
+ --pivot-info Print unique values per pivot dimension and exit
248
+
249
+ \b
250
+ Session:
251
+ --session plot.cicwave.yaml Load saved session
252
+ --export plot.pdf Export to file and exit (no GUI)
253
+ --session s.yaml --export out.pdf Restore session and export
178
254
  """
179
- _run_wave(files, x, backend, sheet)
255
+ _run_wave(files, x, backend, sheet, pivot, pivot_info,
256
+ session_path=session, export_path=export)
180
257
 
181
258
 
182
259
 
@@ -41,6 +41,9 @@ class CmdWave(cs.Command):
41
41
  menubar.add_cascade(menu=menu_edit, label="Edit")
42
42
  menubar.add_cascade(menu=menu_view, label="View")
43
43
 
44
+ self._line_width = 2
45
+ self._font_size = 9
46
+
44
47
  menu_file.add_command(label="Open Raw Ctrl+O",
45
48
  command=self.openFileDialog)
46
49
  menu_file.add_command(label="Export PDF Ctrl+P",
@@ -58,6 +61,10 @@ class CmdWave(cs.Command):
58
61
  command=self.reloadPlots)
59
62
  menu_edit.add_command(label="Auto Scale F",
60
63
  command=self._autoSize)
64
+ menu_edit.add_command(label="Zoom In Shift+Z",
65
+ command=self._zoomIn)
66
+ menu_edit.add_command(label="Zoom Out Ctrl+Z",
67
+ command=self._zoomOut)
61
68
  menu_edit.add_separator()
62
69
  menu_edit.add_command(label="Remove Selected Delete",
63
70
  command=self._removeLine)
@@ -73,6 +80,16 @@ class CmdWave(cs.Command):
73
80
  menu_view.add_separator()
74
81
  menu_view.add_command(label="Toggle Legend L",
75
82
  command=self._toggleLegend)
83
+ menu_view.add_separator()
84
+ menu_view.add_command(label="Increase Line Width Ctrl+Up",
85
+ command=self._incLineWidth)
86
+ menu_view.add_command(label="Decrease Line Width Ctrl+Down",
87
+ command=self._decLineWidth)
88
+ menu_view.add_separator()
89
+ menu_view.add_command(label="Increase Font Size Ctrl+=",
90
+ command=self._incFontSize)
91
+ menu_view.add_command(label="Decrease Font Size Ctrl+-",
92
+ command=self._decFontSize)
76
93
 
77
94
  menu_help = Menu(menubar)
78
95
  menubar.add_cascade(menu=menu_help, label="Help")
@@ -99,12 +116,19 @@ class CmdWave(cs.Command):
99
116
  self.root.bind('<Delete>', lambda e: self._removeLine())
100
117
  self.root.bind('<Escape>', lambda e: self._clearCursors())
101
118
 
119
+ self.root.bind('<Control-z>', lambda e: self._zoomOut())
120
+ self.root.bind('<Control-Up>', lambda e: self._incLineWidth())
121
+ self.root.bind('<Control-Down>', lambda e: self._decLineWidth())
122
+ self.root.bind('<Control-equal>', lambda e: self._incFontSize())
123
+ self.root.bind('<Control-minus>', lambda e: self._decFontSize())
124
+
102
125
  # Single-key shortcuts — skip when focus is in an Entry widget
103
126
  for key, func in [('r', self.reloadPlots),
104
127
  ('f', self._autoSize),
105
128
  ('a', self._setCursorA),
106
129
  ('b', self._setCursorB),
107
- ('l', self._toggleLegend)]:
130
+ ('l', self._toggleLegend),
131
+ ('Z', self._zoomIn)]:
108
132
  self.root.bind(key, self._make_key_handler(func))
109
133
 
110
134
  def _make_key_handler(self, func):
@@ -126,6 +150,40 @@ class CmdWave(cs.Command):
126
150
  if p:
127
151
  p.autoSize()
128
152
 
153
+ def _zoomIn(self):
154
+ p = self.graph.getCurrentPlot()
155
+ if p:
156
+ p.zoomIn()
157
+
158
+ def _zoomOut(self):
159
+ p = self.graph.getCurrentPlot()
160
+ if p:
161
+ p.zoomOut()
162
+
163
+ def _incLineWidth(self):
164
+ self._line_width = min(self._line_width + 1, 10)
165
+ self._applyLineWidth()
166
+
167
+ def _decLineWidth(self):
168
+ self._line_width = max(self._line_width - 1, 1)
169
+ self._applyLineWidth()
170
+
171
+ def _applyLineWidth(self):
172
+ for t in self.graph.nb.tabs():
173
+ self.graph.nb.nametowidget(t).setLineWidth(self._line_width)
174
+
175
+ def _incFontSize(self):
176
+ self._font_size = min(self._font_size + 1, 24)
177
+ self._applyFontSize()
178
+
179
+ def _decFontSize(self):
180
+ self._font_size = max(self._font_size - 1, 6)
181
+ self._applyFontSize()
182
+
183
+ def _applyFontSize(self):
184
+ for t in self.graph.nb.tabs():
185
+ self.graph.nb.nametowidget(t).setFontSize(self._font_size)
186
+
129
187
  def _removeLine(self):
130
188
  p = self.graph.getCurrentPlot()
131
189
  if p:
@@ -176,6 +234,8 @@ class CmdWave(cs.Command):
176
234
  " Ctrl+A Add axis\n"
177
235
  " R Reload all waves\n"
178
236
  " F Auto scale (fit)\n"
237
+ " Shift+Z Zoom in\n"
238
+ " Ctrl+Z Zoom out\n"
179
239
  " Delete Remove selected wave\n"
180
240
  "\n"
181
241
  "Cursors\n"
@@ -189,6 +249,10 @@ class CmdWave(cs.Command):
189
249
  "\n"
190
250
  "View\n"
191
251
  " L Toggle legend\n"
252
+ " Ctrl+Up Increase line width\n"
253
+ " Ctrl+Down Decrease line width\n"
254
+ " Ctrl+= Increase font size\n"
255
+ " Ctrl+- Decrease font size\n"
192
256
  "\n"
193
257
  "Zoom\n"
194
258
  " Scroll Zoom x-axis\n"
@@ -218,6 +282,9 @@ class CmdWave(cs.Command):
218
282
  def openFile(self, fname, sheet_name=None):
219
283
  self.browser.openFile(fname)
220
284
 
285
+ def openDataFrame(self, df, name, **kwargs):
286
+ self.browser.openDataFrame(df, name)
287
+
221
288
  def run(self):
222
289
  tkinter.mainloop()
223
290