Using SofQWNormalisedPolygon with DetectorTwoThetaRanges

I’m trying to use SofQW with a table workspace to define the 2 theta ranges of the detectors. (as described here: https://docs.mantidproject.org/nightly/algorithms/SofQW-v1.htmlSofQW v1 )

all seems OK, but i get the error:

Error in execution of algorithm SofQWNormalisedPolygon:

TableWorkspace::getColVector()const: Can not cast to proper TableCol type

Error in execution of algorithm SofQW:

TableWorkspace::getColVector()const: Can not cast to proper TableCol type

RuntimeError: TableWorkspace::getColVector()const: Can not cast to proper TableCol type

Which makes me think I have a badly formatted table.
I’m creating this over a limited range using the following script in mantid 4.1.0:
Thanks for your help!


# Create Table to hold detector angular range
tableWS = CreateEmptyTableWorkspace()

# Calculate range for PG detectors on IRIS
no_det = int(51)
det_start = int(3)
detIDList = [i+det_start for i in range(no_det)]
angle_start = np.radians(25.)
angle_end = np.radians(160.)
angles = np.linspace(angle_start, angle_end, no_det+1, endpoint = True)
min = angles[:-1]
max = angles[1:]

# Add some columns, Recognized types are: int,float,double,bool,str,V3D,long64
tableWS.addColumn(type="str",name="Detector ID")
tableWS.addColumn(type="float",name="Min two theta")
tableWS.addColumn(type="float",name="Max two theta")

# Populate the columns for three detectors
for i,j in enumerate(detIDList):
    tableWS.addRow ( ['%s sp-%s' % (i,j), min[i], max[i] ] )
    
# Give it a nice name
IRIS_PG_Det = RenameWorkspace('tableWS')

Hi Ian,

It looks like the algorithm is quite sensitive to the column types for the table. It specifically requires int, double, double as the types.

I tested the following example works for me:

import numpy as np
# Create Table to hold detector angular range
IRIS_PG_Det = CreateEmptyTableWorkspace()

# Calculate range for PG detectors on IRIS
no_det = int(51)
det_start = int(3)
detIDList = [i+det_start for i in range(no_det)]
angle_start = np.radians(25.)
angle_end = np.radians(160.)
angles = np.linspace(angle_start, angle_end, no_det+1, endpoint = True)
min = angles[:-1]
max = angles[1:]

# Add some columns, Recognized types are: int,float,double,bool,str,V3D,long64
IRIS_PG_Det.addColumn(type="int",name="Detector ID")
IRIS_PG_Det.addColumn(type="double",name="Min two theta")
IRIS_PG_Det.addColumn(type="double",name="Max two theta")

# Populate the columns for three detectors
for i,j in enumerate(detIDList):
    IRIS_PG_Det.addRow ([j, min[i], max[i] ] )

Hope that helps!

I’ll also update the documentation to make it the requirements of the table clearer.

Thanks Martyn - that works for me.