galsynthspec
Galaxy Synthetic Spectrum fitting
Galsynthspec is a Python package for fitting synthetic galaxy spectra to observed data. It is designed to work with the sfdmap package for spectral fitting and provides tools for analyzing and visualizing the results.
It combines three key features:
- Coordinate-based photometry retrieval using the astroquery package, allowing users to fetch photometric data from various surveys.
- Galaxy fitting using prospector.
- Analysis and visualization tools for the fitted spectra.
If you are working with transient data, galsynthspec can also use TNS to resolve transient names to their respective coordinates, and identify a likely host using PS1.
galsynthspec is a wrapper, which combines the functionality of several other packages in one easy-to-install place. If you use the package, please credit those packages as well, in particular:
Installation
Easy way (Docker):
Use Docker to run the package without needing to install it locally. This is the recommended way to use galsynthspec, as it ensures that all dependencies are correctly set up.
docker pull robertdstein/galsynthspec:latest
Hard way (local installation):
Python Package
You can try the hard way:
git clone git@github.com:robertdstein/galsynthspec.git
cd galsynthspec
pip install -e ".[dev]"
pre-commit install
SFDMap and FSPS
galsynthspec also uses the sfdmap package for extinction corrections. While the package will be installed when using pip, it requires additional data files to function properly. Find a directory to store the SFDMAP data files, and then run:
wget https://github.com/kbarbary/sfddata/archive/master.tar.gz
tar xzf master.tar.gz
You also need to install https://github.com/cconroy20/fsps
Usage
Using Docker
If you want to use galsynthspec without installing it locally, you can run it in a Docker container. After you've pulled the Docker image, you need the prefix:
docker run -v /my/local/dir:/mydata robertdstein/galsynthspec
This command mounts a local directory (/my/local/dir) to a directory inside the Docker container (/mydata), allowing you to access your data files from within the container.
Using a local installation
If you prefer to install galsynthspec locally, you can do so by cloning the repository and installing the package in editable mode.
You should copy the .env.example file to .env and set the SFD_DATA_DIR variable to the directory where you want to store the data files.
You should also set the FSPS_DIR variable to the directory where you have installed fsps.
Finally, be sure to set the GALSYNTHSPEC_DATA_DIR variable to the directory where you want to store the galsynthspec data files.
Running galsynthspec
You can use the package to fetch photometric data for a galaxy by its transient name or coordinates, fit a synthetic spectrum to the data, and analyze the results.
For example, to fetch photometric data for a galaxy by its transient name, you can use the following command:
docker run -v /my/local/dir:/mydata robertdstein/galsynthspec by-name AT2019fdr
for Docker, or
galsynthspec by-name AT2019fdr
for local installation.
This will run the by-name command with the transient name AT2019fdr,
which will resolve the name to its coordinates and fetch the photometric data.
It will then use the prospector package to perform population synthesis.
Finally, it will analyze the results and generate plots.
It will generate an 'average' spectrum for the galaxy, with uncertainty.
It will also generate tabulated predictions for photometry in various bands,
which can be used for further analysis.
Finally, it will generate diagnostic plots to visualize the results of the fitting process.
All this can be viewed in the data directory, under AT2019fdr/.
Metadata
Release files for galsynthspec 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| galsynthspec-0.2.1.tar.gz | 30.7 kB | With provenance | Details for galsynthspec-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| galsynthspec-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for galsynthspec-0.2.1-py3-none-any.whl |
Total release size: 61.8 kB
Release files / galsynthspec-0.2.1.tar.gz
| Download URL | galsynthspec-0.2.1.tar.gz |
|---|---|
| Size | 30.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
606e81309c1acd97622419df3600f625194c899142c78b26b63cb3a54b21abc0
|
|
BLAKE2b-256 checksum How to use checksums |
631c50343d95bec51d38abc877a627d5526bb77a45df3912cf27adf49815dd44
|
| 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 Jun 17, 2025.
Transparency logRelease files / galsynthspec-0.2.1-py3-none-any.whl
| Download URL | galsynthspec-0.2.1-py3-none-any.whl |
|---|---|
| Size | 31.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
da6799e0a0d1163488171655e73e5781ffd0a466cdacce2237087fb13f03b971
|
|
BLAKE2b-256 checksum How to use checksums |
b7d5ff40480aed38399a7269dddff3d5bbedc6509e5ef3f721a3b13cfb959069
|
| 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 Jun 17, 2025.
Transparency logSecurity for galsynthspec 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.
Attestation for galsynthspec-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 Jun 17, 2025.
Transparency logA 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.