From c61e4b7ad2d82f612942e261ca28419e78b83b87 Mon Sep 17 00:00:00 2001 From: Loann Peurey Date: Tue, 27 Feb 2024 13:39:21 +0100 Subject: [PATCH] fix minor documentation issues --- ChildProject/annotations.py | 2 +- ChildProject/pipelines/metricsFunctions.py | 4 ++-- ChildProject/utils.py | 17 ++++++++--------- docs/source/ChildProject.pipelines.rst | 3 +-- docs/source/format.rst | 10 ++-------- 5 files changed, 14 insertions(+), 22 deletions(-) diff --git a/ChildProject/annotations.py b/ChildProject/annotations.py index 76c642a6b..ed4657634 100644 --- a/ChildProject/annotations.py +++ b/ChildProject/annotations.py @@ -71,7 +71,7 @@ class AnnotationManager: ), IndexColumn( name="annotation_filename", - description="output formatted annotation location, relative to `annotations//converted (automatic column, don't specify)", + description="output formatted annotation location, relative to `annotations//converted` (automatic column, don't specify)", filename=True, required=False, generated=True, diff --git a/ChildProject/pipelines/metricsFunctions.py b/ChildProject/pipelines/metricsFunctions.py index 2ef2062e3..a15f3fd1c 100644 --- a/ChildProject/pipelines/metricsFunctions.py +++ b/ChildProject/pipelines/metricsFunctions.py @@ -141,7 +141,7 @@ def new_func(annotations: pd.DataFrame, duration: int, **kwargs): return np.nan # wraps will give the same name and doc, so we need to slightly edit them for the peak function - new_func.__doc__ = "Computing the peak for 1h for the following metric:\n" + function.__doc__ + new_func.__doc__ = "Computing the peak for 1h for the following metric:\n\n" + function.__doc__ new_func.__name__ = "peak_" + function.__name__ new_func.__qualname__ = "peak_" + function.__qualname__ return new_func @@ -160,7 +160,7 @@ def new_func(annotations: pd.DataFrame, duration: int, **kwargs): return function(annotations, duration, **kwargs) * (3600000 / duration) # wraps will give the same name and doc, so we need to slightly edit them for the peak function - new_func.__doc__ = function.__doc__ + "This value is a 'per hour' value." + new_func.__doc__ = function.__doc__ + "\nThis value is a 'per hour' value." new_func.__name__ = function.__name__ + '_ph' new_func.__qualname__ = function.__qualname__ + '_ph' return new_func diff --git a/ChildProject/utils.py b/ChildProject/utils.py index 4da1eadef..53de71545 100644 --- a/ChildProject/utils.py +++ b/ChildProject/utils.py @@ -203,18 +203,17 @@ def calculate_shift(file1, file2, start1, start2, interval): return res,len(ref) def find_lines_involved_in_overlap(df: pd.DataFrame, onset_label: str = 'range_onset', offset_label:str = 'range_offset', labels = []): - """ - takes a dataframe as input. The dataframe is supposed to have a column for the onset + """takes a dataframe as input. The dataframe is supposed to have a column for the onset og a timeline and one for the offset. The function returns a boolean series where all indexes having 'True' are lines involved in overlaps and 'False' when not e.g. to select all lines involved in overlaps, use: - ``` - ovl_segments = df[find_lines_involved_in_overlap(df, 'segment_onset', 'segment_offset')] - ``` - and to select line that never overlap, use: - ``` - ovl_segments = df[~find_lines_involved_in_overlap(df, 'segment_onset', 'segment_offset')] - ``` + ``` + ovl_segments = df[find_lines_involved_in_overlap(df, 'segment_onset', 'segment_offset')] + ``` + and to select line that never overlap, use: + ``` + ovl_segments = df[~find_lines_involved_in_overlap(df, 'segment_onset', 'segment_offset')] + ``` :param df: pandas DataFrame where we want to find overlaps, having some time segments described by 2 columns (onset and offset) :type df: pd.DataFrame diff --git a/docs/source/ChildProject.pipelines.rst b/docs/source/ChildProject.pipelines.rst index 87d1959c2..15fda917b 100644 --- a/docs/source/ChildProject.pipelines.rst +++ b/docs/source/ChildProject.pipelines.rst @@ -21,7 +21,7 @@ ChildProject.pipelines.eafbuilder module :show-inheritance: ChildProject.pipelines.metrics module --------------------------------------- +------------------------------------- .. automodule:: ChildProject.pipelines.metrics :members: @@ -51,7 +51,6 @@ ChildProject.pipelines.processors module :members: :undoc-members: :show-inheritance: - ChildProject.pipelines.samplers module -------------------------------------- diff --git a/docs/source/format.rst b/docs/source/format.rst index 9a8818b0e..858c9fe23 100644 --- a/docs/source/format.rst +++ b/docs/source/format.rst @@ -131,7 +131,7 @@ in a separate file. For recursive metadata, two dataframes cannot share the same basename. For instance, if one dataframe is located at `metadata/children/dates-of-birth.csv` , an error will be thrown if another dataframe exists at - `metadata/children/private/dates-of-birth.csv ` . + `metadata/children/private/dates-of-birth.csv` . Annotations ----------- @@ -200,9 +200,6 @@ These humans have both annotated the same seven 15 second clips. eaf_2021/LM,A730/A730_001105.wav,0,36465000,36480000,A730_001105.eaf,eaf,A730/A730_001105_36465000_36480000.csv eaf_2021/LM,A730/A730_001105.wav,0,39450000,39465000,A730_001105.eaf,eaf,A730/A730_001105_39450000_39465000.csv -.. comment:: - This comment fixes an issue introduced in Sphinx 4.3.1 - .. _format-input-annotations: Annotation importation input format @@ -246,9 +243,6 @@ to the following table: .. index-table:: Machine-readable documentation :header: documentation -.. comment:: - This comment fixes an issue introduced in Sphinx 4.3.1 - - Documentation for the children metadata should be stored in ``docs/children.csv`` - Documentation for the recordings metadata should be stored in ``docs/recordings.csv`` - Documentation for annotations should be stored in ``docs/annotations.csv`` @@ -256,5 +250,5 @@ to the following table: Authorship ~~~~~~~~~~ -We recommend DataCite's .yaml format (see `here `_) +We recommend DataCite's .yaml format (see `here `__)