Example usages of the special directives¶
File tree¶
The following examples assume we have the file tree under the
DATADIRPATH
like this:
DATADIRPATH
`- my/
`- experiment/
|- 2011-02-25-182001/
| |- graph_1.png
| |- graph_2.png
| `- data.json
|
|- 2011-02-25-182002/
| |- graph_1.png
| |- graph_2.png
| `- data.json
|
|- 2011-02-25-182003/
| |- graph_1.png
| |- graph_2.png
| `- data.json
|
|- 2011-02-26-182001/
| |- graph_1.png
| |- graph_2.png
| `- data.json
|
`- 2011-02-26-182002/
|- graph_1.png
|- graph_2.png
`- data.json
Example usages of table-data
¶
Basic example¶
.. table-data:: my/experiment/2011-02-25-*/data.json
:data: alpha beta result.gamma
:link: %(path)s
will produce a table like this:
alpha | beta | result.gamma | link(s) | |
---|---|---|---|---|
my/experiment/2011-02-25-182001/data.json | 1 | 0.1 | 0.01 | (link to the page /my/experiment/2011-02-25-182001/) |
my/experiment/2011-02-25-182002/data.json | 2 | 0.2 | 0.02 | (link to the page /my/experiment/2011-02-25-182001/) |
my/experiment/2011-02-25-182003/data.json | 3 | 0.3 | 0.03 | (link to the page /my/experiment/2011-02-25-182003/) |
Use of :base:
option¶
.. table-data:: 2011-02-25-*/data.json
2011-02-26-*/data.json
:base: my/experiment
:data: alpha beta result.gamma
:link: %(relpath)s
will produce a table like this:
alpha | beta | result.gamma | link(s) | |
---|---|---|---|---|
2011-02-25-182001/data.json | 1 | 0.1 | 0.01 | (link to the page 2011-02-25-182001/) |
2011-02-25-182002/data.json | 2 | 0.2 | 0.02 | (link to the page 2011-02-25-182001/) |
2011-02-25-182003/data.json | 3 | 0.3 | 0.03 | (link to the page 2011-02-25-182003/) |
2011-02-26-182001/data.json | 1 | 0.2 | 0.01 | (link to the page 2011-02-26-182001/) |
2011-02-26-182002/data.json | 2 | 0.1 | 0.02 | (link to the page 2011-02-26-182001/) |
Newest results on top¶
.. table-data:: 2011-02-25-*/data.json
:path-order: sort_r
:base: my/experiment
:data: alpha beta result.gamma
:link: %(relpath)s
will produce a table like this:
alpha | beta | result.gamma | link(s) | |
---|---|---|---|---|
2011-02-25-182003/data.json | 3 | 0.3 | 0.03 | (link to the page 2011-02-25-182003/) |
2011-02-25-182002/data.json | 2 | 0.2 | 0.02 | (link to the page 2011-02-25-182001/) |
2011-02-25-182001/data.json | 1 | 0.1 | 0.01 | (link to the page 2011-02-25-182001/) |
Example usages of table-data-and-image
¶
Basic example¶
.. table-data-and-image:: 2011-02-25-*/data.json
:image: graph_1.png graph_2.png
:path-order: sort_r
:base: my/experiment
:data: alpha beta result.gamma
:link: %(relpath)s
will produce a table like this:
|
(image of 2011-02-25-182003/graph_1.png) | (image of 2011-02-25-182003/graph_2.png) | ||||||
|
(image of 2011-02-25-182002/graph_1.png) | (image of 2011-02-25-182002/graph_2.png) | ||||||
|
(image of 2011-02-25-182001/graph_1.png) | (image of 2011-02-25-182001/graph_2.png) |
Scaling image¶
To scale the image with the table, you can use :image-width:
option.
.. table-data-and-image:: 2011-02-25-*/data.json
:image: graph_1.png
:image-width: 0:100%
:path-order: sort_r
:base: my/experiment
:data: alpha beta result.gamma
:link: %(relpath)s
will produce a table like this:
|
(image of 2011-02-25-182003/graph_1.png) <- the width varied with the width of the table. -> |
||||||
|
(image of 2011-02-25-182002/graph_1.png) | ||||||
|
(image of 2011-02-25-182001/graph_1.png) |
Example usages of dictdiff
¶
Basic example¶
.. dictdiff:: 2011-02-25-*/data.json
:base: my/experiment
:link: %(relpath)s
seed | alpha | beta | result.gamma | link(s) | |
---|---|---|---|---|---|
my/experiment/2011-02-25-182001/data.json | 8906300472 | 1 | 0.1 | 0.01 | (link to the page /my/experiment/2011-02-25-182001/) |
my/experiment/2011-02-25-182002/data.json | 2634932505 | 2 | 0.2 | 0.02 | (link to the page /my/experiment/2011-02-25-182001/) |
my/experiment/2011-02-25-182003/data.json | 2510325972 | 3 | 0.3 | 0.03 | (link to the page /my/experiment/2011-02-25-182003/) |
Exclude data¶
If you don’t want to see seed
in the data, you can exclude it
using the :exclude:
option.
.. dictdiff:: 2011-02-25-*/data.json
:base: my/experiment
:link: %(relpath)s
:exclude: seed
alpha | beta | result.gamma | link(s) | |
---|---|---|---|---|
my/experiment/2011-02-25-182001/data.json | 1 | 0.1 | 0.01 | (link to the page /my/experiment/2011-02-25-182001/) |
my/experiment/2011-02-25-182002/data.json | 2 | 0.2 | 0.02 | (link to the page /my/experiment/2011-02-25-182001/) |
my/experiment/2011-02-25-182003/data.json | 3 | 0.3 | 0.03 | (link to the page /my/experiment/2011-02-25-182003/) |
Example usages of grid-images
¶
Basic example¶
.. grid-images:: 2011-02-25-*[12]/data.json
2011-02-26-*/data.json
:base: my/experiment
:image: graph_1.png
:param: alpha beta
beta=0.1 | beta=0.2 | |
alpha=1 | (image of 2011-02-25-182001/graph_1.png) | (image of 2011-02-26-182001/graph_1.png) |
alpha=2 | (image of 2011-02-26-182002/graph_1.png) | (image of 2011-02-25-182002/graph_1.png) |
Example usage of find-images
¶
.. find-images:: 2011-02-25-*/graph_1.png
:base: my/experiment
will produce paragraphs like this:
my/experiment/2011-02-25-182001/graph_1.png
(image of 2011-02-25-182001/graph_1.png)
my/experiment/2011-02-25-182002/graph_1.png
(image of 2011-02-25-182002/graph_1.png)
my/experiment/2011-02-25-182003/graph_1.png
(image of 2011-02-25-182003/graph_1.png)
Example usages of the template page¶
With the above data tree, you may want to generate the similar page
when you access the page /my/experiment/...
. For that purpose,
you can make a template page /my/experiment/_temp_
with
the following contents:
Table data
==========
.. table-data:: data.json
:base: my/experiment/{{ args[0] }}/
:data: *
:trans:
:widths: 1 9
Images
======
.. find-images:: *.png
:base: my/experiment/{{ args[0] }}/
This template page generates the following page when you
access to the page /my/experiment/2011-02-25-182001
.
Table data
==========
.. table-data:: data.json
:base: my/experiment/2011-02-25-182001/
:data: *
:trans:
:widths: 1 9
Images
======
.. find-images:: *.png
:base: my/experiment/2011-02-25-182001/
Note that {{ args[0] }}
is replaced by 2011-02-25-182001
.
The above page can also be generated by the following template pages:
.. an example using "relpath"
Table data
==========
.. table-data:: data.json
:base: my/experiment/{{ relpath }}
:data: *
:trans:
:widths: 1 9
Images
======
.. find-images:: *.png
:base: my/experiment/{{ relpath }}
and
.. an example using "path"
Table data
==========
.. table-data:: data.json
:base: {{ path }}
:data: *
:trans:
:widths: 1 9
Images
======
.. find-images:: *.png
:base: {{ path }}