Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
lzzzzl
/
param_data
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ade8c794
authored
Nov 09, 2020
by
lzzzzl
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
更新attr_values处理
parent
3d410c52
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
fun/param_trans.py
fun/param_trans.py
View file @
ade8c794
...
@@ -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
(
" "
,
""
))
value
=
obj
.
group
(
2
)
if
obj
else
0
try
:
value
=
int
(
value
)
*
10
return
str
(
value
),
'Hz'
except
:
pass
return
value
,
unit
return
value
,
unit
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment