PEARL Procedures  rev-distro-2.1.1-1-gf419e92-dirty
Igor procedures for the analysis of PEARL data
pearl-scienta-preprocess.ipf File Reference

preprocessing functions for Scienta detector images. More...

#include "pearl-fitfuncs"

Go to the source code of this file.

Namespaces

 PearlScientaPreprocess
 preprocessing functions for Scienta detector images.
 

Functions

variable prompt_int_linbg_reduction (string *param)
 prompt the user for integrate on linear background reduction parameters. More...
 
string capture_int_linbg_cursors ()
 capture linear background reduction parameters from cursors in a graph. More...
 
string csr_int_linbg_reduction (string win)
 calculate linear background reduction parameters from cursors in a graph. More...
 
threadsafe wave int_linbg_reduction (wave source, string *param)
 linear-background subtracted integration reduction function. More...
 
variable prompt_int_quadbg_reduction (string *param)
 
threadsafe wave int_quadbg_reduction (wave source, string *param)
 integrate peak area minus a quadratic background More...
 
variable prompt_redim_linbg_reduction (string *param)
 parameter dialog for the redim_linbg_reduction() function More...
 
threadsafe wave redim_linbg_reduction (wave source, string *param)
 linear background reduction function for incorrectly dimensioned scienta image More...
 
variable test_gauss4_reduction (wave image)
 apply the gauss4_reduction function to a single image More...
 
variable prompt_gauss4_reduction (string *param)
 prompt for the gauss4_reduction parameters More...
 
threadsafe wave gauss4_reduction (wave source, string *param)
 fit horizontal cuts of an image with up to four gaussian peaks on a linear background More...
 

Detailed Description

preprocessing functions for Scienta detector images.

this procedure contains functions for data reduction and instrument-specific normalization.

Author
matthias muntwiler, matth.nosp@m.ias..nosp@m.muntw.nosp@m.iler.nosp@m.@psi..nosp@m.ch

Definition in file pearl-scienta-preprocess.ipf.

Function Documentation

◆ capture_int_linbg_cursors()

string capture_int_linbg_cursors ( )

capture linear background reduction parameters from cursors in a graph.

PRELIMINARY - function arguments may change

sets reduction parameters from cursors in a graph. the resulting parameters are copied to the global s_reduction_params string used by the data explorer.

an even number of cursors (2 or more) must be set on the image. cursor names and order do not matter, except that the alphabetically first cursor which is attached to an image selects the image. the cursors mark the following positions, from innermost to outermost pair:

  1. low and high limits of peak region. if no cursors are present, the limits are set at 40% and 60% of the x-scale.
  2. peak-side boundary of lower and upper background region. if two or less cursors are present, the default background region applies, which extends from the peak limits up to the default cropping region. the background region extends up to the cropping region defined by the third pair.
  3. lower and upper cropping region. if four or less cursors are present, the default cropping region applies, which is 11% on either side of the image in fixed mode, and 0% otherwise. fixed mode is detected by the number of pixels (>= 992).
Note
on profile graphs, the necessary cursors can be configured easily by calling the ad_profile_cursor_mode() function, e.g. ad_profiles_cursor_mode(root:packages:pearl_explorer:preview_image, 1).

Definition at line 93 of file pearl-scienta-preprocess.ipf.

◆ csr_int_linbg_reduction()

string csr_int_linbg_reduction ( string  win)

calculate linear background reduction parameters from cursors in a graph.

PRELIMINARY - function arguments may change

calculates reduction parameters from cursors in a graph. the resulting parameters are returned in a string.

an even number of cursors (2 or more) must be set on the image. cursor names and order do not matter, except that the alphabetically first cursor which is attached to an image selects the image. the cursors mark the following positions, from innermost to outermost pair:

  1. low and high limits of peak region. if no cursors are present, the limits are set at 40% and 60% of the x-scale.
  2. peak-side boundary of lower and upper background region. if two or less cursors are present, the default background region applies, which extends from the peak limits up to the default cropping region. the background region extends up to the cropping region defined by the third pair.
  3. lower and upper cropping region. if four or less cursors are present, the default cropping region applies, which is 11% on either side of the image in fixed mode, and 0% otherwise. fixed mode is detected by the number of pixels (>= 992).
Note
on profile graphs, the necessary cursors can be configured easily by calling the ad_profile_cursor_mode() function, e.g. ad_profiles_cursor_mode(root:packages:pearl_explorer:preview_image, 1).
Parameters
wingraph window name or empty string for top window.
Returns
parameter string for linear background subtraction

Definition at line 133 of file pearl-scienta-preprocess.ipf.

◆ gauss4_reduction()

threadsafe wave gauss4_reduction ( wave  source,
string *  param 
)

fit horizontal cuts of an image with up to four gaussian peaks on a linear background

the function fits each horizontal profile (EDC) with four gaussian peaks on a linear background. the position and width of the peaks is kept fixed according to input parameters. the peak amplitude is constrained to positive value.

the width parameter is defined as in Igor's gauss curve fit function (standard deviation divided by the square root of two). the return value in dest1 is the integrated peak of one of the peaks. dest2 returns the corresponding error estimate.

Parameters
sourcesource wave. two-dimensional distribution of counts. for correct weighting and error estimation it is important that the source wave contains actual counts (Poisson statistics).
param(in, out) semicolon-separated key=value list of processing parameters. this is a pass-by-reference argument. the following parameters are required. position, width and limit parameters are on the x (energy) scale.
  • rngl low limit of fit interval
  • rngh high limit of fit interval
  • pos1 position of peak 1
  • wid1 width of peak 1
  • pos2 position of peak 2
  • wid2 width of peak 2
  • pos3 position of peak 3
  • wid3 width of peak 3
  • pos4 position of peak 4
  • wid4 width of peak 4
  • npeaks number of peaks to fit: 1...4 the others are held at amplitude 0.
  • ybox box size of averaging in y direction, must be 1 or 3. other values lead to corrupt data.
Returns
free wave containing references of the result waves. the number of waves is two times the number of peaks that are fit. the first npeaks waves contain the peak integrals, the second npeaks waves the corresponding error estimates.

Definition at line 718 of file pearl-scienta-preprocess.ipf.

◆ int_linbg_reduction()

threadsafe wave int_linbg_reduction ( wave  source,
string *  param 
)

linear-background subtracted integration reduction function.

data reduction function for adh5_load_reduced_detector. cf. adh5_default_reduction for an explanation of reduction functions.

this function calculates the average pixel value of each angular slice in one center and two background intervals. a background value is calculated at the center position by linear interpolation from the two background values. returns the center minus linear background in dest1. returns the Poisson one-sigma error in dest2.

typical values (peak centered on detector, FWHM ~ 20 % of image) Lcrop=0.11;Hcrop=0.11;Lsize=0.2;Hsize=0.2;Cpos=0.5;Csize=0.2

Parameters
sourcescienta detector image, energy axis along X, angle axis along Y. two-dimensional intensity distribution (image). the scales are carried over to the result waves.
paramparameters in a key1=value1;key2=value2;... list. all region parameters are relative to the image size (0...1).
  • Lcrop = size of the lower cropping region
  • Hcrop = size of the upper cropping region
  • Lsize = size of the lower background integration region
  • Hsize = size of the upper background integration region
  • Cpos = center position of the of the peak integration region
  • Csize = size of the peak integration region
Returns
free wave containing references of the two result waves. the first wave is the integral minus linear background. the second wave is the Poisson one-sigma error.

Definition at line 260 of file pearl-scienta-preprocess.ipf.

◆ int_quadbg_reduction()

threadsafe wave int_quadbg_reduction ( wave  source,
string *  param 
)

integrate peak area minus a quadratic background

data reduction function for adh5_load_reduced_detector. cf. adh5_default_reduction for an explanation of reduction functions.

this function calculates the average pixel value of each angular slice in one center and two background intervals. a background value is calculated at the center position by linear interpolation from the two background values. returns the center minus linear background in dest1. returns the Poisson one-sigma error in dest2.

typical values (peak centered on detector, FWHM ~ 20 % of image) Lcrop=0.11;Hcrop=0.11;Lsize=0.2;Hsize=0.2;Cpos=0.5;Csize=0.2

Parameters
sourcescienta detector image, energy axis along X, angle axis along Y. two-dimensional intensity distribution (image). the scales are carried over to the result waves.
paramparameters in a key1=value1;key2=value2;... list. all region parameters are relative to the image size (0...1).
  • Lcrop = size of the lower cropping region
  • Hcrop = size of the upper cropping region
  • Lsize = size of the lower background integration region
  • Hsize = size of the upper background integration region
  • Cpos = center position of the of the peak integration region
  • Csize = size of the peak integration region
Returns
free wave containing references of the two result waves. the first wave is the integral minus linear background. the second wave is the Poisson one-sigma error.

Definition at line 413 of file pearl-scienta-preprocess.ipf.

◆ prompt_gauss4_reduction()

variable prompt_gauss4_reduction ( string *  param)

prompt for the gauss4_reduction parameters

Definition at line 626 of file pearl-scienta-preprocess.ipf.

◆ prompt_int_linbg_reduction()

variable prompt_int_linbg_reduction ( string *  param)

prompt the user for integrate on linear background reduction parameters.

Definition at line 35 of file pearl-scienta-preprocess.ipf.

◆ prompt_int_quadbg_reduction()

variable prompt_int_quadbg_reduction ( string *  param)

Definition at line 351 of file pearl-scienta-preprocess.ipf.

◆ prompt_redim_linbg_reduction()

variable prompt_redim_linbg_reduction ( string *  param)

parameter dialog for the redim_linbg_reduction() function

Parameters
paramparameter string in a key1=value1;key2=value2;... list. the parameter string is passed by reference. see redim_linbg_reduction() for a description of parameters.
Returns
zero if the user clicked OK, non-zero if the user clicked Cancel.

Definition at line 509 of file pearl-scienta-preprocess.ipf.

◆ redim_linbg_reduction()

threadsafe wave redim_linbg_reduction ( wave  source,
string *  param 
)

linear background reduction function for incorrectly dimensioned scienta image

if the energy step size does not divide the energy range to an integer number, the scienta image is exported with the wrong array size. this can be fixed by redimensioning the array.

the current implementation works in the case where dimension 0 needs to be incremented. the function may be generalized to dimension 1 and/or decrementing by additional parameters. it is not known yet whether a generalization is needed or whether it can cover all cases.

background subtraction and peak integration is the same as by the int_linbg_reduction() function.

Parameters
sourcesource wave Scienta detector image, energy axis along X, angle axis along Y
paramparameter string in a key1=value1;key2=value2;... list. the parameter string is passed by reference.

all region parameters are relative to the image size (0...1).

  • Lcrop size of the lower cropping region
  • Hcrop size of the upper cropping region
  • Lsize size of the lower background integration region
  • Hsize size of the upper background integration region
  • Cpos center position of the of the peak integration region
  • Csize size of the peak integration region

typical values (peak centered on detector, FWHM ~ 20 % of image) Lcrop=0.11;Hcrop=0.11;Lsize=0.2;Hsize=0.2;Cpos=0.5;Csize=0.2

Returns
free wave containing references of the two result waves. the first wave is the integral minus linear background. the second wave is the Poisson one-sigma error.

Definition at line 572 of file pearl-scienta-preprocess.ipf.

◆ test_gauss4_reduction()

variable test_gauss4_reduction ( wave  image)

apply the gauss4_reduction function to a single image

useful for testing or manual processing. to debug, (temporarily) remove the threadsafe attribute from the gauss2_reduction function.

Definition at line 592 of file pearl-scienta-preprocess.ipf.