Skip to content

openstb.simulator.result_converter.numpy

Convert simulation results to NumPy files.

Classes:

Name Description
NumpyConverter

Convert simulation results to a NumPy file.

NumpyConverter

NumpyConverter(filename, compress=False)

Bases: ResultConverter

Convert simulation results to a NumPy file.

The writes the data as a NumPy .npz file with the following variables:

  • baseband_frequency: the frequency used to baseband the data
  • ping_start_time: seconds since the start of the trajectory that the pings were sent
  • pressure: the simulated pressure at each receiver
  • pressure_dimensions: string array giving the order of dimensions in pressure.
  • sample_time: seconds since the start of its ping that each sample was captured

Parameters:

Name Type Description Default
filename PathLike[str] | str

The path to save the converted results at.

required
compress bool

If True, compress the data while writing.

False
Source code in openstb/simulator/result_converter/numpy.py
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
def __init__(self, filename: os.PathLike[str] | str, compress: bool = False):
    """
    Parameters
    ----------
    filename
        The path to save the converted results at.
    compress
        If True, compress the data while writing.

    """
    self.filename = Path(filename)
    self.compress = compress
    if self.filename.exists():
        raise ValueError(
            _("output file {filename} already exists").format(
                filename=self.filename
            )
        )