Skip to main content

Simulates x-ray magnetic scattering

Project description

Magnetic Diffraction

Simple code for computing the magnetic diffraction pattern of a magnetic structure.

To use: Define the structure, beam and geometry of the experiment, then compute scattering by calling the Scatter class. The magnetic structure is defined using the Sample class, the incident beam is defined using the Beam class and the geometry is defined using the Geometry class.

Sample

The Sample is initialized with the following parameters:

Sample(sample_length, scattering_factors, magnetic_configuration)

sample_length: real size of the sample in meters. Scalar if x, y dimensions are equal or vector otherwise.

scattering_factors: scattering factors list with [f0, f1, f2] representing charge, XMCD and XMLD respectively.

structure: the magnetic configuration for scattering (see section below).

Beam

The Beam is initialized with the following parameters:

Beam(wavelength, beam_fwhm, polarization)

wavelength: wavelength of incident radiation in meters.

beam_fwhm: size of beam or full width at half maximum of the beam. Can be a scalar or a 2 component vector.

polarization: 4 component polarization in the form of a Stokes vector (see section below).

Geometry

The Geometry is initialized with the following parameters:

Geometry(angle, detector_distance)

angle: The angle between the beam and the sample plane in degrees.

detector_distance: The distance between the sample and the detector in meters.

Scatter

To compute the scattering pattern call the Scatter class with the following parameters:

Scatter(Sample, Beam, Geometry)

The intensity of the scattering can be obtained from Scatter.intensity or plotted directly using functions in the plotting.py folder, some examples are:

plotting.plot_structure(Sample, quiver=True)        # plot the components magnetic structure
plotting.plot_intensity(Scatter, log=True)          # plot the intensity of the scattering
plotting.plot_diff(Scatter_a, Scatter_b, log=True)  # plot the difference between two scattering patterns

Stokes Parameters

The Stokes parameters are four components that define the polarization state of light. For convenience they are combined to form a vector; it is actually a pseudovector and does not have any physical interpretation. They are defined as follows:

S_0: Intensity of the light.

S_1: Component of intensity of light that is linearly polarized. Positive values for horizontal polarization, negative values for vertical polarization.

S_2: Component of intensity of light that is linearly polarized along the diagonals. Positive values for +45 degree polarization, negative values for -45 degree polarization.

S_3: Component of intensity of light that is circularly polarized. Positive values for right-handed polarization, negative values for left-handed polarization.

Structure

The magnetic vector field is a two-dimensional field, with three components. It is therefore defined as a numpy array of shape (3, nx, ny). To create this array from its scalar components, (mx, my, mz) one can use:

structure = np.array([mx, my, mz])

mx, my, mz must all be of the same size and should be two dimensional, of size (nx, ny), same as the pixel_size.

Structures can be made or imported using the structures header. Some examples are:

strucutres.vortex(nx, ny) and structures.skyrmion(nx, ny).

Geometry

The geometry here is such that the beam travels in the positive z dimension when angle_d = 0 and along the negative y dimension when angle_d = 90.

The sample plane is the x-y plane, thus the mx and my components are in-plane and mz is out of plane.

Theory of Magnetic Diffraction

Theory from "Soft X-ray resonant magnetic scattering of magnetic nanostructures" , https://doi.org/10.1016/j.crhy.2007.06.004

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

magneticscattering-0.1.0.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

magneticScattering-0.1.0-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file magneticscattering-0.1.0.tar.gz.

File metadata

  • Download URL: magneticscattering-0.1.0.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.18

File hashes

Hashes for magneticscattering-0.1.0.tar.gz
Algorithm Hash digest
SHA256 66f3c03fa5816d01f9b860d6895562c1db46ed2d1a714e21dcfa5314dd879601
MD5 3108afe40c0e7cccd8c122a448720908
BLAKE2b-256 654c04bea0ca230149c22d50ebae4fd93dba880784c7993ba81adc3fa623eeed

See more details on using hashes here.

File details

Details for the file magneticScattering-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for magneticScattering-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 626123612b8bba31aba970d33b3e0e39def33501dc2df1170a1f43a1ad4ea315
MD5 616a2e31e9e6661f2f01e0415977378c
BLAKE2b-256 0d1c4c26ce53cc638d671a22e2199f10d1ad831d6fffd247aad356803e896ce0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page