Thanks Nat, that hit the spot. For reference the final code I got was def main(): import sys from iotbx import reflection_file_reader for argv in sys.argv[1:]: reflection_file = reflection_file_reader.any_reflection_file( file_name = argv) if reflection_file.file_type() is None: continue miller_arrays = reflection_file.as_miller_arrays() for ma in miller_arrays: print ma.info().label_string(), E4(ma) def E4(ma): f = ma.as_intensity_array() f = f.array(data=f.data()/f.epsilons().data().as_double()) f.set_observation_type_xray_intensity() f.setup_binner(auto_binning = True) sm = f.second_moment(use_binning = True) moments = [sm.data[j] for j in f.binner().range_used()] return sum(moments) / len(moments) if __name__ == '__main__': main() Best wishes, Graeme On 13 Dec 2012, at 16:29, Nathaniel Echols wrote:
On Thu, Dec 13, 2012 at 8:18 AM,
wrote: That gave me six and a bit: specifically
sm.show() print f.second_moment(use_binning = False)
6.46063790107
The E^2 = I/<I> need to be computed in bins. After that (E^2)^2 should be fine. This got me confused - it must be in there somewhere
Ah, I think I see - look at the "data" attribute:
sm = f.second_moment(use_binning=True) print sm. data [None, 2.3279309836355044, 2.8099112859261517, 2.1769967857271175, 2.200637763782145, 2.2919308734359407, 2.000356888782398, 1.7555453224108684, 1.4836662688931992, None]
(using a dataset from the PDB) I've never fully understood what the first and last elements are supposed to mean (at least one is for "unused" data) - but you can get the elements of interested this way:
for i_bin in f.binner().range_used() : # etc.
-Nat _______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
-- This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail. Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message. Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom