# 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)

  Bases: `InputBase`

  static apply_mask(data, xmask, ymask)
  generate_jobs(command)

    Receives command from user, yields Job() instances

  get_destination_options(command)

    Receives the same command as generate_jobs(), but returns dictionary that will be used to .format() the dispatcher:destination configuration value.

  get_images(imgs, first, last, dry_run=False)
  list_images(scannrs)
  parse_config(config)
  process_job(job)

    Receives a Job() instance, yields (intensity, args_to_be_sent_to_a_Projection_instance)

    > Job()s could have been pickle’d and distributed over a cluster

class binoculars.backends.bm25.EH2SCD(config)

  Bases: `EDFInput`

  monitor_counter = 'C_mont'
  parse_config(config)
  process_image(image)
  qconv = <xrayutilities.experiment.QConversion object>

class binoculars.backends.bm25.HKLProjection(config)

  Bases: `ProjectionBase`

  get_axis_labels()
  project(mu, theta, phi, chi, ccdty, ccdtx, ccdtz, ccdth, ccdtr, wavelength, UB, qconv)

class binoculars.backends.bm25.HKProjection(config)

  Bases: `HKLProjection`

  get_axis_labels()
  project(mu, theta, phi, chi, ccdty, ccdtx, ccdtz, ccdth, ccdtr, wavelength, UB, qconv)

class binoculars.backends.bm25.QProjection(config)

  Bases: `ProjectionBase`

  get_axis_labels()
  project(mu, theta, phi, chi, ccdty, ccdtx, ccdtz, ccdth, ccdtr, wavelength, UB, qconv)

class binoculars.backends.bm25.QinpProjection(config)

  Bases: `ProjectionBase`

  get_axis_labels()
  project(mu, theta, phi, chi, ccdty, ccdtx, ccdtz, ccdth, ccdtr, wavelength, UB, qconv)

## binoculars.backends.example module

class binoculars.backends.example.Input(config)

  Bases: `InputBase`

  generate_jobs(command)

    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)

    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)

    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)

    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)

  Bases: `ProjectionBase`

  get_axis_labels()

    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)

    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)

  Bases: `QProjection`

  get_axis_labels()
  project(wavelength, UB, gamma, delta, theta, mu, chi, phi)

class binoculars.backends.id03.EH1(config)

  Bases: `ID03Input`

  get_point_params(scan, first, last)
  monitor_counter = 'mon'
  parse_config(config)
  process_image(scanparams, pointparams, image)

class binoculars.backends.id03.EH2(config)

  Bases: `ID03Input`

  get_point_params(scan, first, last)
  monitor_counter = 'Monitor'
  parse_config(config)
  process_image(scanparams, pointparams, image)

class binoculars.backends.id03.GammaDelta(config)

  Bases: `HKLProjection`

  get_axis_labels()
  project(wavelength, UB, gamma, delta, theta, mu, chi, phi)

class binoculars.backends.id03.GammaDeltaMu(config)

  Bases: `HKLProjection`

  get_axis_labels()
  project(wavelength, UB, gamma, delta, theta, mu, chi, phi)

class binoculars.backends.id03.GammaDeltaTheta(config)

  Bases: `HKLProjection`

  get_axis_labels()
  project(wavelength, UB, gamma, delta, theta, mu, chi, phi)

class binoculars.backends.id03.GisaxsDetector(config)

  Bases: `ID03Input`

  find_edfs(pattern, scanno)
  get_point_params(scan, first, last)
  monitor_counter = 'mon'
  parse_config(config)
  process_image(scanparams, pointparams, image)

class binoculars.backends.id03.HKLProjection(config)

  Bases: `ProjectionBase`

  get_axis_labels()
  project(wavelength, UB, gamma, delta, theta, mu, chi, phi)

class binoculars.backends.id03.HKProjection(config)

  Bases: `HKLProjection`

  get_axis_labels()
  project(wavelength, UB, gamma, delta, theta, mu, chi, phi)

class binoculars.backends.id03.ID03Input(config)

  Bases: `InputBase`

  static apply_mask(data, xmask, ymask)
  dbg_pointno = None
  dbg_scanno = None
  find_edfs(pattern, scanno)
  generate_jobs(command)

    Receives command from user, yields Job() instances

  get_delayed_jobs(scanno)
  get_delayed_scan(scannumber, timeout=None)
  get_destination_options(command)

    Receives the same command as generate_jobs(), but returns dictionary that will be used to .format() the dispatcher:destination configuration value.

  get_images(scan, first, last, dry_run=False)
  get_scan(scannumber)
  get_scan_params(scan)
  get_wavelength(G)
  static is_aborted(scan)
  static is_zap(scan)
  parse_config(config)
  process_job(job)

    Receives a Job() instance, yields (intensity, args_to_be_sent_to_a_Projection_instance)

    > Job()s could have been pickle’d and distributed over a cluster

  target(scan)
  wait_for_points(scannumber, stop, timeout=None)

class binoculars.backends.id03.QProjection(config)

  Bases: `ProjectionBase`

  get_axis_labels()
  project(wavelength, UB, gamma, delta, theta, mu, chi, phi)

class binoculars.backends.id03.QTransformation(config)

  Bases: `QProjection`

  get_axis_labels()
  parse_config(config)
  project(wavelength, UB, gamma, delta, theta, mu, chi, phi)

class binoculars.backends.id03.Qpp(config)

  Bases: `nrQProjection`

  get_axis_labels()
  project(wavelength, UB, gamma, delta, theta, mu, chi, phi)

class binoculars.backends.id03.SphericalQProjection(config)

  Bases: `QProjection`

  get_axis_labels()
  project(wavelength, UB, gamma, delta, theta, mu, chi, phi)

class binoculars.backends.id03.ThetaLProjection(config)

  Bases: `ProjectionBase`

  get_axis_labels()
  project(wavelength, UB, gamma, delta, theta, mu, chi, phi)

class binoculars.backends.id03.TwoThetaProjection(config)

  Bases: `SphericalQProjection`

  get_axis_labels()
  project(wavelength, UB, gamma, delta, theta, mu, chi, phi)

binoculars.backends.id03.load_matrix(filename)

class binoculars.backends.id03.nrQProjection(config)

  Bases: `QProjection`

  get_axis_labels()
  project(wavelength, UB, gamma, delta, theta, mu, chi, phi)

class binoculars.backends.id03.pixels(config)

  Bases: `ProjectionBase`

  get_axis_labels()
  project(wavelength, UB, gamma, delta, theta, mu, chi, phi)

class binoculars.backends.id03.specularangles(config)

  Bases: `ProjectionBase`

  get_axis_labels()
  project(wavelength, UB, gamma, delta, theta, mu, chi, phi)

## 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)

  Bases: `ID03Input`

  get_point_params(scan, first, last)
  monitor_counter = 'Monitor'
  parse_config(config)
  process_image(scanparams, pointparams, image)
  qconv = <xrayutilities.experiment.QConversion object>
  ty = 600.0

class binoculars.backends.id03_xu.HKLProjection(config)

  Bases: `ProjectionBase`

  get_axis_labels()
  project(mu, theta, delta, gamR, gamT, ty, wavelength, UB, qconv)

class binoculars.backends.id03_xu.HKProjection(config)

  Bases: `HKLProjection`

  get_axis_labels()
  project(mu, theta, delta, gamR, gamT, ty, wavelength, UB, qconv)

class binoculars.backends.id03_xu.ID03Input(config)

  Bases: `InputBase`

  static apply_mask(data, xmask, ymask)
  find_edfs(pattern, scanno)
  generate_jobs(command)

    Receives command from user, yields Job() instances

  get_destination_options(command)

    Receives the same command as generate_jobs(), but returns dictionary that will be used to .format() the dispatcher:destination configuration value.

  get_images(scan, first, last, dry_run=False)
  get_scan(scannumber)
  get_scan_params(scan)
  parse_config(config)
  process_job(job)

    Receives a Job() instance, yields (intensity, args_to_be_sent_to_a_Projection_instance)

    > Job()s could have been pickle’d and distributed over a cluster

class binoculars.backends.id03_xu.QProjection(config)

  Bases: `ProjectionBase`

  get_axis_labels()
  project(mu, theta, delta, gamR, gamT, ty, wavelength, UB, qconv)

## binoculars.backends.sixs module

## Module contents