-
Notifications
You must be signed in to change notification settings - Fork 116
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
Added cutoff_error parameter to enable Automatic Linestrength Cutoff #451
Conversation
radis/lbl/base.py
Outdated
cutoff -= 0.0001 | ||
b = df.S <= cutoff | ||
error = df.S[b].sum() / df.S.sum() * 100 |
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.
what about :
1 . we sort (a copy of) the lines by intensity intensity
2. we compute the cumulated intensity on the sorted array [last value is the total sum]
3. we find the index in the sorted array so that cumulated-intensity is ERROR_fraction * the total
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.
Yes, this seems to be a much better option. I'll work on this.
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.
Please let me know. It will be important to also add tests.
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.
Hello @sagarchotalia ,did you try the approach I suggested above ?
Codecov Report
@@ Coverage Diff @@
## develop #451 +/- ##
===========================================
- Coverage 77.11% 77.03% -0.09%
===========================================
Files 161 161
Lines 18676 18689 +13
===========================================
- Hits 14402 14397 -5
- Misses 4274 4292 +18 |
Also, see the error raised : https://app.travis-ci.com/github/radis/radis/jobs/567095871#L1858 |
Yes, the error was resolved in the next commit. |
Had accidentally changed the docstring in my previous commit; changed it back to raw string
radis/lbl/base.py
Outdated
cutoff -= 0.0001 | ||
b = df.S <= cutoff | ||
error = df.S[b].sum() / df.S.sum() * 100 |
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.
Hello @sagarchotalia ,did you try the approach I suggested above ?
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.
All these operations exist as Numpy array methods. You should use them : it will make your code much more readable; and also much more efficient. List are pure Python objects; whereas Numpy arrays run underlying C code
Description
This PR is to address #268.
Added
cutoff_error
parameter that will allow users to input a cutoff error, which will then be used to keep the internally calculated error below the inputted cutoff error.The way I am doing this currently is, decrementing the
cutoff
by0.001
(arbitrary value assumed for now, will change it if needed) and then recalculating the bool array 'b' and then calculating the internal error againThe size of the boolean array 'b' shall decrease with each iteration until the internal error is less than the cutoff error.
Further Changes:
I am not sure that the approach I am using now fixes #268. If there is a more efficient way to decrease the internal error, kindly suggest the same in the comments.