correlation function for cctbx.miller.array
Hi, I need to calculate the correlation function between two maps, both of them are stored as miller.array objects. There is a map_correlation method, which does something similar to what I want, but this calculates the total correlation coefficient, while what I need is another miller.array with amplitudes = f1*f2 and phases = p2-p1 (where f1, f2 are amplitudes and p1, p2 are phases of map1 and map2, respectively), i.e. not just the sum of these. Is this available somewhere? There is the additional complication that the hkl-list for map1 and map2 may not be fully identical, but the intersect of the two maps could be taken. Thanks, Gabor
Hi Gabor, I coded "map_correlation" method in cctbx_project/cctbx/miller/__init__.py based on (if I recall it correctly): Acta Cryst. (1993). D49, 530-533 Mean phase error and the map-correlation coefficient Lunin and Woolfson I'm not aware of functionality you described... I guess you can create a clone of "map_correlation" with modifications you want, and add a corresponding method with some (long) self-explicable name and a regression test along with it. Pavel On 10/22/13 10:01 AM, Gabor Bunkoczi wrote:
Hi,
I need to calculate the correlation function between two maps, both of them are stored as miller.array objects. There is a map_correlation method, which does something similar to what I want, but this calculates the total correlation coefficient, while what I need is another miller.array with amplitudes = f1*f2 and phases = p2-p1 (where f1, f2 are amplitudes and p1, p2 are phases of map1 and map2, respectively), i.e. not just the sum of these. Is this available somewhere?
There is the additional complication that the hkl-list for map1 and map2 may not be fully identical, but the intersect of the two maps could be taken.
Thanks, Gabor
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
On 2013-10-22 18:25, Pavel Afonine wrote:
Hi Gabor,
I coded "map_correlation" method in cctbx_project/cctbx/miller/__init__.py based on (if I recall it correctly):
Acta Cryst. (1993). D49, 530-533 Mean phase error and the map-correlation coefficient Lunin and Woolfson
I'm not aware of functionality you described...
I guess you can create a clone of "map_correlation" with modifications you want, and add a corresponding method with some (long) self-explicable name and a regression test along with it.
Thanks for confirming this. I go ahead and add it, since this is a generic operation between two functions. I will possibly call it "cross_correlation_map". http://en.wikipedia.org/wiki/Cross_correlation BW, Gabor
Pavel
On 10/22/13 10:01 AM, Gabor Bunkoczi wrote:
Hi,
I need to calculate the correlation function between two maps, both of them are stored as miller.array objects. There is a map_correlation method, which does something similar to what I want, but this calculates the total correlation coefficient, while what I need is another miller.array with amplitudes = f1*f2 and phases = p2-p1 (where f1, f2 are amplitudes and p1, p2 are phases of map1 and map2, respectively), i.e. not just the sum of these. Is this available somewhere?
There is the additional complication that the hkl-list for map1 and map2 may not be fully identical, but the intersect of the two maps could be taken.
Thanks, Gabor
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
-- ################################################## Dr Gabor Bunkoczi Cambridge Institute for Medical Research Wellcome Trust/MRC Building Addenbrooke's Hospital Hills Road Cambridge CB2 0XY ##################################################
Hi Gabor, I'm slightly confused with terminology... The existing function (map_correlation) computes standard correlation coefficient between two maps. Lunin and Woolfson showed that to do so you do not need to compute actual maps but you can use Fourier map coefficients instead and the formula from the paper I mentioned before. This works if you have matching sets of miller indices. If miller indices are different (for instance, because of different resolution or completeness), then you need to compute actual maps using identical gridding (let me know if you need an example of how to do this), and then use a standard general function from scitbx to compute correlation coefficient between two arrays: cc = flex.linear_interpolation(x,y).coefficient() From a quick look I could not see a difference between http://en.wikipedia.org/wiki/Cross_correlation and usual correlation coefficient that everyone uses... though I did not look very carefully.. All the best, Pavel On 10/23/13 12:12 AM, Gabor Bunkoczi wrote:
On 2013-10-22 18:25, Pavel Afonine wrote:
Hi Gabor,
I coded "map_correlation" method in cctbx_project/cctbx/miller/__init__.py based on (if I recall it correctly):
Acta Cryst. (1993). D49, 530-533 Mean phase error and the map-correlation coefficient Lunin and Woolfson
I'm not aware of functionality you described...
I guess you can create a clone of "map_correlation" with modifications you want, and add a corresponding method with some (long) self-explicable name and a regression test along with it.
Thanks for confirming this. I go ahead and add it, since this is a generic operation between two functions. I will possibly call it "cross_correlation_map".
http://en.wikipedia.org/wiki/Cross_correlation
BW, Gabor
Pavel
On 10/22/13 10:01 AM, Gabor Bunkoczi wrote:
Hi,
I need to calculate the correlation function between two maps, both of them are stored as miller.array objects. There is a map_correlation method, which does something similar to what I want, but this calculates the total correlation coefficient, while what I need is another miller.array with amplitudes = f1*f2 and phases = p2-p1 (where f1, f2 are amplitudes and p1, p2 are phases of map1 and map2, respectively), i.e. not just the sum of these. Is this available somewhere?
There is the additional complication that the hkl-list for map1 and map2 may not be fully identical, but the intersect of the two maps could be taken.
Thanks, Gabor
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
Hi Pavel, On 2013-10-23 10:55, Pavel Afonine wrote:
From a quick look I could not see a difference between http://en.wikipedia.org/wiki/Cross_correlation and usual correlation coefficient that everyone uses... though I did not look very carefully..
The difference is that the correlation coefficient is a number, while the cross-correlation is actually a function. In fact, the cross-correlation of two maps is the phased translation function, and the reason I need a map is that the peaks corresponding to potential translations could be found. So although the computation is exactly the same, the map_correlation method takes this a step further, and calculates the integral of the map, removing all spatial information. BW, Gabor
All the best, Pavel
On 10/23/13 12:12 AM, Gabor Bunkoczi wrote:
On 2013-10-22 18:25, Pavel Afonine wrote:
Hi Gabor,
I coded "map_correlation" method in cctbx_project/cctbx/miller/__init__.py based on (if I recall it correctly):
Acta Cryst. (1993). D49, 530-533 Mean phase error and the map-correlation coefficient Lunin and Woolfson
I'm not aware of functionality you described...
I guess you can create a clone of "map_correlation" with modifications you want, and add a corresponding method with some (long) self-explicable name and a regression test along with it.
Thanks for confirming this. I go ahead and add it, since this is a generic operation between two functions. I will possibly call it "cross_correlation_map".
http://en.wikipedia.org/wiki/Cross_correlation
BW, Gabor
Pavel
On 10/22/13 10:01 AM, Gabor Bunkoczi wrote:
Hi,
I need to calculate the correlation function between two maps, both of them are stored as miller.array objects. There is a map_correlation method, which does something similar to what I want, but this calculates the total correlation coefficient, while what I need is another miller.array with amplitudes = f1*f2 and phases = p2-p1 (where f1, f2 are amplitudes and p1, p2 are phases of map1 and map2, respectively), i.e. not just the sum of these. Is this available somewhere?
There is the additional complication that the hkl-list for map1 and map2 may not be fully identical, but the intersect of the two maps could be taken.
Thanks, Gabor
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
For the record, I realized that this can be calculated as: correlation_map = d1.conjugate() * d2 where d1 and d2 are miller.arrays with complex data. There is possibly no real need to add a new function to calculate this. BW, Gabor On 2013-10-23 10:55, Pavel Afonine wrote:
Hi Gabor,
I'm slightly confused with terminology... The existing function (map_correlation) computes standard correlation coefficient between two maps. Lunin and Woolfson showed that to do so you do not need to compute actual maps but you can use Fourier map coefficients instead and the formula from the paper I mentioned before. This works if you have matching sets of miller indices. If miller indices are different (for instance, because of different resolution or completeness), then you need to compute actual maps using identical gridding (let me know if you need an example of how to do this), and then use a standard general function from scitbx to compute correlation coefficient between two arrays:
cc = flex.linear_interpolation(x,y).coefficient()
From a quick look I could not see a difference between http://en.wikipedia.org/wiki/Cross_correlation and usual correlation coefficient that everyone uses... though I did not look very carefully..
All the best, Pavel
On 10/23/13 12:12 AM, Gabor Bunkoczi wrote:
On 2013-10-22 18:25, Pavel Afonine wrote:
Hi Gabor,
I coded "map_correlation" method in cctbx_project/cctbx/miller/__init__.py based on (if I recall it correctly):
Acta Cryst. (1993). D49, 530-533 Mean phase error and the map-correlation coefficient Lunin and Woolfson
I'm not aware of functionality you described...
I guess you can create a clone of "map_correlation" with modifications you want, and add a corresponding method with some (long) self-explicable name and a regression test along with it.
Thanks for confirming this. I go ahead and add it, since this is a generic operation between two functions. I will possibly call it "cross_correlation_map".
http://en.wikipedia.org/wiki/Cross_correlation
BW, Gabor
Pavel
On 10/22/13 10:01 AM, Gabor Bunkoczi wrote:
Hi,
I need to calculate the correlation function between two maps, both of them are stored as miller.array objects. There is a map_correlation method, which does something similar to what I want, but this calculates the total correlation coefficient, while what I need is another miller.array with amplitudes = f1*f2 and phases = p2-p1 (where f1, f2 are amplitudes and p1, p2 are phases of map1 and map2, respectively), i.e. not just the sum of these. Is this available somewhere?
There is the additional complication that the hkl-list for map1 and map2 may not be fully identical, but the intersect of the two maps could be taken.
Thanks, Gabor
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
participants (2)
-
Gabor Bunkoczi
-
Pavel Afonine