-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Spectral mismatch calculation code #1524
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
Changes from 1 commit
bb9b7be
949084a
12e06df
70aa9ab
770480f
ccd04fe
9ab0e4c
d9dd093
01ce237
554fe07
eab1afa
28c2eec
35276c2
0312e6d
5cdb0fa
db27486
42d369e
270d2ba
80f9ea8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
from scipy.interpolate import interp1d | ||
import os | ||
|
||
|
||
def get_sample_sr(wavelength=None): | ||
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. Would it make sense to future-proof this function such that it will be able to return other spectral responses in the future? For example:
^I would also prefer to write out "sr" as it is not immediately clear to me that it stands for "spectral response" 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. I agree that calling out the material is important. For the name, I'd prefer something like 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. Agreed 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. I have no problems making a name and parameter change to pass the review but I think it would be inappropriate to put additional technology options into this function in the future. I believe SR data should be in data files in general. |
||
''' | ||
Generate a generic smooth c-si spectral response for tests and experiments. | ||
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. If data was found, could this function be extended to return spectral response for other cell types? It appears capable of doing so, and if that's correct, I'd suggest adding a kwarg 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. Spectral response data should generally be in data files I think. (Lots coming.) This is really just something for people who have nothing. 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. I still vote for adding a kwarg now, rather than later. 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. Are you thinking of a NotImplemented exception for values other thane "csi" this time around? 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. Something like that, yes |
||
|
@@ -56,6 +57,7 @@ def get_sample_sr(wavelength=None): | |
|
||
return sr | ||
|
||
|
||
def get_am15g(wavelength=None): | ||
''' | ||
Read the ASTM G173-03 AM1.5 global tilted spectrum, optionally interpolated | ||
adriesse marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
@@ -100,6 +102,7 @@ def get_am15g(wavelength=None): | |
|
||
return am15g | ||
|
||
|
||
def calc_spectral_mismatch(sr, e_sun, e_ref=None): | ||
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. I think the name of this function should somehow reflect that it is specific to the case of a broadband reference device. 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. Sure 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. How about: 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. Actually, I am going to update my suggestion to: 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. I would prefer 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. Another idea: keep the function general (not specifically relative to broadband reference) add an optional 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. Its a very reasonable suggestion, but perhaps it could be done in a future PR with some more debate about the range of interesting options and different ways of implementing them? |
||
""" | ||
Calculate the spectral mismatch under a given measured spectrum with | ||
|
@@ -145,7 +148,8 @@ def calc_spectral_mismatch(sr, e_sun, e_ref=None): | |
sr_ref = np.interp(e_ref.T.index, sr.index, sr, left=0.0, right=0.0) | ||
|
||
# a helper function to make usable fraction calculations more readable | ||
integrate = lambda e: np.trapz(e, x=e.T.index, axis=-1) | ||
def integrate(e): | ||
return np.trapz(e, x=e.T.index, axis=-1) | ||
|
||
# calculate usable fractions | ||
uf_sun = integrate(e_sun * sr_sun) / integrate(e_sun) | ||
|
Uh oh!
There was an error while loading. Please reload this page.