ADDING SUPPORT FOR ARBITRARY RESOLUTION VALUES

Author:
Kevin Yager (McGill U)

Arbitrary resolution

The current code allows for resolution to be specified as dq or dq/q. These are certainly the two most common modes for specifying instrument resolution. However, at time one may have resolution that varies in a different way. For instance, different regions with different slit settings may lead to a resolution that is neither a constant $\delta q$ nor a constant $\delta q/q$. To address this, functionality was added where the user can specify a file that contains a listing of $(q, r)$ pairs, where $r$ is the resolution. That is, they can define regions of different resolution, or could even specify the specific resolution for each data point.

In order to accomplish this, the following modifications were made to various files:

prefl.h

Added a header for the function:
double lookupResolution(double q, Parratt *par);
to the list.

prefl.h

Added the function:
double lookupResolution(double q, Parratt *par)
This function is necessary so that we can have a variable resolution. You supply the $q$, and it returns what the resolution is at that $q$.

Importantly, the function "calcReflectivity" was modified to include a more general determination of resolution. The resolution is now determined by a lookup to the resolution array (using the "lookupResolution" function). If, on the other hand, the par->g.rl value is set to SINGLE instead of ARRAY, then this new functionality is bypassed, and the old functionality used instead. For generality, the calls to par->g.rsn were replaced with the value of resolution which is a new local double that stores the resolution value for this $q$.

parratt.h

Modified the _other struct (substructure "g" of _parratt), to include elements required to store the resolution. The pairs of numbers ($q$ and resolution at that $q$) are stored in two arrays.

	unsigned int  rl;  /**< Resolution stored as single value or in an array? */
	unsigned int  rsNum;	/**< The number of resolution values */
	double    *rsArrayq;	/**< The array of resolution q's */
	double    *rsArrayval;	/**< The array of resolution values */
	char          nam[64];  /**< The name of the file with resolution values */

Furthermore, these two constants were added:

#define SINGLE 0 /**< Resolution should be calculated with a single value for all q */
#define ARRAY  1 /**< Resolution should be calculated with an array of values */

pinit.h

Added a header for the function:

void initResolution(struct _other *other);

pinit.h

In the initParratt function, some default initializations were added:

	par->g.rl = SINGLE;
	par->g.rsNum = 0;
	for (i=0; i<64; i++) par->g.rnam[i] = 0;	

Near the end of the function, the initResolution function is called if required.

Also added a function to load the resolution data: void initResolution(struct _other *other)

pxmli.c

Two new possible values for resoln type were added: array-dq and array-dq/q which allow the user to specify a filename for the listing of absolute or relative resolution values.

If the user specified dq or dq/q then the content of the resoln xml tag are assumed to be numerical and this value is stored in par->g.rsn (same as before).

However, if the user specified type array-dq or array-dq/q then the resoln xml tag is assumed to contain a string of the filename. This filename is stored in par->g.rnam and used later to load the file.


Generated on Wed Mar 14 13:24:56 2007 for Parratt by  doxygen 1.4.7