NRSS.writer#

NRSS.writer.dump_data(valArray, index, labelEnergy, f)#

Function to write material optical constants to file

Parameters:
  • valArray (ndarray) –

  • index (int) –

  • labelEnergy (dict) –

  • f (file object) –

NRSS.writer.dump_dataVacuum(index, energy, f)#

Function to write vacuum optical contants (n = 1 + i0)

Parameters:
  • index (int) –

  • energy (float) –

NRSS.writer.find_nearest(array, value)#

Function to find the nearest index

Parameters:
  • array (ndarray) –

  • value (value of energy) –

Returns:

idx – index location corresponding to the closest location

Return type:

Integer

NRSS.writer.get_interpolated_value(array, value, nearest_id, energy_id)#

Function to get the interpolated value

Parameters:
  • array (ndarray) –

  • value (value of energy) –

  • nearest_id (id corresponding to the nearest value) –

Returns:

valArray – array of the interpolated values

Return type:

ndarray

NRSS.writer.removeDuplicates(Data, energy_id)#

Function to remove duplicate energies

Parameters:
  • Data (ndarray) –

  • energy_id (int) –

Returns:

listOut

Return type:

ndarray

NRSS.writer.writeList(name: str, value: list, file)#

Function to write list to file

Parameters:
  • name (str) –

  • value (list) –

  • file (file object) –

NRSS.writer.write_config(Energies, EAngleRotation, CaseType=0, MorphologyType=0, NumThreads=4, AlgorithmType=0, DumpMorphology=False, ScatterApproach=0, WindowingType=0, RotMask=False, EwaldsInterpolation=1)#

Writes config.txt file for CyRSoXS simulations

Parameters:
  • energies (list) – List of energies to be simulated

  • EAngleRotation (list) – List of angle rotations in degrees. Format is [AngleStart, AngleIncrement, AngleStop]

  • CaseType (int) – Scattering configuration. 0 - Default 1 - Beam Divergence 2 - Grazing Incidence

  • MorphologyType (int) – 0 - Euler Morphology (default) 1 - Vector Morphology

  • NumThreads (int) – Number of OpenMP threads to use. Must be >= number of GPUs

  • AlgorithmType (int) – 0 - Communication minimizing (default) 1 - Memory minimizing

  • DumpMorphology (bool) – Boolean flag to write morphology to file, as seen by CyRSoXS, after necessary conversions are performed

  • ScatterApproach (int) – Flag to explicitly calculate the differential scattering cross-section before the Ewald Sphere projection 0 - Do not compute 1 - Compute

  • WindowingType (int) – Type of FFT window to apply 0 - None 1 - Hanning

  • RotMask (bool) – Boolean flag to include values outside valid range for all angles False - Writes NaNs for pixels that are not valid at every EAngleRotation True - Replaces NaNs with values averaged over valid EAngleRotations

  • EwaldInterpolation (int) – Type of interpolation for Ewald Sphere projection 0 - Nearest Neighbor 1 - Trilinear

Return type:

None

NRSS.writer.write_hdf5(material_list, PhysSize, fname, MorphologyType=0, ordering='ZYX', author='NIST')#

Writes Euler or Vector Morphology format into CyRSoXS-compatible HDF5 file and returns the hdf5 filename

Parameters:
  • material_list (lists) – List of material lists. Euler Ex. [[Mat_1_Vfrac, Mat_1_S, Mat_1_Theta, Mat_1_Psi],[Mat_2_Vfrac, Mat_2_S, Mat_2_Theta, Mat_2_Psi]] Vector Ex. [[Mat_1_alignment, Mat_1_unaligned],[Mat_2_alignment, Mat_2_unaligned]]

  • PhysSize (float) – Voxel size

  • fname (str or path) – name of hdf5 file to write

  • MorphologyType (int) – 0 - Euler 1 - Vector

  • ordering (str) – String denoting the axes ordering. ‘ZYX’ or ‘XYZ’

  • author (str) – Name of author writing the morphology

Returns:

Name of hdf5 file written

Return type:

fname

NRSS.writer.write_materials(energies, materialdict, labelEnergy, numMaterial)#

Function to write optical constants for all energies supplied

Parameters:
  • energies (ndarray) –

  • materialdict (dict) –

  • labelEnergy (dict) –

  • numMaterial (int) –

NRSS.writer.write_slurm(hdf5_filename, cyrsoxs_version='latest')#

Writes job.slurm file for use on the NIST glados and wheatley workstations

Parameters:
  • filename (str or pathlib object) – Name of morphology HDF5 file to be simulated. Can include path

  • cyrsoxs_version (str) – String denoting which version of CyRSoXS to run

Return type:

None