[cctbxbb] problem when using Python to convert from numpy array to flex.int array

Jun Aishima jun.aishima at synchrotron.org.au
Mon May 2 20:34:46 PDT 2016


I have used the bootstrap method to build cctbx with my own Python (in a virtual environment). I setup my virtual environment, then source $CCTBX/build/setpaths.sh (bash).

I am currently trying to turn a detector image (uint16) read in with fabio, which results in a numpy ndarray, and then turn that into a scitbx flex array. Since I've had problems doing this in my system, I've written a little script that reproduces the problem:

**********
import fabio
file=fabio.open('testcrystal_1_001.img') # adsc detector image
file.data[0]
from scitbx.array_family import flex
flex.int(file.data[3071]) # this is a 3072x3072 image. For some reason, row 0 causes no problems.
**********
At the end of this email is the stack trace I get.

Has anybody had similar issues? I first saw this when I was trying to convert the entire image into a flex array, but now I've seen it with only one row [3071], while still working for [0:1500], so it doesn't seem like a simple memory issue. Any help would be appreciated.

Jun Aishima

**********

show_stack(1): <stdin>(1) <module>
libc backtrace (23 frames, most recent call last):
  /home/aishimaj/spotter/bin/python() [0x414199]
  /lib64/libc.so.6(__libc_start_main+0xfd) [0x366d21ed5d]
  /home/aishimaj/spotter/bin/python(Py_Main+0xb22) [0x4150b2]
  /home/aishimaj/spotter/bin/python(PyRun_AnyFileExFlags+0x6b) [0x4ce82b]
  /home/aishimaj/spotter/bin/python(PyRun_InteractiveLoopFlags+0x4e) [0x4ce01e]
  /home/aishimaj/spotter/bin/python(PyRun_InteractiveOneFlags+0x1ff) [0x4cdd9f]
  /home/aishimaj/spotter/bin/python(PyEval_EvalCode+0x32) [0x4ad362]
  /home/aishimaj/spotter/bin/python(PyEval_EvalCodeEx+0x877) [0x4ad257]
  /home/aishimaj/spotter/bin/python(PyEval_EvalFrameEx+0x6a0b) [0x4aa8bb]
  /home/aishimaj/spotter/bin/python(PyObject_Call+0x47) [0x419ba7]
  /home/aishimaj/spotter/bin/python() [0x46df9f]
  /home/aishimaj/spotter/bin/python() [0x47623f]
  /home/aishimaj/spotter/bin/python(PyObject_Call+0x47) [0x419ba7]
  /home/aishimaj/spotter/bin/python() [0x42296f]
  /home/aishimaj/spotter/bin/python(PyObject_Call+0x47) [0x419ba7]
  /beamline/phenix/bootstrap/build/lib/libboost_python.so(+0x2d088) [0x7f5561101088]
  /beamline/phenix/bootstrap/build/lib/libboost_python.so(boost::python::handle_exception_impl(boost::function0<void>)+0x43) [0x7f5561112013]
  /beamline/phenix/bootstrap/build/lib/libboost_python.so(+0x2fe08) [0x7f5561103e08]
  /beamline/phenix/bootstrap/build/lib/libboost_python.so(boost::python::objects::function::call(_object*, _object*) const+0xef) [0x7f55611031ff]
  /beamline/phenix/bootstrap/build/lib/scitbx_array_family_flex_ext.so(boost::python::objects::signature_py_function_impl<boost::python::detail::caller<scitbx::af::versa<int, scitbx::af::flex_grid<scitbx::af::small<long, 10ul> > >* (*)(boost::python::numeric::array const&), boost::python::detail::constructor_policy<boost::python::default_call_policies>, boost::mpl::vector2<scitbx::af::versa<int, scitbx::af::flex_grid<scitbx::af::small<long, 10ul> > >*, boost::python::numeric::array const&> >, boost::mpl::v_item<void, boost::mpl::v_item<boost::python::api::object, boost::mpl::v_mask<boost::mpl::vector2<scitbx::af::versa<int, scitbx::af::flex_grid<scitbx::af::small<long, 10ul> > >*, boost::python::numeric::array const&>, 1>, 1>, 1> >::operator()(_object*, _object*)+0x52) [0x7f555ed68452]
  /beamline/phenix/bootstrap/build/lib/scitbx_array_family_flex_ext.so(scitbx::af::boost_python::flex_int_from_numpy_array(boost::python::numeric::array const&)+0x29) [0x7f555f039f79]
  /beamline/phenix/bootstrap/build/lib/scitbx_array_family_flex_ext.so(scitbx::af::versa<int, scitbx::af::flex_grid<scitbx::af::small<long, 10ul> > > scitbx::af::boost_python::versa_flex_from_numpy_array<int>(boost::python::numeric::array const&)+0x1c87) [0x7f555f0415c7]
  /lib64/libc.so.6() [0x366d2326a0]
Segmentation fault (Python and libc call stacks above)
                This crash may be due to a problem in any imported
                Python module, including modules which are not part
                of the cctbx project. To disable the traps leading
                to this message, define these environment variables
                (e.g. assign the value 1):
                    BOOST_ADAPTBX_FPE_DEFAULT
                    BOOST_ADAPTBX_SIGNALS_DEFAULT
                This will NOT solve the problem, just mask it, but
                may allow you to proceed in case it is not critical.

Jun Aishima | Post Doc - MX | Australian Synchrotron
p: (03) 8540 4114 | f: (03) 8540 4200
jun.aishima at synchrotron.org.au<mailto:jun.aishima at synchrotron.org.au> | www.synchrotron.org.au
800 Blackburn Road, Clayton, Victoria 3168

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://phenix-online.org/pipermail/cctbxbb/attachments/20160503/0608a3f3/attachment.htm>


More information about the cctbxbb mailing list