`transform_precessing_spins` fails with array input
After this commit afb2d129, which simplifies gw.conversion.transform_precessing_spins
, the function fails with an array input like in this example:
args = ([1.4, 1.4, 1.4], [0.6, 0.6, 0.6], [0.3, 0.3, 0.3], [0.4, 0.4, 0.4], [0.5, 0.5, 0.5], [0.1, 0.1, 0.1], [0.2, 0.2, 0.2], [90., 90., 90.], [80., 80., 80.], [11., 11., 11.], [0.7, 0.7, 0.7])
npargs = np.array(args)
transform_precessing_spins(*npargs)
It returns with the errors:
TypeError: float() argument must be a string or a number, not 'list'
and
ValueError: setting an array element with a sequence.
I have tried to modify slightly the function by explicitly stating the number of outputs, like this:
@np.vectorize
def vectorised_SimInspiralTransformPrecessingNewInitialConditions(*args):
_1, _2, _3, _4, _5, _6, _7 = \
SimInspiralTransformPrecessingNewInitialConditions(*args)
return _1, _2, _3, _4, _5, _6, _7
and it works. My guess is without the explicit output, the vectorise
function handles them collectively as a tuple, which would fail during array assignment.