How to use the binner in cctbx.miller?
![](https://secure.gravatar.com/avatar/978e52658a0bafdec828ee172bd55030.jpg?s=120&d=mm&r=g)
Hi, as documentation is lacking on this: How can I use the binner from cctbx.miller to bin reflections into different groups according to their d-value and would it be possible afterwards to get integral intesities of each binned group easily? Thanks, Jan
![](https://secure.gravatar.com/avatar/57e5c19a7d4518a2b5b607ed6d763e1a.jpg?s=120&d=mm&r=g)
Does this do what you want?
miller_array.setup_binner(reflections_per_bin=100)
miller_array.mean(use_binning=True)
Cheers,
Richard
2012/1/2 Jan Marten Simons
Hi,
as documentation is lacking on this: How can I use the binner from cctbx.miller to bin reflections into different groups according to their d-value and would it be possible afterwards to get integral intesities of each binned group easily?
Thanks, Jan _______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
![](https://secure.gravatar.com/avatar/978e52658a0bafdec828ee172bd55030.jpg?s=120&d=mm&r=g)
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
![](https://secure.gravatar.com/avatar/4f2753f18ed65eee10e43ac72b651a8d.jpg?s=120&d=mm&r=g)
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
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 [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
participants (3)
-
Jan Marten Simons
-
Ralf Grosse-Kunstleve
-
Richard Gildea