Commit 887d87eb authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Added RelativeSpectralResponse.fwhm attribute that holds the full width half maximum.


Signed-off-by: Daniel Scheffler's avatarDaniel Scheffler <danschef@gfz-potsdam.de>
parent 495ef071
Pipeline #28838 passed with stages
in 2 minutes and 19 seconds
......@@ -2,6 +2,13 @@
History
=======
0.6.0 (2021-10-12)
------------------
* Fixed wrong wavelength and RSRs in case of micrometers.
* Added RelativeSpectralResponse.fwhm attribute that holds the full width half maximum.
0.5.0 (2021-09-27)
------------------
......
......@@ -128,6 +128,7 @@ class RelativeSpectralResponse(object):
self.rsrs_norm01 = {} # RSR values with 1 nm precision
self.bands = []
self.wvl = []
self.fwhm = []
self.wvl_unit = wvl_unit
self.specres_nm = specres_nm
self.format_bandnames = format_bandnames
......@@ -202,10 +203,20 @@ class RelativeSpectralResponse(object):
self.wvl = np.array([np.trapz(x=self.rsrs_wvl, y=self.rsrs_wvl * self.rsrs[band]) for band in self.bands])
# self.wvl = self.wvl if self.wvl_unit == 'micrometers' else np.array([int(i) for i in self.wvl])
# calculate FWHM
fwhm = []
for band in self.bands:
rsr_band = self.rsrs_norm01[band]
rsr_halfmax = np.max(rsr_band) / 2.
wvls_within_fullwidth = self.rsrs_wvl[rsr_band >= rsr_halfmax]
fwhm.append(np.max(wvls_within_fullwidth) - np.min(wvls_within_fullwidth))
self.fwhm = np.array(fwhm)
# force nanometer output
if self.wvl_unit == 'micrometers':
self.rsrs_wvl = self.rsrs_wvl * 1000
self.wvl = self.wvl * 1000
self.rsrs_wvl *= 1000
self.wvl *= 1000
self.fwhm *= 1000
self.conv.update({key: value for key, value in zip(self.bands, self.wvl)})
self.conv.update({value: key for key, value in zip(self.bands, self.wvl)})
......
......@@ -24,5 +24,5 @@
# limitations under the License.
__version__ = '0.5.0'
__versionalias__ = '20210927.01'
__version__ = '0.6.0'
__versionalias__ = '20211012.01'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment