[cctbxbb] Computing E^4 from an mtz file

Graeme.Winter at diamond.ac.uk Graeme.Winter at diamond.ac.uk
Thu Dec 13 03:00:26 PST 2012


Hi Folks,

Trying to write some code to return the average E^4 across (some) bins for an mtz file, I got to


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:
            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)
    sm.show()

if __name__ == '__main__':
    main()


but I have no idea how to actually extract the information I want from sm as this only has show() which gives

Graemes-MacBook-Pro:PlayPen graeme$ cctbx.python E4.py /Users/graeme/projects/sci-397/DEFAULT/scale/AUTOMATIC_DEFAULT_scaled.mtz 

unused:         - 20.8668 [  0/7  ]
bin  1: 20.8668 -  5.8873 [221/235]  2.3863
bin  2:  5.8873 -  4.6904 [216/221]  1.9823
bin  3:  4.6904 -  4.1026 [221/222]  1.9925
<snip>
bin 47:  1.6553 -  1.6435 [153/209]  2.2051
bin 48:  1.6435 -  1.6320 [143/198]  2.2021
bin 49:  1.6320 -  1.6208 [141/204]  2.7085
unused:  1.6208 -         [  0/0  ]

unused:         - 20.8668 [  0/9  ]
bin  1: 20.8668 -  7.1654 [201/225]  2.2405
bin  2:  7.1654 -  5.7261 [202/213]  1.9109
bin  3:  5.7261 -  5.0137 [216/223]  2.0162
bin  4:  5.0137 -  4.5605 [207/212]  2.0043
<snip>
bin 87:  1.6456 -  1.6393 [126/192]  2.5521
bin 88:  1.6393 -  1.6330 [122/210]  2.0195
bin 89:  1.6330 -  1.6269 [131/224]  2.6251
bin 90:  1.6269 -  1.6208 [120/212]  3.0912
unused:  1.6208 -         [  0/0  ]

Really I would like the value programatically or at least a way of getting back an array of the binned values so I can average them myself (which is obviously trivial)

Any suggestions?

Thanks,

Graeme

ps - most of this code is ripped from iotbx.reflection_statistics :o)
-- 
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
 





More information about the cctbxbb mailing list