dynabench.initial
Module containing different initial condition generators.
Classes
|
Composite initial condition generator consisting of multiple initial conditions for the same grid. |
|
Initial condition with a constant value. |
|
Base class for all initial conditions. |
|
Initial condition with random values drawn from a uniform distribution. |
|
Initial condition generator for the sum of gaussians. |
|
Initial condition generator for the sum of wrapped gaussians. |
- class dynabench.initial.Composite(*components: list)[source]
Bases:
InitialCondition
Composite initial condition generator consisting of multiple initial conditions for the same grid. Convenience class to generate multiple initial conditions for different variables.
- Parameters:
components (list) – List of single initial conditions.
- generate(grid: Grid, random_state: int = 42)[source]
Generate the initial condition.
- Parameters:
grid (dynabench.grid.Grid) – The grid on which the initial condition is to be generated.
- Returns:
The initial condition.
- Return type:
np.ndarray
- property num_variables
Get the number of variables.
- class dynabench.initial.Constant(value: float = 0.0, **kwargs)[source]
Bases:
InitialCondition
Initial condition with a constant value.
- Parameters:
value (float, default 0.0) – The value of the constant.
- generate(grid: Grid)[source]
Generate the initial condition.
- Parameters:
grid (dynabench.grid.Grid) – The grid on which the initial condition is to be generated.
- Returns:
The initial condition.
- Return type:
np.ndarray
- class dynabench.initial.InitialCondition(parameters: dict = {}, **kwargs)[source]
Bases:
object
Base class for all initial conditions.
- Parameters:
parameters (dict, default {}) – Dictionary of parameters for the initial condition.
- generate(grid: Grid, random_state: int = 42)[source]
Generate the initial condition.
- Parameters:
grid (dynabench.grid.Grid) – The grid on which the initial condition is to be generated.
- Returns:
The initial condition.
- Return type:
np.ndarray
- property num_variables
Get the number of variables.
- class dynabench.initial.RandomUniform(low: float = 0.0, high: float = 1.0, **kwargs)[source]
Bases:
InitialCondition
Initial condition with random values drawn from a uniform distribution.
- Parameters:
low (float, default 0.0) – The lower bound of the uniform distribution.
high (float, default 1.0) – The upper bound of the uniform distribution.
- generate(grid: Grid, random_state: int = 42)[source]
Generate the initial condition.
- Parameters:
grid (dynabench.grid.Grid) – The grid on which the initial condition is to be generated.
- Returns:
The initial condition.
- Return type:
np.ndarray
- class dynabench.initial.SumOfGaussians(components: int = 1, zero_level: float = 0.0, **kwargs)[source]
Bases:
InitialCondition
Initial condition generator for the sum of gaussians.
- Parameters:
grid_size (tuple, default (64, 64)) – The size of the grid.
components (int, default 1) – The number of gaussian components.
zero_level (float, default 0.0) – The zero level of the initial condition.
- generate(grid: Grid, random_state: int = 42)[source]
Generate the initial condition.
- Parameters:
grid (dynabench.grid.Grid) – The grid on which the initial condition is to be generated.
- Returns:
The initial condition.
- Return type:
np.ndarray
- class dynabench.initial.WrappedGaussians(components: int = 1, zero_level: float = 0.0, periodic_levels: int = 10, **kwargs)[source]
Bases:
InitialCondition
Initial condition generator for the sum of wrapped gaussians.
- Parameters:
components (int, default 1) – The number of gaussian components.
zero_level (float, default 0.0) – The zero level of the initial condition.
periodic_levels (int or list, default 10) – The number of periodic levels to calculate the wrapped distribution. \(p_w(\theta)=\sum_{k=-\infty}^\infty {p(\theta+2\pi k)}\)
- generate(grid: Grid, random_state: int = 42)[source]
Generate the initial condition.
- Parameters:
grid (dynabench.grid.Grid) – The grid on which the initial condition is to be generated.
- Returns:
The initial condition.
- Return type:
np.ndarray