Unverified Commit d98d5e6a authored by Roland Denis's avatar Roland Denis
Browse files

Custom highlighted article at home page depending on a setting.

parent 0808480b
Pipeline #3362 failed with stages
in 4 seconds
......@@ -6,40 +6,41 @@
:start_date: 2019-01-24
:end_date: 2019-01-24
:place: Paris
:summary: Le groupe Calcul propose un atelier d'une journée sur la différenciation automatique et ses usages courants.
.. contents::
.. section :: Description
.. section:: Description
:class: description
Calculating a derivative can sometimes be more delicate than one might think, specially when the function to be derived is itself the result of a numerical calculation.
In practice, this poses numerical and algorithmic problems: on the one hand, it is difficult to control the truncation error of a finite difference computation and on the other hand the symbolic computation can lead to an explosion of the complexity of the expressions.
Calculating a derivative can sometimes be more delicate than one might think, specially when the function to be derived is itself the result of a numerical calculation.
In practice, this poses numerical and algorithmic problems: on the one hand, it is difficult to control the truncation error of a finite difference computation and on the other hand the symbolic computation can lead to an explosion of the complexity of the expressions.
This need is encountered in problems where one seeks to optimize a quantity resulting itself from an approximate calculation.
This is formalized through the optimization of a criterion under constraint.
For example:
This need is encountered in problems where one seeks to optimize a quantity resulting itself from an approximate calculation.
This is formalized through the optimization of a criterion under constraint.
For example:
- the optimal control (aerodynamic stability analysis, ...),
- data assimilation (meteorology, risk analysis, ...),
- the inverse problems (geophysics, medical imaging, design, ...),
- sensitivity analysis (quantification of uncertainties, ...),
- deep learning (neural networks, ...).
- the optimal control (aerodynamic stability analysis, ...),
- data assimilation (meteorology, risk analysis, ...),
- the inverse problems (geophysics, medical imaging, design, ...),
- sensitivity analysis (quantification of uncertainties, ...),
- deep learning (neural networks, ...).
The algorithmic differentiation (AD) allows to get rid of a part of the calculations.
The AD takes a calculation code, as well as a description of the input and output variables, and produces a new code that calculates the derivatives of the outputs with respect to the inputs.
This uses concepts from compilation and program analysis (not computer algebra).
There are two modes of AD, which differ in the way of applying the rule of derivation of a compound function:
The algorithmic differentiation (AD) allows to get rid of a part of the calculations.
The AD takes a calculation code, as well as a description of the input and output variables, and produces a new code that calculates the derivatives of the outputs with respect to the inputs.
This uses concepts from compilation and program analysis (not computer algebra).
There are two modes of AD, which differ in the way of applying the rule of derivation of a compound function:
- the direct mode, which is used when the number of inputs is smaller than the number of outputs;
- the reverse mode, which is used when the number of inputs is greater than the number of outputs, in particular to calculate the gradient of a functional with respect to a large vector.
- the direct mode, which is used when the number of inputs is smaller than the number of outputs;
- the reverse mode, which is used when the number of inputs is greater than the number of outputs, in particular to calculate the gradient of a functional with respect to a large vector.
The inverse mode is equivalent to the adjoint state calculation (used in optimal control) and is close to retro-propagation in neural networks.
These results, well known to specialists in each discipline, are not new, however they deserve to be presented from a broader perspective.
The inverse mode is equivalent to the adjoint state calculation (used in optimal control) and is close to retro-propagation in neural networks.
These results, well known to specialists in each discipline, are not new, however they deserve to be presented from a broader perspective.
The purpose of this day is to bring together specialists in these different technologies to highlight the common needs, the different use cases and the limits of the different methods.
Another goal of this day is to meet different communities, who share these techniques.
The purpose of this day is to bring together specialists in these different technologies to highlight the common needs, the different use cases and the limits of the different methods.
Another goal of this day is to meet different communities, who share these techniques.
The workshop will include educational presentations presenting the principles of the methods, feedback on different applications and presentations recent or more original extensions.
The workshop will include educational presentations presenting the principles of the methods, feedback on different applications and presentations recent or more original extensions.
.. section:: Program
:class: programme
......
......@@ -110,3 +110,11 @@ FOLLOW_US_LINK = "mailto:sympa@listes.math.cnrs.fr?subject=subscribe calcul pré
# sort_key is generated by the customs readers from the date and
# start_date metadata.
ARTICLE_ORDER_BY = 'reversed-sort_key'
# Highlighted article
# If the selected article is finished, the last event is selected.
HIGHLIGHT_SETTINGS = {
'categories': {'journee', 'formation'}, # Filter article category
'article': 'next', # 'next' (next event), 'date' (last added), or its slug.
}
SUMMARY_MAX_LENGTH = 50
......@@ -6,7 +6,7 @@ from pelican import signals
def date_interval(dt_interval):
"""Format a date interval of an event."""
(start_date, end_date) = dt_interval
if start_date == end_date:
return "Le %s" % start_date.strftime('%d %B %Y')
elif start_date.year == end_date.year and start_date.month == end_date.month:
......@@ -16,8 +16,26 @@ def date_interval(dt_interval):
else:
return "Du %s au %s" % (start_date.strftime('%d %B %Y'), end_date.strftime('%d %B %Y'))
def highlighted_article(articles, config):
""" Select the article that is highlighted. """
try:
if config['article'] not in ['next', 'date']: # Slug specified
return next(article for article in articles if article.slug == config['article'] and not article.is_finished)
elif config['article'] == 'next':
return next(article for article in reversed(articles) if article.category.slug in config['categories'] and not article.is_finished)
else: # 'date'
return next(article for article in sorted(articles, key=lambda a: a.date, reverse=True) if article.category.slug in config['categories'] and not article.is_finished)
except:
return next(article for article in articles if article.category.slug in config['categories'])
def add_filter(pelican):
pelican.env.filters.update({'date_interval': date_interval})
pelican.env.filters.update({
'date_interval': date_interval,
'highlighted_article': highlighted_article,
})
def register():
signals.generator_init.connect(add_filter)
......@@ -705,9 +705,12 @@ h2.toc{
}
.header-border {
border-left: 1px solid black;
border-right: 1px solid black;
}
.header-border:first-child {
border-left: 1px solid black;
}
}
@media (max-width: 992px)
......
......@@ -2,30 +2,37 @@
{% block header_content %}
<div class="col mt-5">
{% set article = articles | highlighted_article(HIGHLIGHT_SETTINGS) -%}
<div class="container">
<a href="{{SITEURL}}/category/journee.html" class="btn btn-dark mb-2 p-2" id="header-btn">
<div class="row m-0 d-flex align-items-center">
<div id="circle-journee"></div>
<span class="category text-uppercase pl-2">{{CIRCLES['journee']}}</span>
<div id="circle-{{article.category.slug}}"></div>
<span class="category text-uppercase pl-2">{{CIRCLES[article.category.slug]}}</span>
</div>
</a>
</div>
<h1 class="mt-3 mb-2">Atelier intégration continue</h1>
<h1 class="mt-3 mb-2">{{ article.title }}</h1>
<div class="container text-center py-1">
<div class="row d-flex justify-content-center">
<div class="col-md-3 header-border px-0">
<span>Du 29 au 31 mai 2017</span>
<span>{{ [article.start_date, article.end_date] | date_interval }}</span>
</div>
<div class="col-md-1 px-0">
<span>Paris</span>
<div class="col-md-3 header-border px-0">
<span>{{ article.place }}</span>
</div>
<!--
<div class="col-md-3 header-border px-0">
<span>Institut Henri Poincaré</span>
</div>
-->
</div>
</div>
<p class="font-weight-light text-center pt-4">Le groupe Calcul propose un atelier de trois jours pour vous sensibiliser aux outils utilisés pour faire de l'intégration continue.</p>
<button type="button" class="btn btn-outline-dark detail" id="header-btn">L'événement en détail</button>
<p class="font-weight-light text-center pt-4">{{article.summary}}</p>
<a href="{{SITEURL}}/{{article.url}}">
<div class="btn btn-outline-dark detail" id="header-btn">
L'événement en détail
</div>
</a>
</div>
{% endblock header_content %}
......@@ -34,7 +41,7 @@
<div class="container-fluid event">
<div class="row d-flex justify-content-center mx-xl-5 mx-lg-3" id="event" style="margin-top: 22px;">
{% import 'cards.html' as cards with context %}
{% for article in articles_page.object_list[:5] %}
{% for article in articles[:5] %}
{{ cards.dispatch(article) }}
{% endfor %}
......
Supports Markdown
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