Skip to content

Commit dfb9d48

Browse files
issue 172 investigation ...
1 parent 1dd959f commit dfb9d48

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

PySpice/Config/logging.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ handlers:
2929

3030
root:
3131
level: INFO
32-
#level: WARNING
33-
#level: DEBUG
32+
# level: WARNING
33+
# level: DEBUG
3434
handlers: [console]
3535

3636
####################################################################################################

PySpice/Spice/NgSpice/Shared.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,18 +1105,24 @@ def plot(self, simulation, plot_name):
11051105
vector_info = self._ngspice_shared.ngGet_Vec_Info(name.encode('utf8'))
11061106
vector_type = self._simulation_type[vector_info.v_type]
11071107
length = vector_info.v_length
1108-
# self._logger.debug("vector[{}] {} type {} flags {} length {}".format(i,
1109-
# vector_name,
1110-
# vector_type,
1111-
# self._flags_to_str(vector_info.v_flags),
1112-
# length))
1108+
# template = 'vector[{}] {} type {} flags {} length {}'
1109+
# self._logger.debug(template.format(
1110+
# i,
1111+
# vector_name,
1112+
# vector_type,
1113+
# self._flags_to_str(vector_info.v_flags),
1114+
# length,
1115+
# ))
11131116
if vector_info.v_compdata == ffi.NULL:
1114-
# for k in xrange(length):
1117+
# for k in range(length):
11151118
# print(" [{}] {}".format(k, vector_info.v_realdata[k]))
11161119
tmp_array = np.frombuffer(ffi.buffer(vector_info.v_realdata, length*8), dtype=np.float64)
11171120
array = np.array(tmp_array, dtype=tmp_array.dtype) # copy data
1121+
# import json
1122+
# with open(name + '.json', 'w') as fh:
1123+
# json.dump(list(array), fh)
11181124
else:
1119-
# for k in xrange(length):
1125+
# for k in range(length):
11201126
# value = vector_info.v_compdata[k]
11211127
# print(ffi.addressof(value, field='cx_real'), ffi.addressof(value, field='cx_imag'))
11221128
# print(" [{}] {} + i {}".format(k, value.cx_real, value.cx_imag))

issues/issue-172.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@
88
from PySpice.Unit import *
99
from PySpice.Spice.BasicElement import BehavioralSource
1010

11-
circuit = Circuit("Pulse")
11+
circuit = Circuit('Pulse')
1212

13-
source = circuit.BehavioralSource('source', 'in', circuit.gnd, voltage_expression = "time^4*exp(-1000*time)")
13+
source = circuit.BehavioralSource('source', 'in', circuit.gnd, voltage_expression = 'time^4*exp(-1000*time)')
1414

1515
circuit.R(1, 'in', 'out', u_kOhm(9))
1616
circuit.R(2, 'out', circuit.gnd, u_kOhm(1))
1717

1818
print(circuit)
1919

20-
simulator = circuit.simulator(simulator="ngspice-shared")
20+
simulator = circuit.simulator(simulator='ngspice-shared')
2121
# the commented out version next line works
22-
#simulator = circuit.simulator(simulator="ngspice-subprocess")
23-
transient = simulator.transient(step_time=u_ms(1e-3), end_time=u_ms(20))
22+
#simulator = circuit.simulator(simulator='ngspice-subprocess')
23+
transient = simulator.transient(step_time=u_ms(1e-3), end_time=u_ms(20), log_desk=True)
2424

2525
# clf()
2626
plt.grid(True)

0 commit comments

Comments
 (0)