Radiosity fast#

This class represents an optimized radiosity implementation. It includes the following features:

  • It is optimized for speed

  • It supports various forms and relationships of patches

  • It supports BRDFs

Warning

This class contains a known issue in the energy exchange calculation for non-perfectly Lambertian surfaces. The problem will be fixed in a future release.

class sparrowpy.DirectionalRadiosityFast(walls_points, walls_normal, walls_up_vector, patches_points, patches_normal, patch_size, n_patches, patch_to_wall_ids)[source]#

Radiosity object for directional scattering coefficients.

Methods:

bake_geometry([ff_method, algorithm])

Bake the geometry by calculating all the form factors.

calculate_energy_exchange(speed_of_sound, ...)

Calculate the energy exchange between patches.

collect_receiver_energy(receiver_pos, ...[, ...])

Collect patch histograms as detected by receiver.

from_polygon(polygon_list, patch_size)

Create a Radiosity object for directional scattering coefficients.

init_source_energy(source_position[, ...])

Initializes the energy of the source at the patches.

set_air_attenuation(air_attenuation)

Set air attenuation factor in Np/m.

set_wall_absorption(wall_indexes, absorption)

Set the wall absorption.

set_wall_scattering(wall_indexes, ...)

Set the wall scattering (brdf).

Attributes:

form_factors

Return the form factor.

n_bins

Return the number of frequency bins.

n_patches

Return the total number of patches.

n_walls

Return the number of walls.

patch_size

Return the size of the patches.

patches_area

Return the area of the patches.

patches_center

Return the center of the patches.

patches_normal

Return the normal of the patches.

patches_points

Return the points of the patches.

patches_size

Return the size of the patches.

speed_of_sound

Return the speed of sound in m/s.

visibility_matrix

Return the visibility matrix.

walls_area

Return the area of the walls.

walls_center

Return the center of the walls.

walls_normal

Return the normal of the walls.

walls_points

Return the points of the walls.

walls_up_vector

Return the up vector of the walls.

bake_geometry(ff_method='universal', algorithm='order')[source]#

Bake the geometry by calculating all the form factors.

Parameters:
  • ff_method (str, optional) – defines the form factor calculation method, by default ‘universal’. No other methods are implemented yet.

  • algorithm (str, optional) – defines the algorithm used for Radiosity, by default ‘order’. No other algorithms are implemented yet.

calculate_energy_exchange(speed_of_sound, histogram_time_resolution, histogram_length, algorithm='order', max_depth=-1, recalculate=False)[source]#

Calculate the energy exchange between patches.

Parameters:
  • speed_of_sound (float) – speed of sound in m/s.

  • histogram_time_resolution (float) – time resolution of the histogram, e.g. 1/1000.

  • histogram_length (float) – duration of the histogram in seconds.

  • algorithm (str, optional) – defines the algorithm used for Radiosity, by default ‘order’. No other algorithms are implemented yet.

  • max_depth (int, optional) – maximum reflection order the be calculated. e.g. 0 means the first order reflection, by default -1

  • recalculate (bool, optional) – whether or not to recalculate energy propagation from source position, by default False.

collect_receiver_energy(receiver_pos, speed_of_sound, histogram_time_resolution, method='universal', propagation_fx=False)[source]#

Collect patch histograms as detected by receiver.

The receiver is assumed visible to all patches.

Parameters:
  • receiver_pos (np.ndarray) – receiver positions in cartesian coordinates of shape (n_receivers, 3).

  • speed_of_sound (float) – speed of sound in m/s.

  • histogram_time_resolution (float) – time resolution of the histogram, e.g. 1/1000.

  • method (str, optional) – defines the algorithm used for Radiosity, by default ‘order’. No other algorithms are implemented yet.

  • propagation_fx (bool, optional) – if true the sound propagation from patch to receiver is applied in the final histogram, by default False.

Returns:

histogram_out – the final energy histogram of shape (n_receivers, n_patches, n_bins, n_samples)

Return type:

np.ndarray

property form_factors#

Return the form factor.

classmethod from_polygon(polygon_list, patch_size)[source]#

Create a Radiosity object for directional scattering coefficients.

Parameters:
  • polygon_list (list[PatchesDirectional]) – list of patches

  • patch_size (float) – maximal patch size in meters.

init_source_energy(source_position: ndarray, ff_method='universal', algorithm='order')[source]#

Initializes the energy of the source at the patches.

Note that the geometry must be baked before calling this function. The source is assumed visible to all patches.

Parameters:
  • source_position (np.ndarray) – _description_

  • ff_method (str, optional) – defines the form factor calculation method, by default ‘universal’. No other methods are implemented yet.

  • algorithm (str, optional) – defines the algorithm used for Radiosity, by default ‘order’. No other algorithms are implemented yet.

property n_bins#

Return the number of frequency bins.

property n_patches#

Return the total number of patches.

property n_walls#

Return the number of walls.

property patch_size#

Return the size of the patches.

property patches_area#

Return the area of the patches.

property patches_center#

Return the center of the patches.

property patches_normal#

Return the normal of the patches.

property patches_points#

Return the points of the patches.

property patches_size#

Return the size of the patches.

set_air_attenuation(air_attenuation: FrequencyData)[source]#

Set air attenuation factor in Np/m.

If not called, no air attenuation is applied.

Parameters:

air_attenuation (pyfar.FrequencyData) – Air attenuation factor in Np/m.

set_wall_absorption(wall_indexes, absorption: FrequencyData)[source]#

Set the wall absorption.

If this is not called before baking, a default value of 0.0 is used.

Parameters:
  • wall_indexes (list[int]) – list of walls for the scattering data

  • absorption (pyfar.FrequencyData) – absorption coefficient of cshape (1, )

set_wall_scattering(wall_indexes: list[int], scattering: FrequencyData, sources: Coordinates, receivers: Coordinates)[source]#

Set the wall scattering (brdf).

See brdf for more information. Make sure the absorption is either included in the brdf or set independently via wall using set_wall_absorption.

Parameters:
property speed_of_sound#

Return the speed of sound in m/s.

property visibility_matrix#

Return the visibility matrix.

property walls_area#

Return the area of the walls.

property walls_center#

Return the center of the walls.

property walls_normal#

Return the normal of the walls.

property walls_points#

Return the points of the walls.

property walls_up_vector#

Return the up vector of the walls.