Skip to main content

SpyDust

SpyDust is an advanced Python package for modeling spinning dust radiation in astrophysical environments. Building upon previous models (the IDL SPDUST), SpyDust offers enhanced capabilities and corrections, making it a valuable tool for researchers in astrophysics and related fields.

For a detailed understanding of the underlying models and theoretical background, refer to the publication: SpyDust: an improved and extended implementation for modeling spinning dust radiation.


Features

  • Comprehensive Grain Shape Modeling: Considers a wide range of grain geometries, providing corresponding grain dynamics, directional radiation fields, and angular momentum transports.

  • Updated Physical Processes: Incorporates corrections and extensions, including updated expressions for the effects of electrical dipole radiation back-reaction and plasma drag on angular momentum dissipation.

  • Parallisation: Functions can be run in parallel (implemented by mpi4py) by simply setting the corresponding keyword to True.

  • SPDUST as is mode: Provides a submodule, SPDUST_as_is, which is exactly the full equivalent of the IDL spdust. Just in case the user wants to stick with the spdust simulation.

  • Example notebooks: Provide some Jupyter notebooks to help users get started with this package.


Requirements

SpyDust requires Python 3.7 or higher (up to Python 3.9) and the following dependencies:

Required:

  • numpy
  • scipy
  • mpi4py

Optional:

  • pandas: This is not needed for spinning dust spectra, but if free free emission is also desired (using free_free.py), then it is needed.

Installation

You can install SpyDust using pip:

pip install SpyDust --no-deps

Otherwise, you can directly `git clone' this repo and set up the environment by yourself.


Usage

Import the package in your project and explore its functionalities for modeling spinning dust radiation. Data files required for computations are bundled with the package.


Example usage:

Here is an example of using the `SpyDust.SpyDust' function to generate a spectrum for a sample CNM environment:

from SpyDust.SpyDust import SpyDust

# Define the environment:
# 'nH': total hydrogen number density (cm3),
# 'T': gas temperature (K),
# 'chi': intensity of the radiation field relative to the average interstellar radiation field,
# 'xh': hydrogen ionization fraction,
# 'xC': ionized carbon fractional abundance,
# 'y': molecular hydrogen fractional abundance,
# 'gamma': H2 formation efficiency,
# 'dipole': rms dipole moment for dust grains.
CNM_params = {'nh' : 30, 'T': 100., 'Chi': 1, 'xh': 1.2e-3, 'xC': 3e-4, 'y' : 0, 'gamma': 0, 'dipole': 9.3, 'line':7}


# Generate the spectrum
spectrum = SpyDust(params, min_freq=1, max_freq=400, n_freq=200, single_beta=True)

# Plot the spectrum
import matplotlib.pyplot as plt
plt.loglog(spectrum[0,:], spectrum[1,:])
plt.xlabel('Frequency (GHz)')
plt.ylabel('Emissivity')
plt.show()

Instead of using the SpyDust rotation distribution method described in the paper, you can generate spectra using your own arbitrary distributions of configuration parameters as inputs to the `SpyDust.SED' function.


History

  • Version 1.3: Added new modules to SpyDust, including "mom_exp.py", "SED_fit.py", "full_Stokes.py", and notebooks and products for the spectral feature paper

  • Version 1.2: Fixed import bugs in the example notebooks.

  • Version 1.1: Numba dependency removed and installation issues fixed.

  • Version 1.0: Initial release of SpyDust, introducing comprehensive grain shape modeling, updated physical processes, and degeneracy analysis tools.

TODO (Future Versions)

  • Future upgrades will include features such as the SED fitting tool (based on perturbation statistics tools like moment expansion) and improve the treatment of the grain rotation distribution.

Resources

  • Author: Zheng Zhang
  • License: This project is licensed under the MIT License - see the LICENSE file for details.
  • Collaboration: SpyDust GitHub Collaboration
  • Spdust Documentation: We refer users to the website of spdust for better documentation of environmental parameters

Metadata

Release files for SpyDust 1.3.2

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

Source distribution (sdist)

Source distribution for SpyDust 1.3.2
File Size Uploaded
spydust-1.3.2.tar.gz 1.8 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for SpyDust 1.3.2
File Interpreter ABI Platform
spydust-1.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 3.6 MB

Release files / spydust-1.3.2.tar.gz

Download URL spydust-1.3.2.tar.gz
Size 1.8 MB
Tags Source
SHA-256 checksum
How to use checksums
8c372bc9207b5d6fda7fa69f27cb12393f59efd5113b5fbfd08ec16d46ab9d7f
BLAKE2b-256 checksum
How to use checksums
73ed6bf2293c018eb1625a9c91a4e0dd3687f59f8d42fc2abcf3a345b7e88a11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 10, 2026.

Transparency log

Release files / spydust-1.3.2-py3-none-any.whl

Download URL spydust-1.3.2-py3-none-any.whl
Size 1.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
1a67d06fcde47a6daaf5575b80e7a1414d0eb43fcb86a3d24e78a9d524d68378
BLAKE2b-256 checksum
How to use checksums
4d72ecee3d231403500eb40ea130078decc700c984ff8858c55b6cb2eeeddc85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 10, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.3.2 This release

2 release files

1.3

2 release files

1.2

2 release files

1.1

2 release files

1.0.1

2 release files

1.0.0

2 release files

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