Re: [cctbxbb] Asymmetric Unit with cctbx

Hi Philipp, You can find an expanded version of your script here: http://cci.lbl.gov/~rwgk/tmp/cctbx_examples/2007_06_17/ Use this command to generate a fake mtz file: iotbx.python random_f_calc.py P31 Then this command: iotbx.python mtz_to_map_and_back.py random_f_calcs.mtz FC1 FC2 This illustrates how to convert a manipulated map back to Fourier coefficients (via .structure_factors_from_map()) and write these out in MTZ format. In the example, the map manipulation is simply squaring the map. You can do anything else with the map from Python. For the FFT back to Fourier coefficients, you need a map over the unit cell. For maps, we don't have continuous asymmetric units (the map code pre-dates the ASU gallery). Instead, we have a "tag array" of integer values with the same gridding as the data map. An integer value less than 0 means "this grid point is unique under symmetry", values >= 0 are the 1D indices of the symmetry-related unique point. See the code near the end of mtz_to_map_and_back.py. It shows a loop over the grid points accessing both the tag_array and the real_map. This loop is slow, of course, since it is in Python. It should be fast enough for prototyping, but I'd expect the final version to be implemented in C++, unless your manipulation can be formulated with existing array algebra, e.g. the flex.pow2() in the example, which already runs at C++ speed. Cheers, Ralf ____________________________________________________________________________________ Yahoo! oneSearch: Finally, mobile search that gives answers, not web links. http://mobile.yahoo.com/mobileweb/onesearch?refer=1ONXIC

Hi Ralf, Thank you very much for your quick and detailed reply! It almost does what I am looking for, but I am not sure if I really got how it works... Am I right if I assume that adding lines 5 and 6 to your code: 1 for grid_point in flex.nested_loop(tag_array.focus()): 2 if (tag_array[grid_point] < 0): 3 number_of_symmetry_unique_grid_points += 1 4 sum_of_asu_data += real_map[grid_point] 5 else: 6 print real_map[grid_point], real_map[tag_array[grid_point]] should print twice the same value? It doesn't. Could you be so kind to give me a hint where my error in thinking is? Is there any reason for the different sizes of the tag_array and the real_map? real_map.last() and tag_array.last() show different results. Kind regards Philipp Ralf W. Grosse-Kunstleve schrieb:
Hi Philipp,
You can find an expanded version of your script here:
http://cci.lbl.gov/~rwgk/tmp/cctbx_examples/2007_06_17/ http://cci.lbl.gov/%7Erwgk/tmp/cctbx_examples/2007_06_17/
Use this command to generate a fake mtz file:
iotbx.python random_f_calc.py P31
Then this command:
iotbx.python mtz_to_map_and_back.py random_f_calcs.mtz FC1 FC2
This illustrates how to convert a manipulated map back to Fourier coefficients (via .structure_factors_from_map()) and write these out in MTZ format.
In the example, the map manipulation is simply squaring the map. You can do anything else with the map from Python.
For the FFT back to Fourier coefficients, you need a map over the unit cell. For maps, we don't have continuous asymmetric units (the map code pre-dates the ASU gallery). Instead, we have a "tag array" of integer values with the same gridding as the data map. An integer value less than 0 means "this grid point is unique under symmetry", values >= 0 are the 1D indices of the symmetry-related unique point. See the code near the end of mtz_to_map_and_back.py. It shows a loop over the grid points accessing both the tag_array and the real_map. This loop is slow, of course, since it is in Python. It should be fast enough for prototyping, but I'd expect the final version to be implemented in C++, unless your manipulation can be formulated with existing array algebra, e.g. the flex.pow2() in the example, which already runs at C++ speed.
Cheers, Ralf
------------------------------------------------------------------------ Pinpoint customers http://us.rd.yahoo.com/evt=48250/*http://searchmarketing.yahoo.com/arp/sponsoredsearch_v9.php?o=US2226&cmp=Yahoo&ctv=AprNI&s=Y&s2=EM&b=50who are looking for what you sell. ------------------------------------------------------------------------
_______________________________________________ cctbxbb mailing list [email protected] http://www.phenix-online.org/mailman/listinfo/cctbxbb
-- -------------------------------------------------- Dr Philipp Heuser Postdoctoral fellow EMBL-Hamburg c/o Building 25A, DESY Notkestrasse 85 22603 Hamburg phone: +49 40 89902 188 fax: +49 40 89902 149 mail: [email protected] web: www.philipp-heuser.de --------------------------------------------------
participants (2)
-
Philipp Heuser
-
Ralf W. Grosse-Kunstleve