From cb415b3704d441433157b3fe4b87404bf0e499ab Mon Sep 17 00:00:00 2001 From: Christian Ludwig Date: Fri, 22 Dec 2023 00:25:16 +0000 Subject: [PATCH] update --- metabolabpy/nmr/acqPars.py | 48 ++++++++++++++++++++++++++++++------- metabolabpy/nmr/acqRegEx.py | 8 +++++++ 2 files changed, 48 insertions(+), 8 deletions(-) diff --git a/metabolabpy/nmr/acqPars.py b/metabolabpy/nmr/acqPars.py index be93a4e..35c2f03 100644 --- a/metabolabpy/nmr/acqPars.py +++ b/metabolabpy/nmr/acqPars.py @@ -126,14 +126,46 @@ def __str__(self): # pragma: no cover # end __str__ def parse_reg_ex(self): - self.sfo1 = float(self.reg_ex.sfo1.findall(self.acqus_text)[0]) - self.sfo2 = float(self.reg_ex.sfo2.findall(self.acqus_text)[0]) - self.sfo3 = float(self.reg_ex.sfo3.findall(self.acqus_text)[0]) - self.sfo4 = float(self.reg_ex.sfo4.findall(self.acqus_text)[0]) - self.sfo5 = float(self.reg_ex.sfo5.findall(self.acqus_text)[0]) - self.sfo6 = float(self.reg_ex.sfo6.findall(self.acqus_text)[0]) - self.sfo7 = float(self.reg_ex.sfo7.findall(self.acqus_text)[0]) - self.sfo8 = float(self.reg_ex.sfo8.findall(self.acqus_text)[0]) + try: + self.sfo1 = float(self.reg_ex.sfo1.findall(self.acqus_text)[0]) + except: + self.sfo1 = float(self.reg_ex.sfo1i.findall(self.acqus_text)[0]) + + try: + self.sfo2 = float(self.reg_ex.sfo2.findall(self.acqus_text)[0]) + except: + self.sfo1 = float(self.reg_ex.sfo2i.findall(self.acqus_text)[0]) + + try: + self.sfo3 = float(self.reg_ex.sfo3.findall(self.acqus_text)[0]) + except: + self.sfo1 = float(self.reg_ex.sfo3i.findall(self.acqus_text)[0]) + + try: + self.sfo4 = float(self.reg_ex.sfo4.findall(self.acqus_text)[0]) + except: + self.sfo1 = float(self.reg_ex.sfo4i.findall(self.acqus_text)[0]) + + try: + self.sfo5 = float(self.reg_ex.sfo5.findall(self.acqus_text)[0]) + except: + self.sfo1 = float(self.reg_ex.sfo5i.findall(self.acqus_text)[0]) + + try: + self.sfo6 = float(self.reg_ex.sfo6.findall(self.acqus_text)[0]) + except: + self.sfo1 = float(self.reg_ex.sfo6i.findall(self.acqus_text)[0]) + + try: + self.sfo7 = float(self.reg_ex.sfo7.findall(self.acqus_text)[0]) + except: + self.sfo1 = float(self.reg_ex.sfo7i.findall(self.acqus_text)[0]) + + try: + self.sfo8 = float(self.reg_ex.sfo8.findall(self.acqus_text)[0]) + except: + self.sfo1 = float(self.reg_ex.sfo8i.findall(self.acqus_text)[0]) + self.bf1 = float(self.reg_ex.bf1.findall(self.acqus_text)[0]) self.bf2 = float(self.reg_ex.bf2.findall(self.acqus_text)[0]) self.bf3 = float(self.reg_ex.bf3.findall(self.acqus_text)[0]) diff --git a/metabolabpy/nmr/acqRegEx.py b/metabolabpy/nmr/acqRegEx.py index 761aa7a..4f540e9 100644 --- a/metabolabpy/nmr/acqRegEx.py +++ b/metabolabpy/nmr/acqRegEx.py @@ -16,6 +16,14 @@ def __init__(self): self.sfo6 = re.compile(r'##\$SFO6= (\d+\.\d+)') self.sfo7 = re.compile(r'##\$SFO7= (\d+\.\d+)') self.sfo8 = re.compile(r'##\$SFO8= (\d+\.\d+)') + self.sfo1i = re.compile(r'##\$SFO1= (\d+)') + self.sfo2i = re.compile(r'##\$SFO2= (\d+)') + self.sfo3i = re.compile(r'##\$SFO3= (\d+)') + self.sfo4i = re.compile(r'##\$SFO4= (\d+)') + self.sfo5i = re.compile(r'##\$SFO5= (\d+)') + self.sfo6i = re.compile(r'##\$SFO6= (\d+)') + self.sfo7i = re.compile(r'##\$SFO7= (\d+)') + self.sfo8i = re.compile(r'##\$SFO8= (\d+)') self.bf1 = re.compile(r'##\$BF1= (\d+\.\d+)') self.bf2 = re.compile(r'##\$BF2= (\d+\.\d+)') self.bf3 = re.compile(r'##\$BF3= (\d+\.\d+)')