Vous avez re莽u un message "Your GitLab account has been locked ..." ? Pas d'inqui茅tude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit c4536fdb authored by Alexis Brenon's avatar Alexis Brenon
Browse files

馃摑 Finish utils package doc

parent 2a488dd8
--- A set of utilities modules and classes.
--
-- List of sub-packages, modules and classes:
--
-- List of sub-packages:
--
-- * @{utils.placeholder|placeholder}
--
-- List of modules:
--
-- * @{utils.ffi_cdef|ffi_cdef}
-- * @{utils.package_loader|package_loader}
-- * @{utils.setup|setup}
-- * @{utils.svg_renderer|svg_renderer}
-- * @{utils.utils|utils}
--
-- List of classes:
--
-- * @{utils.argparse.Parser|argparse.Parser}
-- * @{utils.Logger|Logger}
--
-- @package utils
-- @author Alexis BRENON <alexis.brenon@imag.fr>
......
......@@ -4,11 +4,11 @@
-- the value of a continuous sensor.
-- Relevant sensors are lamp, thermometer, etc.
--
-- @author Alexis BRENON <brenon.alexis+arcades@gmail.com>
-- @classmod utils.placeholder.ContinuousIconPlaceHolder
-- @alias class
-- @inherit true
-- @see utils.placeholder.IconPlaceHolder
-- @author Alexis BRENON <brenon.alexis+arcades@gmail.com>
local torch = require('torch')
......
--- SVG gauge placeholder class.
--
-- These placeholders will contain a dynamic gradient used to represent
-- continuous values.
-- Relevant sensors are consumptions meters (water, power, etc.),
-- time (hour in day, day in month)(?), etc.
--
-- @classmod utils.placeholder.GaugePlaceHolder
-- @alias class
-- @inherit true
-- @see utils.placeholder.PlaceHolder
-- @author Alexis BRENON <brenon.alexis+arcades@gmail.com>
local torch = require('torch')
local min = math.min
......@@ -8,6 +20,15 @@ assert(placeholder.PlaceHolder)
local module = {}
local class, super = torch.class('GaugePlaceHolder', 'PlaceHolder', module)
--- Maximum value of the sensor.
-- @tfield number self.max_value
--- Minimum value of the sensor.
-- @tfield number self.min_value
--- Constructor.
-- @tparam Doc element @{penlight/libraries/pl.xml.html/|XML element} to parse
-- @tparam table spec PlaceHolder's specification extracted from SVG聽description
function class:__init(element, spec)
super.__init(self, element, spec)
self.max_value = spec.max
......@@ -16,6 +37,14 @@ function class:__init(element, spec)
self.placed_values = { 0, 0 }
end
--- Private Methods
-- @section private-methods
--- Initialize @{PlaceHolder.string|string}
-- from given @{penlight/libraries/pl.xml.html/|XML element}.
-- @tparam Doc element @{penlight/libraries/pl.xml.html/|XML element}
-- @override true
-- @see PlaceHolder._prepare_string
function class:_prepare_string(element)
self.string = "<svg:linearGradient"
self.string = self.string .. self.dump_attribs(element)
......@@ -31,6 +60,15 @@ function class:_prepare_string(element)
self.string = self.string .. "</svg:linearGradient>"
end
--- Public Methods
-- @section public-methods
--- Change current value of the @{GaugePlaceHolder|placeholder}.
-- @tparam number value New value to apply
-- @treturn GaugePlaceHolder `self`
-- @treturn boolean Is the value modified
-- @override true
-- @see PlaceHolder:set_value
function class:set_value(value)
value = max(min(value or self.value or self.min_value, self.max_value), self.min_value)
local change_value = (value ~= self.value)
......@@ -43,6 +81,12 @@ function class:set_value(value)
return self, change_value
end
--- Get a random value.
--
-- The value is sampled from the range `[``self.min_value``,``self.max_value``]`.
-- @treturn number A value in the range `[``self.min_value``,``self.max_value``]`
-- @override true
-- @see PlaceHolder:get_random_value
function class:get_random_value()
return torch.random(self.min_value, self.max_value)
end
......
--- SVG symbols wrappers.
-- Classes used to easily change parts of an SVG document.
--
-- List of the packaged classes:
--
-- * @{utils.placeholder.PlaceHolder|PlaceHolder}
-- * @{utils.placeholder.IconPlaceHolder|IconPlaceHolder}
-- * @{utils.placeholder.ContinuousIconPlaceHolder|ContinuousIconPlaceHolder}
-- * @{utils.placeholder.DiscreteIconPlaceHolder|DiscreteIconPlaceHolder}
-- * @{utils.placeholder.GaugePlaceHolder|GaugePlaceHolder}
-- * @{utils.placeholder.IconPlaceHolderFactory|IconPlaceHolderFactory}
-- * @{utils.placeholder.PlaceHolderFactory|PlaceHolderFactory}
-- @package utils.placeholder
-- @author Alexis BRENON <alexis.brenon@imag.fr>
......
......@@ -106,7 +106,7 @@ local function _torchSetup(opt)
end
--- Setup training and testing @{environment.BaseEnvironment|environments}.
-- @tparams table args Environments arguments
-- @tparam table args Environments arguments
-- @treturn table `test` and `train` environments
-- @function _environment_setup
local function _environment_setup(args)
......@@ -159,8 +159,8 @@ local function _environment_setup(args)
end
--- Setup an @{agent.BaseAgent|agent}.
-- @tparams table args Agent arguments
-- @tparams table environments Environments in which agent will act
-- @tparam table args Agent arguments
-- @tparam table environments Environments in which agent will act
-- @treturn agent.BaseAgent Instanciated agent
-- @function _agent_setup
local function _agent_setup(args, environments)
......
.list-group-flush .list-group-item {
border-right: 0;
border-left: 0;
......
......@@ -145,6 +145,12 @@
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="$(html_root)/$(escape(ldoc.output)).html">$(ldoc.project)</a>
<span class="navbar-nav d-lg-none">
<a class="nav-item nav-link push-right"
href="$(repository)">
<i class="material-icons">code</i> Repository
</a>
</span>
<div class="collapse navbar-collapse"
id="projectNavbar">
<ul class="navbar-nav mr-auto">
......@@ -167,7 +173,7 @@
</ul>
</div> <!-- Collapsible navbar -->
<span class="navbar-nav">
<span class="navbar-nav d-none d-lg-block">
<a class="nav-item nav-link push-right"
href="$(repository)">
<i class="material-icons">code</i> Repository
......@@ -177,16 +183,17 @@
</div> <!-- Container -->
<!-- Kinds sub-navbars -->
<div class="container"
<div class="container flex-column align-items-start"
role="navigation"
style="background-color: rgba(255, 255, 255, 0.25);">
# for _, kind_name in ldoc.ipairs(project_kinds) do
<!-- Kind navbar -->
<div class="collapse"
<div class="collapse w-100"
role="tabpanel"
data-parent="#project-nav-accordion"
id="project-nav-$(escape(no_spaces(kind_name)))-collapsing">
<div class="d-flex flex-row flex-wrap justify-content-between align-items-center">
<button class="navbar-toggler"
type="button"
data-toggle="collapse"
......@@ -197,6 +204,12 @@
<span class="navbar-toggler-icon"></span>
</button>
<span class="navbar-brand">$(kind_name)</span>
<span class="navbar-nav d-lg-none invisible">
<a class="nav-item nav-link push-right"
href="$(repository)">
<i class="material-icons">code</i> Repository
</a>
</span>
<div class="navbar-collapse collapse"
id="project-nav-$(escape(no_spaces(kind_name)))-bar"> <!-- Responsive collapsible sub-navbar -->
<ul class="navbar-nav">
......@@ -214,6 +227,7 @@
# end
# end
</ul>
</div>
</div> <!-- responsive collapsible sub-navbar -->
</div> <!-- Kind navbar -->
# end
......@@ -229,7 +243,7 @@
<!-- -->
<!-- **************************************************************** -->
<div class="row">
<div class="row justify-content-center">
# local one_column_nav_display = ldoc.one and "[hidden]" or ""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment