mantidproject / mantid

Main repository for Mantid code
https://www.mantidproject.org
GNU General Public License v3.0
210 stars 122 forks source link

Generate Q-vector file for Schultz #6966

Closed peterfpeterson closed 9 years ago

peterfpeterson commented 11 years ago

Here is the email he sent with the request:

Just to follow up, I would like to have a Mantid algorithm that produces an event file list of Qx,Qy,Qz for each event. The Q coordinates are not pixels or voxels, but just calculated coordinates. In ISAW, this is accomplished with the EventToEventQ operator created by Dennis.

Below is a portion of a Python script which reads the binary file.

     # Read the events from binary file----------------------------- - - - 
     events_fname = events_directory + 'TOPAZ_' + srun + '_EventsToQ.bin'
     input = open(events_fname, 'rb')
     print 'The EventsToQ.bin file is ' + events_fname
     print ''
     numberOfEvents = 0
     while True:
         # if numberOfEvents == 1e05: break

         lineString = input.read(12)
         if lineString == "": break
         Qx, Qy, Qz = struct.unpack('fff', lineString)  # unpack binary data
         numberOfEvents = numberOfEvents + 1
         if (numberOfEvents % 100000) == 0: print '\rEvent %.3e'  % numberOfEvents,
peterfpeterson commented 9 years ago

This issue was originally trac ticket 6120