-
Notifications
You must be signed in to change notification settings - Fork 105
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
Fix float exponents when writing a TDB file (TC ERROR DatabaseUtils) #516
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #516 +/- ##
===========================================
- Coverage 90.47% 90.46% -0.02%
===========================================
Files 50 50
Lines 7878 7868 -10
===========================================
- Hits 7128 7118 -10
Misses 750 750 ☔ View full report in Codecov by Sentry. |
…ng function ERROR
Only one test is failing, and I think it's safe for you to modify the pass condition for that test to match this new behavior, since it only differs in the amount of whitespace. |
…addition/subtraction that is not part of an EXP or LN/LOG operation. Updated the test in test_database.py to reflect changes made in tdb.py.
Hi Richard, I’ve updated ‘test_database.py’, and the test should pass now. I’ve also generalized my previous rules to allow line breaks before any number addition/subtraction that isn’t part of an EXP or LN/LOG operation. The previous rules already accounted for that, but were overlooking some permissible break points. |
Please pull and merge the latest I think it should be an easy merge, just adopting the new code and changing the |
Hi @richardotis. This regex basically matches any addition and subtraction of any number, ie. [+-][0-9], since they are not preceded by 'E' or '('. This should prevent breaking lines inside EXP or LN/LOG or power expression: '6.14599E-07', 'T**(-3)', and 'LOG(-3)', hence splitting these could lead to errors in TC. In practice, this makes the functions being breakable at the I'll add a comment on the code about this implementation and merge it to #522 |
…ents with nested functions, i.e., non-numeric values.
The test failures are unrelated and will be fixed once #530 is merged. Can you add a test for |
Sure, I'll add it and let you know. |
…re being broken at correct positions
Hi @richardotis, just added a new test |
Hi, this is a small fix to '_print_Piecewise' function in the io.tdb module to improve compatibility with TC. I'm using this module to parse some of my tdbs and TC complains about float exponents (A constant integer must be used as the exponent in exponential TDB expressions). Thank you.
Edit on 03/07: I updated my previous fix to change only the exponents in '_stringify_expr' and added some extra rules where to break lines in 'reflow_text'. I did a couple of tests with different tdbs and TC is reading it with no errors now.
Checklist
setup.py
(runtime requirements)pyproject.toml
(build requirements)requirements-dev.txt
(build and development requirements)