Integration

See also newpsd

Define the integration formula for selecting the specular ridge and background for an instrument configuration. Return pixel ranges to integrate over:

  {spec_lo spec_hi bkgm_lo bkgm_hi bkgp_lo bkgp_hi}

To suppress the backgrounds, use {} {} instead.

Available variables:

  S1: slit widths (mm)
  A,B: sample and detector angles (degrees)
  dd: distance from sample to detector (mm)
  w: pixel width (mm)  [negative if detector is reversed]
  rec: the record structure
  point: the current point

Use [Td_to_pixel $result $B] to convert offset from specular into pixel

Here is a simple example in which the width of the integration region is defined by the slits, and the background is an equal width region on either side. For slit scans don't subtract a background.

  set a [expr 1.5*abs($S1/$w)+5]
  if {$rec(type)=="slit"} { return [list -$a $a {} {} {} {}] }
  return [list -$a $a -2*$a -$a $a 2*$a]

Here is an example from a detector with simultaneous beams. Since the formula is intimately tied with the center pixel for the beam, it sets the center pixel and the corresponding A/D cross section. Select between cross sections by toggling the condition from 0 to 1. Note that the active region is clipped to +/- 32 pixels from the center of the beam.

  set clip 32
  set lo [expr -1.5*abs($S1/$w)-5]
  set hi [expr -$lo]
  if 0 {
    set rec(index) D
    set rec(centerpixel) 481
  } else {
    set rec(index) A
    set rec(centerpixel) 354
  }
  set bklo [expr 2*$lo]
  set bkhi [expr 2*$hi]
  if { $lo < -$clip } { set lo -$clip }
  if { $hi > $clip } { set hi $clip }
  if {$rec(type)=="slit"} { return [list $lo $hi {} {} {} {}] }
  if { $bklo < -$clip } { set bklo -$clip }
  if { $bkhi > $clip } { set bkhi $clip }
  return [list $lo $hi $bklo $lo $hi $bkhi]

Note that as of this writing the legends on the graph in the compose window are not updated when rec(index) changes, but the lines are kept separate in the reduce screen.

Use the key combination control+enter to update the integration after editing the integration region formula.

The following reduction formula is used for each detector line:

    S: specular pixels
    B: background pixels 
    |S|:   number of specular pixels
    |B|:   number of background pixels
    D(k): detector pixel k
    counts = sum_{k in S} D(k) - |S|/|B| sum_{k in B} D(k)
    dcounts = sqrt( sum_{k in S} D(k) + (|S|/|B|)^2 sum_{k in B} D(k) )

The counts are then scaled by detector or monitor count and by attenuators as usual on the compose window.

The formula internally is a little messier than that to protect against an empty set of background pixels. The B^+ and B^- plots displayed alongside the specular are scaled by |S|/|B^+| and |S|/|B^-| respectively.

2006-02-24


Browse Index