binoculars.backends package¶
Submodules¶
binoculars.backends.bm25 module¶
BINocular backend for beamline BM25, branch B first endstation [1] This backend should serve as a basic implementation of a backend based on xrayutilities [2]. It uses the information from the edf files (motors position and detector image) ignoring the spec file, except for using its scan numbers to identify images belonging to the same scan.
You should use CCD file names generated with the following pattern: filename_#n_#p_#r.edf (n: spec-scan number, p: point number, r: image number) Binning (2,2)
The backend is called ‘EH2SCD’.
Created on 2014-10-28
[1] http://www.esrf.eu/UsersAndScience/Experiments/CRG/BM25/BeamLine/experimentalstations/Single_Crystal_Diffraction [2] http://xrayutilities.sourceforge.net/
author: Dominik Kriegner (dominik.kriegner@gmail.com)
- class binoculars.backends.bm25.EDFInput(config)[source]¶
Bases:
InputBase
- class binoculars.backends.bm25.EH2SCD(config)[source]¶
Bases:
EDFInput
- monitor_counter = 'C_mont'¶
- qconv = <xrayutilities.experiment.QConversion object>¶
- class binoculars.backends.bm25.HKLProjection(config)[source]¶
Bases:
ProjectionBase
- class binoculars.backends.bm25.HKProjection(config)[source]¶
Bases:
HKLProjection
- class binoculars.backends.bm25.QProjection(config)[source]¶
Bases:
ProjectionBase
binoculars.backends.example module¶
- class binoculars.backends.example.Input(config)[source]¶
Bases:
InputBase
- generate_jobs(command)[source]¶
Command is supplied when the program is started in the terminal. This can used to differentiate between separate datasets that will be processed independently.
- get_destination_options(command)[source]¶
Creates the arguments that you can use to construct an output filename. This method returns a dict object with keys that will can be used in the configfile. In the configfile the output filename can now be described as ‘destination = demo_{first}-{last}.hdf5’. This helps to organise the output automatically.
- parse_config(config)[source]¶
To collect and process data you need the values provided in the configuration file. These you can access locally through the provided config object. This is a dict with as keys the labels given in the configfile. To use them outside the parse_config method you attribute them to the self.config object which can be used throughout the input class. A warning will be generated afterwards for config values not popped out of the dict.
- process_job(job)[source]¶
This methods is a generator that returns the intensity, the weights and a tuple of coordinates that will be used for projection. The input is a backend.job object. This objects contains attributes that are supplied as keyword arguments in the generate_jobs method when backend.Job is instantiated. You can wet here the weights according the behaviour of your detector. To select normal averaging give the weights the value of ones. This array should be the same shape as the intensity array.
This example backend simulates a random path through angular space starting at the origin. an example image will be generated using a three dimensional 10-slit interference function. The angles are with respect to the sample where af and delta are the angular coordinates of the pixels and ai and omega are the in plane and out of plane angles of the incoming beam.
- class binoculars.backends.example.QProjection(config)[source]¶
Bases:
ProjectionBase
- get_axis_labels()[source]¶
Specify the names of the axes. The number of labels should be equal to the number of arrays returned in the project method.
- project(wavelength, af, delta, omega, ai)[source]¶
This class takes as input the tuple of coordinates returned by the process_job method in the backend.InputBase class. Here you specify how to project the coordinates that belong to every datapoint. The number of input arguments should match the second tuple returned by process_job. The shape of each returned array should match the shape of the first argument returned by process_job
binoculars.backends.id03 module¶
- class binoculars.backends.id03.CylindricalQProjection(config)[source]¶
Bases:
QProjection
- class binoculars.backends.id03.GammaDelta(config)[source]¶
Bases:
HKLProjection
- class binoculars.backends.id03.GammaDeltaMu(config)[source]¶
Bases:
HKLProjection
- class binoculars.backends.id03.GammaDeltaTheta(config)[source]¶
Bases:
HKLProjection
- class binoculars.backends.id03.GisaxsDetector(config)[source]¶
Bases:
ID03Input
- monitor_counter = 'mon'¶
- class binoculars.backends.id03.HKLProjection(config)[source]¶
Bases:
ProjectionBase
- class binoculars.backends.id03.HKProjection(config)[source]¶
Bases:
HKLProjection
- class binoculars.backends.id03.ID03Input(config)[source]¶
Bases:
InputBase
- dbg_pointno = None¶
- dbg_scanno = None¶
- get_destination_options(command)[source]¶
Receives the same command as generate_jobs(), but returns dictionary that will be used to .format() the dispatcher:destination configuration value.
- class binoculars.backends.id03.QProjection(config)[source]¶
Bases:
ProjectionBase
- class binoculars.backends.id03.QTransformation(config)[source]¶
Bases:
QProjection
- class binoculars.backends.id03.Qpp(config)[source]¶
Bases:
nrQProjection
- class binoculars.backends.id03.SphericalQProjection(config)[source]¶
Bases:
QProjection
- class binoculars.backends.id03.ThetaLProjection(config)[source]¶
Bases:
ProjectionBase
- class binoculars.backends.id03.TwoThetaProjection(config)[source]¶
Bases:
SphericalQProjection
- class binoculars.backends.id03.nrQProjection(config)[source]¶
Bases:
QProjection
- class binoculars.backends.id03.pixels(config)[source]¶
Bases:
ProjectionBase
binoculars.backends.id03_xu module¶
BINocular backend for beamline ID03:EH2 This backend should serve as a basic example of a backend based on xrayutilities [1]. It still uses PyMCA for parsing the spec,edf files. The ‘original’ ID03 backend was used as a template.
Created on 2014-10-16
[1] http://xrayutilities.sourceforge.net/
author: Dominik Kriegner (dominik.kriegner@gmail.com)
- class binoculars.backends.id03_xu.EH2(config)[source]¶
Bases:
ID03Input
- monitor_counter = 'Monitor'¶
- qconv = <xrayutilities.experiment.QConversion object>¶
- ty = 600.0¶
- class binoculars.backends.id03_xu.HKLProjection(config)[source]¶
Bases:
ProjectionBase
- class binoculars.backends.id03_xu.HKProjection(config)[source]¶
Bases:
HKLProjection
binoculars.backends.sixs module¶
This file is part of the binoculars project.
The BINoculars library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
The BINoculars library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with the hkl library. If not, see <http://www.gnu.org/licenses/>.
- Copyright (C) 2015-2021, 2023 Synchrotron SOLEIL
L’Orme des Merisiers Saint-Aubin BP 48 91192 GIF-sur-YVETTE CEDEX
- Copyright (C) 2012-2015 European Synchrotron Radiation Facility
Grenoble, France
- Authors: Willem Onderwaater <onderwaa@esrf.fr>
Picca Frédéric-Emmanuel <picca@synchrotron-soleil.fr>
- class binoculars.backends.sixs.AnglesProjection(config)[source]¶
Bases:
ProjectionBase
- project(index: int, pdataframe: PDataFrame) Tuple[ndarray] [source]¶
- class binoculars.backends.sixs.AnglesProjection2(config)[source]¶
Bases:
ProjectionBase
- project(index: int, pdataframe: PDataFrame) Tuple[ndarray] [source]¶
- class binoculars.backends.sixs.DataFrame(diffractometer, sample, detector, source, h5_nodes)[source]¶
Bases:
NamedTuple
- diffractometer: Diffractometer¶
Alias for field number 0
- h5_nodes: Dict[str, Dataset]¶
Alias for field number 4
- class binoculars.backends.sixs.Detector(name, detector)[source]¶
Bases:
NamedTuple
- detector: Detector¶
Alias for field number 1
- name: str¶
Alias for field number 0
- class binoculars.backends.sixs.Diffractometer(name, ub, geometry)[source]¶
Bases:
NamedTuple
- geometry: Geometry¶
Alias for field number 2
- name: str¶
Alias for field number 0
- ub: ndarray¶
Alias for field number 1
- class binoculars.backends.sixs.FLYMedVEiger(config)[source]¶
Bases:
FlyMedV
- HPATH = {'attenuation': HItem(name='attenuation', optional=True), 'beta': HItem(name='beta', optional=True), 'delta': HItem(name='delta', optional=False), 'eix': DatasetPathOr(path1=HItem(name='eix', optional=True), path2=DatasetPathContains(path='i14-c-cx1-dt-det_tx.1/position_pre')), 'eiz': DatasetPathOr(path1=HItem(name='eiz', optional=True), path2=DatasetPathContains(path='i14-c-cx1-dt-det_tz.1/position_pre')), 'etaa': HItem(name='etaa', optional=True), 'gamma': HItem(name='gamma', optional=False), 'image': HItem(name='eiger_image', optional=False), 'mu': HItem(name='mu', optional=False), 'omega': HItem(name='omega', optional=False), 'timestamp': HItem(name='epoch', optional=True)}¶
- process_image(index, dataframe, pixels0, mask) Optional[Tuple[ndarray, ndarray, Tuple[int, PDataFrame]]] [source]¶
- class binoculars.backends.sixs.FlyMedH(config)[source]¶
Bases:
FlyScanUHV
- HPATH = {'attenuation': HItem(name='attenuation', optional=True), 'delta': HItem(name='delta', optional=False), 'gamma': HItem(name='gamma', optional=False), 'image': DatasetPathOr(path1=HItem(name='xpad_image', optional=True), path2=DatasetPathOr(path1=HItem(name='xpad_s140_image', optional=True), path2=HItem(name='xpad_S140_image', optional=False))), 'mu': HItem(name='mu', optional=False), 'pitch': HItem(name='beta', optional=True), 'timestamp': HItem(name='epoch', optional=True)}¶
- class binoculars.backends.sixs.FlyMedHS70(config)[source]¶
Bases:
FlyMedH
- HPATH = {'attenuation': HItem(name='attenuation', optional=True), 'delta': HItem(name='delta', optional=False), 'gamma': HItem(name='gamma', optional=False), 'image': HItem(name='xpad_s70_image', optional=True), 'mu': HItem(name='mu', optional=False), 'pitch': HItem(name='beta', optional=True), 'timestamp': HItem(name='epoch', optional=True)}¶
- class binoculars.backends.sixs.FlyMedV(config)[source]¶
Bases:
FlyScanUHV
- HPATH = {'attenuation': HItem(name='attenuation', optional=True), 'beta': HItem(name='beta', optional=True), 'delta': HItem(name='delta', optional=False), 'etaa': HItem(name='etaa', optional=True), 'gamma': HItem(name='gamma', optional=False), 'image': DatasetPathOr(path1=HItem(name='xpad_image', optional=True), path2=DatasetPathOr(path1=HItem(name='xpad_s140_image', optional=True), path2=HItem(name='xpad_S140_image', optional=False))), 'mu': HItem(name='mu', optional=False), 'omega': HItem(name='omega', optional=False), 'timestamp': HItem(name='epoch', optional=True)}¶
- class binoculars.backends.sixs.FlyMedVS70(config)[source]¶
Bases:
FlyMedV
- HPATH = {'attenuation': HItem(name='attenuation', optional=True), 'beta': HItem(name='beta', optional=True), 'delta': HItem(name='delta', optional=False), 'etaa': HItem(name='etaa', optional=True), 'gamma': HItem(name='gamma', optional=False), 'image': HItem(name='xpad_s70_image', optional=False), 'mu': HItem(name='mu', optional=False), 'omega': HItem(name='omega', optional=False), 'timestamp': HItem(name='epoch', optional=True)}¶
- class binoculars.backends.sixs.FlyScanUHV(config)[source]¶
Bases:
SIXS
- HPATH = {'attenuation': HItem(name='attenuation', optional=True), 'delta': HItem(name='UHV_DELTA', optional=False), 'gamma': HItem(name='UHV_GAMMA', optional=False), 'image': DatasetPathOr(path1=HItem(name='xpad_image', optional=True), path2=DatasetPathOr(path1=HItem(name='xpad_s140_image', optional=True), path2=HItem(name='xpad_S140_image', optional=False))), 'mu': HItem(name='UHV_MU', optional=False), 'omega': HItem(name='UHV_OMEGA', optional=False), 'timestamp': HItem(name='epoch', optional=True)}¶
- process_image(index, dataframe, pixels, mask) Optional[Tuple[ndarray, ndarray, Tuple[int, PDataFrame]]] [source]¶
- class binoculars.backends.sixs.FlyScanUHV2(config)[source]¶
Bases:
FlyScanUHV
- HPATH = {'attenuation': HItem(name='attenuation', optional=True), 'delta': HItem(name='delta', optional=False), 'gamma': HItem(name='gamma', optional=False), 'image': DatasetPathOr(path1=HItem(name='xpad_image', optional=True), path2=DatasetPathOr(path1=HItem(name='xpad_s140_image', optional=True), path2=HItem(name='xpad_S140_image', optional=False))), 'mu': HItem(name='mu', optional=False), 'omega': HItem(name='omega', optional=False), 'timestamp': HItem(name='epoch', optional=True)}¶
- class binoculars.backends.sixs.FlyScanUHVS70(config)[source]¶
Bases:
FlyScanUHV
- HPATH = {'attenuation': HItem(name='attenuation', optional=True), 'delta': HItem(name='delta', optional=False), 'gamma': HItem(name='gamma', optional=False), 'image': HItem(name='xpad_s70_image', optional=False), 'mu': HItem(name='mu', optional=False), 'omega': HItem(name='omega', optional=False), 'timestamp': HItem(name='epoch', optional=True)}¶
- class binoculars.backends.sixs.FlyScanUHVS70Andreazza(config)[source]¶
Bases:
FlyScanUHV
- HPATH = {'attenuation': HItem(name='attenuation', optional=True), 'delta': HItem(name='delta_xps', optional=False), 'image': HItem(name='xpad_s70_image', optional=False), 'timestamp': HItem(name='epoch', optional=True)}¶
- class binoculars.backends.sixs.FlyScanUHVUfxc(config)[source]¶
Bases:
FlyScanUHV
- HPATH = {'attenuation': HItem(name='attenuation', optional=True), 'delta': HItem(name='delta', optional=False), 'gamma': HItem(name='gamma', optional=False), 'image': HItem(name='ufxc_sixs_image', optional=False), 'mu': HItem(name='mu', optional=False), 'omega': HItem(name='omega', optional=False), 'timestamp': HItem(name='epoch', optional=True)}¶
- class binoculars.backends.sixs.GisaxUhvEiger(config)[source]¶
Bases:
FlyScanUHV
- HPATH = {'attenuation': HItem(name='attenuation', optional=True), 'eix': DatasetPathOr(path1=HItem(name='eix', optional=True), path2=DatasetPathContains(path='i14-c-cx1-dt-det_tx.1/position_pre')), 'eiz': DatasetPathOr(path1=HItem(name='eiz', optional=True), path2=DatasetPathContains(path='i14-c-cx1-dt-det_tz.1/position_pre')), 'image': HItem(name='eiger_image', optional=False)}¶
- process_image(index, dataframe, pixels0, mask) Optional[Tuple[ndarray, ndarray, Tuple[int, PDataFrame]]] [source]¶
- class binoculars.backends.sixs.HKLProjection(config)[source]¶
Bases:
ProjectionBase
- project(index: int, pdataframe: PDataFrame) Tuple[ndarray] [source]¶
- class binoculars.backends.sixs.HKProjection(config)[source]¶
Bases:
HKLProjection
- project(index: int, pdataframe: PDataFrame) Tuple[ndarray] [source]¶
- binoculars.backends.sixs.M(theta, u)[source]¶
- Parameters:
theta (float) – the axis value in radian
u ([float, float, float]) – the axis vector [x, y, z]
- Returns:
the rotation matrix
- Return type:
numpy.ndarray (3, 3)
- class binoculars.backends.sixs.PDataFrame(pixels, k, ub, R, P, index, timestamp, surface_orientation, dataframe, input_config)[source]¶
Bases:
NamedTuple
- P: ndarray¶
Alias for field number 4
- R: ndarray¶
Alias for field number 3
- index: int¶
Alias for field number 5
- input_config: ConfigSection¶
Alias for field number 9
- k: float¶
Alias for field number 1
- pixels: ndarray¶
Alias for field number 0
- surface_orientation: SurfaceOrientation¶
Alias for field number 7
- timestamp: int¶
Alias for field number 6
- ub: Optional[ndarray]¶
Alias for field number 2
- class binoculars.backends.sixs.Pixels(config)[source]¶
Bases:
ProjectionBase
- project(index: int, pdataframe: PDataFrame) Tuple[ndarray] [source]¶
- class binoculars.backends.sixs.QIndex(config)[source]¶
Bases:
Stereo
- project(index: int, pdataframe: PDataFrame) Tuple[ndarray] [source]¶
- class binoculars.backends.sixs.QparQperIndexProjection(config)[source]¶
Bases:
QparQperProjection
- project(index: int, pdataframe: PDataFrame) Tuple[ndarray] [source]¶
- class binoculars.backends.sixs.QparQperProjection(config)[source]¶
Bases:
QxQyQzProjection
- project(index: int, pdataframe: PDataFrame) Tuple[ndarray] [source]¶
- class binoculars.backends.sixs.QxPolarProjection(config)[source]¶
Bases:
QxQyQzProjection
- project(index: int, pdataframe: PDataFrame) Tuple[ndarray] [source]¶
- class binoculars.backends.sixs.QxQyIndexProjection(config)[source]¶
Bases:
QxQyQzProjection
- project(index: int, pdataframe: PDataFrame) Tuple[ndarray] [source]¶
- class binoculars.backends.sixs.QxQyQzProjection(config)[source]¶
Bases:
ProjectionBase
- project(index: int, pdataframe: PDataFrame) Tuple[ndarray] [source]¶
- class binoculars.backends.sixs.QxQzIndexProjection(config)[source]¶
Bases:
QxQyQzProjection
- project(index: int, pdataframe: PDataFrame) Tuple[ndarray] [source]¶
- class binoculars.backends.sixs.QyPolarProjection(config)[source]¶
Bases:
QxQyQzProjection
- project(index: int, pdataframe: PDataFrame) Tuple[ndarray] [source]¶
- class binoculars.backends.sixs.QyQzIndexProjection(config)[source]¶
Bases:
QxQyQzProjection
- project(index: int, pdataframe: PDataFrame) Tuple[ndarray] [source]¶
- class binoculars.backends.sixs.QzPolarProjection(config)[source]¶
Bases:
QxQyQzProjection
- project(index: int, pdataframe: PDataFrame) Tuple[ndarray] [source]¶
- class binoculars.backends.sixs.RealSpace(config)[source]¶
Bases:
ProjectionBase
- project(index: int, pdataframe: PDataFrame) Tuple[ndarray] [source]¶
- class binoculars.backends.sixs.SBSFixedDetector(config)[source]¶
Bases:
FlyScanUHV
- HPATH = {'image': HItem(name='data_11', optional=False), 'timestamp': HItem(name='sensors_timestamps', optional=True)}¶
- process_image(index, dataframe, pixels, mask) Optional[Tuple[ndarray, ndarray, Tuple[int, PDataFrame]]] [source]¶
- class binoculars.backends.sixs.SBSMedH(config)[source]¶
Bases:
FlyScanUHV
- HPATH = {'attenuation': DatasetPathWithAttribute(attribute='long_name', value=b'i14-c-c00/ex/roic/att'), 'delta': DatasetPathWithAttribute(attribute='long_name', value=b'i14-c-cx1/ex/med-h-dif-group.1/delta'), 'gamma': DatasetPathWithAttribute(attribute='long_name', value=b'i14-c-cx1/ex/med-h-dif-group.1/gamma'), 'image': DatasetPathWithAttribute(attribute='long_name', value=b'i14-c-c00/dt/xpad.1/image'), 'mu': DatasetPathWithAttribute(attribute='long_name', value=b'i14-c-cx1/ex/med-h-dif-group.1/mu'), 'pitch': DatasetPathWithAttribute(attribute='long_name', value=b'i14-c-cx1/ex/diff-med-tpp/pitch'), 'timestamp': HItem(name='sensors_timestamps', optional=True)}¶
- class binoculars.backends.sixs.SBSMedV(config)[source]¶
Bases:
FlyScanUHV
- HPATH = {'attenuation': DatasetPathWithAttribute(attribute='long_name', value=b'i14-c-c00/ex/roic/att'), 'beta': DatasetPathContains(path='i14-c-cx1-ex-diff-med-tpp/TPP/Orientation/pitch'), 'delta': DatasetPathWithAttribute(attribute='long_name', value=b'i14-c-cx1/ex/med-v-dif-group.1/delta'), 'etaa': DatasetPathWithAttribute(attribute='long_name', value=b'i14-c-cx1/ex/med-v-dif-group.1/etaa'), 'gamma': DatasetPathWithAttribute(attribute='long_name', value=b'i14-c-cx1/ex/med-v-dif-group.1/gamma'), 'image': DatasetPathWithAttribute(attribute='long_name', value=b'i14-c-c00/dt/xpad.1/image'), 'mu': DatasetPathWithAttribute(attribute='long_name', value=b'i14-c-cx1/ex/med-v-dif-group.1/mu'), 'omega': DatasetPathWithAttribute(attribute='long_name', value=b'i14-c-cx1/ex/med-v-dif-group.1/omega'), 'timestamp': HItem(name='sensors_timestamps', optional=True)}¶
- class binoculars.backends.sixs.SBSMedVFixDetector(config)[source]¶
Bases:
SBSMedV
- HPATH = {'attenuation': DatasetPathWithAttribute(attribute='long_name', value=b'i14-c-c00/ex/roic/att'), 'beta': DatasetPathContains(path='i14-c-cx1-ex-diff-med-tpp/TPP/Orientation/pitch'), 'delta': DatasetPathWithAttribute(attribute='long_name', value=b'i14-c-cx1/ex/med-v-dif-group.1/delta'), 'etaa': DatasetPathWithAttribute(attribute='long_name', value=b'i14-c-cx1/ex/med-v-dif-group.1/etaa'), 'gamma': DatasetPathWithAttribute(attribute='long_name', value=b'i14-c-cx1/ex/med-v-dif-group.1/gamma'), 'image': DatasetPathWithAttribute(attribute='long_name', value=b'i14-c-c00/dt/eiger.1/image'), 'mu': DatasetPathWithAttribute(attribute='long_name', value=b'i14-c-cx1/ex/med-v-dif-group.1/mu'), 'omega': DatasetPathWithAttribute(attribute='long_name', value=b'i14-c-cx1/ex/med-v-dif-group.1/omega'), 'timestamp': HItem(name='sensors_timestamps', optional=True)}¶
- class binoculars.backends.sixs.SIXS(config)[source]¶
Bases:
InputBase
- dbg_pointno = None¶
- dbg_scanno = None¶
- class binoculars.backends.sixs.Sample(a, b, c, alpha, beta, gamma, ux, uy, uz, ub, sample)[source]¶
Bases:
NamedTuple
- a: float¶
Alias for field number 0
- alpha: float¶
Alias for field number 3
- b: float¶
Alias for field number 1
- beta: float¶
Alias for field number 4
- c: float¶
Alias for field number 2
- gamma: float¶
Alias for field number 5
- sample: Sample¶
Alias for field number 10
- ub: ndarray¶
Alias for field number 9
- ux: float¶
Alias for field number 6
- uy: float¶
Alias for field number 7
- uz: float¶
Alias for field number 8
- class binoculars.backends.sixs.Source(wavelength)[source]¶
Bases:
NamedTuple
- wavelength: float¶
Alias for field number 0
- class binoculars.backends.sixs.Stereo(config)[source]¶
Bases:
QxQyQzProjection
- project(index: int, pdataframe: PDataFrame) Tuple[ndarray] [source]¶
- class binoculars.backends.sixs.SurfaceOrientation(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
Enum
- HORIZONTAL = 2¶
- VERTICAL = 1¶
- binoculars.backends.sixs.get_diffractometer(hfile: File, config)[source]¶
Construct a Diffractometer from a NeXus file