-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add speedup test, initial transfer to gpu
- Loading branch information
jacpeterson
committed
Nov 13, 2024
1 parent
19b03f1
commit 4e409f3
Showing
3 changed files
with
59 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from src.acoustipy.TMM import AcousticTMM | ||
import time | ||
|
||
times = [] | ||
# Create an AcousticTMM object, specifying a diffuse sound field at 20C | ||
for i in range(100): | ||
s = time.time() | ||
structure = AcousticTMM(incidence='Diffuse',air_temperature=20, device='cpu') | ||
|
||
# Define the layers of the material using various models | ||
layer1 = structure.Add_Resistive_Screen(thickness=1,flow_resistivity=100000,porosity=.86) | ||
layer2 = structure.Add_DBM_Layer(thickness = 25.4,flow_resistivity=60000) | ||
layer3 = structure.Add_Resistive_Screen(thickness = 1, flow_resistivity=500000,porosity=.75) | ||
|
||
# Specify the material backing condition -- in this case a 400mm air gap | ||
air = structure.Add_Air_Layer(thickness = 400) | ||
|
||
# Build the total transfer matrix of the structure + air gap | ||
transfer_matrix = structure.assemble_structure(layer1,layer2,layer3,air) | ||
|
||
# Calculate the frequency dependent narrow band absorption coefficients | ||
absorption = structure.absorption(transfer_matrix) | ||
|
||
# Calculate the 3rd octave bands absorption coefficients | ||
bands = structure.octave_bands(absorption) | ||
|
||
# Calculate the four frequency average absorption | ||
FFA = structure.FFA(bands) | ||
t = time.time()-s | ||
print(t) | ||
times.append(t) | ||
|
||
print("Average Time: ", sum(times)/len(times)) | ||
|
||
# Plot and display the narrow and 3rd band coefficients on the same figure | ||
# structure.plot_curve([absorption,bands],["absorption","third octave"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters