Base class for all position types.
All subclasses must define:
- type
a 1-character type identifier for the position.
- __init__()
constructor, taking all angle/vector/matrix arguments
plus the hardware. Should store all of the
recognized arguments as attributes, and complain
about others. It should also accept to be called
with only a p argument, referring to a position of
the same type, and make itself a copy of p.
- With(x=y)
a modifier method that returns the position with
one or more of the attributes changed. Position should
be immutable, so this method must return a copied
object!
- as_?()
conversion routines for ? in all types (but capitalized)
(Currently as_B(), as_C(), as_E(), as_F(),
as_G(), as_K(), as_N(), as_X()) including itself.
Many of these can be implemented as cascades.
- **asType(type=?)
conversion routine that takes the target type as
a string parameter.
- towards(other,fraction)
interpolation function that takes an
other position of the same type, and an interpolation
fraction, and that returns a position that can be
mathematically expressed as::
self*(1-fraction)+other*fraction
- Storable()
return a dictionary with all arguments to the
constructor that can be used to reconstruct the
position object including the type, but excluding
the hardware.
- __repr__()
a unique string representation, presentable to
the user.
Some methods are specific to specific 'type's of positions:
- Alternate()
for kappa and eulerian positions, returns a position
with different angles but the same orientation
of the crystal on the goniostat.
- NegateTheta()
for k positions, returns a position with
theta negative that has the same diffraction
vector active at the center of the detector.
- Xrot(angle)
for g positions, rotates the crystal angle
clockwise around the X axis.
- Yrot(angle)
for g positions, rotates the crystal angle
clockwise around the Y axis.
- Zrot(angle)
for g positions, rotates the crystal angle
clockwise around the Z axis.
|
Methods
|
|
|
|
|
WithHighTwoTheta
|
WithHighTwoTheta (
self,
ang,
margin,
)
Calculate a position that has the right-effective theta range ang. |
|
|
WithLowTwoTheta
|
WithLowTwoTheta (
self,
ang,
margin=0,
)
Calculate a position that has the left-effective theta range ang. |
|
|
allowed
|
allowed ( self )
Check whether the position is allowed on the goniostat. |
|
|
asType
|
asType ( self, type )
Return a new Position() object of type type that
represents this position. |
|
|
detector_edgetheta
|
detector_edgetheta (
self,
angle,
margin=0,
)
The theta corresponding to the detector_edgevec
Note: this is an "absolute value"! |
|
|
detector_edgevec
|
detector_edgevec (
self,
angle,
margin=0,
)
A vector pointing to the edge of the detector.
Uses the DetectorEdgeMM method of the hardware, and has
the same parameters. |
|
|
detector_hitrotvec
|
detector_hitrotvec (
self,
v,
margin=0,
)
See whether vector v at GonZero hits the
detector in the current position. |
|
|
detector_hitvec
|
detector_hitvec (
self,
v,
margin=0,
)
See whether vector v hits the detector
in the current position. |
|
|
detector_twothetaspan
|
detector_twothetaspan ( self, margin=0 )
Calculate the effective coverage of the
theta range (including a "sign"). |
|
|
goniometermatrix
|
goniometermatrix ( self )
The goniometer orientation matrix equivalent to this position. |
|
|
orange
|
orange ( self )
The allowed omega ranges for the position on a Kappa Goniostat.
Takes the current value of omega into account.
Returns a n-tuple of tuples. |
|
|
oranges
|
oranges ( self )
The allowed omega ranges for the position on a Kappa Goniostat.
Disregards the current value of omega.
Returns a n-tuple of 2-tuples. |
|
|
rotateBackTwoTheta
|
rotateBackTwoTheta ( self, v )
|
|
|
rotateToTwoTheta
|
rotateToTwoTheta ( self, v )
|
|