scimba_torch.integration.monte_carlo_parameters¶
Parameter samplers for Monte Carlo simulations.
Classes
|
Sample uniformly from given bounds for each dimension. |
|
Sample uniformly the velocities in a circle of radius r. |
|
Sample uniformly the velocities in a cuboid. |
- class UniformParametricSampler(bounds)[source]¶
Bases:
objectSample uniformly from given bounds for each dimension.
- Parameters:
bounds (
list[tuple[float,float]]) – A list of tuples where each tuple contains the lower and upper bounds for each dimension.- Raises:
TypeError – If parameters domain is not a list of tuples of two floats.
ValueError – If any bound has lower value greater than upper value.
- bounds¶
A list of tuples where each tuple contains the lower and upper bounds for each dimension.
- dim¶
The number of dimensions, inferred from the length of bounds.
- sample(n)[source]¶
Generates samples uniformly within the specified bounds for each dimension.
- Parameters:
n (
int) – The number of samples to generate.- Return type:
- Returns:
A tensor containing the generated samples and corresponding labels.
- Raises:
TypeError – If argument is not an integer.
ValueError – If argument is negative.
- class UniformVelocitySampler(velocity_domain)[source]¶
Bases:
objectSample uniformly the velocities in a circle of radius r.
- Parameters:
velocity_domain (
Circle2D) – Velocity domain in which the velocity will be drawn.- Raises:
TypeError – If velocity domain is not an object of class Circle2D.
- dim¶
The number of dimensions, here equal to 2.
- sample(n)[source]¶
Generates samples uniformly within the specified bounds for each dimension.
- Parameters:
n (
int) – The number of samples to generate.- Return type:
- Returns:
A tensor containing the generated samples and corresponding labels.
- Raises:
TypeError – If argument is not an integer.
ValueError – If argument is negative.
- class UniformVelocitySamplerOnCuboid(velocity_domain)[source]¶
Bases:
objectSample uniformly the velocities in a cuboid.
- Parameters:
velocity_domain (
Segment1D|Square2D|Cube3D) – Velocity domain in which the velocity will be drawn.- Raises:
TypeError – If velocity domain is not an object of class Segment1D, Square2D or Cube3D.
- dim¶
The number of dimensions.
- domain_size¶
The size of the domain in each dimension.
- lower_bound¶
The lower bound of the domain.
- sample(n)[source]¶
Generates samples uniformly within the specified bounds for each dimension.
- Parameters:
n (
int) – The number of samples to generate.- Return type:
- Returns:
A tensor containing the generated samples and corresponding labels.
- Raises:
TypeError – If argument is not an integer.
ValueError – If argument is negative.