From fc2d48fa30ffa3766cb16108adb6f37e575244f6 Mon Sep 17 00:00:00 2001 From: Michael Osthege <m.osthege@fz-juelich.de> Date: Sun, 13 Oct 2024 15:47:23 +0200 Subject: [PATCH 1/2] Fix formatting of license and module docstrings --- peak_performance/models.py | 27 ++++++++++++++------------- peak_performance/pipeline.py | 27 ++++++++++++++------------- peak_performance/plots.py | 27 ++++++++++++++------------- 3 files changed, 42 insertions(+), 39 deletions(-) diff --git a/peak_performance/models.py b/peak_performance/models.py index c2ff2af..91a3a20 100644 --- a/peak_performance/models.py +++ b/peak_performance/models.py @@ -1,19 +1,20 @@ -""" -PeakPerformance -Copyright (C) 2023 Forschungszentrum Jülich GmbH +# PeakPerformance +# Copyright (C) 2023 Forschungszentrum Jülich GmbH -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published -by the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Affero General Public License for more details. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <https://www.gnu.org/licenses/>. +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. +""" +This module contains functions for creating various kinds of peak models and to make initial guesses for their parameters. """ from enum import Enum diff --git a/peak_performance/pipeline.py b/peak_performance/pipeline.py index 7224602..d13b021 100644 --- a/peak_performance/pipeline.py +++ b/peak_performance/pipeline.py @@ -1,19 +1,20 @@ -""" -PeakPerformance -Copyright (C) 2023 Forschungszentrum Jülich GmbH +# PeakPerformance +# Copyright (C) 2023 Forschungszentrum Jülich GmbH -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published -by the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Affero General Public License for more details. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <https://www.gnu.org/licenses/>. +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. +""" +Defines steps for a pipeline to process LC-MS-MS data. """ import importlib diff --git a/peak_performance/plots.py b/peak_performance/plots.py index ad69308..b5928ca 100644 --- a/peak_performance/plots.py +++ b/peak_performance/plots.py @@ -1,19 +1,20 @@ -""" -PeakPerformance -Copyright (C) 2023 Forschungszentrum Jülich GmbH +# PeakPerformance +# Copyright (C) 2023 Forschungszentrum Jülich GmbH -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published -by the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Affero General Public License for more details. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see <https://www.gnu.org/licenses/>. +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. +""" +Functions for preparing diagnostic and QC plots. """ import os From ce3eafcb76286f21bc486af7f7714d3d0579d59e Mon Sep 17 00:00:00 2001 From: Michael Osthege <m.osthege@fz-juelich.de> Date: Sun, 13 Oct 2024 16:10:47 +0200 Subject: [PATCH 2/2] Fix various documentation glitches / warnings --- docs/source/conf.py | 2 +- peak_performance/models.py | 16 +++++++++++----- peak_performance/pipeline.py | 12 ++++++------ 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 47f6c77..61517a8 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -73,4 +73,4 @@ # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ["_static"] +html_static_path: List[str] = [] diff --git a/peak_performance/models.py b/peak_performance/models.py index 91a3a20..9a9532f 100644 --- a/peak_performance/models.py +++ b/peak_performance/models.py @@ -29,12 +29,19 @@ class ModelType(str, Enum): - """Class containing all implemented model types.""" + """Enum of default model types.""" Normal = "normal" + """Shape of a Gaussian Normal PDF.""" + SkewNormal = "skew_normal" + """Shape of a skewed Normal PDF.""" + DoubleNormal = "double_normal" + """Superposition of two ``Normal`` peaks.""" + DoubleSkewNormal = "double_skew_normal" + """Superposition of two ``SkewedNormal`` peaks.""" def guess_noise(intensity): @@ -393,10 +400,9 @@ def std_skew_calculation(scale, alpha): Skewness parameter of the skew normal distribution. Returns - ---------- + ------- std Standard deviation of a skew normal distribution. - ------- """ return np.sqrt(scale**2 * (1 - (2 * alpha**2) / ((alpha**2 + 1) * np.pi))) @@ -415,7 +421,7 @@ def mean_skew_calculation(loc, scale, alpha): Skewness parameter of the skew normal distribution. Returns - ---------- + ------- mean Arithmetic mean of a skew normal distribution. """ @@ -489,7 +495,7 @@ def height_calculation(area, loc, scale, alpha, mode_skew): Mode of the skew normal distribution. Returns - ---------- + ------- mean Arithmetic mean of a skew normal distribution. """ diff --git a/peak_performance/pipeline.py b/peak_performance/pipeline.py index d13b021..bfa9cb3 100644 --- a/peak_performance/pipeline.py +++ b/peak_performance/pipeline.py @@ -1187,7 +1187,7 @@ def pipeline( Data format (suffix) of the raw data, default is '.npy'. Returns - ---------- + ------- path_results Path variable pointing to the newly created folder for this batch. """ @@ -1224,7 +1224,7 @@ def pipeline_restart( Path variable pointing to the directory of the broken PeakPerformance batch Returns - ---------- + ------- path_results_new Path variable pointing to the newly created folder for the restarted batch. """ @@ -1323,7 +1323,7 @@ def parse_files_for_model_selection(signals: pandas.DataFrame) -> Dict[str, str] DataFrame containing the signals tab of Template.xlsx. Returns - ---------- + ------- files_for_selection Dict with file names as keys and unique identifiers as values. """ @@ -1430,7 +1430,7 @@ def model_selection_check( to be accepted. Returns - ---------- + ------- selected_model Name of the selected model type. """ @@ -1473,7 +1473,7 @@ def selection_loop( "waic": widely applicable information criterion) Returns - ---------- + ------- result_df DataFrame containing the ranking and scores of the model selection. model_dict @@ -1565,7 +1565,7 @@ def model_selection(path_raw_data: Union[str, os.PathLike], *, ic: str = "loo"): "waic": widely applicable information criterion) Returns - ---------- + ------- comparison_results DataFrame containing all rankings from model selection. model_dict