Add ability to load .lvm from multisim
This commit is contained in:
7157
examples/Example NI Sinsoidal.lvm
Normal file
7157
examples/Example NI Sinsoidal.lvm
Normal file
File diff suppressed because it is too large
Load Diff
47
examples/example_lvm.py
Normal file
47
examples/example_lvm.py
Normal file
@@ -0,0 +1,47 @@
|
||||
import matplotlib.pyplot as plt
|
||||
from scope_parser import parse_ni_data
|
||||
|
||||
data = parse_ni_data("Example NI Sinsoidal.lvm")
|
||||
|
||||
print(data)
|
||||
ch1 = data["CH1"]
|
||||
ch2 = data["CH2"]
|
||||
|
||||
print(ch1.metadata)
|
||||
print(ch2.metadata)
|
||||
|
||||
# Plot both waveforms
|
||||
fig, (ax1, ax2) = plt.subplots(2, 1, figsize=(12, 8))
|
||||
|
||||
# CH 1 plot
|
||||
ax1.plot(ch1.time_values * 1000, ch1.voltage_values, "b-", linewidth=0.8)
|
||||
ax1.set_title("LVM Channel 1")
|
||||
ax1.set_xlabel("Time (ms)")
|
||||
ax1.set_ylabel("Voltage (V)")
|
||||
ax1.grid(True, alpha=0.3)
|
||||
ax1.text(
|
||||
0.02,
|
||||
0.95,
|
||||
f"Average: {ch1.average:.3f} V",
|
||||
transform=ax1.transAxes,
|
||||
verticalalignment="top",
|
||||
bbox=dict(boxstyle="round", facecolor="wheat", alpha=0.8),
|
||||
)
|
||||
|
||||
# CH 2 plot
|
||||
ax2.plot(ch2.time_values * 1000, ch2.voltage_values, "r-", linewidth=0.8)
|
||||
ax2.set_title("LVM Channel 2")
|
||||
ax2.set_xlabel("Time (ms)")
|
||||
ax2.set_ylabel("Voltage (V)")
|
||||
ax2.grid(True, alpha=0.3)
|
||||
ax2.text(
|
||||
0.02,
|
||||
0.95,
|
||||
f"Average: {ch2.average:.3f} V",
|
||||
transform=ax2.transAxes,
|
||||
verticalalignment="top",
|
||||
bbox=dict(boxstyle="round", facecolor="lightcoral", alpha=0.8),
|
||||
)
|
||||
|
||||
plt.tight_layout()
|
||||
plt.show()
|
||||
Reference in New Issue
Block a user