Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
K
klaus_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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Eteri
klaus_wendelin
Commits
dfecfe12
Commit
dfecfe12
authored
Sep 21, 2018
by
Klaus Wölfel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Data Array View: allow strucutred view of plain array
parent
cc43b18a
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 @
dfecfe12
...
...
@@ -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 @
dfecfe12
...
...
@@ -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