treble_tsdk.free_field.simulation

Classes

class treble_tsdk.free_field.simulation.FreeFieldSimulationDefinition
__init__(name: str, free_field_model: ModelObj, frequency: float, source_input: str | list[str] | None = None, simulation_purpose: FreeFieldSimulationPurpose = FreeFieldSimulationPurpose.submodel_source, receiver_sphere_radius_in_m: float = 1, free_field_simulation_settings: FreeFieldSimulationSettings | None = None, material_assignment: list[MaterialAssignment] | None = None, description: str | None = None, local_mesh_sizing: list[LocalMeshSizing] | None = None, mesher_settings: MesherSettings | None = None, metadata: dict[str, str] | ObjectMetadataDto | ObjectMetadata | None = None, **kwargs)

Defining a freefield simulation, can be used to create a submodel source or a device

Parameters:
  • name (str) – Name of the simulation

  • free_field_model (ModelObj) – The free field model including the device to be modelled

  • frequency (float) – Upper frequency of the simulation

  • source_input (str | list[str]) – The sources to model. If the intent is to create a submodel source, you can only use one source and it needs to be a layer name, however, for device creation, you can use a list of layers or coordinates and it will find the closest points on the surface. If sources were already defined as device_microphone_placements this input parameter can be left as None.

  • simulation_purpose (FreeFieldSimulationPurpose) – The purpose of the simulation, defaults to FreeFieldSimulationPurpose.submodel_source

  • receiver_sphere_radius (float) – The radius of the sphere of receivers, defaults to 1

  • free_field_simulation_settings (FreeFieldSimulationSettings) – Detailed simulation settings, defaults to None

  • material_assignment (list[MaterialAssignment]) – Material assignments, we recommend leaving this empty, defaults to None

  • description (str) – Description of simulation, defaults to None

  • local_mesh_sizing (list[LocalMeshSizing]) – Local sizing on meshes, we recommend leaving this empty unless you know what you are doing , defaults to None

  • mesher_settings (MesherSettings) – Extra settings for mesher, we recommend leaving this empty unless you know what you are doing , defaults to None

  • metadata (dict[str, str] | ObjectMetadataDto | ObjectMetadata) – _description_, defaults to None

plot(with_validation=True, project=None, view_2d: View2d | None = None, disable_labels: bool = False, _debug: DebugOptions = {})

Use the plot module to plot the simulation, plotting the model with sources and receivers.

Parameters:
  • with_validation (bool) – Show validation results. Optional, defaults to true.

  • project (Project) – Optional, only required if the “model” property of the simulation is a string containing the model id.

  • view_2d – Show a 2d view, choose between None, View2d.xy, View2d.xz, View2d.yz. Optional, defaults to false.

  • disable_labels – Disables source and receiver labels. Optional, defaults to false.

remove_invalid_receivers()

Performs validation and removes receivers that are invalid

remove_invalid_sources()

Performs validation and removes sources that are invalid

validate(project=None)

Validate simulation. Validates source/receiver positions. Receivers should be inside model and be placed 0.15m from any surface. Sources should be inside model and placed 0.25m from any surface. All layers should have materials assigned to them.

Parameters:

project (Project) – Optional, only required if the “model” property of the simulation is a string containing the model id.

class treble_tsdk.free_field.simulation.FreeFieldSimulationPurpose

An enumeration.

device = 'Device'
submodel_source = 'SubmodelSource'
class treble_tsdk.free_field.simulation.FreeFieldSimulationSettings
__init__(number_of_receivers: int | None = None, max_ambisonics_order: int = 16, speed_of_sound: float = 343.0, inject_triangle_edge_length: float = 0.008, ga_settings: GaSolverSettings | None = None, dg_settings: DgSolverSettings | None = None, gpu_count: int | None = None, dev_blob: str | None = None)

Free field simulation settings.

Parameters:
  • number_of_receivers (int) – Number of receivers on the sphere, defaults to None which makes 600 receivers

  • speed_of_sound (float) – SpeedOfSound (m/s) in medium.

  • inject_triangle_edge_length (float) – The edge length of the injected triangles for DRTF sources, defaults to 8e-3

  • ga_settings (GaSolverSettings) – Settings specific to the GA solver.

  • dg_settings (DgSolverSettings) – Settings sepcific to the DG solver.

  • gpu_count (int) – Sets the number of GPUs to allocate for each wave-solver task in the simulation.

as_metadata_payload() dict[str, str]
property ambisonics_order: int | None

Gets the default ambisonics order for spatial receivers. If no ambisonics order is set for a spatial receiver it defaults to 2. The value can be overwritten on a receiver level.

property dg_settings: DgSolverSettings
property freefield_removal_max_distance: float

Maximum distance for free field removal in meters. Every receiver within that distance from the source will have the free field response / direct sound removed from the response.

property ga_settings: GaSolverSettings
property gpu_count: int

Number of GPUs to use for simulation.

Returns int:

GPU count.

property ir_shift_seconds: float
property speed_of_sound: float

Speed of sound in meters per second.

Returns float:

Speed of sound value.