Skip to content

Commit dfb2ee3

Browse files
committed
Fixed problem in test function
1 parent dd8c708 commit dfb2ee3

File tree

1 file changed

+11
-22
lines changed

1 file changed

+11
-22
lines changed

deism/tests/test_deism_arg.py

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
import yaml
2-
import argparse
3-
import os
4-
import time
51
import numpy as np
6-
import matplotlib.pyplot as plt
7-
import ray
82
from deism.core_deism import *
93
from deism.data_loader import *
104

115

12-
def main():
6+
def test_deism_arg_simulation():
7+
"""Test DEISM-ARG simulation with impedance update."""
138
deism = DEISM("RIR", "convex")
149
# Testing impedance update
1510
# Example of room volumn and roomAreas
@@ -26,23 +21,17 @@ def main():
2621
deism.update_images()
2722
deism.update_directivities()
2823
pressure = deism.run_DEISM()
29-
# visualize the room
30-
# deism.room_convex.plot_room()
31-
# Save the simulation results
32-
np.savez(
33-
f"./outputs/{deism.mode}s/DEISM_{deism.roomtype}_{deism.mode}s_test",
34-
pressure=pressure,
35-
posSource=deism.params["posSource"],
36-
posReceiver=deism.params["posReceiver"],
37-
freqs=deism.params["freqs"],
38-
sampleRate=deism.params["sampleRate"],
39-
reverberationTime=deism.params["reverberationTime"],
40-
RIRLength=deism.params["RIRLength"],
41-
soundSpeed=deism.params["soundSpeed"],
42-
)
24+
25+
# Basic assertions to verify the simulation ran successfully
26+
assert pressure is not None, "Pressure should not be None"
27+
assert len(pressure) > 0, "Pressure should have data"
28+
assert deism.params["posSource"] is not None, "Source position should be set"
29+
assert deism.params["posReceiver"] is not None, "Receiver position should be set"
30+
assert deism.params["freqs"] is not None, "Frequencies should be set"
31+
4332
print("Simulation done!")
4433

4534

4635
# -------------------------------------------------------
4736
if __name__ == "__main__":
48-
main()
37+
test_deism_arg_simulation()

0 commit comments

Comments
 (0)