Hi Jan,
I've fixed the bug. Thanks for pointing out the problem.
The implementation could be streamlined but I doubt it is worth the effort.
Ralf

2012/1/3 Jan Marten Simons <marten@xtal.rwth-aachen.de>
Am Montag 02 Januar 2012 20:14:03 schrieb Richard Gildea:
> Does this do what you want?
>
> miller_array.setup_binner(reflections_per_bin=100)
> miller_array.mean(use_binning=True)

Thanks, this pushed me into the right direction. But now I think I've found a
bug:

f_calc = struct.structure_factors(d_min=1.5).f_calc()
I_calc = f_calc.intensities()
I_calc.setup_binner_d_star_sq_step(d_star_sq_step=0.01)
I_calc.mean(use_binning=True).show()         # works
I_calc.sum(use_binning=True).show()           # gives error (see below)

...
  I_calc.sum(use_binning=True).show()
File "/home/marten/cctbx/cctbx-
dev/sources/cctbx_project/cctbx/miller/__init__.py", line 2633, in sum
   mean.data[i] *= counts[i]
TypeError: unsupported operand type(s) for *=: 'NoneType' and 'int'

>From looking at the code this seems to be caused by empty bins, which fail
during the multiplication step. Also I think it's strange that the sum (and
sum_sq) functions use the mean values instead of just using the sum function
of the miller/flex array. Doesn't this induce some overhead?

With regards,

 Dipl. Phys.
 Jan M. Simons

Institute of Crystallography
RWTH Aachen University
_______________________________________________
cctbxbb mailing list
cctbxbb@phenix-online.org
http://phenix-online.org/mailman/listinfo/cctbxbb