Commit 6c6a3de6 authored by André Anjos's avatar André Anjos 💬

Be more verbose about types

parent 17d9ed6d
Pipeline #4147 failed with stage
in 6 minutes and 9 seconds
...@@ -22,9 +22,9 @@ def open_file(filename, mode='rt'): ...@@ -22,9 +22,9 @@ def open_file(filename, mode='rt'):
Parameters: Parameters:
filename (:obj:`str`, :obj:`file`): The name of the score file to open, or filename (:py:class:`str`, file object): The name of the score file to
a file-like object open for reading. If a file name is given, the open, or a file-like object open for reading. If a file name is given,
according file might be a raw text file or a (compressed) tar file the according file might be a raw text file or a (compressed) tar file
containing a raw text file. containing a raw text file.
...@@ -74,8 +74,8 @@ def four_column(filename): ...@@ -74,8 +74,8 @@ def four_column(filename):
Parameters: Parameters:
filename (:obj:`str`, :obj:`file`): The file object that will be opened filename (:py:class:`str`, :py:class:`File`): The file object that will be
with :py:func:`open_file` containing the scores. opened with :py:func:`open_file` containing the scores.
Returns: Returns:
...@@ -119,8 +119,8 @@ def split_four_column(filename): ...@@ -119,8 +119,8 @@ def split_four_column(filename):
Parameters: Parameters:
filename (:obj:`str`, :obj:`file`): The file object that will be opened filename (:py:class:`str`, :py:class:`File`): The file object that will be
with :py:func:`open_file` containing the scores. opened with :py:func:`open_file` containing the scores.
Returns: Returns:
...@@ -155,8 +155,8 @@ def cmc_four_column(filename): ...@@ -155,8 +155,8 @@ def cmc_four_column(filename):
Parameters: Parameters:
filename (:obj:`str`, :obj:`file`): The file object that will be opened filename (:py:class:`str`, :py:class:`File`): The file object that will be
with :py:func:`open_file` containing the scores. opened with :py:func:`open_file` containing the scores.
Returns: Returns:
...@@ -201,8 +201,8 @@ def five_column(filename): ...@@ -201,8 +201,8 @@ def five_column(filename):
Parameters: Parameters:
filename (:obj:`str`, :obj:`file`): The file object that will be opened with filename (:py:class:`str`, :py:class:`File`): The file object that will be
:py:func:`open_file` containing the scores. opened with :py:func:`open_file` containing the scores.
Returns: Returns:
...@@ -248,8 +248,8 @@ def split_five_column(filename): ...@@ -248,8 +248,8 @@ def split_five_column(filename):
Parameters: Parameters:
filename (:obj:`str`, :obj:`file`): The file object that will be opened with filename (:py:class:`str`, :py:class:`File`): The file object that will be
:py:func:`open_file` containing the scores. opened with :py:func:`open_file` containing the scores.
Returns: Returns:
...@@ -284,8 +284,8 @@ def cmc_five_column(filename): ...@@ -284,8 +284,8 @@ def cmc_five_column(filename):
Parameters: Parameters:
filename (:obj:`str`, :obj:`file`): The file object that will be opened with filename (:py:class:`str`, :py:class:`File`): The file object that will be
:py:func:`open_file` containing the scores. opened with :py:func:`open_file` containing the scores.
Returns: Returns:
...@@ -317,12 +317,12 @@ def load_score(filename, ncolumns=None): ...@@ -317,12 +317,12 @@ def load_score(filename, ncolumns=None):
Parameters: Parameters:
filename (:obj:`str`, :obj:`file`): The file object that will be opened filename (:py:class:`str`, :py:class:`File`): The file object that will be
with :py:func:`open_file` containing the scores. opened with :py:func:`open_file` containing the scores.
ncolumns (:obj:`int`, optional): 4, 5 or None (the default), specifying the ncolumns (:py:class:`int`, optional): 4, 5 or None (the default),
number of columns in the score file. If None is provided, the number of specifying the number of columns in the score file. If None is provided,
columns will be guessed. the number of columns will be guessed.
Returns: Returns:
......
...@@ -50,9 +50,9 @@ def write_matrix( ...@@ -50,9 +50,9 @@ def write_matrix(
The mask file defines, which values are positives, negatives or to be The mask file defines, which values are positives, negatives or to be
ignored. Usually, the file name extension is ``.mask`` ignored. Usually, the file name extension is ``.mask``
model_names (:obj:`str`, optional): If given, the matrix will be written in model_names (py:py:class:`str`, optional): If given, the matrix will be
the same order as the given model names. The model names must be written in the same order as the given model names. The model names must
identical with the second column in the 5-column ``score_file``. be identical with the second column in the 5-column ``score_file``.
.. note:: .. note::
...@@ -62,24 +62,24 @@ def write_matrix( ...@@ -62,24 +62,24 @@ def write_matrix(
Only the scores of the given models will be considered. Only the scores of the given models will be considered.
probe_names (:obj:`list`, optional): A list of strings. If given, the probe_names (:py:py:class:`list`, optional): A list of strings. If given,
matrix will be written in the same order as the given probe names (the the matrix will be written in the same order as the given probe names
``path`` of the probe). The probe names are identical to the third (the ``path`` of the probe). The probe names are identical to the third
column of the 4-column (or the fourth column of the 5-column) column of the 4-column (or the fourth column of the 5-column)
``score_file``. Only the scores of the given probe names will be ``score_file``. Only the scores of the given probe names will be
considered in this case. considered in this case.
score_file_format (:obj:`str`, optional): One of ``('4column', score_file_format (:py:class:`str`, optional): One of ``('4column',
'5column')``. The format, in which the ``score_file`` is; defaults to '5column')``. The format, in which the ``score_file`` is; defaults to
``'4column'`` ``'4column'``
gallery_file_name (:obj:`str`, optional): The name of the gallery file that gallery_file_name (:py:class:`str`, optional): The name of the gallery file
will be written in the header of the OpenBR files. that will be written in the header of the OpenBR files.
probe_file_name (:obj:`str`, optional): The name of the probe file that probe_file_name (:py:class:`str`, optional): The name of the probe file that
will be written in the header of the OpenBR files. will be written in the header of the OpenBR files.
search (:obj:`int`, optional): If given, the scores will be sorted per search (:py:class:`int`, optional): If given, the scores will be sorted per
probe, keeping the specified number of highest scores. If the given probe, keeping the specified number of highest scores. If the given
number is higher than the models, ``NaN`` values will be added, and the number is higher than the models, ``NaN`` values will be added, and the
mask will contain ``0x00`` values. mask will contain ``0x00`` values.
...@@ -226,39 +226,40 @@ def write_score_file( ...@@ -226,39 +226,40 @@ def write_score_file(
score_file (str): Path to the 4 or 5 column style score file that should be score_file (str): Path to the 4 or 5 column style score file that should be
written. written.
models_ids (:obj:`list`, optional): A list of strings with the client ids models_ids (:py:class:`list`, optional): A list of strings with the client
of the models that will be written in the first column of the score file. ids of the models that will be written in the first column of the score
If given, the size must be identical to the number of models (gallery file. If given, the size must be identical to the number of models
templates) in the OpenBR files. If not given, client ids of the model (gallery templates) in the OpenBR files. If not given, client ids of the
will be identical to the **gallery index** in the matrix file. model will be identical to the **gallery index** in the matrix file.
probes_ids (:obj:`list`, optional): A list of strings with the client ids probes_ids (:py:class:`list`, optional): A list of strings with the client
of the probes that will be written in the second/third column of the ids of the probes that will be written in the second/third column of the
four/five column score file. If given, the size must be identical to the four/five column score file. If given, the size must be identical to the
number of probe templates in the OpenBR files. It will be checked that number of probe templates in the OpenBR files. It will be checked that
the OpenBR mask fits to the model/probe client ids. If not given, the the OpenBR mask fits to the model/probe client ids. If not given, the
probe ids will be estimated automatically, i.e., to fit the OpenBR probe ids will be estimated automatically, i.e., to fit the OpenBR
matrix. matrix.
model_names (:obj:`list`, optional): A list of strings with the model path model_names (:py:class:`list`, optional): A list of strings with the model
written in the second column of the five column score file. If not given, path written in the second column of the five column score file. If not
the model index in the OpenBR file will be used. given, the model index in the OpenBR file will be used.
.. note:: .. note::
This entry is ignored in the four column score file format. This entry is ignored in the four column score file format.
probe_names (:obj:`list`, optional): A list of probe path to be written in probe_names (:py:class:`list`, optional): A list of probe path to be
the third/fourth column in the four/five column score file. If given, the written in the third/fourth column in the four/five column score file. If
size must be identical to the number of probe templates in the OpenBR given, the size must be identical to the number of probe templates in the
files. If not given, the probe index in the OpenBR file will be used. OpenBR files. If not given, the probe index in the OpenBR file will be
used.
score_file_format (:obj:`str`, optional): One of ``('4column', score_file_format (:py:class:`str`, optional): One of ``('4column',
'5column')``. The format, in which the ``score_file`` is; defaults to '5column')``. The format, in which the ``score_file`` is; defaults to
``'4column'`` ``'4column'``
replace_nan (:obj:`float`, optional): If NaN values are encountered in the replace_nan (:py:class:`float`, optional): If NaN values are encountered in
OpenBR matrix (which are not ignored due to the mask being non-NULL), the OpenBR matrix (which are not ignored due to the mask being non-NULL),
this value will be written instead. If ``None``, the values will not be this value will be written instead. If ``None``, the values will not be
written in the score file at all. written in the score file at all.
......
...@@ -15,14 +15,14 @@ def log_values(min_step = -4, counts_per_step = 4): ...@@ -15,14 +15,14 @@ def log_values(min_step = -4, counts_per_step = 4):
Parameters: Parameters:
min_step (:obj:`int`, optional): The power of 10 that will be the minimum value. min_step (:py:class:`int`, optional): The power of 10 that will be the
E.g., the default ``-4`` will result in the first number to be minimum value. E.g., the default ``-4`` will result in the first number
:math:`10^{-4}` = ``0.00001`` or ``0.01%`` to be :math:`10^{-4}` = ``0.00001`` or ``0.01%``
counts_per_step (:obj:`int`, optional): The number of values that will be put counts_per_step (:py:class:`int`, optional): The number of values that will
between two adjacent powers of 10. With the default value ``4`` (and be put between two adjacent powers of 10. With the default value ``4``
default values of ``min_step``), we will get ``log_list[0] == 1e-4``, (and default values of ``min_step``), we will get ``log_list[0] ==
``log_list[4] == 1e-3``, ..., ``log_list[16] == 1``. 1e-4``, ``log_list[4] == 1e-3``, ..., ``log_list[16] == 1``.
Returns: Returns:
...@@ -65,15 +65,15 @@ def roc(negatives, positives, npoints=100, CAR=False, **kwargs): ...@@ -65,15 +65,15 @@ def roc(negatives, positives, npoints=100, CAR=False, **kwargs):
"positive" (signal, class) samples of your classifier. See "positive" (signal, class) samples of your classifier. See
(:py:func:`bob.measure.roc`) (:py:func:`bob.measure.roc`)
npoints (:obj:`int`, optional): The number of points for the plot. See npoints (:py:class:`int`, optional): The number of points for the plot. See
(:py:func:`bob.measure.roc`) (:py:func:`bob.measure.roc`)
CAR (:obj:`bool`, optional): If set to ``True``, it will plot the CAR over FAR in CAR (:py:class:`bool`, optional): If set to ``True``, it will plot the CAR
using :py:func:`matplotlib.pyplot.semilogx`, otherwise the FAR over FRR over FAR in using :py:func:`matplotlib.pyplot.semilogx`, otherwise the
linearly using :py:func:`matplotlib.pyplot.plot`. FAR over FRR linearly using :py:func:`matplotlib.pyplot.plot`.
kwargs (:obj:`dict`, optional): Extra plotting parameters, which are passed kwargs (:py:class:`dict`, optional): Extra plotting parameters, which are
directly to :py:func:`matplotlib.pyplot.plot`. passed directly to :py:func:`matplotlib.pyplot.plot`.
Returns: Returns:
...@@ -123,11 +123,11 @@ def roc_for_far(negatives, positives, far_values = log_values(), **kwargs): ...@@ -123,11 +123,11 @@ def roc_for_far(negatives, positives, far_values = log_values(), **kwargs):
"positive" (signal, class) samples of your classifier. See "positive" (signal, class) samples of your classifier. See
(:py:func:`bob.measure.roc`) (:py:func:`bob.measure.roc`)
far_values (:obj:`list`, optional): The values for the FAR, where the CAR should far_values (:py:class:`list`, optional): The values for the FAR, where the
be plotted; each value should be in range [0,1]. CAR should be plotted; each value should be in range [0,1].
kwargs (:obj:`dict`, optional): Extra plotting parameters, which are passed kwargs (:py:class:`dict`, optional): Extra plotting parameters, which are
directly to :py:func:`matplotlib.pyplot.plot`. passed directly to :py:func:`matplotlib.pyplot.plot`.
Returns: Returns:
...@@ -167,16 +167,15 @@ def precision_recall_curve(negatives, positives, npoints=100, **kwargs): ...@@ -167,16 +167,15 @@ def precision_recall_curve(negatives, positives, npoints=100, **kwargs):
"negative" (noise, non-class) samples of your classifier. See "negative" (noise, non-class) samples of your classifier. See
(:py:func:`bob.measure.precision_recall_curve`) (:py:func:`bob.measure.precision_recall_curve`)
positives (array): 1D float array that contains the scores of the positives (array): 1D float array that contains the scores of the
"positive" (signal, class) samples of your classifier. See "positive" (signal, class) samples of your classifier. See
(:py:func:`bob.measure.precision_recall_curve`) (:py:func:`bob.measure.precision_recall_curve`)
npoints (:obj:`int`, optional): The number of points for the plot. See npoints (:py:class:`int`, optional): The number of points for the plot. See
(:py:func:`bob.measure.precision_recall_curve`) (:py:func:`bob.measure.precision_recall_curve`)
kwargs (:obj:`dict`, optional): Extra plotting parameters, which are passed kwargs (:py:class:`dict`, optional): Extra plotting parameters, which are
directly to :py:func:`matplotlib.pyplot.plot`. passed directly to :py:func:`matplotlib.pyplot.plot`.
Returns: Returns:
...@@ -225,7 +224,6 @@ def epc(dev_negatives, dev_positives, test_negatives, test_positives, ...@@ -225,7 +224,6 @@ def epc(dev_negatives, dev_positives, test_negatives, test_positives,
"negative" (noise, non-class) samples of your classifier, from the "negative" (noise, non-class) samples of your classifier, from the
development set. See (:py:func:`bob.measure.epc`) development set. See (:py:func:`bob.measure.epc`)
dev_positives (array): 1D float array that contains the scores of the dev_positives (array): 1D float array that contains the scores of the
"positive" (signal, class) samples of your classifier, from the "positive" (signal, class) samples of your classifier, from the
development set. See (:py:func:`bob.measure.epc`) development set. See (:py:func:`bob.measure.epc`)
...@@ -238,11 +236,11 @@ def epc(dev_negatives, dev_positives, test_negatives, test_positives, ...@@ -238,11 +236,11 @@ def epc(dev_negatives, dev_positives, test_negatives, test_positives,
"positive" (signal, class) samples of your classifier, from the test set. "positive" (signal, class) samples of your classifier, from the test set.
See (:py:func:`bob.measure.epc`) See (:py:func:`bob.measure.epc`)
npoints (:obj:`int`, optional): The number of points for the plot. See npoints (:py:class:`int`, optional): The number of points for the plot. See
(:py:func:`bob.measure.epc`) (:py:func:`bob.measure.epc`)
kwargs (:obj:`dict`, optional): Extra plotting parameters, which are passed kwargs (:py:class:`dict`, optional): Extra plotting parameters, which are
directly to :py:func:`matplotlib.pyplot.plot`. passed directly to :py:func:`matplotlib.pyplot.plot`.
Returns: Returns:
...@@ -327,14 +325,14 @@ def det(negatives, positives, npoints=100, axisfontsize='x-small', **kwargs): ...@@ -327,14 +325,14 @@ def det(negatives, positives, npoints=100, axisfontsize='x-small', **kwargs):
"positive" (signal, class) samples of your classifier. See "positive" (signal, class) samples of your classifier. See
(:py:func:`bob.measure.det`) (:py:func:`bob.measure.det`)
npoints (:obj:`int`, optional): The number of points for the plot. See npoints (:py:class:`int`, optional): The number of points for the plot. See
(:py:func:`bob.measure.det`) (:py:func:`bob.measure.det`)
axisfontsize (:obj:`str`, optional): The size to be used by x/y-tick-labels to set axisfontsize (:py:class:`str`, optional): The size to be used by
the font size on the axis x/y-tick-labels to set the font size on the axis
kwargs (:obj:`dict`, optional): Extra plotting parameters, which are passed kwargs (:py:class:`dict`, optional): Extra plotting parameters, which are
directly to :py:func:`matplotlib.pyplot.plot`. passed directly to :py:func:`matplotlib.pyplot.plot`.
Returns: Returns:
...@@ -399,14 +397,14 @@ def det_axis(v, **kwargs): ...@@ -399,14 +397,14 @@ def det_axis(v, **kwargs):
Parameters: Parameters:
v (list, tuple): A sequence contaiing the X and Y limits in the order v (:py:class:`list`, :py:class:`tuple`): A sequence contaiing the X and Y
``(xmin, xmax, ymin, ymax)``. Expected values should be in percentage limits in the order ``(xmin, xmax, ymin, ymax)``. Expected values should
(between 0 and 100%). If ``v`` is not a list or tuple that contains 4 be in percentage (between 0 and 100%). If ``v`` is not a list or tuple
numbers it is passed without further inspection to that contains 4 numbers it is passed without further inspection to
:py:func:`matplotlib.pyplot.axis`. :py:func:`matplotlib.pyplot.axis`.
kwargs (:obj:`dict`, optional): Extra plotting parameters, which are passed kwargs (:py:class:`dict`, optional): Extra plotting parameters, which are
directly to :py:func:`matplotlib.pyplot.axis`. passed directly to :py:func:`matplotlib.pyplot.axis`.
Returns: Returns:
...@@ -465,12 +463,12 @@ def cmc(cmc_scores, logx = True, **kwargs): ...@@ -465,12 +463,12 @@ def cmc(cmc_scores, logx = True, **kwargs):
cmc_scores (array): 1D float array containing the CMC values (See cmc_scores (array): 1D float array containing the CMC values (See
:py:func:`bob.measure.cmc`) :py:func:`bob.measure.cmc`)
logx (:obj:`bool`, optional): If set (the default), plots the rank axis in logx (:py:class:`bool`, optional): If set (the default), plots the rank
logarithmic scale using :py:func:`matplotlib.pyplot.semilogx` or in axis in logarithmic scale using :py:func:`matplotlib.pyplot.semilogx` or
linear scale using :py:func:`matplotlib.pyplot.plot` in linear scale using :py:func:`matplotlib.pyplot.plot`
kwargs (:obj:`dict`, optional): Extra plotting parameters, which are passed kwargs (:py:class:`dict`, optional): Extra plotting parameters, which are
directly to :py:func:`matplotlib.pyplot.plot`. passed directly to :py:func:`matplotlib.pyplot.plot`.
Returns: Returns:
...@@ -515,17 +513,18 @@ def detection_identification_curve(cmc_scores, far_values = log_values(), rank ...@@ -515,17 +513,18 @@ def detection_identification_curve(cmc_scores, far_values = log_values(), rank
cmc_scores (array): 1D float array containing the CMC values (See cmc_scores (array): 1D float array containing the CMC values (See
:py:func:`bob.measure.cmc`) :py:func:`bob.measure.cmc`)
rank (:obj:`int`, optional): The rank for which the curve should be plotted rank (:py:class:`int`, optional): The rank for which the curve should be
plotted
far_values (:obj:`list`, optional): The values for the FAR, where the CAR should far_values (:py:class:`list`, optional): The values for the FAR, where the
be plotted; each value should be in range [0,1]. CAR should be plotted; each value should be in range [0,1].
logx (:obj:`bool`, optional): If set (the default), plots the rank axis in logx (:py:class:`bool`, optional): If set (the default), plots the rank
logarithmic scale using :py:func:`matplotlib.pyplot.semilogx` or in axis in logarithmic scale using :py:func:`matplotlib.pyplot.semilogx` or
linear scale using :py:func:`matplotlib.pyplot.plot` in linear scale using :py:func:`matplotlib.pyplot.plot`
kwargs (:obj:`dict`, optional): Extra plotting parameters, which are passed kwargs (:py:class:`dict`, optional): Extra plotting parameters, which are
directly to :py:func:`matplotlib.pyplot.plot`. passed directly to :py:func:`matplotlib.pyplot.plot`.
Returns: Returns:
......
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