Hi Marcin,

I do not think that this is an unreasonable burden, given what you gain as a 
result of it - the languages are probably >> 90% identical, and you get access 
to a bucket full of tools by staying in the common ground area. I appreciate 
that rewriting cctbx could be a fun challenge, but I for one don’t have time to 
do so ;-) 

Kay, quite by chance I find myself writing a jiffy script which compares 
scaled-but-unmerged data with scaled and merged data, to look at the 
distributions about the mean value - clearly I could merge the data myself 
using cctbx tools, but the aim was to compare the reflections files as they 
came from aimless - anyway, this computes a “z” score for each reflection i.e. 
(i - <i>) / sig(i) for each observation & forms a histogram:

20 ish lines of code and a few minutes later:

############

from __future__ import print_function, division

from iotbx import mtz
from scitbx.array_family import flex
import sys

merged = mtz.object(sys.argv[1])
unmerged = mtz.object(sys.argv[2])

unique_indices = merged.extract_miller_indices()
all_indices = unmerged.extract_miller_indices()
imean = merged.extract_observations('IMEAN', 'SIGIMEAN')
iuniq = unmerged.extract_observations('I', 'SIGI')

z = flex.double(iuniq.data.size(), 0.0)

for index, i in zip(unique_indices, imean.data):
  sel = (all_indices == index)
  z.set_selected(sel, (iuniq.data - i) / iuniq.sigmas)

h = flex.histogram(z, data_min=-5, data_max=5, n_slots=100)

for c, v in zip(h.slot_centers(), h.slots()):
  print(c, v)

############

thought it may help the discussion. 

best wishes Graeme


> On 7 Jun 2018, at 11:43, Marcin Wojdyr <[email protected]> wrote:
> 
> On 7 June 2018 at 05:29, [email protected]
> <[email protected]> wrote:
>> Dear Kay,
>> 
>> Yes, it’s writing code to be compatible with Python2 and Python3 - in real 
>> life they are largely idiomatically similar, with well documented 
>> differences e.g.
> 
> In other words, it's learning both Python2 and Python3 and using the
> subset of the language that works with both interpreters.
> It's an extra burden and if one is learning Python choosing any of the
> two versions will make it easier.


-- 
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


########################################################################

To unsubscribe from the CCP4BB list, click the following link:
https://www.jiscmail.ac.uk/cgi-bin/webadmin?SUBED1=CCP4BB&A=1

Reply via email to