Skip to main content

parameter_space

parameter_space

ParameterSpace domain object for history matching.

Classes

Name Description
ParameterSpace Encapsulates parameter space information and operations.

ParameterSpace

parameter_space.ParameterSpace(parameters)

Encapsulates parameter space information and operations.

Represents the bounds and constraints for parameters in a history matching analysis. Supports operations like constraining the space based on samples and calculating volume reductions.

Methods

Name Description
constrain_parameter Create new ParameterSpace with updated bounds for one parameter.
constrain_to_samples Create new ParameterSpace constrained to sample bounds.
get_bounds Get bounds for a specific parameter.
get_parameter_names Get list of all parameter names.
plot_bounds Plot each parameter’s bounds as a horizontal range, optionally against
sample_uniformly Generate uniform random samples within parameter bounds.
summary Human-readable summary: one line per parameter with its bounds.
to_dataframe Return the underlying parameters DataFrame.
validate_samples Check if all samples fall within parameter bounds.
volume_fraction_remaining Calculate remaining parameter space volume as fraction of original.
constrain_parameter
parameter_space.ParameterSpace.constrain_parameter(param_name, new_min, new_max)

Create new ParameterSpace with updated bounds for one parameter.

Parameters
Name Type Description Default
param_name str Name of parameter to constrain required
new_min float New minimum value required
new_max float New maximum value required
Returns
Name Type Description
ParameterSpace New ParameterSpace instance with updated bounds
constrain_to_samples
parameter_space.ParameterSpace.constrain_to_samples(samples_df, percentile=95)

Create new ParameterSpace constrained to sample bounds.

Parameters
Name Type Description Default
samples_df pd.DataFrame DataFrame containing parameter samples required
percentile float Percentile to use for bounds (e.g., 95 means 2.5-97.5 range) 95
Returns
Name Type Description
ParameterSpace New ParameterSpace constrained to sample bounds
get_bounds
parameter_space.ParameterSpace.get_bounds(parameter_name)

Get bounds for a specific parameter.

Parameters
Name Type Description Default
parameter_name str Name of the parameter required
Returns
Name Type Description
Tuple[float, float] Tuple of (minimum, maximum) values
get_parameter_names
parameter_space.ParameterSpace.get_parameter_names()

Get list of all parameter names.

plot_bounds
parameter_space.ParameterSpace.plot_bounds(reference=None, ax=None, **kwargs)

Plot each parameter’s bounds as a horizontal range, optionally against a reference ParameterSpace to show shrinkage (delegates to historymatching.plotting.plot_parameter_bounds).

sample_uniformly
parameter_space.ParameterSpace.sample_uniformly(n_samples, seed=None)

Generate uniform random samples within parameter bounds.

Parameters
Name Type Description Default
n_samples int Number of samples to generate required
seed Optional[int] Random seed for reproducibility None
Returns
Name Type Description
pd.DataFrame DataFrame with columns for each parameter
summary
parameter_space.ParameterSpace.summary()

Human-readable summary: one line per parameter with its bounds.

to_dataframe
parameter_space.ParameterSpace.to_dataframe()

Return the underlying parameters DataFrame.

Returns
Name Type Description
pd.DataFrame DataFrame with parameter space definition
validate_samples
parameter_space.ParameterSpace.validate_samples(samples_df)

Check if all samples fall within parameter bounds.

Parameters
Name Type Description Default
samples_df pd.DataFrame DataFrame containing parameter samples required
Returns
Name Type Description
bool True if all samples are valid, False otherwise
volume_fraction_remaining
parameter_space.ParameterSpace.volume_fraction_remaining(original_space)

Calculate remaining parameter space volume as fraction of original.

Parameters
Name Type Description Default
original_space ParameterSpace Original ParameterSpace to compare against required
Returns
Name Type Description
float Fraction of volume remaining (0.0 to 1.0)