View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015125ParaView(No Category)public2014-11-13 10:522015-01-29 10:50
ReporterAndy Bauer 
Assigned ToDan Lipsa 
PriorityhighSeverityminorReproducibilityhave not tried
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target Version4.3Fixed in Version4.3 
Summary0015125: Python Calculator is missing a lot of information
DescriptionWith the changes of moving some of the functionality from ParaView to VTK for the Python calculator filter, some of the functionality was lost. An incomplete list of the functions at http://www.itk.org/Wiki/ParaView/Users_Guide/Python_Calculator [^] that are no longer available are divide() and reciprocal(). From what I can tell there is no way to divide an array with more than one component by an array with just one component. Additionally, single quotes can't be in the expression e.g. "inputs[0].PointData['RTData']" doesn't work. Attached is a ParaView Python script that demonstrates some of the problems. I think this needs to be fixed before PV 4.3 is released.
Additional InformationVTK commit
==========
commit 3a9d5a6a893d9df21f61efcc6b97f5a73ae516ec
Author: Dan Lipsa <dan.lipsa@kitware.com>
Date: Tue Dec 16 15:25:19 2014 -0500

    Reshape numpy.ndarrays so that the can be combined through operators.
    
    An array G of shape (n,3) resulted from computing the
    gradient on a scalar array S of shape (n,) cannot be added together without
    reshaping.
    G + expand_dims(S,1) works,
    G + S gives an error:
    ValueError: operands could not be broadcast together with shapes (n,3) (n,)
    
    This commit computes this reshape operation automatically by appending 1s
    to the dimensions of the array with fewest dimensions.
    
    Change-Id: I0a0eaeecf5063fac1c8b71b9d32472bbc41d42c8
TagsNo tags attached.
ProjectTBD
Topic Namepython-calc-15125
Typeusability
Attached Files? file icon testpc.py [^] (1,359 bytes) 2014-11-13 10:52

 Relationships

  Notes
(0033804)
Andy Bauer (developer)
2014-11-13 10:59

As a jump start, the files that need to be changed are:
VTK/Wrapping/Python/vtk/numpy_interface/algorithms.py
and
VTK/Wrapping/Python/vtk/numpy_interface/internal_algorithms.py
(0033880)
Andy Bauer (developer)
2014-12-03 09:49

I did a little bit of work on this for adding in the ability to divide a multi-component array by a single component array in the Python Calculator. It may not be appropriate for VTK master but I thought I'd share it anyways. It's at http://review.source.kitware.com/#/c/18224/ [^]
(0033915)
Dan Lipsa (developer)
2014-12-09 13:55

To divide a multi-component array by a single component array use the following:

Assume G is a gradient array where G.shape is (n,3) and A is a scalar array, A.shape is (n,)

G / expand_dims(A,1)

Another longer ways is:

G / A.reshape(A.shape[0], 1)
(0033920)
Dan Lipsa (developer)
2014-12-10 10:37

ParaView
========
commit 1cb14a1c28519f45c6f5d1a795f1908ab0e5c5c1
Author: Dan Lipsa <dan.lipsa@kitware.com>
Date: Tue Dec 9 23:12:21 2014 -0500

    Move VTK: Replace " with '
    
    Change-Id: Ic3dcbb94520e6449f6b7e27f934095f9953db914

commit a5ccd94764b6356ddafba3c30e60dc2d78a1d8d6
Author: Dan Lipsa <dan.lipsa@kitware.com>
Date: Mon Dec 8 11:01:58 2014 -0500

    FIX: Replace internal comment character to " (from ').
    
    This way strings in Python are like this: '.... "..." ...'.
    
    Change-Id: Ic084a4480f5f1b83cec84904a3670318aa504945

VTK
===
commit 6a07cbf5d7700a68e57aa6b57cb03f1002765dc6
Author: Dan Lipsa <dan.lipsa@kitware.com>
Date: Tue Dec 9 22:16:40 2014 -0500

    Replace " with '
    
    Change-Id: I8cf716c72ebec68e3f07ca9fd9a5932e229da54f

commit c53e588a69e02ca38495105cde7e0857a3b8ad07
Author: Dan Lipsa <dan.lipsa@kitware.com>
Date: Tue Dec 9 17:44:15 2014 -0500

    Fix non asci quote in comment.
    
    Change-Id: I593b1d1d28e450f694fb6ab3d2e7748ce5555e41

commit 3dab33d8f79cd1e848889ac5974ad69ef7368b81
Author: Dan Lipsa <dan.lipsa@kitware.com>
Date: Mon Dec 8 11:00:56 2014 -0500

    Add missing numpy functions previously available in ParaView 4.1.
    
    Functions added: negative, reciprocal, square, rint, divide, multiply,
    add, subtract, mod, remainder, power, hypot.
    
    Change-Id: I8f579387b7f0871904f616631ae4122a154a8f9a
(0033948)
Utkarsh Ayachit (administrator)
2014-12-13 08:45

Topics merged into master (v4.2.0-276-g7d070dc):
        cleaner_multislice_view
        finer-linear-scalar-bar-increments
(VTK) python-calc-15125
        python-view-15122
        simple-streaming-source
        sorting-15130
(0033976)
Dan Lipsa (developer)
2014-12-16 16:37

Additional VTK commit
=====================
commit 3a9d5a6a893d9df21f61efcc6b97f5a73ae516ec
Author: Dan Lipsa <dan.lipsa@kitware.com>
Date: Tue Dec 16 15:25:19 2014 -0500

    Reshape numpy.ndarrays so that the can be combined through operators.
    
    An array G of shape (n,3) resulted from computing the
    gradient on a scalar array S of shape (n,) cannot be added together without
    reshaping.
    G + expand_dims(S,1) works,
    G + S gives an error:
    ValueError: operands could not be broadcast together with shapes (n,3) (n,)
    
    This commit computes this reshape operation automatically by appending 1s
    to the dimensions of the array with fewest dimensions.
    
    Change-Id: I0a0eaeecf5063fac1c8b71b9d32472bbc41d42c8
(0034018)
Dan Lipsa (developer)
2015-01-06 09:51

Additional VTK commit
=====================
commit ed860dc21440322da09fb1435e6ee0a458d0260b
Author: Dan Lipsa <dan.lipsa@kitware.com>
Date: Sun Dec 28 22:57:52 2014 -0500

    BUG: Account for gradient G + mean(G,0)
    
    If G is a gradient array G.shape = (n,3) we have that
    mean(G,0).shape = (3,). Appending 1s to the second array
    would result in a broadcast error, so we do not do it in
    this case.
    
    Change-Id: I7c46e1c0c4159c40511a221797487b27438cb079
(0034027)
Utkarsh Ayachit (administrator)
2015-01-08 08:01

Topics merged into master (v4.3.0-RC1-28-gca67a44):
(VTK) 15022_fix_extract_subset
(VTK) adios-update
        cgns_plugin_fixes
        pv-interactor-auto-render-optional
(VTK) python-calc-15125
        render_on_settings_change
        return-codes-for-help-and-version
        server_without_mpi
(VTK) update-vtk-20150106

 Issue History
Date Modified Username Field Change
2014-11-13 10:52 Andy Bauer New Issue
2014-11-13 10:52 Andy Bauer Assigned To => Utkarsh Ayachit
2014-11-13 10:52 Andy Bauer File Added: testpc.py
2014-11-13 10:55 Utkarsh Ayachit Project VTK => ParaView
2014-11-13 10:56 Utkarsh Ayachit Target Version => bug_fix
2014-11-13 10:59 Andy Bauer Note Added: 0033804
2014-11-14 22:56 Utkarsh Ayachit Target Version bug_fix => 4.3
2014-12-02 21:15 Utkarsh Ayachit Assigned To Utkarsh Ayachit => Dan Lipsa
2014-12-03 09:49 Andy Bauer Note Added: 0033880
2014-12-04 16:27 Dan Lipsa Status backlog => active development
2014-12-09 13:55 Dan Lipsa Additional Information Updated
2014-12-09 13:55 Dan Lipsa Additional Information Updated
2014-12-09 13:55 Dan Lipsa Note Added: 0033915
2014-12-09 13:58 Dan Lipsa Topic Name => python-calc-15125
2014-12-09 13:58 Dan Lipsa Additional Information Updated
2014-12-10 10:37 Dan Lipsa Note Added: 0033920
2014-12-13 08:43 Utkarsh Ayachit Status active development => gatekeeper review
2014-12-13 08:43 Utkarsh Ayachit Resolution open => fixed
2014-12-13 08:44 Utkarsh Ayachit Fixed in Version => git-master
2014-12-13 08:45 Utkarsh Ayachit Status gatekeeper review => customer review
2014-12-13 08:45 Utkarsh Ayachit Note Added: 0033948
2014-12-16 16:37 Dan Lipsa Status customer review => active development
2014-12-16 16:37 Dan Lipsa Additional Information Updated
2014-12-16 16:37 Dan Lipsa Note Added: 0033976
2015-01-02 10:43 Utkarsh Ayachit Fixed in Version git-master => 4.3
2015-01-06 09:51 Dan Lipsa Note Added: 0034018
2015-01-06 09:51 Dan Lipsa Status active development => gatekeeper review
2015-01-08 08:01 Utkarsh Ayachit Fixed in Version 4.3 => git-master
2015-01-08 08:01 Utkarsh Ayachit Status gatekeeper review => customer review
2015-01-08 08:01 Utkarsh Ayachit Note Added: 0034027
2015-01-11 09:25 Utkarsh Ayachit Fixed in Version git-master => 4.3
2015-01-29 10:50 Andy Bauer Status customer review => closed


Copyright © 2000 - 2018 MantisBT Team