-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ Add parameter IO support for more formats supported by pandas #896
✨ Add parameter IO support for more formats supported by pandas #896
Conversation
Codecov Report
@@ Coverage Diff @@
## main #896 +/- ##
=======================================
+ Coverage 85.6% 85.8% +0.1%
=======================================
Files 90 92 +2
Lines 4909 4959 +50
Branches 927 933 +6
=======================================
+ Hits 4207 4258 +51
Misses 552 552
+ Partials 150 149 -1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution, but there are some changes needed (see review).
In addition:
- It would also be useful to have a
*.csv
file for testing that it looks like it should. - Having an option for writing to
csv
e.g.strip_default=True
would be useful whencsv
files are edited in excel (to reduce code duplication best factor the replacing out in a separate function which then can be unit tested). - Please also add a plugin for
tsv
(tab separated values) the only difference tocsv
should besep=+\t
in thepandas
method.
- What do you think about adding
openpyxl
as a runtime dependency? - What do you think about setting all default parameter values to empty strings, this would reduce cognitive load and make parameter files easier to read.
I am ok with both. |
Yes to both. |
@patrickhaetti Looking at the commit mess I suggest you close this PR and and open a new one, with clean commit history. I think @glotaran/maintainers would also prefer it. |
Let's keep the PR but I will remove the mess 😉 |
f2da31e
to
631dca8
Compare
Benchmark is done. Checkout the benchmark result page. Benchmark diff v0.5.1 vs. mainParametrized benchmark signatures: BenchmarkOptimize.time_optimize(index_dependent, grouped, weight)
Benchmark diff main vs. PRParametrized benchmark signatures: BenchmarkOptimize.time_optimize(index_dependent, grouped, weight)
|
@patrickhaetti I cleaned up the commit history please make sure to reset your local branch to the remote state. E.g. if your remote is called git reset --hard orgin/create-xlsx-parameter If you have uncommitted changes just stash them before ( |
@s-weigand thank you for cleaning up, looks way more better now |
997883c
to
c6906df
Compare
I will implement the |
ddf8d49
to
62e3ddc
Compare
0467af6
to
a44cb82
Compare
a44cb82
to
04b5a0e
Compare
In this PR result comparison was failing on a singular point in the residual. This is not a problem with this PR but reason to further improve the github actions that does the results comparison, see issue #937 which will be fixed in addressed in #937. FAILED .github/test_result_consistency.py::test_result_data_var_consistency[study_transient_absorption_target_analysis-residual]E AssertionError: Result data_var data mismatch: 'residual' in 'dataset1.nc'. .github/test_result_consistency.py:221: AssertionError |
Refine calculation of epsilon for residual check Should resolve issue signaled in glotaran#896
Refine calculation of epsilon for residual check Should resolve issue signaled in glotaran#896
* 🚇Update test_result_consistency Update float_resolution for comparison of spectral values. Should resolve issues with result comparison signaled in #927 * 🚇👌 Further refinement of test_result_consistency Refine calculation of epsilon for residual check Should resolve issues with result comparison signaled in #896 * 🚇👌 Failing tests now also show the tolerances used for the comparison
Functions added it utils/io.py and applied in csv.py. Function safe_parameters_fillna for loading and safe_parameters_replace for saving parameters. Now it will be checked if columns exist before replacing inf/-inf and empty strings.
Take out 'parameter_diff_param.yaml' from builtin/io/pandas/test/ which had varied values of 'parameter.yaml'. Taken out test functions from 'test_pandas_parameters.py' which were based on 'parameter_diff_param.yaml'.
Added ods parameter to xlsx.py Added 'ods' to /glotaran/builtin/io/pandas/xlsx.py. tests added to 'test_pandas_parameters.py' add odfpy>=1.4.1 to setup.cfg Append 'ods' to docstrings.
…x.py Use functions from glotaran.utils.io. Corrected spelling mistake in csv.py
For functions safe_parameters_fillna and safe_parameters_replace
Improved readability (`parameter` -> `parameters`, 'testparameters' -> 'test_parameters') More distinctive filenames from just 'parameter.xlsx' to 'reference_parameter.xlsx' so it doesn't pollute the parameter* file namespace when searching through the project.
f7058cf
to
6203cfe
Compare
glotaran/deprecation/modules/test/test_parameter_parameter_group.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@s-weigand Only one Q for before my lgtm, it is in the review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
✨ Added 'replace_infinfinity' optional argument to keep inf values in csv and tsv files
Sourcery Code Quality Report✅ Merging this PR will increase code quality in the affected files by 0.04%.
Here are some functions in these files that still need a tune-up:
Legend and ExplanationThe emojis denote the absolute quality of the code:
The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request. Please see our documentation here for details on how these metrics are calculated. We are actively working on this report - lots more documentation and extra metrics to come! Help us improve this quality report! |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Hi everybody, I am happy to hear the merge happened! |
Change summary
xlsx = glotaran.builtin.io.pandas.xlsx
openpyxl>=3.0.9
to setup.cfg / install_requiresodfpy>=1.4.1
to setup.cfg / install_requiresopenpyxl==3.0.9
to requirements_dev.txt to read/write xlsxAdded test files to pandas/tests/data with parameter.yaml and create csv, tsv, xlsx parameter files including one type of each parameter definition.
added tsv parameter:
tsv = glotaran.builtin.io.pandas.tsv
Checklist