Skip to content

Commit

Permalink
fix doc; cosmetics
Browse files Browse the repository at this point in the history
  • Loading branch information
srio committed Nov 13, 2023
1 parent 4e8d0be commit d961bb9
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 36 deletions.
3 changes: 2 additions & 1 deletion crystalpy/diffraction/DiffractionSetupAbstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ class DiffractionSetupAbstract(object):
The asymmetry angle between surface normal and Bragg normal (radians).
azimuthal_angle: float
The angle between the projection of the Bragg normal on the crystal surface plane and the x axis (radians).
The angle between the projection of the Bragg normal on the crystal surface plane and the Y axis (radians).
It can also be called inclination angle.
debye_waller: float
The Debye-Waller factor exp(-M).
Expand Down
10 changes: 7 additions & 3 deletions crystalpy/diffraction/DiffractionSetupDabax.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ class DiffractionSetupDabax(DiffractionSetupAbstract):
The asymmetry angle between surface normal and Bragg normal (radians).
azimuthal_angle: float
The angle between the projection of the Bragg normal on the crystal surface plane and the x axis (radians).
The angle between the projection of the Bragg normal on the crystal surface plane and the Y axis (radians).
It can also be called inclination angle.
debye_waller: float
The Debye-Waller factor exp(-M).
Expand All @@ -55,8 +56,11 @@ def __init__(self,
super().__init__(geometry_type=geometry_type,
crystal_name=crystal_name,
thickness=thickness,
miller_h=miller_h, miller_k=miller_k, miller_l=miller_l,
asymmetry_angle=asymmetry_angle,azimuthal_angle=azimuthal_angle)
miller_h=miller_h,
miller_k=miller_k,
miller_l=miller_l,
asymmetry_angle=asymmetry_angle,
azimuthal_angle=azimuthal_angle)

if isinstance(dabax, DabaxXraylib):
self.dx = dabax
Expand Down
10 changes: 7 additions & 3 deletions crystalpy/diffraction/DiffractionSetupShadowPreprocessorV1.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ class DiffractionSetupShadowPreprocessorV1(DiffractionSetupAbstract):
The asymmetry angle between surface normal and Bragg normal (radians).
azimuthal_angle: float
The angle between the projection of the Bragg normal on the crystal surface plane and the x axis (radians).
The angle between the projection of the Bragg normal on the crystal surface plane and the Y axis (radians).
It can also be called inclination angle.
debye_waller: float
The Debye-Waller factor exp(-M).
Expand All @@ -63,8 +64,11 @@ def __init__(self,
super().__init__(geometry_type=geometry_type,
crystal_name=crystal_name,
thickness=thickness,
miller_h=miller_h, miller_k=miller_k, miller_l=miller_l,
asymmetry_angle=asymmetry_angle,azimuthal_angle=azimuthal_angle)
miller_h=miller_h,
miller_k=miller_k,
miller_l=miller_l,
asymmetry_angle=asymmetry_angle,
azimuthal_angle=azimuthal_angle)

self._preprocessor_file = preprocessor_file
self._preprocessor_dictionary = bragg_preprocessor_file_v1_read(self._preprocessor_file)
Expand Down
7 changes: 5 additions & 2 deletions crystalpy/diffraction/DiffractionSetupShadowPreprocessorV2.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,11 @@ def __init__(self,
super().__init__(geometry_type=geometry_type,
crystal_name=crystal_name,
thickness=thickness,
miller_h=miller_h, miller_k=miller_k, miller_l=miller_l,
asymmetry_angle=asymmetry_angle,azimuthal_angle=azimuthal_angle)
miller_h=miller_h,
miller_k=miller_k,
miller_l=miller_l,
asymmetry_angle=asymmetry_angle,
azimuthal_angle=azimuthal_angle)

self._preprocessor_file = preprocessor_file
self._preprocessor_dictionary = bragg_preprocessor_file_v2_read(self._preprocessor_file)
Expand Down
70 changes: 50 additions & 20 deletions crystalpy/diffraction/DiffractionSetupSweeps.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Represents a diffraction setup (from where it inherits) and includes a photon beam
with scanning ephoton energy and deviation angle (scattering plane is YZ plane)
with scanning photon energy and deviation angle (scattering plane is YZ plane)
Units are in SI except for photon energy in eV. Angles in radians.
Expand All @@ -14,7 +14,54 @@


class DiffractionSetupSweeps(DiffractionSetupXraylib):
""" """
"""
Constructor.
Parameters
----------
geometry_type: instance of BraggDiffraction, LaueDiffraction, BraggTransmission, or LaueTransmission
crystal_name: str
The name of the crystal, e.g. "Si".
thickness: float
The crystal thickness in m.
miller_h: int
Miller index H.
miller_k: int
Miller index K.
miller_l: int
Miller index L.
asymmetry_angle: float
The asymmetry angle between surface normal and Bragg normal (radians).
azimuthal_angle: float
The angle between the projection of the Bragg normal on the crystal surface plane and the Y axis (radians).
It can also be called the inclination angle.
energy_min: float
The minimum energy in eV.
energy_max: float
The maximum energy in eV.
energy_points: int
Number of energy points.
angle_deviation_min: float
Minimal angle deviation in rad.
angle_deviation_max: float
Maximal angle in rad.
angle_deviation_points: int
Number of deviations points.
"""

def __init__(self,
geometry_type, crystal_name, thickness,
Expand All @@ -27,24 +74,7 @@ def __init__(self,
angle_deviation_min,
angle_deviation_max,
angle_deviation_points):
"""
Constructor.
:param geometry_type: GeometryType (BraggDiffraction,...).
:param crystal_name: The name of the crystal, e.g. Si.
:param thickness: The crystal thickness.
:param miller_h: Miller index H.
:param miller_k: Miller index K.
:param miller_l: Miller index L.
:param asymmetry_angle: The asymmetry angle between surface normal and Bragg normal.
:param azimuthal_angle: The angle between the projection of the Bragg normal
on the crystal surface plane and the x axis.
:param energy_min: The minimum energy.
:param energy_max: The maximum energy.
:param energy_points: Number of energy points.
:param angle_deviation_min: Minimal angle deviation.
:param angle_deviation_max: Maximal angle deviation.
:param angle_deviation_points: Number of deviations points.
"""

energies = numpy.linspace(energy_min,
energy_max,
energy_points)
Expand Down
26 changes: 19 additions & 7 deletions crystalpy/diffraction/DiffractionSetupXraylib.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,32 @@ class DiffractionSetupXraylib(DiffractionSetupAbstract):
The asymmetry angle between surface normal and Bragg normal (radians).
azimuthal_angle: float
The angle between the projection of the Bragg normal on the crystal surface plane and the x axis (radians).
The angle between the projection of the Bragg normal on the crystal surface plane and the Y axis (radians).
It can also be called inclination angle.
debye_waller: float
The Debye-Waller factor exp(-M).
"""

def __init__(self,
geometry_type=None, crystal_name="", thickness=1e-6,
miller_h=1, miller_k=1, miller_l=1,
geometry_type=None,
crystal_name="",
thickness=1e-6,
miller_h=1,
miller_k=1,
miller_l=1,
asymmetry_angle=0.0,
azimuthal_angle=0.0,):

super().__init__(geometry_type=geometry_type,
crystal_name=crystal_name,
thickness=thickness,
miller_h=miller_h, miller_k=miller_k, miller_l=miller_l,
asymmetry_angle=asymmetry_angle,azimuthal_angle=azimuthal_angle)
miller_h=miller_h,
miller_k=miller_k,
miller_l=miller_l,
asymmetry_angle=asymmetry_angle,
azimuthal_angle=azimuthal_angle)

# Load crystal from xraylib.
self._crystal = xraylib.Crystal_GetCrystal(self.crystalName())
Expand Down Expand Up @@ -258,8 +266,12 @@ def unitcellVolume(self):
from crystalpy.diffraction.GeometryType import BraggDiffraction
import numpy

a = DiffractionSetupXraylib(geometry_type=BraggDiffraction, crystal_name="Si", thickness=1e-5,
miller_h=1, miller_k=1, miller_l=1,
a = DiffractionSetupXraylib(geometry_type=BraggDiffraction,
crystal_name="Si",
thickness=1e-5,
miller_h=1,
miller_k=1,
miller_l=1,
asymmetry_angle=0.0,
azimuthal_angle=0.0,)

Expand Down

0 comments on commit d961bb9

Please sign in to comment.