Just to avoid any confusion between mine and Nat&#39;s responses, there are two similarly named functions in miller.array, common_set and common_sets. <div><br></div><div>Thus the following two lines (note singular common_set):</div>

<div><br></div><div>f_obs = f_obs.common_set(f_calc)</div><div>f_calc = f_calc.common_set(f_obs)</div><div><br></div><div>is equivalent to the one-liner (note plural common_sets):</div><div><br></div><div>f_obs, f_calc = f_obs.common_sets(f_calc)</div>

<div><br></div><div>Cheers,</div><div><br></div><div>Richard</div><div><br><br><div class="gmail_quote">On 6 July 2012 12:04, Richard Gildea <span dir="ltr">&lt;<a href="mailto:rgildea@gmail.com" target="_blank">rgildea@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Jan,<div><br></div><div>You will need to get a matching set of indices for both arrays before calculating the R1 factor. The simplest way to do this would be by calling the miller.array.common_sets() function:</div>

<div>
<br></div><div>e.g. where f_obs and f_calc are two arrays that are not necessarily matching sets of indices:</div><div><br></div><div>f_obs, f_calc = f_obs.common_sets(f_calc)</div><div><br></div><div>Hope that helps,</div>


<div><br></div><div>Richard</div><div class="HOEnZb"><div class="h5"><div><div><br><div class="gmail_quote">On 6 July 2012 11:59, Jan Marten Simons <span dir="ltr">&lt;<a href="mailto:marten@xtal.rwth-aachen.de" target="_blank">marten@xtal.rwth-aachen.de</a>&gt;</span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I&#39;m facing a new challenge while working with cctbx:<br>
<br>
Imagine a set of (possibly incomplete) measured intesities, or integrated<br>
intensities from xrd powder patterns (I_obs) and a fitting crystal symmetry<br>
(xtal_symm). Now if I want to check if a given structure would generate the<br>
same intensities. (--&gt; low R1) the following code exibits the problem:<br>
<br>
# -*- coding: utf-8 -*-<br>
from __future__ import division<br>
from cctbx import xray<br>
from cctbx import crystal<br>
from cctbx.array_family import flex<br>
from libtbx import Auto<br>
<br>
obs_file = &quot;Test.hkl&quot;              # in shelx hklf4 format<br>
xtal_symm = crystal.symmetry(<br>
    unit_cell=(4.000, 5.4321, 7.531, 90.0, 90.0, 90.0),<br>
    space_group_symbol=&quot;P mm2&quot;)<br>
<br>
trial_structure = xray.structure(<br>
  special_position_settings=crystal.special_position_settings(<br>
    crystal_symmetry=xtal_symm),<br>
  scatterers=flex.xray_scatterer([<br>
    xray.scatterer(<br>
      label=&quot;Si&quot;,<br>
      site=(0.0,0.0,0.0),<br>
      u=0.2)]))<br>
<br>
# load (integral) intensities from diffraction data<br>
from iotbx import reflection_file_reader<br>
rfl = reflection_file_reader.any_reflection_file(&quot;amplitudes=&quot;+obs_file,<br>
                                                  ensure_read_access=True)<br>
I_obs = rfl.as_miller_arrays(crystal_symmetry=xtal_symm,<br>
                              force_symmetry=False,<br>
                              merge_equivalents=True,<br>
                              base_array_info=None)[0]<br>
I_obs = I_obs.discard_sigmas()<br>
f_obs = I_obs.as_amplitude_array()<br>
<br>
f_calc = trial_structure.structure_factors(d_min=1.0).f_calc()<br>
f_calc.merge_equivalents()<br>
<br>
R1 = f_calc.r1_factor(f_obs, scale_factor=Auto, assume_index_matching=False)<br>
<br>
gives:<br>
&quot;    assert other.indices().size() == self.indices().size()<br>
AssertionError                               &quot;<br>
<br>
<br>
Is there some way to get the R1_factor for this kind of scenario?<br>
<br>
Cheers and thanks in advance,<br>
Jan<br>
_______________________________________________<br>
cctbxbb mailing list<br>
<a href="mailto:cctbxbb@phenix-online.org" target="_blank">cctbxbb@phenix-online.org</a><br>
<a href="http://phenix-online.org/mailman/listinfo/cctbxbb" target="_blank">http://phenix-online.org/mailman/listinfo/cctbxbb</a><br>
</blockquote></div><br></div></div>
</div></div></blockquote></div><br></div>