| 1 |
Creating a subtracted scattering profile |
| 2 |
***************************************** |
| 3 |
|
| 4 |
This example shows how to create a subtracted scattering profile from batch |
| 5 |
mode SAXS data. While this particular example uses images as the starting |
| 6 |
point, the same process is easily applied to .dat file as well. |
| 7 |
|
| 8 |
.. code-block:: python |
| 9 |
|
| 10 |
import glob |
| 11 |
import os |
| 12 |
import bioxtasraw.RAWAPI as raw |
| 13 |
|
| 14 |
#Load settings |
| 15 |
settings = raw.load_settings('./standards_data/SAXS.cfg') |
| 16 |
|
| 17 |
#Load buffer and sample profiles |
| 18 |
buffer_files = sorted(glob.glob('./standards_data/GIbuf2_A9_18_001_*.tiff')) |
| 19 |
buffers, imgs = raw.load_and_integrate_images(buffer_files, settings) |
| 20 |
|
| 21 |
sample_files = sorted(glob.glob('./standards_data/GI2_A9_19_001_*.tiff')) |
| 22 |
samples, imgs = raw.load_and_integrate_images(sample_files, settings) |
| 23 |
|
| 24 |
#Test for similarity between buffer and sample profiles |
| 25 |
buf_pvals, buf_corrected_pvals, buf_failed_comps = raw.cormap(buffers[1:], |
| 26 |
buffers[0]) |
| 27 |
sam_pvals, sam_corrected_pvals, sam_failed_comps = raw.cormap(samples[1:], |
| 28 |
samples[0]) |
| 29 |
|
| 30 |
#Average buffer and sample profiles |
| 31 |
buf_avg = raw.average(buffers) |
| 32 |
sam_avg = raw.average(samples) |
| 33 |
|
| 34 |
#Subtract buffer and sample profiles |
| 35 |
gi_prof = raw.subtract([sam_avg], buf_avg)[0] |
| 36 |
|
| 37 |
#Save the averaged and subtracted profiles |
| 38 |
if not os.path.exists('./api_results/gi_denss'): |
| 39 |
os.mkdir('./api_results/gi_denss') |
| 40 |
|
| 41 |
raw.save_profile(buf_avg, datadir='./api_results') |
| 42 |
raw.save_profile(sam_avg, datadir='./api_results') |
| 43 |
raw.save_profile(gi_prof, datadir='./api_results') |
| 44 |
|