integratorquadrature¶
- class pyvale.integratorquadrature.Quadrature2D(field: IField, sens_data: SensorData, gauss_pt_offsets: ndarray, gauss_weight_func: Callable)[source]¶
Bases:
IIntegratorSpatial
Gaussian quadrature numerical integrator for spatial averaging in 2D. Used to model spatial averaging of sensors over a rectangular area which is specified in the SensorData object. Handles sampling of the physical field at the integration points and averages them back to a single value per sensor location as specified in the SensorData object.
Implements the IIntegratorSpatial interface allowing for interoperability of different spatial integration algorithms for modelling sensor averaging.
- Parameters:
field (IField) -- A physical field interface that will be sampled at the integration points and averaged back to single value per sensor.
sens_data (SensorData) -- Parameters of the sensor array including the sensor locations, sampling times, type of spatial integrator and its dimensions. See the SensorData dataclass for more details.
gauss_pt_offsets (np.ndarray) -- Offsets from the central location of the integration area with shape=(n_gauss_pts,coord[X,Y,Z])
gauss_weight_func (Callable) -- A function that takes the shape of the measurement array as a tuple and returns a numpy array of weights for the gaussian integration points. The function must return an array with shape=(n_gauss_pts,) +meas_shape where meas_shape=(num_sensors,num_field_components, num_time_steps)
- calc_averages(sens_data: SensorData | None = None) ndarray [source]¶
Calculates the spatial averages for each sensor based on the specified sensor data and numerical integration options (i.e. geometry and integration points).
- Parameters:
sens_data (SensorData | None, optional) -- Specifies the sensor parameters used to calculate the averages, by default None. Is a sensor data object is passed a reference to that object is stored by this class and used in later calculations. If None then it uses the SensorData object stored by this class. Defaults to None.
- Returns:
np.ndarray -- Array of virtual sensor averages with shape=(n_sensors,n_comps, n_timsteps). Note this is consistent with pyvales measurement array.
- calc_integrals(sens_data: SensorData | None = None) ndarray [source]¶
Calculates the numerical integrals for each sensor based on the specified sensor data and numerical integration options (i.e. geometry and integration points).
- Parameters:
sens_data (SensorData | None, optional) -- Specifies the sensor parameters used to calculate the averages, by default None. Is a sensor data object is passed a reference to that object is stored by this class and used in later calculations. If None then it uses the SensorData object stored by this class. Defaults to None.
- Returns:
np.ndarray -- Array of virtual sensor integrals with shape=(n_sensors,n_comps, n_timsteps). Note this is consistent with pyvales measurement array.
- get_averages() ndarray [source]¶
Gets the most recent calculation of the spatial averages for all sensors in the sensor array without performing any new interpolation. If the averages have not been calculated they are first calculated and then returned.
- Returns:
np.ndarray -- Array of virtual sensor averages with shape=(n_sensors,n_comps, n_timsteps). Note this is consistent with pyvales measurement array.
- get_integrals() ndarray [source]¶
Gets the most recent calculation of the spatial averages for all sensors in the sensor array without performing any new interpolation. If the averages have not been calculated they are first calculated and then returned.
- Returns:
np.ndarray -- Array of virtual sensor averages with shape=(n_sensors,n_comps, n_timsteps). Note this is consistent with pyvales measurement array.
- pyvale.integratorquadrature.create_gauss_weights_2d_4pts(meas_shape: tuple[int, int, int]) ndarray [source]¶
Helper function that creates an array of weights for gaussian quadrature integration. This function provides the weights for 2D integrator with 4 integration points.
- Parameters:
meas_shape (tuple[int,int,int]) -- Shape of the measurement array, shape=(n_sensors,n_field_comps, n_time_steps).
- Returns:
np.ndarray -- Array of gaussian quadrature weights with shape = (n_gauss_pts,n_sensors ,n_field_comps,n_time_steps).
- pyvale.integratorquadrature.create_gauss_weights_2d_9pts(meas_shape: tuple[int, int, int]) ndarray [source]¶
Helper function that creates an array of weights for gaussian quadrature integration. This function provides the weights for 2D integrator with 9 integration points.
- Parameters:
meas_shape (tuple[int,int,int]) -- Shape of the measurement array, shape=(n_sensors,n_field_comps, n_time_steps).
- Returns:
np.ndarray -- Array of gaussian quadrature weights with shape = (n_gauss_pts,n_sensors ,n_field_comps,n_time_steps).