Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to v0.4.11, fix tests related to numpy2 & add Newton's law of cooling example #539

Merged
merged 56 commits into from
Feb 5, 2025
Merged
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
dd92a43
Update to v0.4.11
pgleeson May 1, 2024
fba5c46
Merge pull request #532 from ModECI/nml_examples
pgleeson May 15, 2024
5287b12
Regenerated
pgleeson May 23, 2024
dc9448e
Newton's Law of Cooling Example
rimjhimittal May 30, 2024
9d6dde9
fixing some indentation issue
rimjhimittal May 30, 2024
b6b7bf3
black formatted
rimjhimittal May 30, 2024
1b181c6
Update README.md
rimjhimittal Jun 3, 2024
d82719d
Update README.md
rimjhimittal Jun 3, 2024
7cc4341
Uploading the notebook
rimjhimittal Jun 3, 2024
c53c9dc
fix end-of-file
rimjhimittal Jun 3, 2024
0eac2be
Remove pin to grpcio-tools==1.42.0
pgleeson Jun 5, 2024
ed34981
Test psyneulink on py3.11
pgleeson Jun 6, 2024
f1bba2a
all changes made
rimjhimittal Jun 7, 2024
7819333
Merge pull request #533 from rimjhimittal/newton
pgleeson Jun 7, 2024
394496d
Merge branch 'development' into test_versions
pgleeson Jun 13, 2024
88f8353
Merge branch 'test_versions' into nml_examples
pgleeson Jun 13, 2024
f8f8635
Merge pull request #534 from ModECI/test_versions
pgleeson Jun 13, 2024
575403c
Fix typo & regenerate files
pgleeson Jun 14, 2024
7eb4ca8
Merge branch 'development' into nml_examples
pgleeson Jun 14, 2024
1e6e643
Switched RLC Circuit Example
rimjhimittal Jun 14, 2024
c29534f
changes
rimjhimittal Jun 18, 2024
98ecf2e
Ensure numpy<2.0.0 in tests, due to lingering issues with other modul…
pgleeson Jun 18, 2024
59aebdd
Merge pull request #537 from ModECI/nml_examples
pgleeson Jun 18, 2024
9d83492
Merge remote-tracking branch 'upstream/development' into rlc-circuit
rimjhimittal Jun 21, 2024
7089a76
graph issue
rimjhimittal Jul 4, 2024
fb6b15d
Regenerated neuroml files
pgleeson Aug 20, 2024
5eff07d
Add workflow for test_all.sh
pgleeson Aug 20, 2024
0f0d1e7
Test this branch too
pgleeson Aug 20, 2024
351b507
Test on py3.10; update to make neuroml export dimensionally consistent
pgleeson Aug 20, 2024
926b904
Regenerate
pgleeson Aug 20, 2024
9d45150
Restructure all to include dev dependencies
pgleeson Aug 20, 2024
9b0eabf
Fix to find neuron
pgleeson Aug 21, 2024
d8a6cf4
fixed plot error
rimjhimittal Aug 21, 2024
8414d16
Add pre-commit to dev
pgleeson Aug 21, 2024
4ff45cc
Merge branch 'rlc-circuit' of github.com:rimjhimittal/MDF into nml_ex…
pgleeson Aug 21, 2024
a175578
Regenerated image files & fix formatting
pgleeson Aug 21, 2024
9dc3dce
Move neuron...
pgleeson Aug 21, 2024
31b626a
Temp partial fix for parametercondition issue
pgleeson Aug 21, 2024
d7a7557
Catch exit code non 0 in pre-commit
pgleeson Aug 21, 2024
205ffe3
Don't show rlc plot in test
pgleeson Aug 27, 2024
9c6610e
Regenerated with latest neuroml packages
pgleeson Nov 13, 2024
251a59f
Update README.md
pgleeson Dec 11, 2024
e5e911d
Fix formatting
pgleeson Dec 11, 2024
4d75b4b
Test specific psyneulink version
pgleeson Dec 11, 2024
acc49ba
Merge pull request #540 from ModECI/benchmarking
pgleeson Dec 18, 2024
f93e6f3
Merge branch 'development' into nml_examples
pgleeson Dec 18, 2024
601690d
Remove upper pin on PNL, add lower pin.
davidt0x Jan 8, 2025
a21e314
Merge pull request #541 from ModECI/fix/pnl_pin
davidt0x Jan 9, 2025
b4f3ef1
Remove upper pin on pytorch.
davidt0x Jan 15, 2025
c650f5b
Fix for new pytorch.
davidt0x Jan 15, 2025
63ee3cf
Replace torch.onnx._export call with torch.onnx.export
davidt0x Jan 15, 2025
7c3129c
black
davidt0x Jan 15, 2025
cc9a796
Merge pull request #542 from ModECI/fix/pytorch_pin
davidt0x Jan 22, 2025
f3896b7
Merge branch 'development' into nml_examples
pgleeson Feb 4, 2025
6374fd4
Limit torchvision
pgleeson Feb 4, 2025
5f442aa
Merge pull request #538 from ModECI/nml_examples
pgleeson Feb 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixed plot error
rimjhimittal committed Aug 21, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit d8a6cf4c6186a87b6ed31fe98972cc293cd90bb9
66 changes: 33 additions & 33 deletions examples/MDF/switched_rlc.py
Original file line number Diff line number Diff line change
@@ -31,39 +31,19 @@ def run_simulation(mod_graph, duration=2, dt=0.001):
V_values.append(V)
t += dt

fig, (ax1, ax2) = plt.subplots(2, 1, figsize=(10, 10))

ax1.plot(times, i_L_values, label="Inductor Current (i_L)")
ax1.plot(times, i_R_values, label="Resistor Current (i_R)")
ax1.plot(times, i_C_values, label="Capacitor Current (i_C)")
ax1.set_xlabel("Time (s)")
ax1.set_ylabel("Current (A)")
ax1.set_title("Currents in RLC Circuit")
ax1.legend()

ax2.plot(times, V_values, label="Response Voltage (V)", color="orange")
ax2.plot(times, Vs_values, label="Source Voltage (Vs)", color="green")
ax2.set_xlabel("Time (s)")
ax2.set_ylabel("Voltage (V)")
ax2.set_title("Voltage in RLC Circuit")
ax2.legend()

plt.tight_layout()
plt.figure(figsize=(10, 5))
plt.plot(times, i_L_values, label="Inductor Current (i_L)")
plt.plot(times, i_R_values, label="Resistor Current (i_R)")
plt.plot(times, i_C_values, label="Capacitor Current (i_C)")
plt.plot(times, V_values, label="Voltage (V)")
plt.xlabel("Time (s)")
plt.ylabel("Values")
plt.title("Switched RLC Circuit Simulation Results")
plt.legend()
plt.savefig("switched_rlc_plot.png")
if "-nogui" not in sys.argv:
plt.show()

# plt.figure(figsize=(10, 5))
# plt.plot(times, i_L_values, label='Inductor Current (i_L)')
# plt.plot(times, i_R_values, label='Resistor Current (i_R)')
# plt.plot(times, i_C_values, label='Capacitor Current (i_C)')
# plt.plot(times, V_values, label='Voltage (V)')
# plt.xlabel('Time (s)')
# plt.ylabel('Values')
# plt.title('Switched RLC Circuit Simulation Results')
# plt.legend()
# plt.show()

return times, i_L_values, i_R_values, i_C_values, V_values


@@ -74,8 +54,16 @@ def main():
"C": 1e-3, # Capacitance in Farads
"Vb": 0.1, # Battery Voltage in Volts
}

mod = Model(id="SwitchedRLC_Circuit")
parameter_descriptions = {
"R": "Resistance in Ohms",
"L": "Inductance in Henrys",
"C": "Capacitance in Farads",
"Vb": "Battery Voltage in Volts",
}
mod = Model(
id="SwitchedRLC_Circuit",
metadata={"preferred_duration": 2, "preferred_dt": 0.001},
)
mod_graph = Graph(id="SwitchedRLC_Circuit")
mod.graphs.append(mod_graph)

@@ -88,8 +76,20 @@ def main():
voltage.conditions.append(vb)
node.parameters.append(voltage)

node.parameters.append(Parameter(id="R", value=parameters["R"]))
node.parameters.append(Parameter(id="L", value=parameters["L"]))
node.parameters.append(
Parameter(
id="R",
value=parameters["R"],
metadata={"description": parameter_descriptions["R"]},
)
)
node.parameters.append(
Parameter(
id="L",
value=parameters["L"],
metadata={"description": parameter_descriptions["L"]},
)
)
node.parameters.append(Parameter(id="C", value=parameters["C"]))

node.parameters.append(