Skip to content

Point signals from simulation igb file

Full example code: examples/parser/opencarp_point_signal.py

The .igb file of our simulation contains more detailed information about each point, such as the actual signal.

from dgmr.parser import OpencarpReader

igb_file = "path_to_your_igb_file"
data = OpencarpReader.load_igb_file(igb_file)

# Voltages from igb file
# Convert voltages into scalars (local activation times)
tag = "Vm"
voltages = OpencarpReader.load_signals(data, tag=tag)
scalars = OpencarpReader.signal_to_lat(voltages[tag])

print(scalars[:5])

Output:

[[  nan   nan   nan   nan   nan   nan   nan   nan   nan]
 [ 130.  333.  533.  735.  936. 1137. 1339. 1540. 1741.]
 [  nan   nan   nan   nan   nan   nan   nan   nan   nan]
 [  nan   nan   nan   nan   nan   nan   nan   nan   nan]
 [ 196.  403.  602.  804. 1005. 1206. 1408. 1609.   nan]]

Visualization

Using matplotlib, we can easily visualize the signals of a single point using the parsed data.

import matplotlib.pyplot as plt

point_id = 100
egms = OpencarpReader.load_signal(voltages, point_id, tag=tag)

# Plot signal of point with index 100
plt.figure()
plt.plot(egms)
plt.show()

Signal of a multiple points