yanera_reflectivity.h File Reference


Detailed Description

This file contains the declarations for the functions called for calculating the reflectivity curve. The formulas are defined in the reference page << Calculating the reflectivity >>.

Definition in file yanera_reflectivity.h.

Go to the source code of this file.

Functions

void yanera_write_reflectivity (yanera_container *yanera)
 General function call to write refelctivity curves to file.
double calcReflectivity (double q, yanera_resolution *resolution, yanera_model *model, yanera_container *yanera)
 Wrapper for calculating the reflectivity with background and instrumental resolution.
double calcParrattFromSlabs (double q, yanera_model *model, yanera_container *yanera)
 Calculates reflectivity $R(q)$ at $q$ from the slabs given in yanera_model.
double calcParrattFromModel (double q, yanera_model *model, yanera_container *yanera)
 Calculates reflectivity $R(q)$ at $q$ for given yanera_model.
double lookupResolution (double q, yanera_resolution *resolution)
 Retruns the resolution spread at a point $q$.


Function Documentation

void yanera_write_reflectivity ( yanera_container yanera  ) 

Parameters:
yanera The yanera_container.
General function call to write refelctivity curves to file. The function cycles through the models, creates an output filename for each, then Calculates and writes to file (on-the-fly) the reflectivity curve. The curve is calculated from q_min to q_max in q_num number of steps.

Filenames are based on the datafile names, with *.ref appended, or in the event of no datafiles, the default filename is "results_xx.ref" where xx is a sequential number from 1, based on how many models there are.

Definition at line 24 of file yanera_reflectivity.c.

double calcReflectivity ( double  q,
yanera_resolution resolution,
yanera_model model,
yanera_container yanera 
)

Parameters:
q The $q$ value to evaluate $R(q)$.
resolution A pointer to the yanera_resolution data for the datafile and the model.
model The yanera_model for which the refelctiity curve is calculated.
yanera The yanera_container.
Returns:
The reflectivity $R(q)$.
This function is a wrapper to add the background and instrument resolution. The actual reflectivity is calculated by calls to the function calcParratt() .

The instrumental resolution is determined by calculating the reflectivity averaged over several points with Gaussian weights. It's a method that was borrowed and made more general from Parratt32. It works by the following, assuming a $n$ point average,

\begin{eqnarray*} R(q) &=& {\sum_{a=-n}^{n} w_a R(q[1+\frac{a}{n}\frac{\delta q}{q}])}/ {\sum_{a=-n}^{n} w_a} \\ \mathrm{or} &=& {\sum_{a=-n}^{n} w_a R(q+\frac{a}{n}\delta q)}/ {\sum_{a=-n}^{n} w_a} \\ w_a &=& \exp\left(-2\left(\frac{a}{n}\right)^2\right) \end{eqnarray*}

In the first equation, we can specify the instrumental resolution present in the data as in the same manner as it is typically recorded a Chalk River, $\delta q/q=\mathrm{const}$. Otherwise, the resolution can be specified as $\delta q=\mathrm{const}$. The Gaussian averaging of points has been pre-calculated for 9 point average. If no resolution smearing is required, the calculation is skipped for speed.

Finally, the background is added.

Definition at line 96 of file yanera_reflectivity.c.

double calcParrattFromSlabs ( double  q,
yanera_model model,
yanera_container yanera 
)

Parameters:
q The $q$ value to evaluate $R(q)$.
model The yanera_model for which the refelctiity curve is calculated.
yanera The yanera_container.
Returns:
The reflectivity $R(q)$.
Calculates reflectivity $R(q)$ at $q$ for given yanera_model. Formulas are located on page <<Calculating the reflectivity>>. This function uses the tiny slabs calculated by adaptive quadrature.

NOTE: This function sets the imaginary SLD to zero.

At this point the imaginary part of the SLD is not being used. It is read in the XML but not calculated as part of the quadrature into little slabs, so is not accessible for use here.

Definition at line 155 of file yanera_reflectivity.c.

double calcParrattFromModel ( double  q,
yanera_model model,
yanera_container yanera 
)

Parameters:
q The $q$ value to evaluate $R(q)$.
model The yanera_model for which the refelctiity curve is calculated.
yanera The yanera_container.
Returns:
The reflectivity $R(q)$.
Calculates reflectivity $R(q)$ at $q$ for given yanera_model. Formulas are located on page <<Calculating the reflectivity>>. This functions calculates $R(q)$ directly from teh model, and not from the quadarture slabs.

NOTE: This function sets the imaginary SLD to zero.

At this point the imaginary part of the SLD is not being used. It is read in the XML but not calculated as part of the quadrature into little slabs, so is not accessible for use here.

Definition at line 263 of file yanera_reflectivity.c.

double lookupResolution ( double  q,
yanera_resolution resolution 
)

Parameters:
q The value of $q$ that we want the resolution
resolution A pointer to a yanera_rsolution structure with the resolution information.
Returns:
The resolution at that point.
Retruns the resolution spread at a point $q$.

Definition at line 428 of file yanera_reflectivity.c.


Generated on Thu May 29 10:56:33 2008 by  doxygen 1.5.5