Data APIs

SimExLite.SampleData

Sample Structure Data APIs

class SimExLite.SampleData.MolecularDynamicsData(input_path=None)[source]

Molecular Dynamics Data class

Parameters:

input_path (str) – Path to data file

SimExLite.SampleData.createLinkedData(input_path, link_path, snp_range=None, ref_dsets=None, ref_snp=1)[source]
Create a hdf5 data with all items linked to an input data. A

certain dataset can be replaced with that in a reference snapshot, if ref_snp and ref_dsets are provided.

Parameters:
  • input_path (str) – The input hdf5 file name

  • link_path (str) – The hdf5 file name holding the links

  • snp_range (list-like) – The snapshot range to replace, defaults to None, which takes the snapshot range in the reference .h5 file.

  • ref_dsets (str) – The reference dataset name.

  • ref_snp (int) – The reference snapshot, defaults to 1.

SimExLite.SampleData.getItemList(input_path, group)[source]

Get a list of items in one group in a hdf5 file.

Parameters:
  • input_path (str) – The hdf5 file of to check.

  • group (str) – The group path to check.

Returns:

(item name, data shape) in the group

Return type:

list

SimExLite.SampleData.getSnpRange(input_path)[source]

Get the snapshot range of a .h5 file

SimExLite.SampleData.replaceDset(input_path, ref_path, ref_dsets)[source]

Replace/Add dataset with that in another referece .h5 file.

SimExLite.SampleData.snpName(idx)[source]

Get the snapshot group name from an int index

class SimExLite.SampleData.xmdynData(input_path=None)[source]

xmdyn Data class

Parameters:

input_path (str) – Path to XMDYN hdf5 data

getSnpGroupList(snp_idx=1)[source]

Get the dataset list of a snapshot group.

Parameters:

snp_idx (int) – Snapshot index to check, defaults to 1

Returns:

A list of datasets in the snapshot group

Return type:

list

replaceWithExternal(ref_path, ref_dsets, ref_snp=1, snp_range=None)[source]

Replace a dataset in a snapshot range with that in another referece .h5 file.

Parameters:
  • input_path (str) – The input .h5 file name

  • ref_path (str) – The reference .h5 file name

  • ref_dsets (str) – The reference dataset name.

  • ref_snp (int) – The reference snapshot, defaults to 1.

  • snp_range (list-like) – The snapshot range to replace, defaults to None, which takes the snapshot range in the reference .h5 file.

SimExLite.PhotonBeamData

Photon Beam data APIs

class SimExLite.PhotonBeamData.BeamBase(pulse_energy=None, wavelength=None, focus_area=None)[source]

The simplest description of a pulse of the beam.

Parameters:
  • pulse_energy (float, optional) – The energy of the X-ray pulse in Joule.

  • photons_per_pulse (int, optional) – The number of photons of this pulse.

  • wavelength (float, optional) – The wavelength of this pulse in Angstrom.

  • photon_energy (float, optional) – The photon energy of this pulse, in eV.

  • focus_area (float, optional) – The focus area of this pulse, in m**2.

property pulse_energy

The pulse_energy property.

property wavelength

The wavelength property.

class SimExLite.PhotonBeamData.SimpleBeam(pulse_energy=None, photons_per_pulse=None, wavelength=None, wavelength_weights=None, photon_energy=None, photon_energy_weights=None, beam_size: Optional[ndarray] = None, profile: str = 'gaussian', focus_area=None)[source]

The simplest description of a pulse of the beam.

Parameters:
  • pulse_energy (float, optional) – The energy of the X-ray pulse in Joule.

  • photons_per_pulse (int, optional) – The number of photons of this pulse.

  • wavelength (float or ndarray, optional) –

    The wavelength(s) of this pulse in Angstrom. Monchromatic beam: a scalar wavelength. Polychromatic beam (shot-to-shot-invariant):

    an array of length m of wavelengths.

    Polychromatic beam (shot-to-shot-variant):

    an array of np by m of wavelengths.

  • wavelength_weights (ndarray, optional) –

    The relative weights of the corresponding wavelengths. Monchromatic beam: None Polychromatic beam (shot-to-shot-invariant):

    an array of length m of wavelengths.

    Polychromatic beam (shot-to-shot-variant):

    an array of np by m of wavelengths.

  • photon_energy (float of ndarray, optional) –

    The photon energy(s) of this pulse, in eV. Monchromatic beam: a scalar. Polychromatic beam (shot-to-shot-invariant):

    an array of length m of photon energies.

    Polychromatic beam (shot-to-shot-variant):

    an array of np by m of photon energies.

  • photon_energy_weights (ndarray, optional) –

    The relative weights of the corresponding photon energies. Monchromatic beam: None Polychromatic beam (shot-to-shot-invariant):

    an array of length m of photon energies.

    Polychromatic beam (shot-to-shot-variant):

    an array of np by m of photon energies.

  • beam_size (array-like, optional) – Two-element array/list of FWHM (if Gaussian or Airy function) or diameters (if top hat) or widths (if rectangular) of the beam in the order x, y. The unit is meter.

  • profile (str, optional) – The beam profile. It can be one of: gaussian|airy|top-hat|rectangular.

  • focus_area (float, optional) – The focus area of this pulse, in m**2. It will be overridden by beam_size if both are provided.

SimExLite.PhotonBeamData.hcDivide(val)[source]

h is the Plank constant and c is the speed of light. keV <-> Angstrom.

SimExLite.DiffractionData