Skip to content

Commit 7144bf0

Browse files
committed
Updated documentation
1 parent a24f930 commit 7144bf0

File tree

7 files changed

+123
-518
lines changed

7 files changed

+123
-518
lines changed

docs/api_reference.rst

Lines changed: 11 additions & 229 deletions
Original file line numberDiff line numberDiff line change
@@ -11,211 +11,28 @@ DEISM-ARG Core Functions
1111

1212
.. py:function:: run_DEISM_ARG(params)
1313
14-
Main function to run DEISM-ARG simulation for arbitrary room geometries.
14+
Main function to run DEISM-ARG simulation for arbitrary room geometries after the reflection paths are calculated.
1515

1616
:param dict params: Configuration parameters dictionary
1717
:returns: Room transfer function results
18-
:rtype: dict
18+
:rtype: 1D numpy.ndarray
1919

20-
**Key Parameters:**
21-
22-
- **vertices**: Room vertices as Nx3 numpy array
23-
- **maxReflOrder**: Maximum reflection order (integer)
24-
- **soundSpeed**: Speed of sound in m/s (float)
25-
- **freqs**: Frequency array in Hz
26-
- **posSource**: Source position [x, y, z] in meters
27-
- **posReceiver**: Receiver position [x, y, z] in meters
2820

2921
.. py:class:: Room_deism_cpp(params, *choose_wall_centers)
3022
31-
C++ accelerated room class for DEISM-ARG simulations.
23+
C++ accelerated room class for definition of room geometry and calculation of reflection paths.
3224

3325
:param dict params: Configuration parameters
34-
:param choose_wall_centers: Optional wall center coordinates
26+
:param numpy.ndarray params["vertices"]: Room vertices as Nx3 numpy array
27+
:param numpy.ndarray params["wallCenters"]: Wall center coordinates as Nx3 numpy array
28+
:param numpy.ndarray params["acousImpend"]: Acoustic impedance of walls as N * len(params["freqs"]) numpy array
3529

3630
**Main Methods:**
3731

3832
.. py:method:: image_source_model()
3933
40-
Generates image sources using the image source method.
41-
42-
.. py:method:: add_mic(position)
43-
44-
Adds a microphone at the specified position.
45-
46-
:param position: Microphone position [x, y, z]
47-
48-
.. py:class:: Room_deism_python(params, *choose_wall_centers)
49-
50-
Python implementation of room class for DEISM-ARG.
51-
52-
:param dict params: Configuration parameters
53-
:param choose_wall_centers: Optional wall center coordinates
54-
55-
**Attributes:**
56-
57-
- **points**: Room vertices
58-
- **source**: Source position
59-
- **microphones**: List of microphone positions
60-
- **walls**: List of wall objects
61-
- **visible_sources**: Generated image sources
62-
63-
DEISM Shoebox Functions
64-
~~~~~~~~~~~~~~~~~~~~~~~
65-
66-
.. py:function:: run_DEISM(params)
67-
68-
Main function to run DEISM simulation for shoebox rooms.
69-
70-
:param dict params: Configuration parameters dictionary
71-
:returns: Room transfer function results
72-
:rtype: dict
73-
74-
**Key Parameters:**
75-
76-
- **roomSize**: Room dimensions [length, width, height] in meters
77-
- **maxReflOrder**: Maximum reflection order (integer)
78-
- **soundSpeed**: Speed of sound in m/s (float)
79-
- **posSource**: Source position [x, y, z] in meters
80-
- **posReceiver**: Receiver position [x, y, z] in meters
81-
82-
Directivity Functions
83-
~~~~~~~~~~~~~~~~~~~~~
84-
85-
.. py:function:: init_source_directivities(params)
86-
87-
Initialize source directivity patterns for DEISM simulations.
88-
89-
:param dict params: Configuration parameters
90-
:returns: Updated parameters with source directivity coefficients
91-
:rtype: dict
92-
93-
**Parameters:**
94-
95-
- **sourceType**: Type of source ("monopole" or custom)
96-
- **nSourceOrder**: Maximum spherical harmonic order for source
97-
- **radiusSource**: Radius of source sampling sphere in meters
98-
99-
.. py:function:: init_receiver_directivities(params)
100-
101-
Initialize receiver directivity patterns for DEISM simulations.
102-
103-
:param dict params: Configuration parameters
104-
:returns: Updated parameters with receiver directivity coefficients
105-
:rtype: dict
106-
107-
**Parameters:**
108-
109-
- **receiverType**: Type of receiver ("monopole" or custom)
110-
- **vReceiverOrder**: Maximum spherical harmonic order for receiver
111-
- **radiusReceiver**: Radius of receiver sampling sphere in meters
112-
113-
.. py:function:: init_source_directivities_ARG(params, if_rotate_room, reflection_matrix, **kwargs)
114-
115-
Initialize source directivities for DEISM-ARG with room rotation support.
116-
117-
:param dict params: Configuration parameters
118-
:param bool if_rotate_room: Whether to apply room rotation
119-
:param numpy.ndarray reflection_matrix: Reflection matrices for image sources
120-
:param kwargs: Additional parameters (e.g., room_rotation angles)
121-
:returns: Updated parameters with source directivity coefficients
122-
:rtype: dict
123-
124-
.. py:function:: init_receiver_directivities_ARG(params, if_rotate_room, **kwargs)
125-
126-
Initialize receiver directivities for DEISM-ARG with room rotation support.
127-
128-
:param dict params: Configuration parameters
129-
:param bool if_rotate_room: Whether to apply room rotation
130-
:param kwargs: Additional parameters (e.g., room_rotation angles)
131-
:returns: Updated parameters with receiver directivity coefficients
132-
:rtype: dict
133-
134-
Utility Functions
135-
~~~~~~~~~~~~~~~~~
136-
137-
.. py:function:: pre_calc_Wigner(params)
138-
139-
Pre-calculate Wigner 3j symbols for efficient computation.
140-
141-
:param dict params: Configuration parameters
142-
:returns: Updated parameters with Wigner symbols
143-
:rtype: dict
144-
145-
.. py:function:: vectorize_C_vu_r(params)
146-
147-
Vectorize receiver directivity coefficients for LC and MIX modes.
148-
149-
:param dict params: Configuration parameters
150-
:returns: Updated parameters with vectorized coefficients
151-
:rtype: dict
152-
153-
.. py:function:: vectorize_C_nm_s_ARG(params)
154-
155-
Vectorize source directivity coefficients for DEISM-ARG LC and MIX modes.
156-
157-
:param dict params: Configuration parameters
158-
:returns: Updated parameters with vectorized coefficients
159-
:rtype: dict
160-
161-
Data Loading Functions
162-
----------------------
163-
164-
Configuration Loading
165-
~~~~~~~~~~~~~~~~~~~~~
166-
167-
.. py:function:: cmdArgsToDict(config_file)
168-
169-
Load configuration from YAML file and parse command line arguments for DEISM.
170-
171-
:param str config_file: Path to YAML configuration file
172-
:returns: Tuple of (parameters dictionary, command line arguments)
173-
:rtype: tuple
174-
175-
.. py:function:: cmdArgsToDict_ARG(config_file)
176-
177-
Load configuration from YAML file and parse command line arguments for DEISM-ARG.
34+
Generates image sources using the image source method. Also the attenuation and reflection matrices are calculated.
17835

179-
:param str config_file: Path to YAML configuration file
180-
:returns: Tuple of (parameters dictionary, command line arguments)
181-
:rtype: tuple
182-
183-
.. py:function:: loadSingleParam(configs, args)
184-
185-
Process configuration dictionary and command line arguments.
186-
187-
:param dict configs: Configuration dictionary from YAML
188-
:param argparse.Namespace args: Parsed command line arguments
189-
:returns: Processed parameters dictionary
190-
:rtype: dict
191-
192-
Directivity Data Loading
193-
~~~~~~~~~~~~~~~~~~~~~~~~
194-
195-
.. py:function:: load_directive_pressure(silent_mode, device_type, device_name)
196-
197-
Load directivity data from files.
198-
199-
:param bool silent_mode: Whether to suppress output messages
200-
:param str device_type: "source" or "receiver"
201-
:param str device_name: Name of the directivity data file
202-
:returns: Tuple of (frequencies, pressure data, directions, radius)
203-
:rtype: tuple
204-
205-
Parameter Validation
206-
~~~~~~~~~~~~~~~~~~~~
207-
208-
.. py:function:: detect_conflicts(params)
209-
210-
Detect and resolve parameter conflicts.
211-
212-
:param dict params: Parameters dictionary
213-
214-
**Checks:**
215-
216-
- Consistency between directivity type and spherical harmonic orders
217-
- Validates monopole source/receiver settings
218-
- Issues warnings for potential conflicts
21936

22037
Configuration Parameters
22138
------------------------
@@ -234,10 +51,10 @@ Core Parameters
23451
- Description
23552
* - soundSpeed
23653
- float
237-
- Speed of sound in m/s (default: 343.0)
54+
- Speed of sound in m/s (default: 343)
23855
* - airDensity
23956
- float
240-
- Air density in kg/m³ (default: 1.225)
57+
- Air density in kg/m³ (default: 1.2)
24158

24259
**Room Parameters:**
24360

@@ -366,7 +183,7 @@ Acoustic Parameters
366183
- Acoustic impedance of walls
367184
* - angleDependentFlag
368185
- bool
369-
- Whether reflection coefficients are angle-dependent
186+
- Whether reflection coefficients are angle-dependent (Always 1 in DEISM-ARG)
370187
* - RIRLength
371188
- float
372189
- Room impulse response length in seconds
@@ -391,7 +208,7 @@ Acoustic Parameters
391208
- Whether to remove direct path from calculation
392209
* - numParaImages
393210
- int
394-
- Number of parallel image source calculations
211+
- Number of parallel image source calculations (You can adjust based on your RAM)
395212
* - silentMode
396213
- bool
397214
- Whether to suppress output messages
@@ -429,30 +246,6 @@ For custom directivity patterns, provide data in the following format:
429246
- **Inclination**: 0 to π, measured from +z axis (0 = +z direction)
430247
- **Radius**: Distance from origin to sampling points
431248

432-
Error Handling
433-
--------------
434-
435-
Common error types and their meanings:
436-
437-
**ValueError**
438-
Raised when parameter values are invalid or inconsistent.
439-
440-
*Example*: Frequency arrays don't match between parameters and directivity data.
441-
442-
**TypeError**
443-
Raised when parameter types are incorrect.
444-
445-
*Example*: Room dimensions provided as string instead of list of floats.
446-
447-
**ImportError**
448-
Raised when required dependencies are missing.
449-
450-
*Example*: C++ extensions not properly compiled.
451-
452-
**FileNotFoundError**
453-
Raised when configuration or directivity files cannot be found.
454-
455-
*Example*: Custom directivity data file doesn't exist.
456249

457250
Performance Considerations
458251
--------------------------
@@ -462,14 +255,3 @@ Performance Considerations
462255
- **Original (ORG)**: Most accurate, highest computational cost
463256
- **LC**: Fastest, good approximation for higher-order reflections
464257
- **MIX**: Balanced approach, recommended for most applications
465-
466-
**Memory Optimization:**
467-
468-
- Use LC or MIX modes for large simulations
469-
- Reduce maximum reflection order if memory limited
470-
- Consider frequency resolution vs. accuracy trade-offs
471-
472-
**Parallel Processing:**
473-
474-
- Set ``numParaImages`` to utilize multiple CPU cores
475-
- Ray-based parallelization automatically scales with available resources

0 commit comments

Comments
 (0)