Ticket #4071 (closed: fixed)

Opened 9 years ago

Last modified 5 years ago

Allow numpy arrays to be passed into properties through python interface

Reported by: Martyn Gigg Owned by: Martyn Gigg
Priority: major Milestone: Release 2.0
Component: Mantid Keywords:
Cc: Blocked By:
Blocking: Tester: Andrei Savici

Description


Change History

comment:1 Changed 9 years ago by Martyn Gigg

  • Status changed from new to accepted

comment:2 Changed 9 years ago by Martyn Gigg

Refs #4071. Basics of handling sequence types for Python.

Changeset: 2b0c445bc9198c85f2c108eeed30fc77a68bee3f

comment:3 Changed 9 years ago by Martyn Gigg

Refs #4071. Fix the RHEL5 Py_ssize_t problem

Changeset: d3d9eebf403f74eca809eb1c23a336aabe93f2df

comment:4 Changed 9 years ago by Martyn Gigg

Refs #4071. Fix windows and RHEL5 builds.

Changeset: 690802336497e20c9eb9acfa07ee810738dc8b3f

comment:5 Changed 9 years ago by Martyn Gigg

Refs #4071. Fix windows linker errors and warnings.

Changeset: 318cb053c78e2c699a607c4cd4dcebafe2aca869

comment:6 Changed 9 years ago by Martyn Gigg

Refs #4071. Fix windows linker errors?.

Changeset: 319f8bc22eccde2e408454092f1bb89000f5b045

comment:7 Changed 9 years ago by Martyn Gigg

Refs #4071. Windows doesn't like two python tests.

Changeset: bdbd65f4977f64a67dadecae1b14133488446c6c

comment:8 Changed 9 years ago by Martyn Gigg

Refs #4071. Basics of handling sequence types for Python.

Changeset: 2b0c445bc9198c85f2c108eeed30fc77a68bee3f

comment:9 Changed 9 years ago by Martyn Gigg

Refs #4071. Fix the RHEL5 Py_ssize_t problem

Changeset: d3d9eebf403f74eca809eb1c23a336aabe93f2df

comment:10 Changed 9 years ago by Martyn Gigg

Refs #4071. Fix windows and RHEL5 builds.

Changeset: 690802336497e20c9eb9acfa07ee810738dc8b3f

comment:11 Changed 9 years ago by Martyn Gigg

Refs #4071. Fix windows linker errors and warnings.

Changeset: 318cb053c78e2c699a607c4cd4dcebafe2aca869

comment:12 Changed 9 years ago by Martyn Gigg

Refs #4071. Fix windows linker errors?.

Changeset: 319f8bc22eccde2e408454092f1bb89000f5b045

comment:13 Changed 9 years ago by Martyn Gigg

Refs #4071. Windows doesn't like two python tests.

Changeset: bdbd65f4977f64a67dadecae1b14133488446c6c

comment:14 Changed 9 years ago by Martyn Gigg

Refs #4071. More property type exports.

Changeset: 30249fce62fe11611907e16f9f0185aa225a5ea7

comment:15 Changed 9 years ago by Martyn Gigg

Refs #4071. Adding sequence support for properties.

Changeset: 36426cc7e7905bc6ab8a96cf33d4345992923f1b

comment:16 Changed 9 years ago by Martyn Gigg

Refs #4071. Numpy float arrays now make it into properties.

There is still an issue with types convertible to a C++ double that needs to be resolved. It involves being able to cast correctly from a void* ptr.

Changeset: b9a720358ceec88d2bffc1add1a6f7e2acb47fe1

comment:17 Changed 9 years ago by Martyn Gigg

Refs #4071. Improve passing numpy arrays to vector<double> properties.

If a user passes an integer type numpy array to a vector<double> property it will now be accepted rather than throwing a conversion error as before.

Changeset: e08602d38365bffeed8cb1c299a52f020176e7c0

comment:18 Changed 9 years ago by Martyn Gigg

Refs #4071. Add back second Python/C++ test.

I have added a cxxtest global fixture that should ensure the python interpreter is only called once. This should fix the windows tests.

Changeset: 028418df493e6c0ef35751e015b747237e0dbfdc

comment:19 Changed 9 years ago by Martyn Gigg

Refs #4071. Fix PythonInterface tests on Windows.

The issue was that it couldn't find the python pyd files. They are now copied into the mantid package instead of being moved. In the process of this there was some CMake stuff that was duplicated so that has been removed and a single function used.

Changeset: c90d013cbde6f7bf52b3ff9db2de3be280b98687

comment:20 Changed 9 years ago by Martyn Gigg

Refs #4071. Git Gui decided not to stage my change...

Changeset: 0abf82a36f2973768a214588bec496422ef1ece6

comment:21 Changed 9 years ago by Martyn Gigg

Refs #4071. Handle a few more numpy data types.

Changeset: acd508b9ab7ceef9e8202c7ba44c78288dfe2af5

comment:22 Changed 9 years ago by Martyn Gigg

  • Status changed from accepted to verify
  • Resolution set to fixed

That should do the property side of it.

comment:23 Changed 9 years ago by Martyn Gigg

Refs #4071. More property type exports.

Changeset: 30249fce62fe11611907e16f9f0185aa225a5ea7

comment:24 Changed 9 years ago by Martyn Gigg

Refs #4071. Adding sequence support for properties.

Changeset: 36426cc7e7905bc6ab8a96cf33d4345992923f1b

comment:25 Changed 9 years ago by Martyn Gigg

Refs #4071. Numpy float arrays now make it into properties.

There is still an issue with types convertible to a C++ double that needs to be resolved. It involves being able to cast correctly from a void* ptr.

Changeset: b9a720358ceec88d2bffc1add1a6f7e2acb47fe1

comment:26 Changed 9 years ago by Martyn Gigg

Refs #4071. Improve passing numpy arrays to vector<double> properties.

If a user passes an integer type numpy array to a vector<double> property it will now be accepted rather than throwing a conversion error as before.

Changeset: e08602d38365bffeed8cb1c299a52f020176e7c0

comment:27 Changed 9 years ago by Martyn Gigg

Refs #4071. Add back second Python/C++ test.

I have added a cxxtest global fixture that should ensure the python interpreter is only called once. This should fix the windows tests.

Changeset: 028418df493e6c0ef35751e015b747237e0dbfdc

comment:28 Changed 9 years ago by Martyn Gigg

Refs #4071. Fix PythonInterface tests on Windows.

The issue was that it couldn't find the python pyd files. They are now copied into the mantid package instead of being moved. In the process of this there was some CMake stuff that was duplicated so that has been removed and a single function used.

Changeset: c90d013cbde6f7bf52b3ff9db2de3be280b98687

comment:29 Changed 9 years ago by Martyn Gigg

Refs #4071. Git Gui decided not to stage my change...

Changeset: 0abf82a36f2973768a214588bec496422ef1ece6

comment:30 Changed 9 years ago by Martyn Gigg

Refs #4071. Handle a few more numpy data types.

Changeset: acd508b9ab7ceef9e8202c7ba44c78288dfe2af5

comment:31 Changed 9 years ago by Andrei Savici

  • Status changed from verify to verifying
  • Tester set to Andrei Savici

comment:32 Changed 9 years ago by Andrei Savici

  • Status changed from verifying to closed

I've tested the following:

from numpy import *
PolynomialCorrection(InputWorkspace='a',OutputWorkspace='x1',Coefficients=arange(5)+1)

The history shows

PolynomialCorrection(InputWorkspace='a',OutputWorkspace='x1',Coefficients='1,2,3,4,5')

I hope that this is what the ticket was supposed to solve

comment:33 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 4918

Note: See TracTickets for help on using tickets.