Table of Contents

Module: position goniometer/position.py

Goniometer positions, calculations and conversions.

Positions are normally constructed by the Position() factory function from this module. None of the other classes and routines available in this module are widely used outside this implementation.

The Position() objects constructed by the Position() factory can be:

  • converted to another type using as_?() functions where ? is a one-letter uppercase abbreviation of the type.

  • modified using the With() method.

  • queried using attribute references.

Functions   
GZero
Null
Position
PositionFromStorage
Zero
angleinrange
fromDatabase
movetorange
normalangle
rangeastype
sameangle
sign
  GZero 
GZero ( hardware=None )

Return a zero position in g type.

  Null 
Null ( hardware )

Return zero position.

  Position 
Position (
        p=None,
        type=None,
        **kw,
        )

Position factory function.

parameters:

type

k for kappa type, e for Euler, f for horizonal Euler, n for euler with counter-clock-wise motors except phi, g for goniometermatrix, b for bisecting, c for C-vector, x for X8 kappa, t for theta1-theta2. d for horizontal euler like in MAR DTB

hardware

hardware used for checking possibilities and for calculations using kappa support angle and wavelength. This can be omitted, but this makes it very difficult to perform conversions.

optional (type specific) parameters:

if type='k': omega, kappa, dx, phi, theta
if type='e': omega, chi, dx, phi, theta
if type='f': omega, chi, dx, phi, theta
if type='d': omega, chi, dx, phi, theta
if type='n': omega, chi, dx, phi, theta
if type='b': dx, theta, phi, chi, psi
if type='c': dx, c, psi, signtheta
if type='g': dx, theta, matrix
if type='x': omega, kappa, dx, phi, theta
if type='t': theta1, theta2, dx

matrix= 3x3-matrix, c= 3-vector, dx in mm, angles in radians.

Alternatively, a position object p can be passed, and a copy will be returned.

Exceptions   
TypeError( "unknown type specified in Position()" )
  PositionFromStorage 
PositionFromStorage ( hardware,  state )

Return the position expressed by the dictionary state.

state is a dictionary created using position.storable() before.

Exceptions   
error( "Illegal type from storage. Saved in newer version?" )
  Zero 
Zero ( hardware=None )

Return a zero-position in Kappa angles.

  angleinrange 
angleinrange (
        a,
        amin,
        amax,
        crit=0.001 * projtls.degrees,
        )

Return true if amin <= a <= amax is fulfilled Within crit.

  fromDatabase 
fromDatabase ( hardware,  dbobj )

Read position from database.

  movetorange 
movetorange (
        a,
        amin,
        amax,
        )

Bring angle a between amin and amax. Raise a ValueError exception if that is not possible.

Exceptions   
ValueError( 'angle cannot be moved into range' )
  normalangle 
normalangle ( a )

Bring angle a between -pi and +pi.

  rangeastype 
rangeastype (
        p1,
        p2,
        type,
        crit=0.001 * projtls.degrees,
        )

Convert positions p1 and p2 to type, keeping differences in axes angles.

Exceptions   
TypeError( 'need position objects of same type' )
  sameangle 
sameangle (
        a1,
        a2,
        crit=0.003 * projtls.degrees,
        )

Return true if a1 and a2 are the same within crit.

  sign 
sign ( a )

Return -1.0 for negative numbers, 1.0 otherwise.

Classes   
PositionBase

Base class for all position types.

error

Exception raised when a conversion can not be performed.


Table of Contents

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