Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Chaofan Chen
ogs
Commits
a4feaf28
Commit
a4feaf28
authored
5 months ago
by
Max Jaeschke
Committed by
Dmitri Naumov
5 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Black formatting for pre commit
parent
442c8b2e
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
Tests/Data/Parabolic/T/3D_Beier_sandbox/read_values_from_prj_curve.py
+16
-14
16 additions, 14 deletions
...arabolic/T/3D_Beier_sandbox/read_values_from_prj_curve.py
with
16 additions
and
14 deletions
Tests/Data/Parabolic/T/3D_Beier_sandbox/read_values_from_prj_curve.py
+
16
−
14
View file @
a4feaf28
...
...
@@ -7,25 +7,27 @@ import numpy as np
file
=
inspect
.
getfile
(
inspect
.
currentframe
())
prj_path
=
os
.
path
.
split
(
os
.
path
.
realpath
(
file
))[
0
]
#read prj-data
tree
=
ET
.
parse
(
prj_path
+
'
/beier_sandbox.prj
'
)
#
read prj-data
tree
=
ET
.
parse
(
prj_path
+
"
/beier_sandbox.prj
"
)
root
=
tree
.
getroot
()
curve_elements
=
root
.
findall
(
'
.//curve
'
)
curve_elements
=
root
.
findall
(
"
.//curve
"
)
for
curve
in
curve_elements
:
curve_name
=
curve
.
find
(
'
name
'
).
text
curve_name
=
curve
.
find
(
"
name
"
).
text
# read coordinates
coords_element
=
curve
.
find
(
'
coords
'
)
coords_text
=
coords_element
.
text
#
replace("\n", " ")
coords_array
=
np
.
fromstring
(
coords_text
,
dtype
=
float
,
sep
=
'
'
)
coords_element
=
curve
.
find
(
"
coords
"
)
coords_text
=
coords_element
.
text
#
replace("\n", " ")
coords_array
=
np
.
fromstring
(
coords_text
,
dtype
=
float
,
sep
=
"
"
)
# Store array in binary format
coords_array
.
astype
(
'
<f8
'
).
tofile
(
prj_path
+
f
'
/
{
curve_name
}
_coords.bin
'
)
# < - little Endian | f - float | 8 - Bytes equal to 64bit(double)
coords_array
.
astype
(
"
<f8
"
).
tofile
(
prj_path
+
f
"
/
{
curve_name
}
_coords.bin
"
)
# < - little Endian | f - float | 8 - Bytes equal to 64bit(double)
# read values
values_element
=
curve
.
find
(
'
values
'
)
values_text
=
values_element
.
text
#replace("\n", " ")
values_array
=
np
.
fromstring
(
values_text
,
dtype
=
float
,
sep
=
'
'
)
values_array
.
astype
(
'
<f8
'
).
tofile
(
prj_path
+
f
'
/
{
curve_name
}
_values.bin
'
)
# < - little Endian | f - float | 8 - Bytes equal to 64bit(double)
values_element
=
curve
.
find
(
"
values
"
)
values_text
=
values_element
.
text
# replace("\n", " ")
values_array
=
np
.
fromstring
(
values_text
,
dtype
=
float
,
sep
=
"
"
)
values_array
.
astype
(
"
<f8
"
).
tofile
(
prj_path
+
f
"
/
{
curve_name
}
_values.bin
"
)
# < - little Endian | f - float | 8 - Bytes equal to 64bit(double)
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