From b3307e8c224dd76ee9b912ad47841de5b0efabf9 Mon Sep 17 00:00:00 2001 From: esea_info Date: Fri, 14 Apr 2023 17:15:46 +0800 Subject: [PATCH] profiler --- Ramses.py | 11 ++++++++++- profiler.py | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Ramses.py b/Ramses.py index a5429af..0246377 100644 --- a/Ramses.py +++ b/Ramses.py @@ -28,6 +28,7 @@ class Ramses(object): @Returns : realWavelength Intensity """ self.buf = b'' + self.mode = 0 # 默认0 空气中,1:水中 self.it = None self.light_int = None # 未标定的整数值 self.spectrum = None # 光谱强度 @@ -43,6 +44,10 @@ class Ramses(object): self.buf = buf pass + def setMode(self, mode=1): + self.mode = 1 + pass + def setCalCfg(self, d: dict): self.cal_cfg = d pass @@ -136,7 +141,11 @@ class Ramses(object): Cn, int(self.cal_cfg['DarkPixelStart']), int(self.cal_cfg['DarkPixelStop'])) Dn = Cn-Offset En = Dn * (t0/self.it) - Fn = En/np.asarray(self.cal_cfg["cal"], dtype=float) # 空气或水中的标定文件 + if self.mode == 0: + Fn = En/np.asarray(self.cal_cfg["cal"], dtype=float) # 空气的标定文件 + else: + Fn = En/np.asarray(self.cal_cfg["calaq"], dtype=float) # 水中的标定文件 + self.spectrum = Fn diff --git a/profiler.py b/profiler.py index 31d73d9..2a4998c 100644 --- a/profiler.py +++ b/profiler.py @@ -733,6 +733,8 @@ class Profiler(object): self.ramses.setBuf(temp_buf) func = self.getFuncBySeq(i) cfg = self.getCfgByFunc( func) + if i == 1 or i==3: # 两个空气中一个水中注意序号 + self.ramses.setMode(1) # 水中??? 另外一个是空气中的 self.ramses.setCalCfg(cfg) self.ramses.resetItSpectrum() self.ramses.ConvertAndCalibrate()