pyloggrid.LogGrid.DataExplorer

Data processing and visualisation

Module Contents

Classes

DataExplorer

Data processing and visualisation

class DataExplorer(data_path: str)

Data processing and visualisation

Parameters:

data_path – simulation’s folder

getgrid(N_pts: int, k_min: float, fields: dict[str, ndarray] = None, k0: bool = False) Grid

Creates a grid populated with a step’s fields.

Parameters:
  • N_pts – grid size

  • k_min – grid’s min k

  • fields – grid’s fields

  • k0 – whether grid has k=0

Returns:

the populated grid

display(draw_funcs: dict[str, DrawFuncDict], N_points: int | None = None, loadfromsave: bool = False, N_min: int = 1, N_max: int | None = None, n_jobs: int = 1) None

Compute and display all the requested drawables.

Parameters:
  • draw_funcs – functions to draw, as a dict {name -> {"get"->fun, "plot"->fun(drawables, ts), "perframe"->bool}}. If perframe, the getter is per step and has signature fun(grid, t, simu_params). Otherwise, it is called once with signature fun(dataExplorer) If perframe is omitted, default to True

  • N_points – max number of points to evaluate. If None, equal to the max available points

  • N_min – The first step evaluated

  • N_max – The last step evaluated

  • loadfromsave – data is not calculated but directly loaded from already computed drawables in drawables.npy. N_min, N_max, N_points are not taken into account.

  • n_jobs – the number of parrallel threads to use. Use -1 for unlimited (not recommended)

load_step(step: int = None, ts: ndarray = None, t: float = None, grid: bool = True) dict | tuple[dict, Grid]

Load a saved step, either by step number, or by simulation time. If time is provided, it overrides the step.

Parameters:
  • step – step to load

  • ts – array of simulation times

  • t – time of the step to use. Must be provided with ts. Overrides step.

  • grid – if True, create a grid from loaded data and return it

Returns:

step data {fields, t, N_points, k_min, elapsed_time} if not grid, else a tuple step_data, grid