-
Notifications
You must be signed in to change notification settings - Fork 2
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
Adjust import statements to match convention #43
Conversation
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.
Good job overall! I only marked two spots where you missed the np. prefix, both times before the 'sum' function. We gotta be careful with this specifically, since there is a function called 'sum' in standard python, so removing the import for 'sum' from numpy does not lead to a syntax error.
napytau/core/tau_final.py
Outdated
@@ -24,12 +21,12 @@ def calculate_tau_final( | |||
if len(tau_i_values) == 0: | |||
return -1, -1 | |||
|
|||
weights: ndarray = 1 / power(delta_tau_i_values, 2) | |||
weights: np.ndarray = 1 / np.power(delta_tau_i_values, 2) | |||
|
|||
# Calculate the weighted mean of tau_i | |||
weighted_mean: float = sum(weights * tau_i_values) / sum(weights) |
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.
weighted_mean: float = sum(weights * tau_i_values) / sum(weights) | |
weighted_mean: float = np.sum(weights * tau_i_values) / np.sum(weights) |
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.
Its concerning, that the tests didn't catch that, could you have a look at why this wasn't tested?
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, that's what I thought as well. Turns out I forgot to verify the mocked functions in tau_final are called correctly. I now added the tests for this.
Co-authored-by: Martin Fuchs <[email protected]>
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.
One tiny thing, which applies to 2 files i think
napytau/core/chi.py
Outdated
from numpy import sum | ||
from numpy import mean | ||
from numpy import power | ||
import numpy as np | ||
from scipy import optimize | ||
from scipy.optimize import OptimizeResult |
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.
this does not match the import convention
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.
Summary
Adjusted all numpy import statements to match and create continuous scheme.
PR checklist
Closes/Fixes/Related to