Skip to content

holab.losses

amplitude_correlation(predicted, target, pad_value=0.0)

Calculate the amplitude correlation between two Fourier series.

The function takes two Fourier series, gets them on grid and computes the amplitude correlation. If the shapes of predicted and target are different, the target is padded to match the shape of the predicted.

Parameters:

Name Type Description Default
predicted FourierSeries

The predicted Fourier series.

required
target FourierSeries

The target Fourier series to which predicted series is compared.

required
pad_value Num

Value used for padding the target Fourier series if its shape is different from the predicted series. Default is 0.

0.0

Returns:

Name Type Description
Num Num

The amplitude correlation between the predicted and target Fourier series.

field_intensity(field)

Calculate the intensity of a complex field

Parameters:

Name Type Description Default
field FourierSeries

The complex field.

required

Returns:

Name Type Description
Num Num

The intensity of the field.

normalized_mse(predicted, target, pad_value=0.0)

Calculate the normalized mean squared error between two Fourier series.

Parameters:

Name Type Description Default
predicted FourierSeries

The predicted Fourier series.

required
target FourierSeries

The target Fourier series to which the predicted series is compared.

required
pad_value Num

Value used for padding the target Fourier series if its shape is different from the predicted series. Default is 0.

0.0

Returns:

Name Type Description
Num Num

The normalized mean squared error.

point_intensity(point, pressure_plane)

Returns the absolute intensity of a 2D field at a point. The point coordinates are given in the same units as the domain.

Points in between grid nodes are calculated using the Band Limited Interpolant of the Fourier Series.

Parameters:

Name Type Description Default
point Tuple[float, float]

The point coordinates. The point (0,0) corresponds to the center of the pressure plane.

required
pressure_plane FourierSeries

The pressure plane.

required

Returns:

Name Type Description
Num Num

The absolute intensity at the point.

real_imag_correlation(predicted, target, pad_value=0.0)

Calculate the amplitude correlation between two Fourier series, considering the real and imaginary parts separately.

The function takes two Fourier series, gets them on grid and computes the correlation. If the shapes of predicted and target are different, the target is padded to match the shape of the predicted.

Parameters:

Name Type Description Default
predicted FourierSeries

The predicted Fourier series.

required
target FourierSeries

The target Fourier series to which predicted series is compared.

required
pad_value Num

Value used for padding the target Fourier series if its shape is different from the predicted series. Default is 0.

0.0

Returns:

Name Type Description
Num Num

The amplitude correlation between the predicted and target Fourier series.