SimEx.Calculators package

SimEx.Calculators.AbstractBaseCalculator module

module AbstractBaseCalculator

Hosting the base class of all Calculators.

class SimEx.Calculators.AbstractBaseCalculator.AbstractBaseCalculator(parameters=None, input_path=None, output_path=None)[source]

Bases: SimEx.AbstractBaseClass.AbstractBaseClass

Class AbstractBaseCalculator

Abstract class for all simulation calculators.

Parameters
  • parameters (dict || AbstractCalculatorParameters) – Parameters of the calculation (not data).

  • input_path (str) – Path to hdf5 file holding the input data.

  • output_path (str) – Path to hdf5 file for output.

abstract backengine()[source]

Method to call the backengine for the calculator. To be implemented on the derived classes.

classmethod dumpLoader(fname)[source]

Creates calculator object from a dump file

Parameters

fname – path to the dump file.

Returns

Created calculator object.

Raises

RuntimeError – if cannot create object.

dumpToFile(fname)[source]

dump class instance to file.

Parameters

fname – Path to file to dump.

abstract expectedData()[source]

Query for the data fields expected by this calculator.

property input_path

Query for the input file path(s).

property output_path

Query for the output file path(s).

property parameters

Query for the control parameters of the calculator.

abstract providedData()[source]

Query for the data fields provided by this calculator.

classmethod runFromCLI()[source]

Method to start calculator computations from command line.

Returns

exit with status code

abstract saveH5()[source]
SimEx.Calculators.AbstractBaseCalculator.checkAndSetBaseCalculator(var=None, default=None)[source]

Check if passed object is an AbstractBaseCalculator instance. If non is given, set to given default.

Parameters
  • var – The object to check.

  • default – The default to use.

Returns

Te checked photon source object.

Raises

RuntimeError – if no valid BaseCalculator was given.

SimEx.Calculators.AbstractBaseCalculator.checkAndSetIO(io)[source]

Check the passed io path/filenames and set appropriately.

SimEx.Calculators.AbstractBaseCalculator.checkAndSetParameters(parameters)[source]

Utility to check if the ‘parameters’ argument is valid input.

Parameters

parameters (dict or AbstractCalculatorParameters) – The parameters object to check.

Returns

The checked parameters object.

SimEx.Calculators.AbstractPhotonAnalyzer module

module AbstractPhotonAnalyzer

Module for AbstractPhotonAnalyzer

class SimEx.Calculators.AbstractPhotonAnalyzer.AbstractPhotonAnalyzer(parameters=None, input_path=None, output_path=None)[source]

Bases: SimEx.Calculators.AbstractBaseCalculator.AbstractBaseCalculator

Class AbstractPhotonAnalyzer

Abstract base class for all PhotonAnalyzers.

Parameters
  • parameters (dict || AbstractCalculatorParameters) – Parameters of the calculation (not data).

  • input_path (str) – Path to hdf5 file holding the input data.

  • output_path (str) – Path to hdf5 file for output.

SimEx.Calculators.AbstractPhotonAnalyzer.checkAndSetPhotonAnalyzer(var=None, default=None)[source]

Check if passed object is an AbstractPhotonAnalyzer instance. If non is given, set to given default.

Parameters
  • var – The object to check.

  • default – The default to use.

Returns

The checked photon source object.

Raises

RuntimeError – if no valid PhotonAnalyzer was given.

SimEx.Calculators.AbstractPhotonDetector module

module AbstractPhotonDetector

Hosts the base class for all PhotonDetectors.

class SimEx.Calculators.AbstractPhotonDetector.AbstractPhotonDetector(parameters=None, input_path=None, output_path=None)[source]

Bases: SimEx.Calculators.AbstractBaseCalculator.AbstractBaseCalculator

Class AbstractPhotonDetector

Abstract base class for all PhotonDetectors.

SimEx.Calculators.AbstractPhotonDetector.checkAndSetPhotonDetector(var=None, default=None)[source]

Check if passed object is an AbstractPhotonDetector instance. If non is given, set to given default.

Parameters
  • var – The object to check.

  • default – The default to use.

Returns

The checked photon source object.

Raises

RuntimeError – if no valid PhotonDetector was given.

SimEx.Calculators.AbstractPhotonDiffractor module

module AbstractPhotonDiffractor

Hosts the base class for all Diffractors.

class SimEx.Calculators.AbstractPhotonDiffractor.AbstractPhotonDiffractor(parameters=None, input_path=None, output_path=None)[source]

Bases: SimEx.Calculators.AbstractBaseCalculator.AbstractBaseCalculator

Abstract base class for all PhotonDiffractors.

Parameters
  • parameters (dict || AbstractCalculatorParameters) – Parameters of the calculation (not data).

  • input_path (str) – Path to hdf5 file holding the input data.

  • output_path (str) – Path to hdf5 file for output.

SimEx.Calculators.AbstractPhotonDiffractor.checkAndSetPhotonDiffractor(var=None, default=None)[source]

Check if passed object is an AbstractPhotonDiffractor instance. If non is given, set to given default.

@param var : The object to check. @param default : The default to use. @return : The checked photon source object. @throw : RuntimeError if no valid PhotonDiffractor was given.

SimEx.Calculators.AbstractPhotonInteractor module

module AbstractPhotonInteractor

Hosts the base class for all PhotonInteractors.

class SimEx.Calculators.AbstractPhotonInteractor.AbstractPhotonInteractor(parameters=None, input_path=None, output_path=None, sample_path=None)[source]

Bases: SimEx.Calculators.AbstractBaseCalculator.AbstractBaseCalculator

Class AbstractPhotonInteractor

Abstract base class for all PhotonInteractors.

Parameters
  • parameters (dict || AbstractCalculatorParameters) – Parameters of the calculation (not data).

  • input_path (str) – Path to hdf5 file holding the input data.

  • output_path (str) – Path to hdf5 file for output.

  • sample_path (str) – Path to file containing the sample atom coordinates (at least atom type and cartesian coordinates).

SimEx.Calculators.AbstractPhotonInteractor.checkAndSetPhotonInteractor(var=None, default=None)[source]

Check if passed object is an AbstractPhotonInteractor instance. If non is given, set to given default.

@param var : The object to check. @param default : The default to use. @return : The checked photon source object. @throw : RuntimeError if no valid PhotonInteractor was given.

SimEx.Calculators.AbstractPhotonPropagator module

module AbstractPhotonPropagator

Module holding the AbstractPhotonPropagator abstract class.

class SimEx.Calculators.AbstractPhotonPropagator.AbstractPhotonPropagator(parameters=None, input_path=None, output_path=None)[source]

Bases: SimEx.Calculators.AbstractBaseCalculator.AbstractBaseCalculator

Class AbstractPhotonPropagator

Base class for all PhotonPropagators.

Parameters
  • parameters (dict || AbstractCalculatorParameters) – Parameters of the calculation (not data).

  • input_path (str) – Path to hdf5 file holding the input data.

  • output_path (str) – Path to hdf5 file for output.

expectedData()[source]

Return the list of expected data sets with full paths.

Returns

List of strings, e.g. [‘/data/data1’, ‘/params/params1’]

providedData()[source]

Return the list of provided data sets with full paths.

Returns

List of strings, e.g. [/data/data1, /params/params1’]

SimEx.Calculators.AbstractPhotonPropagator.checkAndSetPhotonPropagator(var=None, default=None)[source]

Check if passed object is an AbstractPhotonPropagator instance. If non is given, set to given default.

Parameters
  • var – The object to check

  • default – The default to use

Returns

The checked photon source object

Raises

RuntimeError – if no valid PhotonPropagator was given.

SimEx.Calculators.AbstractPhotonSource module

module AbstractPhotonSource

Hosting the base class for all PhotonSources.

class SimEx.Calculators.AbstractPhotonSource.AbstractPhotonSource(parameters=None, input_path=None, output_path=None)[source]

Bases: SimEx.Calculators.AbstractBaseCalculator.AbstractBaseCalculator

Class AbstractPhotonSource

Abstract base class for all PhotonSources.

Parameters
  • parameters (dict || AbstractCalculatorParameters) – Parameters of the calculation (not data).

  • input_path (str) – Path to hdf5 file holding the input data.

  • output_path (str) – Path to hdf5 file for output.

expectedData()[source]

Return the list of expected data sets with full paths.

Returns

List of strings, e.g. [/data/data1, /params/params1’]

providedData()[source]

Return the list of provided data sets with full paths.

Returns

List of strings, e.g. [/data/data1, /params/params1’]

SimEx.Calculators.AbstractPhotonSource.checkAndSetPhotonSource(var=None, default=None)[source]

Check if passed object is an AbstractPhotonSource instance. If non is given, set to given default.

Parameters
  • var – The object to check.

  • default – The default to use.

Returns

The checked photon source object.

Throw

RuntimeError if no valid PhotonSource was given.

SimEx.Calculators.ComptonScatteringCalculator module

module ComptonScatteringCalculator

Hosts the ComptonScatteringCalculator class.

class SimEx.Calculators.ComptonScatteringCalculator.ComptonScatteringCalculator(parameters=None, input_path=None, output_path=None)[source]

Bases: SimEx.Calculators.AbstractPhotonDiffractor.AbstractPhotonDiffractor

Class ComptonScatteringCalculator

Class representing a Compton scattering calculator.

:param parameters : Parameters for the ComptonScatteringCalculator. :type parameters : dict

Parameters
  • input_path (str) – Path to input data for Compton Scattering calculations (Default: ‘xrts_in.h5’).

  • output_path (str) – Path to output data for Compton Scatteroutg calculations (Default: ‘xrts_out.h5’).

backengine()[source]

This method drives the backengine xrts.

property data

Query for the field data.

expectedData()[source]

Query for the data expected by the Diffractor.

providedData()[source]

Query for the data provided by the Diffractor.

saveH5()[source]
SimEx.Calculators.ComptonScatteringCalculator.checkAndSetParameters(parameters)[source]

Utility to check if the parameters dictionary is ok .

SimEx.Calculators.ComptonScatteringCalculator.fermihalf(x, sgn)[source]

Series approximation to the F_{1/2}(x) or F_{-1/2}(x) Fermi-Dirac integral. Credits: Greg von Winckel http://www.scientificpython.net/pyblog/approximate-fermi-dirac-integrals

SimEx.Calculators.CrystFELPhotonDiffractor module

module CrystFELPhotonDiffractor

Module that holds the CrystFELPhotonDiffractor class.

class SimEx.Calculators.CrystFELPhotonDiffractor.CrystFELPhotonDiffractor(parameters=None, input_path=None, output_path=None)[source]

Bases: SimEx.Calculators.AbstractPhotonDiffractor.AbstractPhotonDiffractor

Class CrystFELPhotonDiffractor

Represents simulation of photon diffraction by crystals using CrystFEL.oattern_sim.

Parameters
  • parameters (CrystFELPhotonDiffractorParameters) – Parameters of the calculation (not data).

  • input_path (str) – Path to hdf5 file holding the input data.

  • output_path (str) – Path to hdf5 file for output.

backengine()[source]

This method drives the backengine CrystFEL.pattern_sim.

computeNTasks()[source]

Calculate the number of MPI tasks as function of available resources and assigned cpus per task.

property data

Query for the field data.

expectedData()[source]

Query for the data expected by the Diffractor.

providedData()[source]

Query for the data provided by the Diffractor.

saveH5()[source]

Method to save the output to a file. Creates links to h5 files that all contain only one pattern.

saveH5_geom()[source]

Method to save the output to a file. Creates links to h5 files that all contain only one pattern.

SimEx.Calculators.DMPhasing module

module DMPhasing

Module that holds the DMPhasing class.

class SimEx.Calculators.DMPhasing.DMPhasing(parameters=None, input_path=None, output_path=None)[source]

Bases: SimEx.Calculators.AbstractPhotonAnalyzer.AbstractPhotonAnalyzer

Class DMPhasing

Encapsulates photon diffraction analysis for electron density reconstruction from oriented 3D diffraction patterns.

Parameters
  • parameters (DMPhasingParameters instance) – Phasing parameters.

  • input_path (str) – Path to input data (file or directory).

  • output_path (str) – Path to output data (file or directory).

backengine()[source]

Start the actual calculation.

Returns

0 if the DM run was successful, 1 if not.

property data

Query for the field data.

Returns

The stored 3D electron density map.

expectedData()[source]

Query for the data expected by the Analyzer.

Returns

A list of strings telling which datasets are expected to be found in the input file.

providedData()[source]

Query for the data provided by the Analyzer.

Returns

A list of strings indicating which datasets are produced in the output data.

saveH5()[source]
SimEx.Calculators.DMPhasing.show_support(support)[source]

SimEx.Calculators.EMCCaseGenerator module

module EMCCaseGenerator

Hosting the EMCCaseGenerator class that sets up a EMC run.

class SimEx.Calculators.EMCCaseGenerator.EMCCaseGenerator(runLog=None)[source]

Bases: object

Class EMCCaseGenerator

Encapsulates one EMC case.

Parameters

runLog (str, default None (don't save log.)") – Flag that indicates where to save the runtime log.

createTestScatteringGeometry()[source]

ATTENTION: Untested! Contains recipe to create, diffract and show a low-pass-filtered, random particle contrast.

If particle and diffraction parameters are not given, then default ones are used: particleRadius = 5.9 (num. of pixels; good results if number is x.9, where x is an integer), damping = 1.5 (larger damping=larger DeBye-Waller factor), frac = 0.5 (frac. of most intense realspace voxels forced to persist in iterative particle generation), pad = 1.8 (extra voxels to pad on 3D particle density to create support for phasing), radius = numpy.floor(particleRadius) + numpy.floor(pad) (half length of cubic volume that holds particle), size = 2*radius + 1 (length of cubic volume that holds particle).

diffractTestCase(inMaxScattAngDeg=45.0, inSigma=6.0, inQminNumShannonPix=1.4302966531242025)[source]

ATTENTION: Untested! Requires makeMonster() to first be called, so that particle density is created.

Function diffract() needs the maximum scattering angle to the edge of the detector, the sampling rate of Shannon pixels (inSigma=6 means each Shannon pixel is sampled by roughly 6 pixels), and the central missing data region has a radius of inQminNumShannonPix (in units of Shannon pixels).

Variables redefined here: z = cotangent of maximum scattering angle, sigma = sampling rate on Shannon pixels, qmax = number of pixels to edge of detector, numPixToEdge = same as qmax, detectorDist = detector-particle distance (units of detector pixels), beamstop = voxel positions of central disk of missing data on detector, detector = pixel position of 2D area detector (projected on Ewald sphere), intensities = 3D Fourier intensities of particle.

makeTestParticleAndSupport(inParticleRadius=5.9, inDamping=1.5, inFrac=0.5, inPad=1.8)[source]

ATTENTION: Untested! Recipe for creating random, “low-passed-filtered binary” contrast by alternating binary projection and low-pass-filter on an random, 3D array of numbers.

Variables defined here: support = sphereical particle support (whose radius is less than particleRadius given), density = 3D particle contrast, supportPositions = voxel position of support used in phasing.

placePixel(ii, jj, zL)[source]

Gives (qx,qy,qz) position of pixels on Ewald sphere when given as input the (x,y,z)=(ii,jj,zL) position of pixel in the diffraction laboratory. The latter is measured in terms of the size of each realspace pixel.

Parameters
  • ii (int) – Pixel index in x direction

  • jj (int) – Pixel index in y direction

  • zL (float) – Distance of pixel from detector in units of detector size.

readGeomFromDetectorFile(fn='detector.dat')[source]

Read qx,qy,qz coordinates of detector and beamstop from detector.dat.

readGeomFromPhotonData(fn, thisProcess)[source]

Extract detector geometry from S2E photon files.

Parameters

fn (str) – Path to file to read.

showDensity()[source]

ATTENTION: Untested! Shows particle density as an array of sequential, equal-sized 2D sections.

showDetector()[source]

Shows detector pixels as points on scatter plot; could be slow for large detectors.

showLogIntensity(inSection=0)[source]

ATTENTION: Untested! Show a particular intensities section of Fourier intensities. Sections range from -qmax to qmax.

showLogIntensitySlices()[source]

ATTENTION: Untested! Shows Fourier intensities as an array of sequential, equal-sized 2D sections. Maximum intensities set to logarithm of maximum intensity in 3D Fourier volume.

writeAllOuputToFile(supportFileName='support.dat', densityFileName='density.dat', detectorFileName='detector.dat', intensitiesFileName='intensity.dat')[source]

ATTENTION: Untested! Convenience function for writing output

Parameters
  • supportFileName (str, default 'support.dat') – Path to file for support data.

  • densityFileName (str, default 'density.dat') – Path to file for density data.

  • detectorFileName (str, default 'detector.dat') – Path to file for detector data.

  • intensitiesFileName (str, default intensities.dat') – Path to file for intensities data.

writeDensityToFile(filename='density.dat')[source]

Write electron density to a file. ATTENTION: Untested! :param filename: Path to file. :type filename: str

writeDetectorToFile(filename='detector.dat')[source]

Writes computed detector and beamstop coordinates to output.

Parameters

filename (str) – Path of file where to write the detector data.

writeSparsePhotonFile(fileList, outFN, outFNH5Avg, thisProcess, numProcesses)[source]

Convert dense S2E file format to sparse EMC photons.dat format.

Parameters
  • fileList (List ot str.) – List of files to convert into one sparse photon file.

  • outFN (str, default 'photons.dat') – Filename of sparse photon file.

  • outFNH5Avg (str) – Filename for averaged photon file.

writeSupportToFile(filename='support.dat')[source]

Write the support range to a file. ATTENTION: Untested! :param filename: Path to file. :type filename: str

SimEx.Calculators.EMCCaseGenerator.cluster_two_means(vals)[source]
SimEx.Calculators.EMCCaseGenerator.find_two_means(vals, v0, v1)[source]
SimEx.Calculators.EMCCaseGenerator.load_intensities(ref_file)[source]
SimEx.Calculators.EMCCaseGenerator.support_from_autocorr(auto, qmax, thr_0, thr_1, kl=1, write=True)[source]
SimEx.Calculators.EMCCaseGenerator.zero_neg(x)[source]

SimEx.Calculators.EMCOrientation module

module EMCOrientation

Module that holds the EMCOrientation class.

class SimEx.Calculators.EMCOrientation.EMCOrientation(parameters=None, input_path=None, output_path=None, tmp_files_path=None, run_files_path=None)[source]

Bases: SimEx.Calculators.AbstractPhotonAnalyzer.AbstractPhotonAnalyzer

Class EMCOrientation

Representing photon data analysis for orientation of 2D diffraction patterns to a 3D diffraction volume.

Parameters
  • parameters (EMCOrientationParameters instance) – Parameters for the EMC orientation calculator.

  • input_path (str) – Path to directory holding input data for EMC.

  • output_path (str) – Path to file where output data will be stored.

  • tmp_files_path (str) – Path to directory where temporary files will be stored.

  • run_files_path (str) – Path to directory where run data will be stored, in particular the sparse photons file ‘photons.dat’ and ‘detector.dat’.

Note

If ‘run_files_path’ is an existing directory that contains data from a previous EMC run, the current run will append to the existing data. A consistency check is performed.

backengine()[source]

Starts EMC simulations in parallel in a subprocess

computeNTasks()[source]
property data

Query for the field data.

expectedData()[source]

Query for the data expected by the Analyzer.

providedData()[source]

Query for the data provided by the Analyzer.

property run_files_path
saveH5()[source]
property tmp_files_path

SimEx.Calculators.EstherPhotonMatterInteractor module

module EstherPhotonMatterInteractor

Module that holds the EstherPhotonMatterInteractor class.

class SimEx.Calculators.EstherPhotonMatterInteractor.EstherPhotonMatterInteractor(parameters=None, input_path=None, output_path=None)[source]

Bases: SimEx.Calculators.AbstractPhotonInteractor.AbstractPhotonInteractor

Class EstherPhotonMatterInteractor

Class interfacing the Esther Radiation-Hydrodynamics simulation backengine.

Parameters
  • parameters (EstherPhotonMatterInteractorParameters) – Parameters for the EstherPhotonMatterInteractor.

  • input_path (str) – Path to the input data for this calculator.

  • output_path (str) – Path to write output data generated by this calculator to.

backengine()[source]

This method drives the esther backengine code.

property data

Query for the field data.

expectedData()[source]

Query for the data expected by the Diffractor.

providedData()[source]

Query for the data provided by the Diffractor.

saveH5()[source]

Method to save the data to a file.

SimEx.Calculators.FEFFPhotonMatterInteractor module

module FEFFPhotonMatterInteractor

Holds the FEFFPhotonMatterInteractor class.

class SimEx.Calculators.FEFFPhotonMatterInteractor.FEFFPhotonMatterInteractor(parameters=None, input_path=None, output_path=None)[source]

Bases: SimEx.Calculators.AbstractPhotonInteractor.AbstractPhotonInteractor

Class FEFFPhotonMatterInteractor

Interface class for photon-matter interaction calculations using the FEFF code.

Parameters
  • parameters (FEFFPhotonMatterInteractorParameters) – Parameters that govern the PMI calculation.

  • input_path (str) – Location of data needed by the PMI calculation.

  • output_path (str) – Where to store the data generated by the PMI calculation.

backengine()[source]

This method drives the backengine code.

property data

Query for the field data.

expectedData()[source]

Query for the data expected by the Interactor.

property path_to_executable

Query the path to the feff executable.

providedData()[source]

Query for the data provided by the Interactor.

saveH5()[source]
property working_directory

Query the working directory

SimEx.Calculators.GenesisPhotonSource module

module GenesisPhotonSource

Module that holds the GenesisPhotonSource class.

class SimEx.Calculators.GenesisPhotonSource.GenesisPhotonSource(parameters=None, input_path=None, output_path=None)[source]

Bases: SimEx.Calculators.AbstractPhotonSource.AbstractPhotonSource

Class GenesisPhotonSource

Representing a x-ray free electron laser photon source using the Genesis backengine.

:param parameters : Photon source parameters. :type parameters: dict

Parameters
  • input_path (str) – The path to the input data for the photon source.

  • output_path – The path where to save output data.

Note input_path

Accepts a native genesis beam file or openPMD conform hdf5.

backengine()[source]

Method to call the backengine for the calculator. To be implemented on the derived classes.

property data

Query for the field data.

saveH5()[source]

SimEx.Calculators.IdealPhotonDetector module

module IdealPhotonDetector

Module that holds the IdealPhotonDetector class.

class SimEx.Calculators.IdealPhotonDetector.IdealPhotonDetector(parameters=None, input_path=None, output_path=None)[source]

Bases: SimEx.Calculators.AbstractPhotonDetector.AbstractPhotonDetector

Class IdealPhotonDetector

Class representing an ideal photon detector.

This is just a dummy calculator that copies input data to output data.

Parameters
  • parameters (dict) – Parameters for the Detector simulation.

  • input_path (str) – Path to input files for the detector simulation.

  • output_path (str) – Path where output is stored.

backengine()[source]

This method drives the backengine code.

property data

Query for the field data.

expectedData()[source]

Query for the data expected by the Interactor.

providedData()[source]

Query for the data provided by the Interactor.

saveH5()[source]

SimEx.Calculators.PlasmaXRTSCalculator module

module PlasmaXRTSCalculator

Module that holds the PlasmaXRTSCalculator class.

class SimEx.Calculators.PlasmaXRTSCalculator.PlasmaXRTSCalculator(parameters=None, input_path=None, output_path=None)[source]

Bases: SimEx.Calculators.AbstractPhotonDiffractor.AbstractPhotonDiffractor

Class PlasmaXRTSCalculator

Represents a plasma x-ray Thomson scattering calculation.

Parameters
  • parameters (PlasmaXRTSCalculatorParameters) – Parameters for the PlasmaXRTSCalculator.

  • input_path (str) – Path to the input data for this calculator.

  • output_path (str, default 'xrts.h5') – Where to write output data generated by this calculator.

backengine()[source]

This method drives the backengine xrts.

property data

Query for the field data.

expectedData()[source]

Query for the data expected by the Diffractor.

providedData()[source]

Query for the data provided by the Diffractor.

saveH5()[source]

Method to save the data to a file.

property static_data

Query for the static data.

SimEx.Calculators.PlasmaXRTSCalculator.checkAndSetParameters(parameters)[source]

Utility to check if the parameters dictionary is ok .

Parameters

parameters (AbstractCalculatorParameters) – The parameters to check.

SimEx.Calculators.PlasmaXRTSCalculator.extractDate(pattern_string, text)[source]

Workhorse function to get a pattern from text using a regular expression. :param pattern_string: The regex pattern to find. :type pattern_string: str (argument to re.compile)

Parameters

text (str) – The string from which to extract the date.

:return The date. :rtype: float

SimEx.Calculators.S2EReconstruction module

module S2EReconstruction

Module that holds the S2EReconstruction class.

class SimEx.Calculators.S2EReconstruction.S2EReconstruction(parameters=None, input_path=None, output_path=None)[source]

Bases: SimEx.Calculators.AbstractPhotonAnalyzer.AbstractPhotonAnalyzer

Class S2EReconstruction

Class representing photon data analysis for electron density reconstruction from 2D diffraction patterns.

Wraps the EMC orientation module and the DM phasing module.

Parameters
  • parameters (dict) – The parameters for the reconstruction.

  • input_path (str) – Path for input data.

  • output_path (str) – Path where to write output to.

Example parameters

parameters={‘EMC_Parameters’ : EMCOrientationParameters(), ‘DM_Parameters’ : DMPhasingParameters()} # Use default parameters for EMC and DM.

backengine()[source]

Run the EMC and DM backengine executables.

property data

Query for the field data.

expectedData()[source]

Query for the data expected by the Analyzer.

providedData()[source]

Query for the data provided by the Analyzer.

saveH5()[source]

SimEx.Calculators.SingFELPhotonDiffractor module

module SingFELPhotonDiffractor

Module that holds the SingFELPhotonDiffractor class.

class SimEx.Calculators.SingFELPhotonDiffractor.SingFELPhotonDiffractor(parameters=None, input_path=None, output_path=None)[source]

Bases: SimEx.Calculators.AbstractPhotonDiffractor.AbstractPhotonDiffractor

Class SingFELPhotonDiffractor

Representing scattering from a molecular sample into a detector plane.

Parameters
  • parameters (dict || SingFELPhotonDiffractorParameters) – Parameters of the calculation (not data).

  • input_path (str) – Path to hdf5 file holding the input data.

  • output_path (str) – Path to hdf5 file for output.

backengine()[source]

This method drives the backengine singFEL.

computeNTasks()[source]
property data

Query for the field data.

expectedData()[source]

Query for the data expected by the Diffractor.

providedData()[source]

Query for the data provided by the Diffractor.

saveH5()[source]

SimEx.Calculators.XCSITPhotonDetector module

module XCSITPhotonDetector

Hosts the XCSITPhotonDetector class.

class SimEx.Calculators.XCSITPhotonDetector.XCSITPhotonDetector(parameters=None, input_path=None, output_path=None)[source]

Bases: SimEx.Calculators.AbstractPhotonDetector.AbstractPhotonDetector

Class XCSITPhotonDetector

Wraps detector simulations with XCSIT.

Parameters

parameters – Parameters of the calulator such as the type of

detector :type parameters: XCSITPhotonDetectorParameters

Parameters
  • input_path (str) – Path to the hdf5 file holding the input data.

  • output_path (str) – Path pointing to the path for output

backengine()[source]

Executes the simulation of the particle and charge simulation.

expectedData()[source]

Query for the data fields expected by this calculator.

getChargeData()[source]
getInteractionData()[source]
getPhotonData()[source]
property input_path

Query for the input file path(s).

property output_path

Query for the output file path(s).

providedData()[source]

Query for the data fields provided by this calculator.

saveH5()[source]

Save the results in a file

SimEx.Calculators.XFELWavePropagator module

module WavePropagator

Module that holds the WavePropagator class.

class SimEx.Calculators.WavePropagator.WavePropagator(parameters=None, input_path=None, output_path=None)[source]

Bases: SimEx.Calculators.AbstractPhotonPropagator.AbstractPhotonPropagator

Class WavePropagator

Represents coherent wavefront propagation using the WPG wrapper for SWR.

Parameters
  • parameters (WavePropagatorParameters instance.) – Parameters for the photon propagation.

  • input_path (str, default 'FELsource/') – Location of input data for photon propagation.

  • output_path (str, default 'prop/') – Location of propagation output data.

backengine()[source]

Starts WPG simulations in parallel in a subprocess

computeNTasks()[source]
property data

Query for the field data.

saveH5()[source]

SimEx.Calculators.XFELPhotonSource module

module XFELPhotonSource

Module that holds the XFELPhotonSource class.

class SimEx.Calculators.XFELPhotonSource.XFELPhotonSource(parameters=None, input_path=None, output_path=None)[source]

Bases: SimEx.Calculators.AbstractPhotonSource.AbstractPhotonSource

Class XFELPhotonSource

Class representing a x-ray free electron laser photon source.

:param parameters : Photon source parameters. :type parameters: dict

Parameters
  • input_path (str, default FELsource_in.h5) – The path to the input data for the photon source.

  • output_path – The path where to save output data.

backengine()[source]

Method to call the backengine for the calculator. To be implemented on the derived classes.

property data

Query for the field data.

saveH5()[source]

SimEx.Calculators.XMDYNDemoPhotonMatterInteractor module

module XMDYNDemoPhotonMatterInteractor

Module that holds the XMDYNDemoPhotonMatterInteractor class.

class SimEx.Calculators.XMDYNDemoPhotonMatterInteractor.PMIDemo[source]

Bases: object

f_dbase_Zq2id(a_Z, a_q)[source]
f_dbase_setup()[source]
f_init_random()[source]
f_load_pulse(a_prop_out)[source]
f_load_sample(sample_path)[source]
f_load_snp_content(a_fp, a_snp)[source]
f_load_snp_from_dir(path_to_snapshot)[source]

Load xmdyn output from an xmdyn directory.

Parameters
  • path (str) – The directory path to xmdyn output.

  • snapshot_index (int) – Which snapshot to load.

Returns

The snapshot data.

Return type

dict

f_load_snp_xxx(a_real, a_snp)[source]
f_num_snp_xxx(all_real)[source]
f_rotate_sample()[source]
f_s2e_setup()[source]
f_save_data(dset, data)[source]
f_save_info()[source]
f_save_snp(a_snp)[source]
f_system_setup()[source]
f_time_evolution()[source]
class SimEx.Calculators.XMDYNDemoPhotonMatterInteractor.XMDYNDemoPhotonMatterInteractor(parameters=None, input_path=None, output_path=None, sample_path=None)[source]

Bases: SimEx.Calculators.AbstractPhotonInteractor.AbstractPhotonInteractor

Class XMDYNDemoPhotonMatterInteractor

Interface class for photon-matter interaction calculations using the demo version of the XMDYN code.

Parameters
  • parameters (dict) – Parameters that govern the PMI calculation.

  • input_path (str) – Location of data needed by the PMI calculation (Laser source wavefront data).

  • output_path (str) – Where to store the data generated by the PMI calculation.

  • sample_path (str) – Location of the sample/target geometry file. Can be either a simS2E sample file or a pdb file. Specifying a pdb will first check if it’s present in a database, if not, it will issue a query for the basename of the file to the RCSB protein data bank.

backengine()[source]

This method drives the backengine code.

property data

Query for the field data.

expectedData()[source]

Query for the data expected by the Interactor.

providedData()[source]

Query for the data provided by the Interactor.

saveH5()[source]
SimEx.Calculators.XMDYNDemoPhotonMatterInteractor.f_eval_disp(a_snp, a_r0, a_sample)[source]
SimEx.Calculators.XMDYNDemoPhotonMatterInteractor.f_eval_numE(a_snp, a_sample)[source]
SimEx.Calculators.XMDYNDemoPhotonMatterInteractor.f_h5_out2in(src, dest, *args)[source]
SimEx.Calculators.XMDYNDemoPhotonMatterInteractor.f_hdf5_simple_read(self, a_file, a_dataset)[source]
SimEx.Calculators.XMDYNDemoPhotonMatterInteractor.f_md_step(r, v, m, dt)[source]
SimEx.Calculators.XMDYNDemoPhotonMatterInteractor.f_pmi_diagnostics_help()[source]
SimEx.Calculators.XMDYNDemoPhotonMatterInteractor.load_ff_database()[source]
SimEx.Calculators.XMDYNDemoPhotonMatterInteractor.s2e_gen_randrot_quat(quat, rotmat)[source]
SimEx.Calculators.XMDYNDemoPhotonMatterInteractor.s2e_rand_orient(r, mat)[source]

SimEx.Calculators.XMDYNPhotonMatterInteractor module

module XMDYNPhotonMatterInteractor

Module that holds the XMDYNPhotonMatterInteractor class.

class SimEx.Calculators.XMDYNPhotonMatterInteractor.XMDYNPhotonMatterInteractor(parameters=None, input_path=None, output_path=None, sample_path=None, seed=1, root_path=None)[source]

Bases: SimEx.Calculators.AbstractPhotonInteractor.AbstractPhotonInteractor

Class XMDYNPhotonMatterInteractor

Wrapper class for photon-matter interaction calculations using the XMDYN code.

Parameters
  • parameters (dict) – Parameters that govern the PMI calculation.

  • input_path (str) – Location of data needed by the PMI calculation (Laser source wavefront data).

  • output_path (str) – Where to store the data generated by the PMI calculation.

  • sample_path (str) – Location of the sample/target geometry file. Can be either a simS2E sample file or a pdb file. Specifying a pdb will first check if it’s present in a database, if not, it will issue a query for the basename of the file to the RCSB protein data bank.

  • root_path (str) – Path to a root directory from which to restart a (previously failed) simulation.

backengine()[source]

This method drives the backengine code.

property data

Query for the field data.

expectedData()[source]

Query for the data expected by the Interactor.

load_snp_from_dir(path_to_snapshot)[source]

Load xmdyn output from an xmdyn directory.

Parameters
  • path (str) – The directory path to xmdyn output.

  • snapshot_index (int) – Which snapshot to load.

Returns

The snapshot data.

Return type

dict

property parameters

Query the calculator parameters.

Returns

The parameters of this Calculator.

providedData()[source]

Query for the data provided by the Interactor.

property root_path

Get the path to the restart data.

property sample_path

Get the path to the sample geometry file.

saveH5()[source]
setup_hierarchy(h5_handle)[source]

Create all datagroups in the output hdf5 file.

Parameters

h5_handle (h5py.File) – File handle to writable hdf5 file.

SimEx.Calculators.XMDYNPhotonMatterInteractor.h5_out2in(src, dest, *args)[source]