Commit ade8c794 by lzzzzl

更新attr_values处理

parent 3d410c52
Showing with 10 additions and 4 deletions
...@@ -234,7 +234,13 @@ class ParamTrans: ...@@ -234,7 +234,13 @@ class ParamTrans:
""" """
trans_rule = r'(±\d+|±\d+.\d+|\d+|\d+\.\d+)([a-zA-Z]ppm|ppm|[a-zA-Z]Hz|Hz)$' trans_rule = r'(±\d+|±\d+.\d+|\d+|\d+\.\d+)([a-zA-Z]ppm|ppm|[a-zA-Z]Hz|Hz)$'
value, unit = ParamTrans.base_trans(trans_rule, key) value, unit = ParamTrans.base_trans(trans_rule, key)
if 'ppm' in unit: if unit != 0 and 'ppm' in unit:
return value * 10, 'Hz' number_rule = r'(±|)(\d+|\d+\.\d+)'
else: obj = re.match(number_rule, key.replace(" ", ""))
return value, unit value = obj.group(2) if obj else 0
try:
value = int(value) * 10
return str(value), 'Hz'
except:
pass
return value, unit
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 sign in to comment