[Nexus] Nexus with python on windows

Jon Wright wright at esrf.fr
Mon Nov 19 21:13:33 GMT 2007


Hi Darren, Andy;

There is a nice video introduction to PyTables at:

http://www.carabos.com/videos/pytables-1-intro

I'd be curious as to how hard it is to write a Nexus compliant hdf file 
using PyTables.

 > I know he has grappled with Python and Nexus in the past

Hmm... clearly not an expert, I lost that fight. Freddie did compile the 
python bindings for us a while back. Having gotten the executables I 
tried again just now and am not able to get past the testcase which 
comes with them:

  >>> import nxpython
  >>> h = nxpython.nx_open("nxpython_test.nxs", nxpython.NXACC_CREATE)
  >>> type(h)
  <type 'PySwigObject'>
  >>> help(h)
  [...]
  >>> help(nxpython)
  [...]
  >>> for i in dir(nxpython):print type(getattr(nxpython,i)),i
  [...]
  # start of C example:
  >>> nxpython.nx_putattr (h , "user_name", "Joe Bloggs")
  Traceback (most recent call last):
    File "<stdin>", line 1, in ?
  TypeError: in method 'nx_putattr', argument 3 of type 'void *'

Any suggestions? My impression was that the Nexus python bindings are 
not used very much in comparison to PyTables. Similarly, does anyone 
even have an example nexus file with monochromatic x-ray diffraction 
data from a 2D area detector ?

Jon

PS: If the data is for crystallography you might be interested in 
CBFlib, which has some python bindings. It records data in imgcif format.



Andy Gotz wrote:
> Hi Darren,
> 
> I do not know the answer to your question as I am no expert on Python 
> and Nexus. But I am copying this email to one of our local Python 
> experts (Jon Wright). I know he has grappled with Python and Nexus in 
> the past. He alos has Nu,py experience. I am sure there are other 
> experts on this list who can help you too.
> 
> Andy
> 
> Darren Dale wrote:
>> On Mon Jul 30 14:11:11 BST 2007 Akeroyd, FA (Freddie) wrote:
>>  
>>> I've compiled the python binding for Windows and added a link to then
>>> from
>>> http://download.nexusformat.org/kits/windows/
>>>
>>> These binding are swig based and provide a direct interface to the usual
>>> NeXus API functions; I'm afraid there is currently no support for
>>> Numeric/numpy
>>>     
>>
>> Has there been any discussion of supporting numpy? If not, is there 
>> any interest in discussing it now?
>>
>> I'm a staff scientist at the Cornell High Energy Synchrotron Source. 
>> I'm working on a project that interacts with Certified Scientific's 
>> spec server to acquire and then process data. I was considering using 
>> pytables, but NeXus might be a better fit. I have very little 
>> experience working with pytables, and none with NeXus, so any comments 
>> or discussion would be welcome.
>>
>> Thanks,
>> Darren
>>
>>   
> 




More information about the NeXus mailing list