diffpy.utils.scattering_objects package
Scattering objects
Submodules
diffpy.utils.scattering_objects.user_config module
diffpy.utils.scattering_objects.diffraction_objects module
- class diffpy.utils.scattering_objects.diffraction_objects.Diffraction_object(name='', wavelength=None)[source]
Bases:
object
- insert_scattering_quantity(xarray, yarray, xtype, metadata={}, scat_quantity=None, name=None, wavelength=None)[source]
- on_xtype(xtype)[source]
return a 2D np array with x in the first column and y in the second for x of type type :param xtype:
- q_to_tth()[source]
Helper function to convert q to two-theta.
By definition the relationship is:
\[\sin\left(\frac{2\theta}{2}\right) = \frac{\lambda q}{4 \pi}\]thus
\[2\theta_n = 2 \arcsin\left(\frac{\lambda q}{4 \pi}\right)\]- Parameters:
q (array) – An array of \(q\) values
wavelength (float) – Wavelength of the incoming x-rays
developers (Function adapted from scikit-beam. Thanks to those)
- Returns:
two_theta – An array of \(2\theta\) values in radians
- Return type:
array
- set_angles_from_range(begin_angle, end_angle, step_size=None, n_steps=None)[source]
create an array of linear spaced angle-values
- Parameters:
float (step_size) – the beginning angle
float – the ending angle
float – the size of the step between points. Only specify step_size or n_steps, not both
integer (n_steps) – the number of steps. Odd numbers are preferred. Only specify step_size or n_steps, not both
- Returns:
Sets self.angles
self.angles array of floats – the q values in the independent array
- set_qs_from_range(begin_q, end_q, step_size=None, n_steps=None)[source]
create an array of linear spaced Q-values
- Parameters:
float (step_size) – the beginning angle
float – the ending angle
float – the size of the step between points. Only specify step_size or n_steps, not both
integer (n_steps) – the number of steps. Odd numbers are preferred. Only specify step_size or n_steps, not both
- Returns:
Sets self.qs
self.qs array of floats – the q values in the independent array
- tth_to_q()[source]
Helper function to convert two-theta to q
By definition the relationship is
\[\sin\left(\frac{2\theta}{2}\right) = \frac{\lambda q}{4 \pi}\]thus
\[q = \frac{4 \pi \sin\left(\frac{2\theta}{2}\right)}{\lambda}\]- Parameters:
two_theta (array) – An array of \(2\theta\) values in units of degrees
wavelength (float) – Wavelength of the incoming x-rays
developers. (Function adapted from scikit-beam. Thanks to those)
- Returns:
q – An array of \(q\) values in the inverse of the units of
wavelength
- Return type:
array