.. include:: substitutions.txt .. currentmodule:: jscatter Analysis of SAS data -------------------- How to smooth Xray data and make an inset in the plot ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SAS data often have a large number of points at higher Q. The best way to get reasonable statistics there is to reduce the number of points by averaging in intervals (see .prune). Spline gives trust less results. These are real data from X33 beamline, EMBL Hamburg. .. literalinclude:: ../../examples/example_sas_smooth_xraydata.py :language: python .. image:: ../../examples/smooth_xraydata.png :align: center :height: 300px :alt: smooth_xraydata Analysis of SAS data ^^^^^^^^^^^^^^^^^^^^ In small angle scattering a typical situation is that you want to measure a formfactor (particle shape) or structure factor (particle interaction). For this a concentration series is measured and we need to extrapolate to zero concentration to get the formfactor. Afterwards we can divide the measurement by the formfactor to get the structure factor. So we have three key parts : - Correction for transmission, dark and empty cell scattering to get instrument independent datasets. - Extrapolating concentration scaled data to get the formfactor. - Divide by formfactor to get structure factor **Correction** Brulet at al [1]_ describe the data correction for SANS, which is in principle also valid for SAXS, if incoherent contributions are neglected. The difference is, that SAXS has typical transmission around ~0.3 for 1mm water sample in quartz cell due to absorption, while in SANS typical values are around ~0.9 for D2O. Larger volume fractions in the sample play a more important rule for SANS as hydrogenated ingredients reduce the transmission significantly, while in SAXS still the water and the cell (quartz) dominate. One finds for a sample inside of a container with thicknesses (:math:`z`) for sample, buffer (solvent), empty cell and empty beam measurement (omitting the overall q dependence): .. math:: I_s = \frac{1}{z_S}\big((\frac{I_S-I_{dark}}{T_S}-I_{b}T_S\big) -\big(\frac{I_{EC}-I_{dark}}{T_{EC}}-I_{b}T_{EC})\big) - \frac{1}{z_B}\big((\frac{I_B-I_{dark}}{T_B}-I_{b}T_B\big) -\big(\frac{I_{EC}-I_{dark}}{T_{EC}}-I_{b}T_{EC})\big) where - :math:`I_s` is the interesting species - :math:`I_S` is the sample of species in solvent (buffer) - :math:`I_B` is the pure solvent (describing a constant background) - :math:`I_{dark}` is the dark current measurement. For Pilatus detectors equal zero. - :math:`I_b` is the empty beam measurement - :math:`I_{EC}` is the empty cell measurement - :math:`z_x` corresponding sample thickness - :math:`T_x` corresponding transmission The recurring pattern :math:`\big((\frac{I-I_{dark}}{T}-I_{b}T\big)` shows that the the beam tail (border of primary beam not absorbed by the beam stop) is attenuated by the corresponding sample. For equal sample thickness :math:`z` the empty beam is included in subtraction of :math:`I_B` : .. math:: I_s = \frac{1}{z} \big((\frac{I_S-I_{dark}}{T_S}-I_{b}T_S) - (\frac{I_B-I_{dark}}{T_B}-I_{b}T_B)\big) - The simple case If the transmissions are nearly equal as for e.g. protein samples with low concentration (:math:`T_S \approx T_B`) we only need to subtract the transmission and dark current corrected buffer measurement from the sample. .. math:: I_s = \frac{1}{z} \big((\frac{I_S-I_{dark}}{T_S}) - (\frac{I_B-I_{dark}}{T_B}\big) - Higher accuracy for large volume fractions For larger volume fractions :math:`\Phi` the transmission might be different and we have to take into account that only :math:`1-\Phi` of solvent contributes to :math:`I_S`. We may incorporate this in the sense of an optical density changing the effective thickness :math:`\frac{1}{z_B}\rightarrow\frac{1-\Phi}{z_B}` resulting in different thicknesses :math:`z_S \neq z_B` .. [1] Improvement of data treatment in small-angle neutron scattering Brûlet et al Journal of Applied Crystallography 40, 165-177 (2007) **Extrapolation and dividing by concentration** We assume that the above correction was correctly applied and we have a transmission corrected sample and buffer (background) measurement. This is what you typically get from SANS instruments as e.g KWS1-3 from MLZ Garching or D11-D33 at ILL, Grenoble. The key part is ``dataff=datas.extrapolate(molarity=0)[0]`` to extrapolate to zero molarity. .. literalinclude:: ../../examples/example_sas_analyseSASData.py :language: python .. image:: ../../examples/SAS_sf_extraction.png :align: center :height: 300px :alt: SAS_sf_extraction How to fit SANS data including the resolution for different detector distances ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ First this example shows the influence of smearing, then how to do a fit including smearing a la Pedersen. The next example can do the same. .. literalinclude:: ../../examples/example_sas_SANSsmearing.py :language: python .. image:: ../../examples/SANSsmearing.jpg :align: center :height: 300px :alt: Picture about SANS smearing Fitting multiple smeared data together ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ In the following example all smearing types may be mixed and can be fitted together. For details and more examples on smearing see :py:func:`~jscatter.smallanglescattering.smear` This examples shows SAXS/SANS smearing with different collimation. .. literalinclude:: ../../examples/example_sas_fitwithsmearing.py :language: python :end-before: sys.exit() # end .. image:: ../../examples/images/smearedfitexample.png :align: center :height: 300px :alt: Picture about smearing/desmearing Smearing and desmearing of SAX and SANS data ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Here we examine the effect of instrumental smearing for SAX (Kratky Camera, line! ) and SANS and how we can use the Lake algorithm for desmearing. The conclusion is that because of the increased noise it is in most cases more effective to fit smeared models than to desmear data and fit these. The additional advantage is that at the edges (eg detector limits) we can desmear a model correctly while we need assumptions for the data (e.g. low Q Guinier behavior, high Q as constant) which are sometimes difficult to justify. .. literalinclude:: ../../examples/example_sas_SASdesmearing.py :language: python .. image:: ../../examples/SASdesmearing.png :align: center :height: 300px :alt: Picture about smearing/desmearing Simultaneous fit SANS data of a partly matched sample measured at 3 contrast conditions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ In this example we ignore smearing (Add it if needed). We have a sample like a micelles of a diblock copolymer with a shorter hydrophobic and a longer hydrophilic part. The hydrophobic part will make a core with hydrophilic extended Gaussian coils into the solvent. To separate core and coils 3 contrast were measured in H2O, a H2O/D2O mixture with SLD 3e-4 and D2O. As a reasonable high concentration was used we observe in the core contrast (black points) already a structure factor as a maximum at around 0.3 /nm. The minimum around 1 /nm defines the core radius in ths contrast that we fix. This structure factor we need to include. We do a simultaneous fit of all together using the coreGaussiancoronna model. To add structure factor and background we write our own model. .. literalinclude:: ../../examples/example_sas_MultipleContrastFit.py :language: python :start-after: # end generate data .. image:: ../../examples/images/multicontrastfit.png :align: center :height: 300px :alt: A simultaneous contrast fit Multilamellar Vesicles ^^^^^^^^^^^^^^^^^^^^^^ Here we look at the various effects appearing for vesicles and how they change the scattering. .. literalinclude:: ../../examples/example_sas_multilamellarVesicle.py :language: python :lines: 2- The first image shows how a multilamellar vesicles changes the shape of the membrane correlation peak with increasing dislocations of the centers. .. image:: ../../examples/multilamellar1.png :align: center :height: 300px :alt: Picture multilamellar1 Larger number of lamella shifts the correlation peak to higher Q. .. image:: ../../examples/multilamellar2.png :align: center :height: 300px :alt: Picture multilamellar2 The shell formfactor determines the high Q minima. This allows to access the structure of e.g. bilayers. .. image:: ../../examples/multilamellar3.png :align: center :height: 300px :alt: Picture multilamellar3 Multilamellar and unilamellar can be distinguished with the aid of the appearing correlation peaks. See below. .. image:: ../../examples/multilamellar4.png :align: center :height: 300px :alt: Picture multilamellar4 DPPC Vesicle in SAXS ^^^^^^^^^^^^^^^^^^^^^^ A more realistic example for DPPC We use a simplified model with 3 box layers and approximate thickness and scattering length densities. Kučerka uses a multi Gaussian profile. .. literalinclude:: ../../examples/example_sas_multilamellarVesiclereal.py :language: python :lines: 2- We observe in this figure modulations at the left flank of the prominent peak. The modulations are caused by the multilamelarity and a clear indication. Already small modulations indicate multi lamellar vesicles in accordance with Kučerka et al. .. image:: ../../examples/multilamellar5.png :align: center :height: 300px :alt: Picture multilamellar5 **Multilamellar SAXS example for DPPC** The first minima with following increase is a result of the near matching condition for bilayers in SAXS. Additionally we observe characteristic peaks/shoulders in the first increase/top as a result of multilamellar interference. See for comparison Kučerka et al. Langmuir 23, 1292 (2007) https://doi.org/10.1021/la062455t . We use again the simplified model with 3 box layers and approximate thickness from above .. literalinclude:: ../../examples/example_sas_multilamellarVesicleSAXS.py :language: python :lines: 2- .. image:: ../../examples/multilamellar5SAXS.png :align: center :height: 300px :alt: Picture multilamellar5SAXS 2D oriented scattering ^^^^^^^^^^^^^^^^^^^^^^ **Formfactors of oriented particles or particle complexes** .. literalinclude:: ../../examples/example_2D_orientedScattering.py :language: python :lines: 2- .. image:: ../../examples/2D_5coreshell.png :align: left :height: 300px :alt: 2D scattering coreshell .. image:: ../../examples/2D_5spheres.png :align: center :height: 300px :alt: 2D scattering **Oriented crystal structure factors in 2D** .. literalinclude:: ../../examples/example_2D_structurefactors.py :language: python :lines: 5- .. image:: ../../examples/smallCubeAsymmetric.png :align: center :height: 300px :alt: 2D scattering coreshell .. image:: ../../examples/smallCube10degreeRotation.png :align: center :height: 300px :alt: 2D scattering **Ewald Sphere of simple cubic lattice** .. literalinclude:: ../../examples/example_2D_EwaldSphere.py :language: python :lines: 1- .. image:: ../../examples/Ewald2.png :align: left :height: 300px :alt: Ewald2 .. image:: ../../examples/Ewald.png :align: center :height: 300px :alt: Ewald2 A nano cube build of different lattices ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. include:: ../../examples/example_sas_comparisonLattices.py :start-after: """ :end-before: END .. literalinclude:: ../../examples/example_sas_comparisonLattices.py :language: python :lines: 23-69 .. image:: ../../examples/LatticeComparison.png :align: center :height: 300px :alt: LatticeComparison .. include:: ../../examples/example_sas_comparisonLattices.py :start-after: #start2 :end-before: #end2 .. literalinclude:: ../../examples/example_sas_comparisonLattices.py :language: python :lines: 83-115 .. image:: ../../examples/LatticeComparison2.png :align: center :height: 300px :alt: LatticeComparison2 .. include:: ../../examples/example_sas_comparisonLattices.py :start-after: #start3 :end-before: #end3 .. literalinclude:: ../../examples/example_sas_comparisonLattices.py :language: python :lines: 132- .. image:: ../../examples/LatticeComparison3.png :align: center :height: 300px :alt: LatticeComparison3 Linear Pearls with connecting coils ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The example uses cloudscattering to build a line of spheres. Between the spheres are Gaussian coils to represent chains connecting the spheres. The model :py:func:`~jscatter.formfactor.composed.linearPearls` is very similar build but uses a simpler build of the linear chain. .. literalinclude:: ../../examples/example_sas_connected_linearPearls.py :lines: 1- .. image:: ../../examples/connected_linearPearls.png :align: center :height: 300px :alt: example_connected_linearPearls