﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	blockedby	blocking	notify_on_close	platform	project
1063	Collections don't accept Numpy arrays with mismatched type	Tristan Croll	Tom Goddard	"{{{
import numpy
m = session.models.list()[0]
m.atoms.coords = m.atoms.coords.astype(numpy.float32)
---------------------------------------------------------------------------
ArgumentError                             Traceback (most recent call last)
<ipython-input-3-98d541f0a9d6> in <module>()
----> 1 m.atoms.coords = m.atoms.coords.astype(numpy.float32)

~/apps/chimerax/lib/python3.6/site-packages/chimerax/core/atomic/molc.py in set_prop(self, values)
    194                     va[:] = values
    195                     v = pointer(va)
--> 196                 cset(self._c_pointers, n, v)
    197 
    198         return property(get_prop, set_prop, doc = doc)

ArgumentError: argument 3: <class 'TypeError'>: expected LP_c_double instance instead of LP_c_float
}}}

This came up for me because I have a Collection class with a 64-bit cvec_property that uses Atoms.elements.masses (which returns a float32 array) as an input to calculate spring constants. Of course I can cast it to the required type myself, but would it be better to change line 181 of molc.py to the following?

{{{
                if isinstance(values,ndarray) and values.ndim == vdim and values.dtype == value_type:
}}}"	defect	closed	moderate		Core		not a bug						all	ChimeraX
