Calibrators¶
-
class
ollin.calibration.velocity.
VelocityCalibrator
(movement_model, config=None)[source]¶ Class to calibrate velocity parameters.
This class also holds all data generated in calibration simulations.
-
config
¶ dict
– Dictionary holding all configuration settings. Seeconfig
to see all relevant settings.
-
movement_model
¶ MovementModel
– Reference to Movement model instance being calibrated.
-
velocity_info
¶ array
–Numpy array of size:
[num_velocities, num_niches, num_worlds, trials_per_world]
containing velocity information. Here:
Num_velocities: Refers to the number of simulated mean velocities held in the configuration array config['velocities']
.Num_niches: Refers to the number of simulated niche sizes held in the configuration array config['niche_sizes']
.Num_worlds: Refers to the number of sites created per selection of (velocity, niche_size)
.Trials_per_world: Refers to the number of simulations made per site. Hence if:
vel = self.velocity_info[i, j, k, l]
this means that
vel
was the mean velocity in the l-th simulation at the k-th world generated with niche sizeconfig['niche_sizes'][j]
and “model”-mean velocityconfig['velocities'][i]
.
-
calculate_velocity_info
()[source]¶ Simulate multiple scenarios in parallel and record mean velocity.
-
fit
()[source]¶ Fit correction parameter to simulated velocity data.
Returns: fit – Dictionary holding the fitted parameters. Return type: dict
-
plot
(cmap='Set2', figsize=(10, 10), ax=None, plotfit=True)[source]¶ Plot graph of generated velocity data and fit.
Plots a graph of internal Model’s “mean-velocity” parameter versus resulting simulated mean velocity. Adds a fitted line to the plot if desired to visually check calibration.
Parameters: - cmap (
str
, optional) – Name of colormap to use for diferent niche sizes. - ax (
matplotlib.axes.Axes
, optional) – Ax in which to draw the plot. If not given a new one will be created. - fisize (
tuple
, optional) – Size of figure to create. Used only if no ax is given. - plotfit (bool, optional) – If True will plot a line fitted to velocity data. Defaults to True.
Returns: ax – Ax object for further plotting.
Return type: matplotlib.axes.Axes
- cmap (
-
-
class
ollin.calibration.home_range.
HomeRangeCalibrator
(movement_model, config=None)[source]¶ Class to calibrate Home Range parameters.
This class also holds all data generated in calibration simulations.
-
config
¶ dict
– Dictionary holding all configuration settings. Seeconfig
to see all relevant settings.
-
movement_model
¶ MovementModel
– Reference to Movement model instance being calibrated.
-
home_range_info
¶ array
–Numpy array of size:
[num_velocities, num_niches, num_worlds, trials]
containing occupancy information. Here:
Num_velocities: Refers to the number of simulated mean velocities held in the configuration array config['velocities']
.Num_niches: Refers to the number of simulated niche sizes held in the configuration array config['niche_sizes']
.Num_worlds: Refers to the number of sites created per selection of (velocity, niche_size)
.Trials: Refers to the number of simulations made per site. Hence if:
hr = home_range_info[i, j, k, l]
this means that
hr
was the mean home range in the l-th simulation at the k-th world generated with niche sizeconfig['niche_sizes'][j]
and mean velocityconfig['velocities'][i]
.
-
fit
()[source]¶ Fit correction parameter to simulated home range data.
Returns: fit – Dictionary holding the fitted parameters. Return type: dict
-
plot
(cmap='Set2', figsize=(10, 10), ax=None, plotfit=True)[source]¶ Plot graph of generated home range data and fit.
Plots a graph of mean velocity versus resulting simulated home ranges. Adds a fitted line to the plot if desired to visually check calibration.
Parameters: - cmap (
str
, optional) – Name of colormap to use for diferent niche sizes. - ax (
matplotlib.axes.Axes
, optional) – Ax in which to draw the plot. If not given a new one will be created. - fisize (
tuple
, optional) – Size of figure to create. Used only if no ax is given. - plotfit (bool, optional) – If True will plot a line fitted to velocity data. Defaults to True.
Returns: ax – Ax object for further plotting.
Return type: matplotlib.axes.Axes
- cmap (
-
-
class
ollin.calibration.occupancy.
OccupancyCalibrator
(movement_model, config=None)[source]¶ Class to calibrate Occupancy parameters.
This class also holds all data generated in calibration simulations.
-
config
¶ dict
– Dictionary holding all configuration settings. Seeconfig
to see all relevant settings.
-
movement_model
¶ MovementModel
– Reference to Movement model instance being calibrated.
-
occupancy_info
¶ array
–Numpy array of size:
[num_home_ranges, num_niches, num_nums, num_worlds, trials]
containing occupancy information. Here:
Num_home_ranges: Refers to the number of simulated home ranges held in the configuration array config['home_ranges']
.Num_niches: Refers to the number of simulated niche sizes held in the configuration array config['niche_sizes']
.Num_nums: Refers to the number of different number of individuals simulated which are held in the configuration array config['nums`]
.Num_worlds: Refers to the number of sites created per selection of (home_range, niche_size)
.Trials: Refers to the number of simulations made per site. Hence if:
oc = occupancy_info[i, j, k, l, m]
this means that
oc
was the occupancy generated byconfig['nums'][k]
individuals, randomly selected from the the m-th simulation at the l-th world generated with niche sizeconfig['niche_sizes'][j]
and home rangeconfig['home_ranges'][k]
.
-
fit
()[source]¶ Fit model parameters to simulated occupancy data.
Returns: fit – Dictionary holding the fitted parameters. Return type: dict
-
plot
(figsize=(10, 10), ax=None, x_var='density', w_target=True, xscale=None, yscale=None, lwidth=0.1, wtext=False)[source]¶ Plot graph of generated occupancy data and fit.
Plots a grid of graphs of the relation between population density and resulting simulated occupancy. Adds a fitted line to the plot if desired to visually check calibration.
Parameters: - ax (
matplotlib.axes.Axes
, optional) – Ax in which to draw the plot. If not given a new one will be created. - fisize (
tuple
, optional) – Size of figure to create. Used only if no ax is given. - x_var (
str
, optional) – Variable to use in the x-axis. Options are: ‘density’, ‘home_range’, ‘niche_sizes’. Defaults to ‘density’. - w_target (
bool
, optional) – If True will plot a line fitted to velocity data. Defaults to True. - xscale (
str
, optional) – Scale to use in the x-axis. Options are: ‘linear’, ‘log’. Defaults to ‘linear’. - yscale (
str
, optional) – Scale to use in the y-axis. Options are: ‘linear’, ‘log’, ‘logit’. Defaults to ‘linear’. - lwidth (
str
, optional) – Width of fitted line. Defaults to 0.1. - wtext (
bool
, optional) – If True will add a text description to each plot, specifying the niche size and home_range.
Returns: ax – Ax object for further plotting.
Return type: matplotlib.axes.Axes
- ax (
-