-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Handle flake8 issues in part of the codebase. #2643
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -782,8 +782,9 @@ def _lambertw_v_from_i(current, photocurrent, saturation_current, | |
|
|
||
| # Explicit solutions where Gsh=0 | ||
| if np.any(idx_z): | ||
| V[idx_z] = a[idx_z] * np.log1p((IL[idx_z] - I[idx_z]) / I0[idx_z]) - \ | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. F401 'warnings.warn' imported but unused |
||
| I[idx_z] * Rs[idx_z] | ||
| V[idx_z] = \ | ||
| a[idx_z] * np.log1p((IL[idx_z] - I[idx_z]) / I0[idx_z]) - \ | ||
| I[idx_z] * Rs[idx_z] | ||
|
|
||
| # Only compute using LambertW if there are cases with Gsh>0 | ||
| if np.any(idx_p): | ||
|
|
@@ -865,17 +866,21 @@ def _lambertw_i_from_v(voltage, photocurrent, saturation_current, | |
|
|
||
| # Explicit solutions where Rs=0 | ||
| if np.any(idx_z): | ||
| I[idx_z] = IL[idx_z] - I0[idx_z] * np.expm1(V[idx_z] / a[idx_z]) - \ | ||
| Gsh[idx_z] * V[idx_z] | ||
| I[idx_z] = \ | ||
| IL[idx_z] - I0[idx_z] * np.expm1(V[idx_z] / a[idx_z]) - \ | ||
| Gsh[idx_z] * V[idx_z] | ||
|
|
||
| # Only compute using LambertW if there are cases with Rs>0 | ||
| # Does NOT handle possibility of overflow, github issue 298 | ||
| if np.any(idx_p): | ||
| # LambertW argument, cannot be float128, may overflow to np.inf | ||
| argW = Rs[idx_p] * I0[idx_p] / ( | ||
| a[idx_p] * (Rs[idx_p] * Gsh[idx_p] + 1.)) * \ | ||
| np.exp((Rs[idx_p] * (IL[idx_p] + I0[idx_p]) + V[idx_p]) / | ||
| (a[idx_p] * (Rs[idx_p] * Gsh[idx_p] + 1.))) | ||
| argW = ( | ||
| Rs[idx_p] * I0[idx_p] | ||
| / (a[idx_p] * (Rs[idx_p] * Gsh[idx_p] + 1.)) | ||
| * np.exp( | ||
| (Rs[idx_p] * (IL[idx_p] + I0[idx_p]) + V[idx_p]) | ||
| / (a[idx_p] * (Rs[idx_p] * Gsh[idx_p] + 1.)) | ||
| )) | ||
|
|
||
| # lambertw typically returns complex value with zero imaginary part | ||
| # may overflow to np.inf | ||
|
|
@@ -884,9 +889,10 @@ def _lambertw_i_from_v(voltage, photocurrent, saturation_current, | |
| # Eqn. 2 in Jain and Kapoor, 2004 | ||
| # I = -V/(Rs + Rsh) - (a/Rs)*lambertwterm + Rsh*(IL + I0)/(Rs + Rsh) | ||
| # Recast in terms of Gsh=1/Rsh for better numerical stability. | ||
| I[idx_p] = (IL[idx_p] + I0[idx_p] - V[idx_p] * Gsh[idx_p]) / \ | ||
| (Rs[idx_p] * Gsh[idx_p] + 1.) - ( | ||
| a[idx_p] / Rs[idx_p]) * lambertwterm | ||
| I[idx_p] = \ | ||
| (IL[idx_p] + I0[idx_p] - V[idx_p] * Gsh[idx_p]) / \ | ||
| (Rs[idx_p] * Gsh[idx_p] + 1.) - (a[idx_p] / Rs[idx_p]) * \ | ||
| lambertwterm | ||
|
|
||
| if output_is_scalar: | ||
| return I.item() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,8 +9,6 @@ | |
| import pandas as pd | ||
| from scipy.integrate import trapezoid | ||
|
|
||
| from warnings import warn | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. F401 'warnings.warn' imported but unused |
||
|
|
||
|
|
||
| def calc_spectral_mismatch_field(sr, e_sun, e_ref=None): | ||
| """ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,6 @@ | |
| import numpy as np | ||
| import pandas as pd | ||
| from pvlib.tools import sind | ||
| from pvlib._deprecation import warn_deprecated | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. F401 'warnings.warn' imported but unused |
||
| from pvlib.tools import _get_sample_intervals | ||
| import scipy | ||
| import scipy.constants | ||
|
|
||
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.
E704 multiple statements on one line (def)