From fbf9683ce82abd78d632e46a80bce5d892c1d6e7 Mon Sep 17 00:00:00 2001 From: Anselm Hahn Date: Sat, 25 Dec 2021 14:24:53 +0100 Subject: [PATCH] Fixed: #169 -> minimalistic printout for terminal --- .github/dependabot.yml | 1 - .github/workflows/codeql-analysis.yml | 58 +++++++++---------- .github/workflows/python-ci.yml | 14 ++--- .gitlab-ci.yml | 4 +- .gitlab/.gitlab-webide.yml | 3 +- .pre-commit-config.yaml | 2 +- CHANGELOG.md | 23 ++++++-- Examples/example_1_summary.json | 2 +- Examples/example_2.json | 2 +- Examples/example_2_summary.json | 2 +- Examples/example_3.json | 2 +- Examples/example_3_summary.json | 2 +- Examples/example_5.json | 2 +- Examples/example_5_summary.json | 2 +- Examples/example_6.json | 2 +- Examples/example_6_summary.json | 2 +- Examples/example_7.json | 2 +- Examples/example_7_summary.json | 2 +- README.md | 6 +- SECURITY.md | 3 +- docs/doc/fitting.md | 6 +- docs/examples/example3.md | 2 +- docs/examples/example4.md | 10 ++-- docs/examples/example6.md | 2 +- docs/examples/example7.md | 5 +- docs/interface/features.md | 18 +++--- docs/interface/usage.md | 25 ++++---- spectrafit/report.py | 4 +- spectrafit/spectrafit.py | 13 +++-- spectrafit/test/scripts/fitting_input.toml | 4 +- spectrafit/test/scripts/fitting_input.yaml | 4 +- spectrafit/test/scripts/test_globalfit.json | 2 +- spectrafit/test/scripts/test_input_1.json | 4 +- spectrafit/test/scripts/test_input_10.json | 4 +- spectrafit/test/scripts/test_input_11.json | 4 +- spectrafit/test/scripts/test_input_2.json | 4 +- spectrafit/test/scripts/test_input_3.json | 2 +- spectrafit/test/scripts/test_input_3.toml | 2 +- spectrafit/test/scripts/test_input_3.yaml | 2 +- spectrafit/test/scripts/test_input_3.yml | 2 +- spectrafit/test/scripts/test_input_4.json | 2 +- spectrafit/test/scripts/test_input_6.json | 4 +- spectrafit/test/scripts/test_input_7.json | 4 +- spectrafit/test/scripts/test_input_8.json | 4 +- spectrafit/test/scripts/test_input_9.json | 4 +- .../test/scripts/test_input_all_models.toml | 2 +- .../test/scripts/test_input_global.json | 4 +- .../test/scripts/test_input_global_0.json | 2 +- .../test/scripts/test_input_global_1.json | 2 +- .../scripts/test_missing_parameter_1.json | 4 +- .../scripts/test_missing_parameter_2.json | 4 +- .../scripts/test_missing_parameters_1.json | 4 +- .../scripts/test_missing_parameters_2.json | 4 +- 53 files changed, 153 insertions(+), 146 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 35cfb1e43..c51a1e404 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -2,7 +2,6 @@ version: 2 updates: - # Maintain dependencies for GitHub Actions - package-ecosystem: "github-actions" directory: "/" diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 8858741c5..36c586a7a 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -13,12 +13,12 @@ name: "CodeQL" on: push: - branches: [ main ] + branches: [main] pull_request: # The branches below must be a subset of the branches above - branches: [ main ] + branches: [main] schedule: - - cron: '33 9 * * 0' + - cron: "33 9 * * 0" jobs: analyze: @@ -32,40 +32,40 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'python' ] + language: ["python"] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] # Learn more: # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed steps: - - name: Checkout repository - uses: actions/checkout@v2 + - name: Checkout repository + uses: actions/checkout@v2 - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v1 + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v1 - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl - # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language + # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language - #- run: | - # make bootstrap - # make release + #- run: | + # make bootstrap + # make release - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml index 37105a4c1..69ee9ae15 100644 --- a/.github/workflows/python-ci.yml +++ b/.github/workflows/python-ci.yml @@ -82,13 +82,13 @@ jobs: needs: build runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v2 - with: - # Make sure the actual branch is checked out when running on pull requests - ref: ${{ github.head_ref }} - # This is important to fetch the changes to the previous commit - fetch-depth: 0 + - name: Checkout + uses: actions/checkout@v2 + with: + # Make sure the actual branch is checked out when running on pull requests + ref: ${{ github.head_ref }} + # This is important to fetch the changes to the previous commit + fetch-depth: 0 # - name: Prettify code # uses: creyD/prettier_action@v4.1 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8a03c4f4e..4843b42f7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -23,7 +23,7 @@ cache: - venv/ before_script: - - python -V # Print out python version for debugging + - python -V # Print out python version for debugging - pip install virtualenv - virtualenv venv - source venv/bin/activate @@ -31,7 +31,7 @@ before_script: test: script: - python setup.py test - - pip install tox flake8 # you can also use tox + - pip install tox flake8 # you can also use tox - tox -e py36,flake8 run: diff --git a/.gitlab/.gitlab-webide.yml b/.gitlab/.gitlab-webide.yml index 506c3cf3a..5e074d8c3 100644 --- a/.gitlab/.gitlab-webide.yml +++ b/.gitlab/.gitlab-webide.yml @@ -6,7 +6,8 @@ terminal: - name: registry.gitlab.com/gitlab-org/webide-file-sync:latest alias: webide-file-sync entrypoint: ["/bin/sh"] - command: ["-c", "sleep 5 && ./webide-file-sync -project-dir $CI_PROJECT_DIR"] + command: + ["-c", "sleep 5 && ./webide-file-sync -project-dir $CI_PROJECT_DIR"] ports: # The `webide-file-sync` executable defaults to port 3000. - number: 3000 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 808a0d2ae..1c4230fb9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,7 +12,7 @@ repos: - id: check-ast - id: check-merge-conflict - id: check-added-large-files - args: ['--maxkb=1000'] + args: ["--maxkb=1000"] - repo: https://github.com/psf/black.git rev: 21.12b0 hooks: diff --git a/CHANGELOG.md b/CHANGELOG.md index 20ebce798..c5981e9c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,23 @@ > See also: [https://github.com/Anselmoo/spectrafit/releases][1] +## v 0.8.0 + +--- + +- Introduced smaller enhancement: + - Printout of the fit parameters in the output file: True/False -> [0, 1, 2] + - Keyword check for `SpectraFit` +- Fix smaller bugs: + - `Pseudo-Voigt` power factor from 0.25 -> 0.2 + - Correct type-definitions for `SpectraFit` + +## v0.7.1 + +--- + +- Maintance of the `SpectraFit` package + ## v0.7.0 --- @@ -150,11 +167,9 @@ [8]: https://github.com/Anselmoo/spectrafit/security [9]: https://dependabot.com [10]: https://securitylab.github.com/tools/codeql/ -[11]: - https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository +[11]: https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository [12]: https://git-lfs.github.com [13]: https://github.com/apps/stale [14]: https://github.com/Anselmoo/spectrafit/blob/main/README.md [15]: https://pypi.org/project/spectrafit/ -[16]: - https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.find_peaks.html +[16]: https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.find_peaks.html diff --git a/Examples/example_1_summary.json b/Examples/example_1_summary.json index 3a772a9c7..ebde31e76 100644 --- a/Examples/example_1_summary.json +++ b/Examples/example_1_summary.json @@ -13,7 +13,7 @@ "header": null, "noplot": false, "version": false, - "verbose": false, + "verbose": 1, "description": { "project_name": "Example1", "project_details": "Example 1", diff --git a/Examples/example_2.json b/Examples/example_2.json index ab7083e24..2ed331007 100644 --- a/Examples/example_2.json +++ b/Examples/example_2.json @@ -11,7 +11,7 @@ "separator": "\t", "shift": 0, "smooth": 0, - "verbose": false, + "verbose": 1, "version": false }, "fitting": { diff --git a/Examples/example_2_summary.json b/Examples/example_2_summary.json index 6c22c70a8..32fe7ff48 100644 --- a/Examples/example_2_summary.json +++ b/Examples/example_2_summary.json @@ -13,7 +13,7 @@ "header": null, "noplot": false, "version": false, - "verbose": false, + "verbose": 1, "description": { "project_name": "Template", "project_details": "Template for testing", diff --git a/Examples/example_3.json b/Examples/example_3.json index 880313ff8..88663ceef 100644 --- a/Examples/example_3.json +++ b/Examples/example_3.json @@ -11,7 +11,7 @@ "separator": ",", "shift": 0, "smooth": 0, - "verbose": false, + "verbose": 1, "version": false }, "fitting": { diff --git a/Examples/example_3_summary.json b/Examples/example_3_summary.json index e644aa3d2..16b9833b8 100644 --- a/Examples/example_3_summary.json +++ b/Examples/example_3_summary.json @@ -13,7 +13,7 @@ "header": 0, "noplot": false, "version": false, - "verbose": false, + "verbose": 1, "description": { "project_name": "Template", "project_details": "Template for testing", diff --git a/Examples/example_5.json b/Examples/example_5.json index 58ac3338e..7d46a10ba 100644 --- a/Examples/example_5.json +++ b/Examples/example_5.json @@ -11,7 +11,7 @@ "separator": ",", "shift": 0, "smooth": 0, - "verbose": false, + "verbose": 1, "version": false }, "fitting": { diff --git a/Examples/example_5_summary.json b/Examples/example_5_summary.json index f2dd05a38..474ff8430 100644 --- a/Examples/example_5_summary.json +++ b/Examples/example_5_summary.json @@ -13,7 +13,7 @@ "header": 0, "noplot": false, "version": false, - "verbose": false, + "verbose": 1, "description": { "project_name": "Template", "project_details": "Template for testing", diff --git a/Examples/example_6.json b/Examples/example_6.json index dca5270fc..16c2b1fda 100644 --- a/Examples/example_6.json +++ b/Examples/example_6.json @@ -9,7 +9,7 @@ "separator": ",", "shift": 0.2, "smooth": false, - "verbose": false, + "verbose": 1, "version": false, "noplot": false, "global": 1 diff --git a/Examples/example_6_summary.json b/Examples/example_6_summary.json index cb5b93f65..6644c5fff 100644 --- a/Examples/example_6_summary.json +++ b/Examples/example_6_summary.json @@ -13,7 +13,7 @@ "header": 0, "noplot": false, "version": false, - "verbose": false, + "verbose": 1, "global": 1, "description": { "project_name": "Template", diff --git a/Examples/example_7.json b/Examples/example_7.json index 62cbe0749..9ae8116a5 100644 --- a/Examples/example_7.json +++ b/Examples/example_7.json @@ -20,7 +20,7 @@ "width": [0.002, 12], "wlen": 100 }, - "verbose": false, + "verbose": 1, "version": false }, "fitting": { diff --git a/Examples/example_7_summary.json b/Examples/example_7_summary.json index 39e2c3a9b..4639210b9 100644 --- a/Examples/example_7_summary.json +++ b/Examples/example_7_summary.json @@ -23,7 +23,7 @@ }, "noplot": false, "version": false, - "verbose": false, + "verbose": 1, "description": { "project_name": "Template", "project_details": "Template for testing", diff --git a/README.md b/README.md index d7e0caf3e..a79db9f83 100644 --- a/README.md +++ b/README.md @@ -127,8 +127,10 @@ optional arguments: for manual peak definition. -np, --noplot No plotting the spectra and the fit of `SpectraFit`. -v, --version Display the current version of `SpectraFit`. - -vb, --verbose Display the initial configuration parameters as a - dictionary. + -vb, --verbose Display the initial configuration parameters and fit + results, as a table '1', as a dictionary '2', or not in + the terminal '0'. The default option is set to 1 for + table `printout`. ``` ## Documentation diff --git a/SECURITY.md b/SECURITY.md index a0102fc79..49f9d845e 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -25,5 +25,4 @@ Tell them where to go, how often they can expect to get an update on a reported vulnerability, what to expect if the vulnerability is accepted or declined, etc. [1]: https://securitylab.github.com/tools/codeql/ -[2]: - https://github.com/Anselmoo/spectrafit/blob/main/.github/workflows/codeql-analysis.yml +[2]: https://github.com/Anselmoo/spectrafit/blob/main/.github/workflows/codeql-analysis.yml diff --git a/docs/doc/fitting.md b/docs/doc/fitting.md index fd8fe99b6..eef803772 100644 --- a/docs/doc/fitting.md +++ b/docs/doc/fitting.md @@ -55,9 +55,7 @@ result = mini.minimize(**args["optimizer"]) this [SciPy implementation][4] is implemented in `SpectraFit` and can be used by setting the `minimizer` parameter to `"differential_evolution"`. -[1]: - https://lmfit.github.io/lmfit-py/fitting.html?highlight=minimizer#lmfit.minimizer.Minimizer +[1]: https://lmfit.github.io/lmfit-py/fitting.html?highlight=minimizer#lmfit.minimizer.Minimizer [2]: https://lmfit.github.io/lmfit-py/fitting.html?highlight=minimize [3]: https://en.wikipedia.org/wiki/Differential_evolution -[4]: - https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.differential_evolution.html +[4]: https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.differential_evolution.html diff --git a/docs/examples/example3.md b/docs/examples/example3.md index 85e527ea4..6dc686322 100644 --- a/docs/examples/example3.md +++ b/docs/examples/example3.md @@ -60,7 +60,7 @@ also printed in the terminal output: "separator": "\t", "shift": 0, "smooth": 0, - "verbose": false, + "verbose": 1, "version": false }, "fitting": { diff --git a/docs/examples/example4.md b/docs/examples/example4.md index 9ee3b2511..d7c12a852 100644 --- a/docs/examples/example4.md +++ b/docs/examples/example4.md @@ -638,7 +638,7 @@ following changes between previous "separator": "\t", "shift": 0, "smooth": 0, - "verbose": false, + "verbose": 1, "version": false }, ``` @@ -659,7 +659,7 @@ and actually "separator": ",", "shift": 0.2, "smooth": 4, - "verbose": true, + "verbose": 2, "version": false, "noplot": true }, @@ -680,8 +680,6 @@ spectrafit _ -i example_3.json > Elastic-line of a pseudo 2p3d-RIXS spectra. -[1]: - https://numpy.org/doc/stable/reference/random/generated/numpy.random.random.html -[2]: - https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html +[1]: https://numpy.org/doc/stable/reference/random/generated/numpy.random.random.html +[2]: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html [3]: ../../examples/example3/ diff --git a/docs/examples/example6.md b/docs/examples/example6.md index 6cd85d87d..72c6ff093 100644 --- a/docs/examples/example6.md +++ b/docs/examples/example6.md @@ -137,7 +137,7 @@ based on the `lmfit` approach for [Fit Multiple Data Sets][2]. In this case of "separator": ",", "shift": 0.2, "smooth": false, - "verbose": false, + "verbose": 1, "version": false, "noplot": false, "global": 1 diff --git a/docs/examples/example7.md b/docs/examples/example7.md index 39f9cb489..8d61d6ad5 100644 --- a/docs/examples/example7.md +++ b/docs/examples/example7.md @@ -30,7 +30,7 @@ In the following example the in example the section block looks like: "width": [0.002, 12], "wlen": 100 }, - "verbose": false, + "verbose": 1, "version": false } } @@ -347,6 +347,5 @@ in the figure shown below. }, ``` -[1]: - https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.find_peaks.html +[1]: https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.find_peaks.html [2]: ../../interface/usage/ diff --git a/docs/interface/features.md b/docs/interface/features.md index 36526e2bb..cdd289d41 100644 --- a/docs/interface/features.md +++ b/docs/interface/features.md @@ -205,7 +205,7 @@ different types of output files will be generated "header": null, "noplot": true, "version": false, - "verbose": false, + "verbose": 1, ``` 2. The project-specific meta-data. @@ -332,7 +332,7 @@ different types of output files will be generated "header": null, "noplot": true, "version": false, - "verbose": false, + "verbose": 1, "description": { "project_name": "Template", "project_details": "Template for testing", @@ -360,7 +360,7 @@ different types of output files will be generated "sigmas": null, "trace": false, "maxiter": 200, - "verbose": false, + "verbose": 1, "prob_func": null }, "peaks": { @@ -2478,10 +2478,8 @@ different types of output files will be generated ``` [1]: https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.describe.html -[2]: - ../../api/spectrafit_api/#spectrafit.spectrafit.extracted_from_command_line_runner -[3]: - https://lmfit.github.io/lmfit-py/model.html?highlight=report#lmfit.model.ModelResult.fit_report +[2]: ../../api/spectrafit_api/#spectrafit.spectrafit.extracted_from_command_line_runner +[3]: https://lmfit.github.io/lmfit-py/model.html?highlight=report#lmfit.model.ModelResult.fit_report [4]: https://en.wikipedia.org/wiki/Akaike_information_criterion [5]: https://en.wikipedia.org/wiki/Bayesian_information_criterion [6]: /spectrafit/interface/features/#fit-statistic @@ -2490,12 +2488,10 @@ different types of output files will be generated [9]: https://lmfit.github.io/lmfit-py/fitting.html?highlight=correlation [10]: https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.corr.html [11]: https://en.wikipedia.org/wiki/Confidence_interval -[12]: - https://lmfit.github.io/lmfit-py/examples/example_confidence_interval.html?highlight=confidence +[12]: https://lmfit.github.io/lmfit-py/examples/example_confidence_interval.html?highlight=confidence [13]: ../../api/plotting_api/ [14]: /spectrafit/interface/features/#correlation-analysis -[15]: - https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.from_dict.html +[15]: https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.from_dict.html [16]: /spectrafit/interface/features/#pre-analysis [17]: https://en.wikipedia.org/wiki/Correlation [18]: https://docs.python.org/3/library/socket.html diff --git a/docs/interface/usage.md b/docs/interface/usage.md index ece8adf2e..55b1787db 100644 --- a/docs/interface/usage.md +++ b/docs/interface/usage.md @@ -132,7 +132,7 @@ Define the settings in the input file as shown below: "separator": "\t", "shift": 0, "smooth": 0, -"verbose": false, +"verbose": 1, "version": false, "noplot": false } @@ -196,7 +196,7 @@ keyword `parameters` as shown below: "sigmas": null, "trace": true, "maxiter": 200, - "verbose": false, + "verbose": 1, "prob_func": null } } @@ -330,7 +330,7 @@ same way like the local fitting model; via Input file "separator": ",", "shift": 0.2, "smooth": false, - "verbose": false, + "verbose": 1, "version": false, "noplot": false, "global": 1, @@ -431,7 +431,7 @@ types. "separator": "\t", "shift": 0, "smooth": 0, - "verbose": false, + "verbose": 1, "version": false }, "fitting": { @@ -455,7 +455,7 @@ types. "sigmas": null, "trace": true, "maxiter": 200, - "verbose": false, + "verbose": 1, "prob_func": null } }, @@ -556,14 +556,11 @@ types. [1]: https://en.wikipedia.org/wiki/Voigt_profile#Pseudo-Voigt_approximation [2]: https://en.wikipedia.org/wiki/Power_law [3]: https://en.wikipedia.org/wiki/Inverse_trigonometric_functions -[4]: - ../../api/spectrafit_api/#spectrafit.spectrafit.extracted_from_command_line_runner -[5]: - https://lmfit.github.io/lmfit-py/fitting.html?highlight=minimizer#module-lmfit.minimizer +[4]: ../../api/spectrafit_api/#spectrafit.spectrafit.extracted_from_command_line_runner +[5]: https://lmfit.github.io/lmfit-py/fitting.html?highlight=minimizer#module-lmfit.minimizer [6]: ../../api/spectrafit_api/#spectrafit.spectrafit.fitting_routine [7]: /spectrafit/interface/usage/#standard-usage -[8]: - https://lmfit.github.io/lmfit-py/fitting.html?highlight=minimizer#module-lmfit.minimizer +[8]: https://lmfit.github.io/lmfit-py/fitting.html?highlight=minimizer#module-lmfit.minimizer [9]: https://lmfit.github.io/lmfit-py/constraints.html [10]: ../../doc/expression [11]: ../../examples/example6 @@ -571,7 +568,5 @@ types. [13]: https://en.wikipedia.org/wiki/Cauchy_distribution [14]: https://en.wikipedia.org/wiki/Voigt_profile [15]: https://en.wikipedia.org/wiki/Voigt_profile#Pseudo-Voigt_approximation -[16]: - https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.find_peaks.html -[17]: - https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html +[16]: https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.find_peaks.html +[17]: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html diff --git a/spectrafit/report.py b/spectrafit/report.py index fab0703ee..086fb087b 100644 --- a/spectrafit/report.py +++ b/spectrafit/report.py @@ -153,9 +153,9 @@ def __init__( def __call__(self) -> None: """Print the results of the fitting process.""" - if self.args["verbose"]: + if self.args["verbose"] == 1: self.printing_verbose_mode - else: + elif self.args["verbose"] == 2: self.printing_regular_mode @property diff --git a/spectrafit/spectrafit.py b/spectrafit/spectrafit.py index fe5621f7e..78ff3b360 100644 --- a/spectrafit/spectrafit.py +++ b/spectrafit/spectrafit.py @@ -143,7 +143,7 @@ def get_args() -> Dict[str, Any]: "--autopeak", help=( "Auto detection of peaks in the spectra based on `SciPy`. The position, " - "height, and width are used as estimation for the `Gaussian` models." + "height, and width are used as estimation for the `Gaussian` models. " "The default option is 'False' for manual peak definition." ), action="store_true", @@ -167,9 +167,14 @@ def get_args() -> Dict[str, Any]: parser.add_argument( "-vb", "--verbose", - help="Display the initial configuration parameters as a dictionary.", - action="store_true", - default=False, + help=( + "Display the initial configuration parameters and fit results, as a table " + "'1', as a dictionary '2', or not in the terminal '0'. The default option " + "is set to 1 for table `printout`." + ), + type=int, + default=1, + choices=[0, 1, 2], ) return vars(parser.parse_args()) diff --git a/spectrafit/test/scripts/fitting_input.toml b/spectrafit/test/scripts/fitting_input.toml index 71e3dacd9..6fff04f6c 100644 --- a/spectrafit/test/scripts/fitting_input.toml +++ b/spectrafit/test/scripts/fitting_input.toml @@ -9,7 +9,7 @@ oversampling = false separator = "\t" shift = 0 smooth = 0 -verbose = false +verbose = 1 version = false [fitting.description] @@ -37,7 +37,7 @@ min_correl = 0 [fitting.parameters.conf_interval] trace = true maxiter = 200 -verbose = false +verbose = 1 [fitting.peaks.1.pseudovoigt.amplitude] max = 2 diff --git a/spectrafit/test/scripts/fitting_input.yaml b/spectrafit/test/scripts/fitting_input.yaml index 0af95e638..590f099c3 100644 --- a/spectrafit/test/scripts/fitting_input.yaml +++ b/spectrafit/test/scripts/fitting_input.yaml @@ -13,7 +13,7 @@ settings: separator: "\t" shift: 0 smooth: 0 - verbose: false + verbose: 1 version: false fitting: description: @@ -39,7 +39,7 @@ fitting: sigmas: trace: true maxiter: 200 - verbose: false + verbose: 1 prob_func: peaks: "1": diff --git a/spectrafit/test/scripts/test_globalfit.json b/spectrafit/test/scripts/test_globalfit.json index 05b2c5acf..ceb3d30e9 100644 --- a/spectrafit/test/scripts/test_globalfit.json +++ b/spectrafit/test/scripts/test_globalfit.json @@ -11,7 +11,7 @@ "separator": "\t", "shift": 0, "smooth": 0, - "verbose": false, + "verbose": 1, "version": false }, "fitting": { diff --git a/spectrafit/test/scripts/test_input_1.json b/spectrafit/test/scripts/test_input_1.json index cba45b128..2d51b5362 100644 --- a/spectrafit/test/scripts/test_input_1.json +++ b/spectrafit/test/scripts/test_input_1.json @@ -11,7 +11,7 @@ "separator": "\t", "shift": 0, "smooth": 0, - "verbose": false, + "verbose": 1, "version": true }, "fitting": { @@ -35,7 +35,7 @@ "sigmas": null, "trace": false, "maxiter": 200, - "verbose": false, + "verbose": 1, "prob_func": null } }, diff --git a/spectrafit/test/scripts/test_input_10.json b/spectrafit/test/scripts/test_input_10.json index 0625a7efb..62afa8210 100644 --- a/spectrafit/test/scripts/test_input_10.json +++ b/spectrafit/test/scripts/test_input_10.json @@ -12,7 +12,7 @@ "shift": 0, "smooth": 0, "autopeak": true, - "verbose": false, + "verbose": 1, "version": false }, "fitting": { @@ -37,7 +37,7 @@ "sigmas": null, "trace": false, "maxiter": 200, - "verbose": false, + "verbose": 1, "prob_func": null } }, diff --git a/spectrafit/test/scripts/test_input_11.json b/spectrafit/test/scripts/test_input_11.json index e087c63e3..2b704d296 100644 --- a/spectrafit/test/scripts/test_input_11.json +++ b/spectrafit/test/scripts/test_input_11.json @@ -22,7 +22,7 @@ "rel_height": 1, "plateau_size": 0.5 }, - "verbose": false, + "verbose": 1, "version": false }, "fitting": { @@ -47,7 +47,7 @@ "sigmas": null, "trace": false, "maxiter": 200, - "verbose": false, + "verbose": 1, "prob_func": null } } diff --git a/spectrafit/test/scripts/test_input_2.json b/spectrafit/test/scripts/test_input_2.json index 34bb75f3e..bbd284074 100644 --- a/spectrafit/test/scripts/test_input_2.json +++ b/spectrafit/test/scripts/test_input_2.json @@ -11,7 +11,7 @@ "separator": "\t", "shift": 0, "smooth": 0, - "verbose": false, + "verbose": 1, "version": false }, "fitting": { @@ -36,7 +36,7 @@ "sigmas": null, "trace": false, "maxiter": 200, - "verbose": false, + "verbose": 1, "prob_func": null } }, diff --git a/spectrafit/test/scripts/test_input_3.json b/spectrafit/test/scripts/test_input_3.json index 6cfec4198..c0e048dbb 100644 --- a/spectrafit/test/scripts/test_input_3.json +++ b/spectrafit/test/scripts/test_input_3.json @@ -10,7 +10,7 @@ "separator": ",", "shift": 0.2, "smooth": 4, - "verbose": true, + "verbose": 2, "version": false, "noplot": true }, diff --git a/spectrafit/test/scripts/test_input_3.toml b/spectrafit/test/scripts/test_input_3.toml index fdadaa991..eac04f5d8 100644 --- a/spectrafit/test/scripts/test_input_3.toml +++ b/spectrafit/test/scripts/test_input_3.toml @@ -9,7 +9,7 @@ oversampling = true separator = "," shift = 0.2 smooth = 4 -verbose = true +verbose = 2 version = false noplot = true diff --git a/spectrafit/test/scripts/test_input_3.yaml b/spectrafit/test/scripts/test_input_3.yaml index 4f2003c2c..04351b58c 100644 --- a/spectrafit/test/scripts/test_input_3.yaml +++ b/spectrafit/test/scripts/test_input_3.yaml @@ -12,7 +12,7 @@ settings: separator: "," shift: 0.2 smooth: 4 - verbose: true + verbose: 2 version: false noplot: true fitting: diff --git a/spectrafit/test/scripts/test_input_3.yml b/spectrafit/test/scripts/test_input_3.yml index 4f2003c2c..04351b58c 100644 --- a/spectrafit/test/scripts/test_input_3.yml +++ b/spectrafit/test/scripts/test_input_3.yml @@ -12,7 +12,7 @@ settings: separator: "," shift: 0.2 smooth: 4 - verbose: true + verbose: 2 version: false noplot: true fitting: diff --git a/spectrafit/test/scripts/test_input_4.json b/spectrafit/test/scripts/test_input_4.json index 2324a438c..09128120e 100644 --- a/spectrafit/test/scripts/test_input_4.json +++ b/spectrafit/test/scripts/test_input_4.json @@ -11,7 +11,7 @@ "separator": ",", "shift": 0.2, "smooth": 4, - "verbose": false, + "verbose": 1, "version": false, "noplot": true }, diff --git a/spectrafit/test/scripts/test_input_6.json b/spectrafit/test/scripts/test_input_6.json index b7f47b372..bb56517c9 100644 --- a/spectrafit/test/scripts/test_input_6.json +++ b/spectrafit/test/scripts/test_input_6.json @@ -10,7 +10,7 @@ "separator": ",", "shift": 0.2, "smooth": 4, - "verbose": false, + "verbose": 1, "version": false, "noplot": false }, @@ -36,7 +36,7 @@ "sigmas": null, "trace": false, "maxiter": 200, - "verbose": false, + "verbose": 1, "prob_func": null } }, diff --git a/spectrafit/test/scripts/test_input_7.json b/spectrafit/test/scripts/test_input_7.json index 84b1cd67c..6107ee8c1 100644 --- a/spectrafit/test/scripts/test_input_7.json +++ b/spectrafit/test/scripts/test_input_7.json @@ -11,7 +11,7 @@ "separator": "\t", "shift": 0, "smooth": 0, - "verbose": true, + "verbose": 2, "version": false }, "fitting": { @@ -43,7 +43,7 @@ "sigmas": null, "trace": false, "maxiter": 200, - "verbose": false, + "verbose": 1, "prob_func": null } }, diff --git a/spectrafit/test/scripts/test_input_8.json b/spectrafit/test/scripts/test_input_8.json index 6d5b4eeef..91f7ca9e4 100644 --- a/spectrafit/test/scripts/test_input_8.json +++ b/spectrafit/test/scripts/test_input_8.json @@ -11,7 +11,7 @@ "separator": "\t", "shift": 0, "smooth": 0, - "verbose": false, + "verbose": 1, "version": false }, "fitting": { @@ -36,7 +36,7 @@ "sigmas": null, "trace": false, "maxiter": 200, - "verbose": false, + "verbose": 1, "prob_func": null } }, diff --git a/spectrafit/test/scripts/test_input_9.json b/spectrafit/test/scripts/test_input_9.json index f21a810c0..9d7951df7 100644 --- a/spectrafit/test/scripts/test_input_9.json +++ b/spectrafit/test/scripts/test_input_9.json @@ -11,7 +11,7 @@ "separator": "\t", "shift": 0, "smooth": 0, - "verbose": true, + "verbose": 2, "version": false }, "fitting": { @@ -36,7 +36,7 @@ "sigmas": null, "trace": false, "maxiter": 200, - "verbose": false, + "verbose": 1, "prob_func": null } }, diff --git a/spectrafit/test/scripts/test_input_all_models.toml b/spectrafit/test/scripts/test_input_all_models.toml index b94924cfc..9bb592ec9 100644 --- a/spectrafit/test/scripts/test_input_all_models.toml +++ b/spectrafit/test/scripts/test_input_all_models.toml @@ -10,7 +10,7 @@ oversampling = true separator = "," shift = 0.2 smooth = 4 -verbose = true +verbose = 2 version = false noplot = true diff --git a/spectrafit/test/scripts/test_input_global.json b/spectrafit/test/scripts/test_input_global.json index 3153cc64e..a164fd38b 100644 --- a/spectrafit/test/scripts/test_input_global.json +++ b/spectrafit/test/scripts/test_input_global.json @@ -10,7 +10,7 @@ "separator": ",", "shift": 0.2, "smooth": false, - "verbose": false, + "verbose": 1, "version": false, "noplot": true, "global": 1 @@ -37,7 +37,7 @@ "sigmas": null, "trace": false, "maxiter": 200, - "verbose": false, + "verbose": 1, "prob_func": null } }, diff --git a/spectrafit/test/scripts/test_input_global_0.json b/spectrafit/test/scripts/test_input_global_0.json index 71b6b7acd..a9f61988f 100644 --- a/spectrafit/test/scripts/test_input_global_0.json +++ b/spectrafit/test/scripts/test_input_global_0.json @@ -9,7 +9,7 @@ "separator": ",", "shift": 0.2, "smooth": false, - "verbose": false, + "verbose": 1, "version": false, "noplot": false, "global": 0 diff --git a/spectrafit/test/scripts/test_input_global_1.json b/spectrafit/test/scripts/test_input_global_1.json index b8d0690aa..fdb8d7c59 100644 --- a/spectrafit/test/scripts/test_input_global_1.json +++ b/spectrafit/test/scripts/test_input_global_1.json @@ -9,7 +9,7 @@ "separator": ",", "shift": 0.2, "smooth": false, - "verbose": false, + "verbose": 1, "version": false, "noplot": false, "global": 1 diff --git a/spectrafit/test/scripts/test_missing_parameter_1.json b/spectrafit/test/scripts/test_missing_parameter_1.json index 6d48cb74d..70b9e554f 100644 --- a/spectrafit/test/scripts/test_missing_parameter_1.json +++ b/spectrafit/test/scripts/test_missing_parameter_1.json @@ -10,7 +10,7 @@ "separator": ",", "shift": 0.2, "smooth": 4, - "verbose": false, + "verbose": 1, "version": false, "noplot": false }, @@ -35,7 +35,7 @@ "sigmas": null, "trace": false, "maxiter": 200, - "verbose": false, + "verbose": 1, "prob_func": null } }, diff --git a/spectrafit/test/scripts/test_missing_parameter_2.json b/spectrafit/test/scripts/test_missing_parameter_2.json index e7116a098..98ae1681e 100644 --- a/spectrafit/test/scripts/test_missing_parameter_2.json +++ b/spectrafit/test/scripts/test_missing_parameter_2.json @@ -10,7 +10,7 @@ "separator": ",", "shift": 0.2, "smooth": 4, - "verbose": false, + "verbose": 1, "version": false, "noplot": false }, @@ -35,7 +35,7 @@ "sigmas": null, "trace": false, "maxiter": 200, - "verbose": false, + "verbose": 1, "prob_func": null } }, diff --git a/spectrafit/test/scripts/test_missing_parameters_1.json b/spectrafit/test/scripts/test_missing_parameters_1.json index 6d48cb74d..70b9e554f 100644 --- a/spectrafit/test/scripts/test_missing_parameters_1.json +++ b/spectrafit/test/scripts/test_missing_parameters_1.json @@ -10,7 +10,7 @@ "separator": ",", "shift": 0.2, "smooth": 4, - "verbose": false, + "verbose": 1, "version": false, "noplot": false }, @@ -35,7 +35,7 @@ "sigmas": null, "trace": false, "maxiter": 200, - "verbose": false, + "verbose": 1, "prob_func": null } }, diff --git a/spectrafit/test/scripts/test_missing_parameters_2.json b/spectrafit/test/scripts/test_missing_parameters_2.json index e7116a098..98ae1681e 100644 --- a/spectrafit/test/scripts/test_missing_parameters_2.json +++ b/spectrafit/test/scripts/test_missing_parameters_2.json @@ -10,7 +10,7 @@ "separator": ",", "shift": 0.2, "smooth": 4, - "verbose": false, + "verbose": 1, "version": false, "noplot": false }, @@ -35,7 +35,7 @@ "sigmas": null, "trace": false, "maxiter": 200, - "verbose": false, + "verbose": 1, "prob_func": null } },