-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add functions to fit and convert IAM models #1827
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
Conversation
The fitting doesn't require evenly spaced IAM measurements. |
Here's the reference, now published but it won't appear on OSTI or other sources for a few months. |
Ready for another round of reviews. @kandersolar I didn't make the residual function a user input, if that's important I can revisit. |
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.
A quick look. Haven't examined the tests yet. tests look great!
In the case of nonuniform samples, more weight being given to the regions of denser samples, I think. Not necessarily a problem, but something to consider documenting. |
# data. | ||
|
||
# Create and perturb IAM data. | ||
aoi = np.linspace(0, 90, 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.
aoi = np.linspace(0, 90, 100) | |
aoi = np.linspace(0, 85, 18) |
This would more representative for measurements.
# %% | ||
# The weight function | ||
# ------------------- | ||
# :py:func:`pvlib.iam.fit` uses a weight function when computing residuals |
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.
I suggest you say a bit more about the shape and purpose of these functions. I see there is more in the other example, but I think it is more relevant or important here.
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 more minor doc comment...
@cwhanse good to merge?
\\sum_{\\theta=0}^{90} weight \\left(\\theta \\right) \\times | ||
\\| source \\left(\\theta \\right) - target \\left(\\theta \\right) \\| | ||
|
||
The sum is over :math:`\\theta = 0, 1, 2, ..., 90`. |
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.
Not quite true; the code actually uses np.linspace(0, 90, 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.
Changed to code to linspace(0, 90, 90)
Ready to merge from my point of view.
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.
Pedantic nitpick: linspace(0, 90, 90)
produces [0., 1.0112, 2.0225, ... , 87.9775, 88.9888, 90.]
. To produce theta = 0, 1, 2, ..., 90
as the docstring states, I think we need linspace(0, 90, 91)
.
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.
Not a nit, rather, that's the intent, because it feels natural to step by 1.0000000000000...
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.
I agree it feels natural to step by unity. I was trying to point out that the current code (np.linspace(0, 90, 90)
) steps by 90/89 linspace(0, 90, 91)
.
@kandersolar codecov error. |
docs/sphinx/source/reference
for API changes.docs/sphinx/source/whatsnew
for all changes. Includes link to the GitHub Issue with:issue:`num`
or this Pull Request with:pull:`num`
. Includes contributor name and/or GitHub username (link with:ghuser:`user`
).remote-data
) and Milestone are assigned to the Pull Request and linked Issue.