Ticket #5777 (closed: fixed)

Opened 8 years ago

Last modified 5 years ago

IntArrayProperty in new Python API doesn't accept ranges

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

Description

In the old API you could do

self.declareListProperty("Input", int)

and the set the property using a range

alg.setProperty("Input", "10:15")

which would yield the 6 numbers from 10->15. Trying the same on the new API with an IntArrayProperty throws an error saying it can't convert "10:15" to an int list

Change History

comment:1 Changed 8 years ago by Martyn Gigg

  • Status changed from new to accepted

comment:2 Changed 8 years ago by Martyn Gigg

Allow Python ArrayProperty to deal with ranges. Refs #5777

The Python property is actually a vector<long> so an extra template instantiation was required for the toValue function.

Changeset: ca8d42e63e8333cc4485fc4e5895cb0cf6f5b6c1

comment:3 Changed 8 years ago by Martyn Gigg

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

comment:4 Changed 8 years ago by Martyn Gigg

Allow Python ArrayProperty to deal with ranges. Refs #5777

The Python property is actually a vector<long> so an extra template instantiation was required for the toValue function.

Changeset: ca8d42e63e8333cc4485fc4e5895cb0cf6f5b6c1

comment:5 Changed 8 years ago by Andrei Savici

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

comment:6 Changed 8 years ago by Andrei Savici

  • Status changed from verifying to closed

Tried in ipython:

a=IntArrayProperty("input","10:15")
a.value

Obtained

array([10, 11, 12, 13, 14, 15])

comment:7 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 6623

Note: See TracTickets for help on using tickets.