API Documentation¶
Python SOFA API for reading, writing and creating .sofa files.
-
class
sofa.Database[source]¶ Read and write NETCDF4 files following the SOFA specifications and conventions
-
static
create(path, convention, dimensions=None)[source]¶ Create a new .sofa file following a SOFA convention
Parameters: - path (str) – Relative or absolute path to .sofa file
- convention (str) – Name of the SOFA convention to create, see
sofa.conventions.implemented() - dimensions (dict or int, optional) – Number of measurements or dict of dimensions to define (standard dimensions: “M”: measurements, “R”: receivers, “E”: emitters, “N”: data length)
Returns: database (
sofa.Database)
-
static
open(path, mode='r', parallel=False)[source]¶ Parameters: - path (str) – Relative or absolute path to .sofa file
- mode (str, optional) – File access mode (‘r’: readonly, ‘r+’: read/write)
- parallel (bool, optional) – Whether to open the file with parallel access enabled (requires parallel-enabled netCDF4)
Returns: database (
sofa.Database)
-
convention¶
-
Data¶ DataType specific access for the measurement data, see
sofa.datatypes
-
Dimensions¶ sofa.access.Dimensionsfor the database dimensions
-
Listener¶ sofa.spatial.SpatialObjectfor the Listener
-
Source¶ sofa.spatial.SpatialObjectfor the Source
-
Receiver¶ sofa.spatial.SpatialObjectfor the Receiver(s)
-
Emitter¶ sofa.spatial.SpatialObjectfor the Emitter(s)
-
Room¶ RoomType specific access for the room data, see
sofa.roomtypes
-
Metadata¶ sofa.access.Metadatafor the database metadata
-
Variables¶ sofa.access.DatasetVariablesfor direct access to database variables
-
static
sofa.access¶
-
class
sofa.access.DatasetVariables(database)[source]¶ -
get_variable(name)[source]¶ Parameters: name (str) – Name of the variable Returns: value ( sofa.access.Variable) – Access object for the variable
-
get_string_array(name)[source]¶ Parameters: name (str) – Name of the string array Returns: value ( sofa.access.StringArray) – Access object for the string array
-
create_variable(name, dims, data_type='d', fill_value=0)[source]¶ Parameters: - name (str) – Name of the variable
- dims (tuple(str)) – Dimensions of the variable
Returns: value (
sofa.access.Variable) – Access object for the variable
-
create_string_array(name, dims)[source]¶ Parameters: - name (str) – Name of the variable
- dims (tuple(str)) – Dimensions of the variable
Returns: value (
sofa.access.StringArray) – Access object for the string array
-
-
class
sofa.access.Dimensions(dataset)[source]¶ Dimensions specified by SOFA as int
-
C¶ Coordinate dimension size
-
I¶ Scalar dimension size
-
M¶ Number of measurements
-
R¶ Number of receivers
-
E¶ Number of emitters
-
N¶ Number of data samples per measurement
-
S¶ Largest data string size
-
-
class
sofa.access.Metadata(dataset)[source]¶ -
get_attribute(name)[source]¶ Parameters: name (str) – Name of the attribute Returns: value (str) – Value of the attribute
-
set_attribute(name, value)[source]¶ Parameters: - name (str) – Name of the attribute
- value (str) – New value of the attribute
-
-
class
sofa.access.ProxyObject(database, name)[source]¶ Proxy object that provides access to variables and attributes of a name group in the netCDF4 dataset
-
database¶
-
name¶
-
dataset¶
-
create_attribute(name, value='')[source]¶ Creates the attribute in the netCDF4 dataset with its full name self.name+name
Parameters: - name (str) – Name of the variable
- value (str, optional) – Initial value of the attribute
-
create_variable(name, dims, data_type='d', fill_value=0)[source]¶ Creates the variable in the netCDF4 dataset with its full name self.name+name
Parameters: - name (str) – Name of the variable
- dims (tuple(str)) – Dimensions of the variable
Returns: value (
sofa.access.Variable) – Access object for the variable
-
create_string_array(name, dims)[source]¶ Creates the string array in the netCDF4 dataset with its full name self.name+name
Parameters: - name (str) – Name of the variable
- dims (tuple(str)) – Dimensions of the variable
Returns: value (
sofa.access.StringArray) – Access object for the string array
-
-
class
sofa.access.StringArray(database, name)[source]¶ -
initialize(dims, data_type='c', fill_value='\x00')[source]¶ Create the zero-padded character array in the underlying netCDF4 dataset. Dimension ‘S’ must be the last dimension, and is appended if not included in dims.
-
get_values(indices=None, dim_order=None)[source]¶ Parameters: - indices (dict(key:str, value:int or slice), optional) – Key: dimension name, value: indices to be returned, complete axis assumed if not provided
- dim_order (tuple of str, optional) – Desired order of dimensions in the output array
Returns: values (np.ndarray) – Requested array range in regular or desired dimension order, if provided
-
axis(dim)¶ Parameters: dim (str) – Name of the dimension Returns: axis (int) – Index of the dimension axis or None if unused
-
database¶
-
dimensions()¶ Returns: dimensions (tuple of str) – Variable dimension names in order
-
exists()¶ Returns: exists (bool) – True if variable exists, False otherwise
-
name¶
-
set_values(values, indices=None, dim_order=None, repeat_dim=None)[source]¶ Parameters: - values (np.ndarray) – New values for the array range
- indices (dict(key:str, value:int or slice), optional) – Key: dimension name, value: indices to be set, complete axis assumed if not provided
- dim_order (tuple of str, optional) – Dimension names in provided order, regular order assumed
- repeat_dim (tuple of str, optional) – Tuple of dimension names along which to repeat the values
-
-
class
sofa.access.Variable(database, name)[source]¶ -
Units¶ Units of the values
-
axis(dim)¶ Parameters: dim (str) – Name of the dimension Returns: axis (int) – Index of the dimension axis or None if unused
-
database¶
-
dimensions()¶ Returns: dimensions (tuple of str) – Variable dimension names in order
-
exists()¶ Returns: exists (bool) – True if variable exists, False otherwise
-
get_values(indices=None, dim_order=None)¶ Parameters: - indices (dict(key:str, value:int or slice), optional) – Key: dimension name, value: indices to be returned, complete axis assumed if not provided
- dim_order (tuple of str, optional) – Desired order of dimensions in the output array
Returns: values (np.ndarray) – Requested array range in regular or desired dimension order, if provided
-
initialize(dims, data_type='d', fill_value=0)¶ Create the variable in the underlying netCDF4 dataset
-
name¶
-
set_values(values, indices=None, dim_order=None, repeat_dim=None)¶ Parameters: - values (np.ndarray) – New values for the array range
- indices (dict(key:str, value:int or slice), optional) – Key: dimension name, value: indices to be set, complete axis assumed if not provided
- dim_order (tuple of str, optional) – Dimension names in provided order, regular order assumed
- repeat_dim (tuple of str, optional) – Tuple of dimension names along which to repeat the values
-
sofa.conventions¶
sofa.datatypes¶
Classes for accessing DataType-specific measurement data.
-
class
sofa.datatypes.FIR(database)[source]¶ Finite Impulse Response data type
- IR :
sofa.access.Variable - Discrete time impulse responses, dimensions (‘M’, ‘R’, ‘N’)
- Delay :
sofa.access.Variable - Broadband delay in units of dimension ‘N’, dimensions (‘I’, ‘R’) or (‘M’, ‘R’)
- SamplingRate :
sofa.access.Variable - Sampling rate, dimensions (‘I’) or (‘M’), with attribute “Units”
-
Type¶ SOFA data type
-
create_attribute(name, value='')¶ Creates the attribute in the netCDF4 dataset with its full name self.name+name
Parameters: - name (str) – Name of the variable
- value (str, optional) – Initial value of the attribute
-
create_string_array(name, dims)¶ Creates the string array in the netCDF4 dataset with its full name self.name+name
Parameters: - name (str) – Name of the variable
- dims (tuple(str)) – Dimensions of the variable
Returns: value (
sofa.access.StringArray) – Access object for the string array
-
create_variable(name, dims, data_type='d', fill_value=0)¶ Creates the variable in the netCDF4 dataset with its full name self.name+name
Parameters: - name (str) – Name of the variable
- dims (tuple(str)) – Dimensions of the variable
Returns: value (
sofa.access.Variable) – Access object for the variable
-
database¶
-
dataset¶
-
initialize(sample_count=None, variances=[], string_length=None)¶ Create the necessary variables and attributes
Parameters: - sample_count (int, optional) – Number of samples per measurement, mandatory if dimension N has not been defined
- variances (list) – Names of the variables that vary along dimension M
- string_length (int, optional) – Size of the longest data string
-
name¶
-
optional_variance_names()¶ Returns a list of standardized data elements that may vary between measurements
- IR :
-
class
sofa.datatypes.FIRE(database)[source]¶ Finite Impulse Response per Emitter data type
- IR :
sofa.access.Variable - Discrete time impulse responses, dimensions (‘M’, ‘R’, ‘E’, ‘N’)
- Delay :
sofa.access.Variable - Broadband delay in units of dimension ‘N’, dimensions (‘I’, ‘R’, ‘E’) or (‘M’, ‘R’, ‘E’)
- SamplingRate :
sofa.access.Variable - Sampling rate, dimensions (‘I’) or (‘M’), with attribute “Units”
-
Type¶ SOFA data type
-
create_attribute(name, value='')¶ Creates the attribute in the netCDF4 dataset with its full name self.name+name
Parameters: - name (str) – Name of the variable
- value (str, optional) – Initial value of the attribute
-
create_string_array(name, dims)¶ Creates the string array in the netCDF4 dataset with its full name self.name+name
Parameters: - name (str) – Name of the variable
- dims (tuple(str)) – Dimensions of the variable
Returns: value (
sofa.access.StringArray) – Access object for the string array
-
create_variable(name, dims, data_type='d', fill_value=0)¶ Creates the variable in the netCDF4 dataset with its full name self.name+name
Parameters: - name (str) – Name of the variable
- dims (tuple(str)) – Dimensions of the variable
Returns: value (
sofa.access.Variable) – Access object for the variable
-
database¶
-
dataset¶
-
initialize(sample_count=None, variances=[], string_length=None)¶ Create the necessary variables and attributes
Parameters: - sample_count (int, optional) – Number of samples per measurement, mandatory if dimension N has not been defined
- variances (list) – Names of the variables that vary along dimension M
- string_length (int, optional) – Size of the longest data string
-
name¶
-
optional_variance_names()¶ Returns a list of standardized data elements that may vary between measurements
- IR :
-
class
sofa.datatypes.SOS(database)[source]¶ Second Order Sections data type
- SOS :
sofa.access.Variable - Second order sections, dimensions (‘M’, ‘R’, ‘N’)
- Delay :
sofa.access.Variable - Broadband delay in samples resulting from SamplingRate, dimensions (‘M’, ‘R’)
- SamplingRate :
sofa.access.Variable - Sampling rate, dimensions (‘I’) or (‘M’), with attribute “Units”
-
initialize(sample_count=None, variances=[], string_length=None)[source]¶ Create the necessary variables and attributes
Parameters: - sample_count (int, optional) – Number of samples per measurement, mandatory if dimension N has not been defined
- variances (list) – Names of the variables that vary along dimension M
- string_length (int, optional) – Size of the longest data string
-
Type¶ SOFA data type
-
create_attribute(name, value='')¶ Creates the attribute in the netCDF4 dataset with its full name self.name+name
Parameters: - name (str) – Name of the variable
- value (str, optional) – Initial value of the attribute
-
create_string_array(name, dims)¶ Creates the string array in the netCDF4 dataset with its full name self.name+name
Parameters: - name (str) – Name of the variable
- dims (tuple(str)) – Dimensions of the variable
Returns: value (
sofa.access.StringArray) – Access object for the string array
-
create_variable(name, dims, data_type='d', fill_value=0)¶ Creates the variable in the netCDF4 dataset with its full name self.name+name
Parameters: - name (str) – Name of the variable
- dims (tuple(str)) – Dimensions of the variable
Returns: value (
sofa.access.Variable) – Access object for the variable
-
database¶
-
dataset¶
-
name¶
-
optional_variance_names()¶ Returns a list of standardized data elements that may vary between measurements
- SOS :
-
class
sofa.datatypes.TF(database)[source]¶ Transfer Function data type
- Real :
sofa.access.Variable - Real part of the complex spectrum, dimensions (‘M’, ‘R’, ‘N’)
- Imag :
sofa.access.Variable - Imaginary part of the complex spectrum, dimensions (‘M’, ‘R’, ‘N’)
- N :
sofa.access.Variable - Frequency values, dimension (‘N’,), with attributes “LongName” and “Units”
-
N¶ Frequency values
-
Type¶ SOFA data type
-
create_attribute(name, value='')¶ Creates the attribute in the netCDF4 dataset with its full name self.name+name
Parameters: - name (str) – Name of the variable
- value (str, optional) – Initial value of the attribute
-
create_string_array(name, dims)¶ Creates the string array in the netCDF4 dataset with its full name self.name+name
Parameters: - name (str) – Name of the variable
- dims (tuple(str)) – Dimensions of the variable
Returns: value (
sofa.access.StringArray) – Access object for the string array
-
create_variable(name, dims, data_type='d', fill_value=0)¶ Creates the variable in the netCDF4 dataset with its full name self.name+name
Parameters: - name (str) – Name of the variable
- dims (tuple(str)) – Dimensions of the variable
Returns: value (
sofa.access.Variable) – Access object for the variable
-
database¶
-
dataset¶
-
initialize(sample_count=None, variances=[], string_length=None)[source]¶ Create the necessary variables and attributes
Parameters: - sample_count (int, optional) – Number of samples per measurement, mandatory if dimension N has not been defined
- variances (list) – Names of the variables that vary along dimension M
- string_length (int, optional) – Size of the longest data string
-
name¶
-
optional_variance_names()¶ Returns a list of standardized data elements that may vary between measurements
- Real :
sofa.roomtypes¶
Classes for accessing RoomType-specific data.
-
class
sofa.roomtypes.FreeField(database)[source]¶ -
Type¶ SOFA data type
-
create_attribute(name, value='')¶ Creates the attribute in the netCDF4 dataset with its full name self.name+name
Parameters: - name (str) – Name of the variable
- value (str, optional) – Initial value of the attribute
-
create_string_array(name, dims)¶ Creates the string array in the netCDF4 dataset with its full name self.name+name
Parameters: - name (str) – Name of the variable
- dims (tuple(str)) – Dimensions of the variable
Returns: value (
sofa.access.StringArray) – Access object for the string array
-
create_variable(name, dims, data_type='d', fill_value=0)¶ Creates the variable in the netCDF4 dataset with its full name self.name+name
Parameters: - name (str) – Name of the variable
- dims (tuple(str)) – Dimensions of the variable
Returns: value (
sofa.access.Variable) – Access object for the variable
-
database¶
-
dataset¶
-
initialize(variances=[], string_length=None)¶ Create the necessary variables and attributes
Parameters: - measurement_count (int) – Number of measurements
- sample_count (int) – Number of samples per measurement
- variances (list) – Names of the variables that vary along dimension M
- string_length (int, optional) – Size of the longest data string
-
name¶
-
optional_variance_names()¶ Returns a list of standardized data elements that may vary between measurements
-
-
class
sofa.roomtypes.Reverberant(database)[source]¶ -
initialize(variances=[], string_length=None)[source]¶ Create the necessary variables and attributes
Parameters: - measurement_count (int) – Number of measurements
- sample_count (int) – Number of samples per measurement
- variances (list) – Names of the variables that vary along dimension M
- string_length (int, optional) – Size of the longest data string
-
Type¶ SOFA data type
-
create_attribute(name, value='')¶ Creates the attribute in the netCDF4 dataset with its full name self.name+name
Parameters: - name (str) – Name of the variable
- value (str, optional) – Initial value of the attribute
-
create_string_array(name, dims)¶ Creates the string array in the netCDF4 dataset with its full name self.name+name
Parameters: - name (str) – Name of the variable
- dims (tuple(str)) – Dimensions of the variable
Returns: value (
sofa.access.StringArray) – Access object for the string array
-
create_variable(name, dims, data_type='d', fill_value=0)¶ Creates the variable in the netCDF4 dataset with its full name self.name+name
Parameters: - name (str) – Name of the variable
- dims (tuple(str)) – Dimensions of the variable
Returns: value (
sofa.access.Variable) – Access object for the variable
-
database¶
-
dataset¶
-
name¶
-
optional_variance_names()¶ Returns a list of standardized data elements that may vary between measurements
-
-
class
sofa.roomtypes.Shoebox(database)[source]¶ Shoebox room type
- CornerA :
sofa.spatial.Coordinates - First corner of room cuboid, dimensions (‘I’, ‘C’) or (‘M’, ‘C’)
- CornerB :
sofa.spatial.Coordinates - Opposite corner of room cuboid, dimensions (‘I’, ‘C’) or (‘M’, ‘C’)
-
CornerA¶ First corner of room cuboid
-
CornerB¶ Opposite corner of room cuboid
-
initialize(variances=[], string_length=None)[source]¶ Create the necessary variables and attributes
Parameters: - measurement_count (int) – Number of measurements
- sample_count (int) – Number of samples per measurement
- variances (list) – Names of the variables that vary along dimension M
- string_length (int, optional) – Size of the longest data string
-
Type¶ SOFA data type
-
create_attribute(name, value='')¶ Creates the attribute in the netCDF4 dataset with its full name self.name+name
Parameters: - name (str) – Name of the variable
- value (str, optional) – Initial value of the attribute
-
create_string_array(name, dims)¶ Creates the string array in the netCDF4 dataset with its full name self.name+name
Parameters: - name (str) – Name of the variable
- dims (tuple(str)) – Dimensions of the variable
Returns: value (
sofa.access.StringArray) – Access object for the string array
-
create_variable(name, dims, data_type='d', fill_value=0)¶ Creates the variable in the netCDF4 dataset with its full name self.name+name
Parameters: - name (str) – Name of the variable
- dims (tuple(str)) – Dimensions of the variable
Returns: value (
sofa.access.Variable) – Access object for the variable
-
database¶
-
dataset¶
-
name¶
-
optional_variance_names()¶ Returns a list of standardized data elements that may vary between measurements
- CornerA :
sofa.spatial¶
-
sofa.spatial.sph2cart(alpha, beta, r)[source]¶ Spherical to cartesian coordinate transform.
\[\begin{split}x = r \cos \alpha \sin \beta \\ y = r \sin \alpha \sin \beta \\ z = r \cos \beta\end{split}\]with \(\alpha \in [0, 2\pi), \beta \in [-\frac{\pi}{2}, \frac{\pi}{2}], r \geq 0\)
Parameters: - alpha (float or array_like) – Azimuth angle in radians
- beta (float or array_like) – Elevation angle in radians (with 0 denoting azimuthal plane)
- r (float or array_like) – Radius
Returns: - x (float or
numpy.ndarray) – x-component of Cartesian coordinates - y (float or
numpy.ndarray) – y-component of Cartesian coordinates - z (float or
numpy.ndarray) – z-component of Cartesian coordinates
-
sofa.spatial.cart2sph(x, y, z)[source]¶ Cartesian to spherical coordinate transform.
\[\begin{split}\alpha = \arctan \left( \frac{y}{x} \right) \\ \beta = \arccos \left( \frac{z}{r} \right) \\ r = \sqrt{x^2 + y^2 + z^2}\end{split}\]with \(\alpha \in [-pi, pi], \beta \in [-\frac{\pi}{2}, \frac{\pi}{2}], r \geq 0\)
Parameters: - x (float or array_like) – x-component of Cartesian coordinates
- y (float or array_like) – y-component of Cartesian coordinates
- z (float or array_like) – z-component of Cartesian coordinates
Returns: - alpha (float or
numpy.ndarray) – Azimuth angle in radians - beta (float or
numpy.ndarray) – Elevation angle in radians (with 0 denoting azimuthal plane) - r (float or
numpy.ndarray) – Radius
-
class
sofa.spatial.Units[source]¶ -
-
Metre= 'metre'¶
-
Meter= 'meter'¶
-
Degree= 'degree'¶
-
Radians= 'radians'¶
-
static
convert_angle_units(coords, dimensions, old_units, new_units)[source]¶ Parameters: - coords (array_like) – Array of spherical coordinate values
- dimensions (tuple of str) – Names of the array dimensions in order, must contain “C”
- old_units (str) – Units of the angle values in the array
- new_units (str) – Target angle units
Returns: new_coords (np.ndarray) – Array of converted spherical coordinate values in identical dimension order
-
-
class
sofa.spatial.System[source]¶ Enum of valid coordinate systems
-
Cartesian= 'cartesian'¶
-
Spherical= 'spherical'¶
-
static
convert(coords, dimensions, old_system, new_system, old_angle_unit=None, new_angle_unit=None)[source]¶ Parameters: - coords (array_like) – Array of coordinate values
- dimensions (tuple of str) – Names of the array dimensions in order, must contain “C”
- old_system (str) – Coordinate system of the values in the array
- new_system (str) – Target coordinate system
- old_angle_unit (str, optional) – Unit of the angular spherical coordinates
- new_angle_unit (str, optional) – Target unit of the angular spherical coordinates
Returns: new_coords (np.ndarray) – Array of converted coordinate values in identical dimension order
-
-
class
sofa.spatial.Coordinates(obj, descriptor)[source]¶ Specialized
sofa.access.Variablefor spatial coordinates-
default_values= {'Position': (array([0, 0, 0]), 'cartesian'), 'Up': (array([0, 0, 1]), 'cartesian'), 'View': (array([1, 0, 0]), 'cartesian')}¶
-
Type¶ Coordinate system of the values
-
get_values(indices=None, dim_order=None, system=None, angle_unit=None)[source]¶ Gets the coordinates in their original reference system
Parameters: - indices (dict(key:str, value:int or slice), optional) – Key: dimension name, value: indices to be returned, complete axis assumed if not provided
- dim_order (tuple of str, optional) – Desired order of dimensions in the output array
- system (str, optional) – Target coordinate system
- angle_unit (str, optional) – Unit for spherical angles in the output array
Returns: values (np.ndarray) – Coordinates in the original reference system
-
get_global_values(indices=None, dim_order=None, system=None, angle_unit=None)[source]¶ Transform local coordinates (such as Receiver or Emitter) into the global reference system
Parameters: - indices (dict(key:str, value:int or slice), optional) – Key: dimension name, value: indices to be returned, complete axis assumed if not provided
- dim_order (tuple of str, optional) – Desired order of dimensions in the output array
- system (str, optional) – Target coordinate system
- angle_unit (str, optional) – Unit for spherical angles in the output array
Returns: global_values (np.ndarray) – Transformed coordinates in global reference system
-
get_relative_values(ref_object, indices=None, dim_order=None, system=None, angle_unit=None)[source]¶ Transform coordinates (such as Receiver or Emitter) into the reference system of a given
sofa.spatial.SpatialObject, aligning the x-axis with View and the z-axis with UpParameters: - ref_object (
sofa.spatial.Object) – Spatial object providing the reference system, None for - indices (dict(key:str, value:int or slice), optional) – Key: dimension name, value: indices to be returned, complete axis assumed if not provided
- dim_order (tuple of str, optional) – Desired order of dimensions in the output array
- system (str, optional) – Target coordinate system
- angle_unit (str, optional) – Unit for spherical angles in the output array
Returns: relative_values (np.ndarray) – Transformed coordinates in original or provided reference system
- ref_object (
-
set_values(values, indices=None, dim_order=None, repeat_dim=None, system=None, angle_unit=None)[source]¶ Sets the coordinate values after converting them to the system and units given by the dataset variable
Parameters: - values (np.ndarray) – New values for the array range
- indices (dict(key:str, value:int or slice), optional) – Key: dimension name, value: indices to be set, complete axis assumed if not provided
- dim_order (tuple of str, optional) – Dimension names in provided order, regular order assumed
- repeat_dim (tuple of str, optional) – Tuple of dimension names along which to repeat the values
- system (str, optional) – Coordinate system of the provided values
- angle_unit (str, optional) – Angle units of the provided values
-
-
class
sofa.spatial.SpatialObject(database, name)[source]¶ Spatial object such as Listener, Receiver, Source, Emitter
-
Position¶ Position of the spatial object relative to its reference system
-
View¶ View (x-axis) of the spatial object relative to its reference system
-
Up¶ Up (z-axis) of the spatial object relative to its reference system
-
Type¶ Coordinate syste, of the values
-
initialize(fixed=[], variances=[], count=None)[source]¶ Create the necessary variables and attributes
Parameters: - fixed (list(str), optional) – List of spatial coordinates that are fixed for all measurements [“Position”, “View”, “Up”]
- variances (list(str), optional) – List of spatial coordinates that vary between measurements [“Position”, “View”, “Up”], overrides mentions in fixed
- count (int, optional) – Number of objects (such as Emitters or Receivers), ignored for Listener and Source
-
initialize_coordinates(fixed=[], variances=[])[source]¶ Parameters: - fixed (list(str), optional) – List of spatial coordinates that are fixed for all measurements [“Position”, “View”, “Up”]
- variances (list(str), optional) – List of spatial coordinates that vary between measurements [“Position”, “View”, “Up”], overrides mentions in fixed
-
get_pose(indices=None, dim_order=None, system=None, angle_unit=None)[source]¶ Gets the spatial object coordinates or their defaults if they have not been defined. Relative spatial objects return their global pose, or their reference object’s pose values if theirs are undefined.
Parameters: - indices (dict(key:str, value:int or slice), optional) – Key: dimension name, value: indices to be returned, complete axis assumed if not provided
- dim_order (tuple of str, optional) – Desired order of dimensions in the output arrays
- system (str, optional) – Target coordinate system
- angle_unit (str, optional) – Unit for spherical angles in the output arrays
Returns: position, view, up (np.ndarray, np.ndarray, np.ndarray) – Spatial object reference system
-