This repository was archived by the owner on Aug 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
This repository was archived by the owner on Aug 30, 2020. It is now read-only.
Nonlinearity Correction #16
Copy link
Copy link
Open
Labels
Description
I could'nt open a second pull request, so here is a patch for the implementation of the nonlinearity correction:
--- ../python-oceanoptics_upstream/oceanoptics/base.py 2015-01-14 10:22:10.573384769 +0100
+++ oceanoptics/base.py 2015-01-16 09:40:37.732968993 +0100
@@ -168,7 +170,7 @@
only_valid_pixels : bool, optional
only optical active pixels are returned.
correct_nonlinearity : bool, optional
- does nothing yet.
+ corrects for nonlinearity of CCD-Chip
correct_darkcounts : bool, optional
does nothing yet.
correct_saturation : bool, optional
@@ -183,8 +185,14 @@
data = np.array(self._request_spectrum()[self._valid_pixels], dtype=np.float64)
else:
data = np.array(self._request_spectrum(), dtype=np.float64)
+ if correct_nonlinearity:
+ data = data/self._calc_nonlinearity(data)
return data
+ def _calc_nonlinearity(self, counts):
+ return sum( self._nl_factors[i] * counts**i for i in range(8) )
+
+
def spectrum(self, raw=False, only_valid_pixels=True,
correct_nonlinearity=True, correct_darkcounts=True,
correct_saturation=True):
@@ -197,7 +205,7 @@
only_valid_pixels : bool, optional
only optical active pixels are returned.
correct_nonlinearity : bool, optional
- does nothing yet.
+ corrects for nonlinearity of CCD-Chip
correct_darkcounts : bool, optional
does nothing yet.
correct_saturation : bool, optional
Reactions are currently unavailable