spec2nexus.diffractometers#

source code documentation#

Describe SPEC diffractometer geometry #G control lines.

#G0 … G[] array (geo mode, sector, etc) #G1 … U[] array (lattice constants, orientation reflections) #G2 is unused #G3 … UB[] array (orientation matrix) #G4 … Q[] array (lambda, frozen angles, cut points, etc)

API

Diffractometer(geo_name)

describe the diffractometer for the scan

DiffractometerGeometryCatalog()

catalog of the diffractometer geometries known to SPEC

split_name_variation(geo_name)

split geo_name into geometry name and variation

get_geometry_catalog()

reset_geometry_catalog()

class spec2nexus.diffractometers.Diffractometer(geo_name)[source]#

Bases: object

describe the diffractometer for the scan

parse(scan)

print_all(scan)

Print All (pa) about this diffractometer scan.

print_brief(scan)

Print brief information (wh: where) about this diffractometer scan.

property _Q_names#

List of names used to define Q (typically: h k l). All lower case.

_get_Q_dict(info)[source]#

Dictionary with all the Q-related terms & values (hkl, for example).

PARAMETERS

info dict :

from _get_info_dict()

_get_info_dict(level='str')[source]#

Return dictionary for use in various reports.

PARAMETER

level str :

Level of detail for desired report. One of these values: pa, str, wh. Default: str

_positioners_dict(scan)[source]#

Dictionary with positioners (keys) and positions (values) in this scan.

PARAMETERS

scan obj :

SPEC data file scan (a spec2nexus.spec.SpecDataFileScan object).

parse(scan)[source]#
print_all(scan)[source]#

Print All (pa) about this diffractometer scan.

PARAMETERS

scan obj :

SPEC data file scan (a spec2nexus.spec.SpecDataFileScan object).

print_brief(scan)[source]#

Print brief information (wh: where) about this diffractometer scan.

PARAMETERS

scan obj :

SPEC data file scan (a spec2nexus.spec.SpecDataFileScan object).

class spec2nexus.diffractometers.DiffractometerGeometryCatalog[source]#

Bases: object

catalog of the diffractometer geometries known to SPEC

geometries([variations])

list known geometries

get(geo_name[, default])

return dictionary for diffractometer geometry geo_name

get_default_geometry()

has_geometry(geo_name)

Is the geo_name geometry defined? True or False

match(scan)

Find the geo_name geometry that matches the scan.

_get_scan_positioners_(scan)[source]#
db = {}#
geometries(variations=False)[source]#

list known geometries

PARAMETERS

variationsbool

If True, also list known variations

get(geo_name, default=None)[source]#

return dictionary for diffractometer geometry geo_name

get_default_geometry()[source]#
get_variant(geometry, variant_name)[source]#
has_geometry(geo_name)[source]#

Is the geo_name geometry defined? True or False

match(scan)[source]#

Find the geo_name geometry that matches the scan.

Look at the data file header if the name is defined on the first comment line, as written by the SPEC standard macro. If there is more than one matching geometry, pick the first one.

class spec2nexus.diffractometers.KeyDescriptionValue(key, description, value)#

Bases: tuple

_asdict()#

Return a new dict which maps field names to their values.

_field_defaults = {}#
_fields = ('key', 'description', 'value')#
classmethod _make(iterable)#

Make a new KeyDescriptionValue object from a sequence or iterable

_replace(**kwds)#

Return a new KeyDescriptionValue object replacing specified fields with new values

count(value, /)#

Return number of occurrences of value.

description#

Alias for field number 1

index(value, start=0, stop=9223372036854775807, /)#

Return first index of value.

Raises ValueError if the value is not present.

key#

Alias for field number 0

value#

Alias for field number 2

class spec2nexus.diffractometers.LatticeParameters2D(a, b, gamma)#

Bases: tuple

_asdict()#

Return a new dict which maps field names to their values.

_field_defaults = {}#
_fields = ('a', 'b', 'gamma')#
classmethod _make(iterable)#

Make a new LatticeParameters2D object from a sequence or iterable

_replace(**kwds)#

Return a new LatticeParameters2D object replacing specified fields with new values

a#

Alias for field number 0

b#

Alias for field number 1

count(value, /)#

Return number of occurrences of value.

gamma#

Alias for field number 2

index(value, start=0, stop=9223372036854775807, /)#

Return first index of value.

Raises ValueError if the value is not present.

class spec2nexus.diffractometers.LatticeParameters3D(a, b, c, alpha, beta, gamma)#

Bases: tuple

_asdict()#

Return a new dict which maps field names to their values.

_field_defaults = {}#
_fields = ('a', 'b', 'c', 'alpha', 'beta', 'gamma')#
classmethod _make(iterable)#

Make a new LatticeParameters3D object from a sequence or iterable

_replace(**kwds)#

Return a new LatticeParameters3D object replacing specified fields with new values

a#

Alias for field number 0

alpha#

Alias for field number 3

b#

Alias for field number 1

beta#

Alias for field number 4

c#

Alias for field number 2

count(value, /)#

Return number of occurrences of value.

gamma#

Alias for field number 5

index(value, start=0, stop=9223372036854775807, /)#

Return first index of value.

Raises ValueError if the value is not present.

class spec2nexus.diffractometers.Reflections2D(h, k, wavelength, angles)#

Bases: tuple

_asdict()#

Return a new dict which maps field names to their values.

_field_defaults = {}#
_fields = ('h', 'k', 'wavelength', 'angles')#
classmethod _make(iterable)#

Make a new Reflections2D object from a sequence or iterable

_replace(**kwds)#

Return a new Reflections2D object replacing specified fields with new values

angles#

Alias for field number 3

count(value, /)#

Return number of occurrences of value.

h#

Alias for field number 0

index(value, start=0, stop=9223372036854775807, /)#

Return first index of value.

Raises ValueError if the value is not present.

k#

Alias for field number 1

wavelength#

Alias for field number 2

class spec2nexus.diffractometers.Reflections3D(h, k, l, wavelength, angles)#

Bases: tuple

_asdict()#

Return a new dict which maps field names to their values.

_field_defaults = {}#
_fields = ('h', 'k', 'l', 'wavelength', 'angles')#
classmethod _make(iterable)#

Make a new Reflections3D object from a sequence or iterable

_replace(**kwds)#

Return a new Reflections3D object replacing specified fields with new values

angles#

Alias for field number 4

count(value, /)#

Return number of occurrences of value.

h#

Alias for field number 0

index(value, start=0, stop=9223372036854775807, /)#

Return first index of value.

Raises ValueError if the value is not present.

k#

Alias for field number 1

l#

Alias for field number 2

wavelength#

Alias for field number 3

spec2nexus.diffractometers.get_geometry_catalog()[source]#
spec2nexus.diffractometers.reset_geometry_catalog()[source]#
spec2nexus.diffractometers.split_name_variation(geo_name)[source]#

split geo_name into geometry name and variation