Skip to content
Snippets Groups Projects
Commit cf9aa2d4 authored by Yannick DAYER's avatar Yannick DAYER
Browse files

[doc] Add external docs links and fix wrong refs.

parent 9d8c8d29
No related branches found
No related tags found
1 merge request!45Switch to the new package structure using citools
Pipeline #66602 failed
...@@ -109,4 +109,7 @@ autodoc_default_options = { ...@@ -109,4 +109,7 @@ autodoc_default_options = {
intersphinx_mapping = { intersphinx_mapping = {
"python": ("https://docs.python.org/3", None), "python": ("https://docs.python.org/3", None),
"scipy": ("https://docs.scipy.org/doc/scipy/", None), "scipy": ("https://docs.scipy.org/doc/scipy/", None),
"numpy": ("https://numpy.org/doc/stable/", None),
"matplotlib": ("https://matplotlib.org/stable/", None),
"PIL": ("https://pillow.readthedocs.io/en/latest/", None),
} }
...@@ -58,10 +58,8 @@ def create_directories_safe(directory, dryrun=False): ...@@ -58,10 +58,8 @@ def create_directories_safe(directory, dryrun=False):
os.makedirs(directory, exist_ok=True) os.makedirs(directory, exist_ok=True)
def open_file(filename): def open_file(filename) -> np.ndarray:
"""open_file(filename) -> file. """Reads a file content.
Opens a file for reading.
Parameters Parameters
---------- ----------
...@@ -118,10 +116,8 @@ def open_file(filename): ...@@ -118,10 +116,8 @@ def open_file(filename):
raise ValueError(f"Unknown file extension: {extension}") raise ValueError(f"Unknown file extension: {extension}")
def write_file(filename, data, format="pillow"): def write_file(filename, data, format="pillow") -> None:
"""write_file(filename, data) -> None. """Writes the contents of a :py:class:`numpy.ndarray` to a file.
Writes the contents of a :py:class:`numpy.ndarray` to a file.
Parameters Parameters
---------- ----------
...@@ -150,11 +146,11 @@ def write_file(filename, data, format="pillow"): ...@@ -150,11 +146,11 @@ def write_file(filename, data, format="pillow"):
raise RuntimeError(f"Unknown file extension: {extension}") raise RuntimeError(f"Unknown file extension: {extension}")
def load(inputs): def load(inputs) -> np.ndarray:
"""load(inputs) -> data. """Loads the content of a file.
Loads the contents of a file, an iterable of files, or an iterable of Will take a filename (or an iterable of filenames) and put the content into a
:class:`File` objects into a :py:class:`numpy.ndarray`. :py:class:`numpy.ndarray`.
**Parameters:** **Parameters:**
...@@ -169,13 +165,6 @@ def load(inputs): ...@@ -169,13 +165,6 @@ def load(inputs):
would assume that each file contains a single 1D sample or a set of 1D would assume that each file contains a single 1D sample or a set of 1D
samples, load them in memory and concatenate them into a single and samples, load them in memory and concatenate them into a single and
returned 2D :py:class:`numpy.ndarray`. returned 2D :py:class:`numpy.ndarray`.
3. An iterable of :py:class:`File`. In this case, this would assume
that each :py:class:`File` contains a single 1D sample or a set
of 1D samples, load them in memory if required and concatenate them into
a single and returned 2D :py:class:`numpy.ndarray`.
4. An iterable with mixed filenames and :py:class:`File`. In this
case, this would returned a 2D :py:class:`numpy.ndarray`, as described
by points 2 and 3 above.
**Returns:** **Returns:**
...@@ -208,16 +197,15 @@ def load(inputs): ...@@ -208,16 +197,15 @@ def load(inputs):
else: else:
raise TypeError( raise TypeError(
"Unexpected input object. This function is expecting a filename, " "Unexpected input object. This function is expecting a filename, "
"or an iterable of filenames and/or File objects." "or an iterable of filenames."
) )
def save(array, filename, create_directories=False): def save(array, filename, create_directories=False):
"""Saves the contents of an array-like object to file. """Saves the contents of an array-like object to file.
Effectively, this is the same as creating a :py:class:`File` object Effectively, this is the same as opening a file with the mode flag set to ``'w'``
with the mode flag set to ``'w'`` (write with truncation) and calling (write with truncation) and calling ``file.write`` passing ``array`` as parameter.
:py:meth:`File.write` passing ``array`` as parameter.
Parameters: Parameters:
......
...@@ -57,7 +57,7 @@ def bob_to_pillow(img): ...@@ -57,7 +57,7 @@ def bob_to_pillow(img):
Returns Returns
------- -------
Image PIL.Image.Image
An object of pillow.Image. An object of pillow.Image.
""" """
# first convert to matplotlib format # first convert to matplotlib format
...@@ -78,7 +78,7 @@ def pillow_to_bob(img): ...@@ -78,7 +78,7 @@ def pillow_to_bob(img):
Parameters Parameters
---------- ----------
img : Image img: PIL.Image.Image
A Pillow Image A Pillow Image
Returns Returns
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment