Skip to content

Commit 76c6f71

Browse files
committed
Added a mapping between parameter names in YAML setup files and params dictionary in the codes
1 parent 7144bf0 commit 76c6f71

File tree

5 files changed

+163
-83
lines changed

5 files changed

+163
-83
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@ build/
66
outputs/
77
var/
88
deism.egg-info/
9-
dist/
9+
dist/
10+
**/*.so
11+
**/*.pyc
12+
media/
13+
new_features/

deism/data_loader.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ def detect_conflicts(params):
127127
print(
128128
"[Warning] Distance between source and receiver is smaller than the sum of the source and receiver radius! \n"
129129
)
130+
# Check if frequency steps is 2, if not, raise a warning
131+
if params["freqStep"] != 2:
132+
print("[Warning] Frequency step is not 2, which is not recommended! \n")
130133

131134
# To be continued...
132135

@@ -532,7 +535,7 @@ def loadSingleParam(configs, args):
532535
# if args.adrc is not None
533536
# else configs["Reflections"]["angleDependentFlag"]
534537
# )
535-
params["RIRLength"] = args.rirlen or configs["Reflections"]["RIRLength"]
538+
536539
# positions of the source and receiver
537540
params["posSource"] = np.array(
538541
args.xs or list(configs["Positions"]["source"].values())
@@ -551,6 +554,7 @@ def loadSingleParam(configs, args):
551554
params["freqStep"] = args.fstep or configs["Frequencies"]["frequencyStep"]
552555
params["endFreq"] = args.fmax or configs["Frequencies"]["endFrequency"]
553556
params["sampleRate"] = args.fs or configs["Frequencies"]["samplingRate"]
557+
params["RIRLength"] = args.rirlen or configs["RIRLength"]
554558

555559
# Directivity parameters
556560
params["nSourceOrder"] = (

docs/api_reference.rst

Lines changed: 135 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -37,182 +37,250 @@ DEISM-ARG Core Functions
3737
Configuration Parameters
3838
------------------------
3939

40+
This section describes all configuration parameters used in DEISM, including their types, descriptions, and corresponding YAML configuration keys.
41+
42+
Note that the parameter names in the YAML configuration files may differ from the parameter names in the ``params`` dictionary.
43+
The mapping is handled automatically by the ``loadSingleParam()`` function in ``data_loader.py``.
44+
However, we also provide a mapping table below for reference.
45+
4046
Core Parameters
4147
~~~~~~~~~~~~~~~
4248

4349
**Environment Parameters:**
4450

4551
.. list-table::
46-
:widths: 25 15 60
52+
:widths: 30 20 15 35
4753
:header-rows: 1
4854

49-
* - Parameter
55+
* - YAML Key
56+
- Params Key
5057
- Type
5158
- Description
52-
* - soundSpeed
59+
* - Environment.soundSpeed
60+
- soundSpeed
5361
- float
5462
- Speed of sound in m/s (default: 343)
55-
* - airDensity
63+
* - Environment.airDensity
64+
- airDensity
5665
- float
5766
- Air density in kg/m³ (default: 1.2)
5867

5968
**Room Parameters:**
6069

6170
.. list-table::
62-
:widths: 25 15 60
71+
:widths: 30 20 15 35
6372
:header-rows: 1
6473

65-
* - Parameter
74+
* - YAML Key
75+
- Params Key
6676
- Type
6777
- Description
68-
* - roomSize
69-
- list[float]
78+
* - Dimensions.[length, width, height]
79+
- roomSize
80+
- numpy.ndarray
7081
- Room dimensions [L, W, H] in meters (shoebox only)
71-
* - vertices
82+
* - N/A (set explicitly in example files)
83+
- vertices
7284
- numpy.ndarray
7385
- Room vertices as Nx3 array (DEISM-ARG only)
74-
* - maxReflOrder
75-
- int
76-
- Maximum reflection order (default: 3)
77-
* - convexRoom
86+
87+
* - DEISM_specs.convexRoom
88+
- convexRoom
7889
- bool
7990
- Whether room is convex (DEISM-ARG only)
8091

92+
**Wall Properties:**
93+
94+
.. list-table::
95+
:widths: 30 20 15 35
96+
:header-rows: 1
97+
98+
* - YAML Key
99+
- Params Key
100+
- Type
101+
- Description
102+
* - Reflections.acoustImpendence
103+
- acousImpend
104+
- float/list/array
105+
- Acoustic impedance of walls
106+
* - Reflections.angleDependentFlag
107+
- angleDependentFlag
108+
- bool
109+
- Whether reflection coefficients are angle-dependent
110+
* - Reflections.maxReflectionOrder
111+
- maxReflOrder
112+
- int
113+
- Maximum reflection order (default: 3)
114+
81115
**Source/Receiver Parameters:**
82116

83117
.. list-table::
84-
:widths: 25 15 60
118+
:widths: 30 20 15 35
85119
:header-rows: 1
86120

87-
* - Parameter
121+
* - YAML Key
122+
- Params Key
88123
- Type
89124
- Description
90-
* - posSource
91-
- list[float]
125+
* - Positions.source.[x, y, z]
126+
- posSource
127+
- numpy.ndarray
92128
- Source position [x, y, z] in meters
93-
* - posReceiver
94-
- list[float]
129+
* - Positions.receiver.[x, y, z]
130+
- posReceiver
131+
- numpy.ndarray
95132
- Receiver position [x, y, z] in meters
96-
* - orientSource
97-
- list[float]
133+
* - Orientations.source.[alpha, beta, gamma]
134+
- orientSource
135+
- numpy.ndarray
98136
- Source orientation [α, β, γ] in degrees
99-
* - orientReceiver
100-
- list[float]
137+
* - Orientations.receiver.[alpha, beta, gamma]
138+
- orientReceiver
139+
- numpy.ndarray
101140
- Receiver orientation [α, β, γ] in degrees
102141

103142
**Frequency Parameters:**
104143

105144
.. list-table::
106-
:widths: 25 15 60
145+
:widths: 30 20 15 35
107146
:header-rows: 1
108147

109-
* - Parameter
148+
* - YAML Key
149+
- Params Key
110150
- Type
111151
- Description
112-
* - startFreq
152+
* - Frequencies.startFrequency
153+
- startFreq
113154
- float
114155
- Starting frequency in Hz
115-
* - endFreq
156+
* - Frequencies.endFrequency
157+
- endFreq
116158
- float
117159
- Ending frequency in Hz
118-
* - freqStep
160+
* - Frequencies.frequencyStep
161+
- freqStep
119162
- float
120163
- Frequency step size in Hz
121-
* - sampleRate
164+
* - Frequencies.samplingRate
165+
- sampleRate
122166
- int
123167
- Sampling rate in Hz
124168

169+
**RIR length:**
170+
171+
.. list-table::
172+
:widths: 30 20 15 35
173+
:header-rows: 1
174+
175+
* - YAML Key
176+
- Params Key
177+
- Type
178+
- Description
179+
* - Reflections.RIRLength
180+
- RIRLength
181+
- float
182+
- Room impulse response length in seconds
183+
125184
Directivity Parameters
126185
~~~~~~~~~~~~~~~~~~~~~~
127186

128187
**Source Directivity:**
129188

130189
.. list-table::
131-
:widths: 25 15 60
190+
:widths: 30 20 15 35
132191
:header-rows: 1
133192

134-
* - Parameter
193+
* - YAML Key
194+
- Params Key
135195
- Type
136196
- Description
137-
* - sourceType
197+
* - Directivities.source
198+
- sourceType
138199
- str
139200
- Source type ("monopole" or custom name)
140-
* - nSourceOrder
201+
* - MaxSphDirectivityOrder.nSourceOrder
202+
- nSourceOrder
141203
- int
142204
- Maximum spherical harmonic order for source
143-
* - radiusSource
205+
* - Radius.source
206+
- radiusSource
144207
- float
145208
- Radius of source sampling sphere in meters
146209

147210
**Receiver Directivity:**
148211

149212
.. list-table::
150-
:widths: 25 15 60
213+
:widths: 30 20 15 35
151214
:header-rows: 1
152215

153-
* - Parameter
216+
* - YAML Key
217+
- Params Key
154218
- Type
155219
- Description
156-
* - receiverType
220+
* - Directivities.receiver
221+
- receiverType
157222
- str
158223
- Receiver type ("monopole" or custom name)
159-
* - vReceiverOrder
224+
* - MaxSphDirectivityOrder.vReceiverOrder
225+
- vReceiverOrder
160226
- int
161227
- Maximum spherical harmonic order for receiver
162-
* - radiusReceiver
228+
* - Radius.receiver
229+
- radiusReceiver
163230
- float
164231
- Radius of receiver sampling sphere in meters
165-
* - ifReceiverNormalize
232+
* - DEISM_specs.ifReceiverNormalize
233+
- ifReceiverNormalize
166234
- bool
167235
- Whether to normalize receiver directivity
168236

169-
Acoustic Parameters
237+
DEISM Parameters
170238
~~~~~~~~~~~~~~~~~~~
171239

172-
**Wall Properties:**
173-
174-
.. list-table::
175-
:widths: 25 15 60
176-
:header-rows: 1
177-
178-
* - Parameter
179-
- Type
180-
- Description
181-
* - acousImpend
182-
- float/list
183-
- Acoustic impedance of walls
184-
* - angleDependentFlag
185-
- bool
186-
- Whether reflection coefficients are angle-dependent (Always 1 in DEISM-ARG)
187-
* - RIRLength
188-
- float
189-
- Room impulse response length in seconds
190240

191241
**Algorithm Parameters:**
192242

193243
.. list-table::
194-
:widths: 25 15 60
244+
:widths: 30 20 15 35
195245
:header-rows: 1
196246

197-
* - Parameter
247+
* - YAML Key
248+
- Params Key
198249
- Type
199250
- Description
200-
* - DEISM_mode
251+
* - DEISM_specs.Mode
252+
- DEISM_mode
201253
- str
202254
- Algorithm mode ("ORG", "LC", "MIX")
203-
* - mixEarlyOrder
255+
* - DEISM_specs.mixEarlyOrder
256+
- mixEarlyOrder
204257
- int
205258
- Reflection order threshold for MIX mode (default: 2)
206-
* - ifRemoveDirectPath
259+
* - DEISM_specs.ifRemoveDirect
260+
- ifRemoveDirectPath
207261
- bool
208262
- Whether to remove direct path from calculation
209-
* - numParaImages
263+
* - DEISM_specs.numParaImages
264+
- numParaImages
210265
- int
211-
- Number of parallel image source calculations (You can adjust based on your RAM)
212-
* - silentMode
266+
- Number of parallel image source calculations
267+
* - DEISM_specs.QFlowStrength
268+
- qFlowStrength
269+
- float
270+
- Point source flow strength for receiver directivity
271+
* - SilentMode
272+
- silentMode
213273
- bool
214274
- Whether to suppress output messages
215275

276+
**Configuration Notes:**
277+
278+
- YAML keys use nested dictionary notation (e.g., ``Environment.soundSpeed``)
279+
- Array parameters like positions are converted from YAML lists to numpy arrays
280+
- The ``roomSize`` parameter combines the three dimension values into a single array
281+
- Some parameters (like ``convexRoom``) are only used in DEISM-ARG mode
282+
- The mapping is handled automatically by the ``loadSingleParam()`` function in ``data_loader.py``
283+
216284
Directivity Data Format
217285
-----------------------
218286

0 commit comments

Comments
 (0)