# Localization¶

opensoundscape.localization.calc_speed_of_sound(temperature=20)

Calculate speed of sound in meters per second

Calculate speed of sound for a given temperature in Celsius (Humidity has a negligible effect on speed of sound and so this functionality is not implemented)

Parameters: temperature – ambient temperature in Celsius the speed of sound in meters per second
opensoundscape.localization.localize(receiver_positions, arrival_times, temperature=20.0, invert_alg='gps', center=True, pseudo=True)

Perform TDOA localization on a sound event

Localize a sound event given relative arrival times at multiple receivers. This function implements a localization algorithm from the equations described in the class handout (“Global Positioning Systems”). Localization can be performed in a global coordinate system in meters (i.e., UTM), or relative to recorder positions in meters.

Parameters: receiver_positions – a list of [x,y,z] positions for each receiver Positions should be in meters, e.g., the UTM coordinate system. arrival_times – a list of TDOA times (onset times) for each recorder The times should be in seconds. temperature – ambient temperature in Celsius invert_alg – what inversion algorithm to use center – whether to center recorders before computing localization result. Computes localization relative to centered plot, then translates solution back to original recorder locations. (For behavior of original Sound Finder, use True) pseudo – whether to use the pseudorange error (True) or sum of squares discrepancy (False) to pick the solution to return (For behavior of original Sound Finder, use False. However, in initial tests, pseudorange error appears to perform better.) The solution (x,y,z,b) with the lower sum of squares discrepancy b is the error in the pseudorange (distance to mics), b=c*delta_t (delta_t is time error)
opensoundscape.localization.lorentz_ip(u, v=None)

Compute Lorentz inner product of two vectors

For vectors u and v, the Lorentz inner product for 3-dimensional case is defined as

u*v + u*v + u*v - u*v

Or, for 2-dimensional case as

u*v + u*v - u*v
Parameters: u – vector with shape either (3,) or (4,) v – vector with same shape as x1; if None (default), sets v = u value of Lorentz IP float
opensoundscape.localization.travel_time(source, receiver, speed_of_sound)

Calculate time required for sound to travel from a souce to a receiver

Parameters: source – cartesian position [x,y] or [x,y,z] of sound source receiver – cartesian position [x,y] or [x,y,z] of sound receiver speed_of_sound – speed of sound in m/s time in seconds for sound to travel from source to receiver