Skip to main content

This package can be used to simulate magnetic scattering and Fourier transform holography from a structure.

Installation

magneticScattering can be installed through pip:

(.venv)$ pip install magneticScattering

Documentation

Comprehensive documentation with examples is available online at readthedocs.

Quickstart

To calculate the observed magnetic scattering from a system, three classes describing the experimental setup must first be specified, namely the:

  1. Sample

  2. Beam

  3. Geometry

These classes are then passed to the Scatter class in order to perform the calculation. In the following sections, these parameters are described in more detail and examples are provided.

Sample

The Sample is initialized with the following parameters:

Sample(sample_length, scattering_factors, magnetic_configuration)
  • sample_length: size of the sample in meters as a scalar or a two-component vector in meters

  • scattering_factors: scattering factors list [f0, f1, f2]. These are the complex pre-factors corresponding to the charge, magnetic circular and magnetic linear scattering. The real part is the refractive index (or phase) and the imaginary part is the dissipation (or absorption)

  • structure: the magnetic configuration of the sample as a numpy array with shape (3, nx, ny) (charge component will be inferred) or (4, nx, ny) with the charge component at index 0

Beam

The Beam is initialized with the following parameters:

Beam(wavelength, beam_fwhm, polarization)
  • wavelength: wavelength of incident radiation in meters.

  • beam_fwhm: full width at half maximum of the beam as a scalar or a two-component vector in meters.

  • polarization: four-component polarization in the form of a Stokes vector.

Geometry

The Geometry is initialized with the following parameters:

Geometry(angle, detector_distance)
  • angle: The angle of incidence between the beam and the sample in degrees.

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

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

The sample plane is the x-y plane, such that the \(m_x\) and \(m_y\) components are in-plane, and \(m_z\) is out of plane.

Scatter

To compute the scattering pattern, call the Scatter class with the three classes from before as arguments:

Scatter(Sample, Beam, Geometry)

The intensity of the scattering can be obtained from Scatter.intensity or plotted directly using functions in the plot submodule. For example, for a labyrinthine structure

Magnetization components of a labyrinthine magnetic domain structure

the full-view scattering pattern (left) can be used to isolate a region of interest (left, red rectangle) to calculate a higher resolution scattering. The difference between the scattering obtained from the two circular polarizations is shown on the right

Full view of the scattering pattern, with a red rectangle representing the desired region of interest Higher resolution scattering pattern of the region of interest

References

van der Laan, G., “Theory from Soft X-ray resonant magnetic scattering of magnetic nano structures,” https://doi.org/10.1016/j.crhy.2007.06.004

Metadata

Release files for magneticScattering 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for magneticScattering 0.2.1
File Size Uploaded Provenance
magneticscattering-0.2.1.tar.gz 158.2 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for magneticScattering 0.2.1
File Interpreter ABI Platform
magneticscattering-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 315.1 kB

Release files / magneticscattering-0.2.1.tar.gz

Download URL magneticscattering-0.2.1.tar.gz
Size 158.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4a450aa1a4fe3976c32c9777e02859e8d464c0e5784cca24b979c665adca7c49
BLAKE2b-256 checksum
How to use checksums
c85066731e09bee2fca4aa4bbb9e0936f452f60028d975d55fde14bb67648dbe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 5, 2025.

Transparency log

Release files / magneticscattering-0.2.1-py3-none-any.whl

Download URL magneticscattering-0.2.1-py3-none-any.whl
Size 157.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
900c160800f1f6ebecbf070fe3b9047713727ffce7c6bd677901154822064ef8
BLAKE2b-256 checksum
How to use checksums
49529659144ca3f91893296c55fc22a0751b4bddfcbe23c2ea5398238df2d97c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 5, 2025.

Transparency log

Security for magneticScattering 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for magneticscattering-0.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 5, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page