3.8. fmas.data_io

Implements dataclass and functions for handling and reading simulation parameters and data from and to HDF5 files.

SimPars

Simulation parameter dataclass.

set_par_from_dict

Set parameters from dictionary.

fetch_par_dict_h5

Fetch parameter dictionary from file.

read_h5

Fetch parameters from file.

save_h5

Save data in HDF5 format.

class fmas.data_io.SimPars(t_max: Optional[float] = None, t_num: Optional[int] = None, z_min: Optional[float] = None, z_max: Optional[float] = None, z_num: Optional[int] = None, z_skip: int = 1, beta_w: Optional[numpy.ndarray] = None, n2: Optional[float] = None, fR: Optional[float] = None, tau1: Optional[float] = None, tau2: Optional[float] = None, E_0t: Optional[numpy.ndarray] = None, out_file_path: Optional[str] = None, model_type: str = 'FMAS_S_R', solver_type: str = 'IFM_RK4IP')

Simulation parameter dataclass.

Dataclass holding simulation paramters defining the computational domain, model, and z-propagation scheme.

Parameters
  • t_max (float) – Half-period of temporal mesh \(t\).

  • t_num (int) – Number of meshpoints in time-mesh \(t\).

  • z_min (float) – Value of first mesh-point along \(z\).

  • z_max (float) – Value of last mesh-point along \(z\).

  • z_num (int) – Number of slices along \(z\).

  • z_skip (int) – Number of steps to skip when accumulating data (default z_skip=1).

  • beta_w (numpy.ndarray) – Frequency-domain representation of propagation constant.

  • n2 (float) – Nonlinear refractive index.

  • fR (float) – Fractional contribution of Raman response.

  • tau1 (float) – Raman response time scale.

  • tau2 (float) – Raman response time scale.

  • E_0t (numpy.ndarray) – Real-valued optical field at \(z=z_{\rm{min}}\).

  • out_file_path (str) – Full path for output file.

  • model_type (str) – Propagation model (default: FMAS_S_R).

  • solver_type (str) – Propagation algorithm (default: IFM_RK4IP).

fmas.data_io.fetch_par_dict_h5(file_path)

Fetch parameter dictionary from file.

Parameters

file_path (str) – Location of HDF5 input file.

Returns

Dictionary holding parameters from file.

Return type

dict

fmas.data_io.read_h5(file_path)

Fetch parameters from file.

Parameters

file_path (str) – Location of HDF5 input file.

Returns

Simulation parameter dataclass.

Return type

(dataclass)

fmas.data_io.save_h5(out_path, **results)

Save data in HDF5 format.

Parameters
  • out_path (str) – Name for ouput file.

  • **results – Arbitrary keyword arguments.

fmas.data_io.set_par_from_dict(sim_par, **par_dict)

Set parameters from dictionary.

Parameters
  • sim_par (dataclass) – Simulation parameter dataclass.

  • **par_dict – Arbitrary keyword arguments.

Returns

Simulation parameter dataclass.

Return type

(dataclass)