An all-sky 3D dust map based on Gaia and LAMOST.
Project description
dustmaps3d
🌌 An all-sky 3D dust extinction map based on Gaia and LAMOST
📄 Wang et al. (2025), An all-sky 3D dust map based on Gaia and LAMOST
📌 DOI: 10.12149/101620
📦 A Python package for easy access to the 3D dust map
📌 DOI: 10.12149/101619
📦 Installation
Install via pip:
pip install dustmaps3d
📦 Data File Notice
⚠️ The package does not include the data file. Upon first use, a ~400MB model file will be automatically downloaded from GitHub or the NADC mirror.
🚀 Automatic Download Mechanism
- When
dustmaps3d()is called, the package will attempt to download the filedata_v3.fits.gz; - After the download, the file will be automatically decompressed into
data_v3.fitsand cached locally; - Subsequent calls will directly load from the cache without re-downloading.
🌐 What If the Download Fails?
If you're outside China, the default download source is GitHub. However, network issues (like connect timeout) may still occur. The package supports fallback to an alternative mirror:
- ✅ Primary source (international users): GitHub Releases
- 🌀 Backup source (Chinese mirror): NADC (currently under review, coming soon)
If both sources fail, you can manually download the data file.
📥 Manual Download (Recommended for Chinese Users)
- Visit the mirror link (coming soon)
- Download the file:
data_v3.fits.gz - Decompress it into
data_v3.fits - Place the file in the local cache directory (the location will be printed the first time you run the package)
Example path on Windows:
C:\Users\<username>\AppData\Local\dustmaps3d\data_v3.fits
Example path on Linux/macOS:
/home/<username>/.local/share/dustmaps3d/data_v3.fits
🚀 Usage
from dustmaps3d import dustmaps3d
l = [120.0]
b = [30.0]
d = [1.5]
EBV, dust, sigma, max_d = dustmaps3d(l, b, d)
print(f"EBV: {EBV.values[0]:.4f} [mag]")
print(f"Dust: {dust.values[0]:.4f} [mag/kpc]")
print(f"Sigma: {sigma.values[0]:.4f} [mag]")
print(f"Max distance: {max_d.values[0]:.4f} kpc")
Batch example with FITS:
import numpy as np
from astropy.table import Table
from dustmaps3d import dustmaps3d
data = Table.read('input.fits')
l = data['l'].astype(float)
b = data['b'].astype(float)
d = data['d'].astype(float)
EBV, dust, sigma, max_d = dustmaps3d(l, b, d)
data['EBV_3d'] = EBV
data['dust'] = dust
data['sigma'] = sigma
data['max_distance'] = max_d
data.write('output.fits', overwrite=True)
🧠 Function Description
dustmaps3d(l, b, d, n_process=None)
Estimates 3D dust extinction and related quantities for given galactic coordinates and distances.
| Input | Type | Description | Unit |
|---|---|---|---|
l |
np.ndarray | Galactic longitude | degrees |
b |
np.ndarray | Galactic latitude | degrees |
d |
np.ndarray | Distance | kpc |
Returns:
| Output | Type | Description | Unit |
|---|---|---|---|
EBV |
np.ndarray | E(B–V) extinction | mag |
dust |
np.ndarray | Dust density (d(EBV)/dx) | mag/kpc |
sigma |
np.ndarray | Estimated uncertainty in E(B–V) | mag |
max_d |
np.ndarray | Maximum reliable distance | kpc |
If
dcontainsNaN, it will be automatically replaced by the maximum reliable distance along that line of sight (max_d).If the input
dexceedsmax_d, it indicates the point lies beyond the model's reliable range. The returned values in this case are extrapolated and not guaranteed to be accurate.
⚡ Performance
- Fully vectorized and optimized with NumPy
- On a modern personal computer, evaluating 100 million stars takes only ~100 seconds
📜 Citation
If you use this model or the Python package, please cite both:
- Wang, T. (2025), An all-sky 3D dust map based on Gaia and LAMOST. DOI: 10.12149/101620
- dustmaps3d: A Python package for easy access to the 3D dust map. DOI: 10.12149/101619
🛠️ License
This project is open-source and distributed under the MIT License.
📫 Contact
If you have any questions, suggestions, or encounter issues using this package,
please feel free to contact the authors via GitHub issues or email.
- Prof. Yuan Haibo: yuanhb@bnu.edu.cn
- Wang Tao: wt@mail.bnu.edu.cn
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dustmaps3d-2.2.0.tar.gz.
File metadata
- Download URL: dustmaps3d-2.2.0.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c956b57a3216aa9fad91e9000a257f4f6400d1c73933abb0a7abb5a22e8438b
|
|
| MD5 |
f0578c3ba55bca0f572be970399e1d1e
|
|
| BLAKE2b-256 |
ea3968607f05c6b53d04acdc92061453c6e59fcaf0b67653319a6f300446a7c4
|
File details
Details for the file dustmaps3d-2.2.0-py3-none-any.whl.
File metadata
- Download URL: dustmaps3d-2.2.0-py3-none-any.whl
- Upload date:
- Size: 12.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2bcc57dabec8880b2528a027eebc3532653638a793aecd525ff252842ea2b1ed
|
|
| MD5 |
0df704aab3101c66846cd7ff8877768a
|
|
| BLAKE2b-256 |
1ba71f8ea16cb4217f4310335d1a487296586563f6bd24281dc2679beeb2684d
|