Utilities –- Parts and Usage Overview
Modules for auxiliary functions used with the core informative sampling.
DataIO.jl
InformativeSamplingUtils.DataIO
— ModuleA module for handling data in and out.
Main public types and functions:
InformativeSamplingUtils.DataIO.maps_dir
— ConstantThe default directory containing the maps that can be used as data during simulated sampling.
InformativeSamplingUtils.DataIO.output_dir
— ConstantThe default output directory where files can be saved.
InformativeSamplingUtils.DataIO.output_ext
— ConstantThe default extension for saved output files.
InformativeSamplingUtils.DataIO.GaussGroundTruth
— TypeStruct/function for generating ground truth values from a linear combination of gaussian peaks.
Examples
GaussGroundTruth(peaks) # pass in a list of Peaks
InformativeSamplingUtils.DataIO.GaussGroundTruth
— MethodProduces ground-truth value(s) for a point or list of points. Accepts a single vector, a vector of vectors, or a matrix of column vectors.
Each probability distribution component is divided by its own peak height and the highest of all the peaks before being added into the total. This causes the entire ground truth map to have a max value of (about) 1.
InformativeSamplingUtils.DataIO.Peak
— TypeUsed within a GaussGroundTruth. Holds a 2D normal distribution and the desired height of the peak.
InformativeSamplingUtils.DataIO.Peak
— MethodInputs:
μ
: the peak location (distribution mean)Σ
: the peak width (distribution covariance)h
: the peak height
InformativeSamplingUtils.DataIO.dateTimeString
— FunctionCreates a string containing the date and time separated by dashes. Can pass in a DateTime object, defaults to current time.
InformativeSamplingUtils.DataIO.imgToMap
— MethodTakes a matrix in the format created from an image, re-formats it, and returns a GridMap. Images view a matrix with its indexing top-down and left-right. GridMaps view a matrix with its indexing left-right and bottom-up.
Examples
using DelimitedFiles: readdlm
image = readdlm(file_name, ',')
bounds = (lower = [0.0, 0.0], upper = [1.0, 1.0])
map = imgToMap(image, bounds)
map = imgToMap(image) # or auto bounds
InformativeSamplingUtils.DataIO.normalize
— MethodA helper method to normalize an array so its values are within the range [0, 1].
InformativeSamplingUtils.DataIO.produceMap
— MethodproduceMap(
func,
map::GridMaps.GridMap
) -> Union{GridMaps.GridMap{_A, _B, _C, Float64} where {_B, _C<:AbstractArray{_A, _B}}, GridMaps.GridMap{_A, N, _C, Float64} where {N, _C<:AbstractArray{_A, N}}} where _A
Generates a GridMap from a function for chosen bounds and dimensions. Can also pass in another GridMap in place of bounds and dims.
InformativeSamplingUtils.DataIO.produceMaps
— MethodproduceMaps(
beliefModel::MultiQuantityGPs.MQGP,
map::GridMaps.GridMap;
quantity
) -> Tuple{Union{GridMaps.GridMap{_A, _B, _C, Float64} where {_B, _C<:AbstractArray{_A, _B}}, GridMaps.GridMap{_A, N, _C, Float64} where {N, _C<:AbstractArray{_A, N}}} where _A, Union{GridMaps.GridMap{_A, _B, _C, Float64} where {_B, _C<:AbstractArray{_A, _B}}, GridMaps.GridMap{_A, N, _C, Float64} where {N, _C<:AbstractArray{_A, N}}} where _A}
Generates belief and uncertainty GridMaps from a belief model for chosen bounds and dimensions. Can also pass in another GridMap in place of bounds and dims.
InformativeSamplingUtils.DataIO.save
— Methodsave(
mission,
samples,
beliefs,
times;
animation,
sub_dir_name,
file_name
) -> Union{Nothing, Plots.AnimatedGif}
A collection of methods for saving data from missions, metrics, and general julia objects.
InformativeSamplingUtils.DataIO.saveBeliefMapToPng
— FunctionsaveBeliefMapToPng(beliefModel, occupancy) -> Any
saveBeliefMapToPng(beliefModel, occupancy, file_name) -> Any
This is really just to give something out to munch, so it needs to be an rgba png with the last channel as the amount.
InformativeSamplingUtils.DataIO.spatialAve
— FunctionA helper method to perform a spatial average on a matrix. The extent of the average can be chosen with its default being 1.
Visualization.jl
InformativeSamplingUtils.Visualization
— ModuleA module with methods to visualize mission data. The form displayed is determined by what data types are passed in.
Main public types and functions:
InformativeSamplingUtils.Visualization.getAxes
— MethodgetAxes(map) -> Tuple{Any, Any}
Method to get the x and y plotting axes. This (re)generates them only if needed and saves them into global module variables for future use.
InformativeSamplingUtils.Visualization.vis
— FunctionSimple convenience function that also displays the output of any visualize function. See those.
InformativeSamplingUtils.Visualization.visualize
— Functionvisualize(map::GridMaps.GridMap; ...) -> Any
visualize(map::GridMaps.GridMap, title; points, clim) -> Any
Method to show any GridMap data.
InformativeSamplingUtils.Visualization.visualize
— Functionvisualize(
beliefModel::MultiQuantityGPs.MQGP,
samples,
occupancy;
...
) -> Any
visualize(
beliefModel::MultiQuantityGPs.MQGP,
samples,
occupancy,
new_loc;
quantity
) -> Any
Method to show belief model values of mean and standard deviation and the sample locations that they were generated from. Shows two plots side-by-side.
InformativeSamplingUtils.Visualization.visualize
— Functionvisualize(sampleCost, samples, occupancy) -> Any
visualize(sampleCost, samples, occupancy, new_loc) -> Any
Method to show sample cost values.
InformativeSamplingUtils.Visualization.visualize
— Methodvisualize(
md,
samples,
beliefModel::MultiQuantityGPs.MQGP,
sampleCost,
new_loc;
quantity
) -> Any
Main method to visualize the current state of a search. Generates all the other visuals through their respective methods and lays them out in a grid. Currently shows the belief model, the ground truth, and the obstacles.
Arguments pass through to the sub-methods that need them. res is the grid resolution when plotting continuous-valued functions and defaults to [0.01, 0.01].
If no ground truth is available, it is not plotted.
InformativeSamplingUtils.Visualization.visualize
— Methodvisualize(
md,
samples,
beliefModel::MultiQuantityGPs.MQGP,
new_loc;
quantity
) -> Any
InformativeSamplingUtils.Visualization.visualize
— Methodvisualize(sampler, map) -> Any
Method to show ground truth data from a function.
InformativeSamplingUtils.Visualization.visualize
— Methodvisualize(maps::GridMaps.GridMap...; titles, points) -> Any
Method to show a ground truth map and up to three other prior data maps. Pass each map in as its own argument.
Metrics.jl
InformativeSamplingUtils.Metrics
— ModuleA module to calculate the metrics from a mission and belief model.
Main public types and functions:
InformativeSamplingUtils.Metrics.calcMetrics
— FunctionA collection of methods that calculates metrics from sampling missions.