Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Frida
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Coenen, Joachim
Frida
Commits
91e7f146
Commit
91e7f146
authored
8 years ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
Corrections thanks to test data from Zach.
parent
0c9970c8
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pub/share/converters/i96-to-yda
+28
-24
28 additions, 24 deletions
pub/share/converters/i96-to-yda
with
28 additions
and
24 deletions
pub/share/converters/i96-to-yda
+
28
−
24
View file @
91e7f146
...
...
@@ -10,9 +10,8 @@ PROGNAME = "i96-to-y96"
class
FlowSeq
(
list
):
pass
class
FlowODict
(
OrderedDict
):
pass
def
improved_dump
(
data
,
stream
=
None
,
Dumper
=
yaml
.
Dumper
,
**
kwds
):
class
ImprovedDumper
(
Dumper
):
pass
def
improved_dump
(
data
,
stream
=
None
,
**
kwds
):
class
ImprovedDumper
(
yaml
.
Dumper
):
pass
def
odict_representer
(
dumper
,
data
):
return
dumper
.
represent_mapping
(
yaml
.
resolver
.
BaseResolver
.
DEFAULT_MAPPING_TAG
,
...
...
@@ -28,11 +27,11 @@ def improved_dump(data, stream=None, Dumper=yaml.Dumper, **kwds):
data
,
flow_style
=
True
)
ImprovedDumper
.
add_representer
(
OrderedDict
,
odict_representer
)
ImprovedDumper
.
add_representer
(
FlowSeq
,
flowseq_representer
)
ImprovedDumper
.
add_representer
(
FlowODict
,
flowodict_representer
)
ImprovedDumper
.
add_representer
(
FlowSeq
,
flowseq_representer
)
return
yaml
.
dump
(
data
,
stream
,
ImprovedDumper
,
allow_unicode
=
True
,
encoding
=
'
utf-8
'
,
default_flow_style
=
False
,
indent
=
4
,
width
=
7
0
,
**
kwds
)
default_flow_style
=
False
,
indent
=
2
,
width
=
8
0
,
**
kwds
)
# Parse block number ib of ta, starting with line ita.
# Return tuple ita,bh, where ita is first line of next block,
...
...
@@ -54,7 +53,7 @@ def readBlock(ib, ta, ita):
sys
.
exit
(
1
)
return
ita
+
1
,
bh
key
=
ta
[
ita
][:
ioffs
].
strip
()
val
=
ta
[
ita
][
ioffs
:]
.
strip
()
val
=
ta
[
ita
][
ioffs
:]
bh
[
key
]
=
val
# Print error message and terminate.
...
...
@@ -98,41 +97,46 @@ ita = 1
ita
,
bh
=
readBlock
(
2
,
ta
,
ita
)
if
not
"
fil
"
in
bh
:
exxx
(
"
missing entry
'
fil
'"
)
oldname
=
bh
[
"
fil
"
]
oldname
=
bh
[
"
fil
"
]
.
strip
(
'
\t\r\n\0
'
)
ita
,
bh
=
readBlock
(
3
,
ta
,
ita
)
if
not
"
?cu
"
in
bh
:
exxx
(
"
missing entry
'
?cu
'"
)
if
bh
[
"
?cu
"
]
!=
"
0
"
:
if
(
"
?cu
"
in
bh
)
and
(
int
(
bh
[
"
?cu
"
])
!=
0
):
exxx
(
"
this is not a data file, but a curve, which is currently not supported
"
)
ita
,
bh
=
readBlock
(
4
,
ta
,
ita
)
for
key
,
val
in
bh
.
items
():
rpar
=
OrderedDict
()
s1
=
val
[:
24
]
s2
=
val
[
24
:]
rpar
[
"
name
"
]
=
key
rpar
[
"
unit
"
]
=
s1
.
strip
()
rpar
[
"
val
"
]
=
float
(
s2
.
strip
())
rpar
[
"
stdv
"
]
=
0
out
[
"
RPar
"
].
append
(
rpar
)
try
:
rpar
=
OrderedDict
()
s1
=
val
[:
24
]
s2
=
val
[
24
:]
rpar
[
"
name
"
]
=
key
rpar
[
"
unit
"
]
=
s1
.
strip
()
rpar
[
"
val
"
]
=
float
(
s2
.
strip
())
rpar
[
"
stdv
"
]
=
0
out
[
"
RPar
"
].
append
(
rpar
)
except
ValueError
as
err
:
exxx
(
"
Error in rpar {%s: %s}: %s
"
%
(
key
,
val
,
err
))
ita
,
bh
=
readBlock
(
5
,
ta
,
ita
)
zcoord
=
[]
for
key
,
val
in
bh
.
items
():
if
key
==
"
z2
"
:
exxx
(
"
z2 not yet supported; please send input file to Joachim
"
)
coord
=
FlowODict
()
s1
=
val
[:
24
]
s2
=
val
[
24
:]
coord
[
"
name
"
]
=
s1
.
strip
()
coord
[
"
unit
"
]
=
s2
.
strip
()
out
[
"
Coord
"
][
key
]
=
coord
if
key
[:
1
]
==
"
z
"
:
zcoord
.
append
(
coord
)
else
:
out
[
"
Coord
"
][
key
]
=
coord
if
len
(
coord
)
>
0
:
out
[
"
Coord
"
][
"
z
"
]
=
zcoord
ita
,
bh
=
readBlock
(
6
,
ta
,
ita
)
for
key
,
val
in
bh
.
items
():
out
[
"
History
"
].
append
(
key
)
out
[
"
History
"
].
append
(
"
old filename:
"
+
oldname
)
out
[
"
History
"
].
append
(
"
%s-%s: converted %s.i96 -> .yda
"
%
(
PROGNAME
,
VERSION
,
stem
)
)
out
[
"
History
"
].
append
(
key
.
rstrip
(
'
\t\r\n\0
'
)
)
out
[
"
History
"
].
append
(
"
old filename:
"
+
oldname
)
out
[
"
History
"
].
append
(
"
%s-%s: converted %s.i96 -> .yda
"
%
(
PROGNAME
,
VERSION
,
stem
)
)
for
i
in
range
(
3
):
m
=
re
.
match
(
r
'
\(.+\)
'
,
ta
[
ita
])
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment