Table of Contents

Module: scan goniometer/scan.py

Scan parameters and scans.

This module defines classes and functions to calculate, optimize, and perform scans, and a class to define scan parameters.

The goniometer movement associated with a scan is stored in "scan" objects. All other "scan parameters" are stored in "scan parameters" objects (there are exceptions possible, see the description of the Scan() class for details).

This separation of tasks makes it very easy to change some parameters of the data collection in one place only (namely in the ScanParams() object), without touching the data collection strategy. Related, it is possible to generate a data collection strategy without ever thinking about exactly which frames will be collected.

A true data collection will thus use a single "scan parameter" object, and one or multiple "Scan" objects.

Functions   
ExpandedScan
MaximalOmegaScan
ScanFromKcdHeader
ScanFromStorage
ShrunkenScan
SymmetricOmegaScan
fnpatternvalid
newpattern
numpat
varfilter
  ExpandedScan 
ExpandedScan (
        s,
        dataset,
        step=5 * projtls.degrees,
        tryhigh=1,
        trylow=1,
        nwanted=1,
        minval=-365 * projtls.degrees,
        maxval=365 * projtls.degrees,
        )

Optimize the begin and end positions of a scan for efficiency.

As many reflections as possible will be found in the smallest possible scan. This is done by expanding the scan in step increments from both sides until the the number of added reflections by one step is lower than nwanted. Expanding at the bottom is only tried if trylow=1, at the top only if tryhigh=1. No consultation with the hardware is performed to check for validity of the range. If the range of values should be limited, this should be passed in the minval and maxval parameters.

  MaximalOmegaScan 
MaximalOmegaScan (
        p,
        anglemargin=config.anglemargin * projtls.degrees,
        detectorsizemargin=config.detectorsizemargin,
        )

Return an OmegaScan() that uses as much space as possible around p.

This queries the hardware for allowed space.

  ScanFromKcdHeader 
ScanFromKcdHeader (
        h,
        hardware=None,
        extendfactor=1.0,
        hend=None,
        mosaicity=0.0,
        )

Reconstruct a Scan() object from an image file header.

parameters:

h

image header.

optional parameters:

extendfactor

make the scan this many times longer than the image header h indicates.

hend

the image header of the last image in the scan. This is incompatible with the extendfactor parameter, and is preferable when a scan should be constructed that corresponds to a complete set of images.

mosaicity

an extra angle to be added before the beginning and after the end of the scan to allow for mosaicity of the crystal.

Exceptions   
error( "Cannot represent scan from KCD header" )
  ScanFromStorage 
ScanFromStorage ( hardware,  state )

Reconstruct a scan from the dictionary state.

Automatically recognizes the type of scan from the state dictionary, and constructs the scan applied to the given hardware connection. The construction verifies that the scan can be performed on the hardware. If only small adjustments are required to the endpoints, these are automatically applied. If larger adjustments would be required, None is returned.

Exceptions   
error( 'Unknown scan type from Storage. Reloading newer version?' )
  ShrunkenScan 
ShrunkenScan (
        s,
        dataset,
        step=5 * projtls.degrees,
        tryhigh=1,
        trylow=1,
        completeness=1.0,
        )

Optimize the begin and end positions of a scan for efficiency.

As many reflections as possible will be found in the smallest possible scan. This is done by shrinking the scan in step increments from both sides until the fraction of reflections found drops below the specified completeness

  SymmetricOmegaScan 
SymmetricOmegaScan (
        p,
        width,
        anglemargin=config.anglemargin * projtls.degrees,
        detectorsizemargin=config.detectorsizemargin,
        )

Return an OmegaScan() that starts width/2 before p, and ends width later.

this queries the hardware for allowed space, and will deviate from centering on p if there is not enough space on one of the two sides.

  fnpatternvalid 
fnpatternvalid (
        p,
        scanlimit=99,
        imagelimit=999,
        )

Check the validity of the file name pattern taking limits into account

arguments:

p

proposed filenamepattern

scanlimit

the number of scans it MUST fit

imagelimit

the number of images per scan it MUST fit

  newpattern 
newpattern ( char )

Returns a new file name pattern starting with the given character.

A later character is chosen if the 01/01 file for the given pattern already exist

  numpat 
numpat ( i )

Return a regular expression matching enough # characters to fit i

  1. if i=4, return (##*), for i=1002 return (#####*)

  varfilter 
varfilter ( original,  modifier )

For modifiable variables, return the modified value.

parameters:

original

the original value.

modifier

the modifier. Should be either None for no modification or ("replace",newvalue) to use the newvalue or (multiply,factor) to multiply the original value with the given factor.

Exceptions   
error( "Unrecognized modifier %s" % modifier )
Classes   
AnyScan

Top class for all classes representing a scan.

OmegaScan

A "OneAxisScan" that will rotate around the omega angle.

OneAxisScan

A Rotation scan in which one motor of the Kappa goniostat moves.

PhiScan

A "OneAxisScan" that will rotate around the phi angle.

ScanParams

Keep the parameters of a scan that are not relevant to simulation.

error

Exception raised for problems encountered in the scan module.


Table of Contents

This document was automatically generated on Tue Nov 25 12:18:58 2008 by HappyDoc version WORKING