Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Klaus Wölfel
wendelin
Commits
6252f617
Commit
6252f617
authored
Sep 21, 2018
by
Klaus Wölfel
Committed by
Eteri
Jan 28, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Data Array View: allow strucutred view of plain array
parent
a9895411
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
15 deletions
+16
-15
bt5/erp5_wendelin/DocumentTemplateItem/portal_components/document.erp5.DataArrayLine.py
...lateItem/portal_components/document.erp5.DataArrayLine.py
+2
-2
bt5/erp5_wendelin/DocumentTemplateItem/portal_components/document.erp5.DataArrayViewLine.py
...Item/portal_components/document.erp5.DataArrayViewLine.py
+14
-13
No files found.
bt5/erp5_wendelin/DocumentTemplateItem/portal_components/document.erp5.DataArrayLine.py
View file @
6252f617
...
...
@@ -69,9 +69,9 @@ class DataArrayLine(DataArray):
if
dtype_expression
is
None
:
dtype
=
np
.
dtype
(
array_view
.
dtype
)
else
:
dtype
=
evaluateExpressionFromString
(
dtype
=
np
.
dtype
(
evaluateExpressionFromString
(
createExpressionContext
(
None
,
portal
=
getindex
),
dtype_expression
)
dtype_expression
)
)
dtype
.
names
=
name_list
return
array_view
.
view
(
dtype
=
dtype
)
return
array_view
bt5/erp5_wendelin/DocumentTemplateItem/portal_components/document.erp5.DataArrayViewLine.py
View file @
6252f617
...
...
@@ -51,27 +51,28 @@ class DataArrayViewLine(DataArray):
"""
Get numpy view of Parent Data Array according to index.
"""
zbigarray
=
self
.
getPredecessorValue
().
getArray
()
getindex
=
GetIndex
(
"getindex"
)
index_expression
=
self
.
getIndexExpression
()
dtype_expression
=
self
.
getDtypeExpression
()
name_list
=
self
.
getNameList
()
index
=
evaluateExpressionFromString
(
createExpressionContext
(
None
,
portal
=
getindex
),
"python: portal[%s]"
%
self
.
getIndexExpression
()
"python: portal[%s]"
%
index_expression
)
zbigarray
=
self
.
getPredecessorValue
().
getArray
()
try
:
array_view
=
zbigarray
[
index
]
except
TypeError
:
array
=
zbigarray
[:]
new_dtype
=
np
.
dtype
({
name
:
array
.
dtype
.
fields
[
name
]
for
name
in
index
})
array_view
=
np
.
ndarray
(
array
.
shape
,
new_dtype
,
array
,
0
,
array
.
strides
)
name_list
=
self
.
getNameList
()
dtype_expression
=
self
.
getDtypeExpression
()
if
dtype_expression
is
not
None
or
name_list
:
if
dtype_expression
is
None
:
dtype
=
np
.
dtype
(
array_view
.
dtype
)
else
:
dtype
=
evaluateExpressionFromString
(
createExpressionContext
(
None
,
portal
=
getindex
),
dtype_expression
)
dtype
.
names
=
name_list
return
array_view
.
view
(
dtype
=
dtype
)
if
dtype_expression
is
not
None
:
dtype
=
np
.
dtype
(
evaluateExpressionFromString
(
createExpressionContext
(
None
,
portal
=
getindex
),
dtype_expression
))
if
name_list
:
dtype
.
names
=
name_list
array_view
=
array_view
.
reshape
(
array_view
.
size
,).
view
(
dtype
)
else
:
array_view
=
array_view
return
array_view
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