MTZ object creation bug or feature?
I wonder if anyone has noticed the behaviour that the creation of columns in an mtz object seems to suffer from a problem. The script below creates an mtz object from three miller arrays of intensities, amplitudes and anomalous differences together with their sigmas on 5 reflections. The intention is that the mtz object should also consist of three pairs of columns ( I,SIGI and F,SIGF and DANO,SIGDANO). However the script shows that if the miller array with anomalous differences is added as the last miller array then the resulting mtz object is messed up: It has grouped F,SIGF and DANO,SIGDANO together as 10 reflections instead of just 5. Only if the miller array with anomalous differences is added as the second miller array after the intensities does the resulting mtz object contain the three distinct pairs of columns I,SIGI and F,SIGF and DANO,SIGDANO as intended each with 5 reflections. from cctbx.xray import observation_types from cctbx.array_family import flex from cctbx import miller from cctbx import crystal xs = crystal.symmetry(unit_cell=(50,50,40, 90,90,120), space_group_symbol="P3 1") mi = flex.miller_index([(1,-2,3), (0,0,-3), (1, 2, 3), (0, 1, 2), (1, 0, 2)]) ma1 = miller.array( miller.set(xs, mi), flex.double( [ 11.2, 6.3, 26.1, 14.9, 2.4 ] ), sigmas=flex.double( [ 13.6, 6.3, 24.9, 6.2, 11.1 ] ) ) ma2 = miller.array( miller.set(xs, mi), flex.double( [ 8.2, 26.3, 2.1, 4.9, 32.4 ] ), sigmas=flex.double( [ 3.6, 76.3, 2.9, 61.2, 1.1 ] ) ) ma3 = miller.array( miller.set(xs, mi), flex.double( [ 8.2, 26.3, 2.1, 4.9, 32.4 ] ), sigmas=flex.double( [ 3.6, 76.3, 2.9, 61.2, 1.1 ] ) ) mtz1 = ma1.as_mtz_dataset(column_root_label = "I", column_types = "JQ") mtz1.add_miller_array(ma2, column_root_label = "F", column_types = "FQ") mtz1.add_miller_array(ma3, column_root_label = "DANO", column_types = "DQ") mtz1.mtz_object().as_miller_arrays() # unexpected F,SIGF,DANO,SIGDANO array looks messed up mtz2 = ma1.as_mtz_dataset(column_root_label = "I", column_types = "JQ") mtz2.add_miller_array(ma3, column_root_label = "DANO", column_types = "DQ") mtz2.add_miller_array(ma2, column_root_label = "F", column_types = "FQ") mtz2.mtz_object().as_miller_arrays() # looks correct Is this a bug, a well known feature or am I simply doing something wrong? Many thanks, Rob -- Robert Oeffner, Ph.D. Research Associate, The Read Group Department of Haematology, Cambridge Institute for Medical Research University of Cambridge Cambridge Biomedical Campus The Keith Peters Building Hills Road Cambridge CB2 0XY www.cimr.cam.ac.uk/investigators/read/index.html tel: +44(0)1223 763234 -- This email has been checked for viruses by AVG. https://www.avg.com
Hi Rob,
On 30 Mar 2021, at 01:27, Robert Oeffner
wrote: Is this a bug, a well known feature or am I simply doing something wrong?
This is certainly known (http://phenix-online.org/pipermail/phenixbb/2011-October/017772.html) - it's because when F,SIGF and DANO,SIGDANO are adjacent columns they are converted to F+/SIGF+,F-/SIGF- with Observation type: xray.reconstructed_amplitude Adding: for a in mtz1.mtz_object().as_miller_arrays(): if a.observation_type().__str__() == 'xray.reconstructed_amplitude': for i,hkl in enumerate(a.indices()): print('{:4d}{:4d}{:4d} {:0.2f} {:0.2f}'.format(hkl[0], hkl[1], hkl[2], a.data()[i], a.sigmas()[i])) to your example code shows this: 1 -2 3 12.30 4.02 -1 2 -3 4.10 4.02 0 0 -3 39.45 85.31 0 0 3 13.15 85.31 1 2 3 3.15 3.24 -1 -2 -3 1.05 3.24 0 1 2 7.35 68.42 0 -1 -2 2.45 68.42 1 0 2 48.60 1.23 -1 0 -2 16.20 1.23 Best regards, Huw
Hi,
This is interesting and good to know. From F+/SIGF+,F-/SIGF one cannot
reconstruct DANO,SIGDANO if the errors are correlated and conversely
one loses information about correlations when going from DANO,SIGDANO
+ Fmean to F+/SIGF+,F-/SIGF . My preferred representation is therefore
DANO,SIGDANO + Fmean . It may be good not to make automatic
assumptions about these conversions.
Best wishes,
Gergely
On Tue, Mar 30, 2021 at 10:33 AM Huw Jenkins
Hi Rob,
On 30 Mar 2021, at 01:27, Robert Oeffner
wrote: Is this a bug, a well known feature or am I simply doing something wrong?
This is certainly known (http://phenix-online.org/pipermail/phenixbb/2011-October/017772.html) - it's because when F,SIGF and DANO,SIGDANO are adjacent columns they are converted to F+/SIGF+,F-/SIGF- with Observation type: xray.reconstructed_amplitude
Adding:
for a in mtz1.mtz_object().as_miller_arrays(): if a.observation_type().__str__() == 'xray.reconstructed_amplitude': for i,hkl in enumerate(a.indices()): print('{:4d}{:4d}{:4d} {:0.2f} {:0.2f}'.format(hkl[0], hkl[1], hkl[2], a.data()[i], a.sigmas()[i]))
to your example code shows this:
1 -2 3 12.30 4.02 -1 2 -3 4.10 4.02 0 0 -3 39.45 85.31 0 0 3 13.15 85.31 1 2 3 3.15 3.24 -1 -2 -3 1.05 3.24 0 1 2 7.35 68.42 0 -1 -2 2.45 68.42 1 0 2 48.60 1.23 -1 0 -2 16.20 1.23
Best regards,
Huw _______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
-- Gergely Katona, Professor Department of Chemistry and Molecular Biology, University of Gothenburg Box 462, 40530 Göteborg, Sweden Tel: +46-31-786-3959 / M: +46-70-912-3309 / Fax: +46-31-786-3910 Web: http://katonalab.eu, Email: [email protected]
Thank you, Huw, for your enlightening explanation of this behaviour. I'll make sure not to have adjacent F,SIGF and DANO,SIGDANO columns when creating mtz objects with cctbx. It always amazes me how such problems have been highlighted in the past on the bulletin boards. Rob On 30-03-2021 09:33, Huw Jenkins wrote:
Hi Rob,
On 30 Mar 2021, at 01:27, Robert Oeffner
wrote: Is this a bug, a well known feature or am I simply doing something wrong? This is certainly known (http://phenix-online.org/pipermail/phenixbb/2011-October/017772.html) - it's because when F,SIGF and DANO,SIGDANO are adjacent columns they are converted to F+/SIGF+,F-/SIGF- with Observation type: xray.reconstructed_amplitude
Adding:
for a in mtz1.mtz_object().as_miller_arrays(): if a.observation_type().__str__() == 'xray.reconstructed_amplitude': for i,hkl in enumerate(a.indices()): print('{:4d}{:4d}{:4d} {:0.2f} {:0.2f}'.format(hkl[0], hkl[1], hkl[2], a.data()[i], a.sigmas()[i]))
to your example code shows this:
1 -2 3 12.30 4.02 -1 2 -3 4.10 4.02 0 0 -3 39.45 85.31 0 0 3 13.15 85.31 1 2 3 3.15 3.24 -1 -2 -3 1.05 3.24 0 1 2 7.35 68.42 0 -1 -2 2.45 68.42 1 0 2 48.60 1.23 -1 0 -2 16.20 1.23
Best regards,
Huw _______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
-- Robert Oeffner, Ph.D. Research Associate, The Read Group Department of Haematology, Cambridge Institute for Medical Research University of Cambridge Cambridge Biomedical Campus The Keith Peters Building Hills Road Cambridge CB2 0XY www.cimr.cam.ac.uk/investigators/read/index.html tel: +44(0)1223 763234 -- This email has been checked for viruses by AVG. https://www.avg.com
participants (3)
-
Gergely Katona
-
Huw Jenkins
-
Robert Oeffner