Synthesize galaxy spectra from photometry
Project description
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/.
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
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 galsynthspec-0.1.1.tar.gz.
File metadata
- Download URL: galsynthspec-0.1.1.tar.gz
- Upload date:
- Size: 30.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17a275189d1e8278ddc57adfce354d7e2e46f0493c3a655d2a2ff86c13cef338
|
|
| MD5 |
09925a06e14adc60d232f001bef7d9a8
|
|
| BLAKE2b-256 |
52ddc9c067d274e7031602558494a9895faedb945bd4e3722c2749d8ff774bb2
|
Provenance
The following attestation bundles were made for galsynthspec-0.1.1.tar.gz:
Publisher:
continuous_integration.yml on robertdstein/galsynthspec
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
galsynthspec-0.1.1.tar.gz -
Subject digest:
17a275189d1e8278ddc57adfce354d7e2e46f0493c3a655d2a2ff86c13cef338 - Sigstore transparency entry: 235575559
- Sigstore integration time:
-
Permalink:
robertdstein/galsynthspec@d0c420618b6bdbff7720b3049b0c497497365058 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/robertdstein
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
continuous_integration.yml@d0c420618b6bdbff7720b3049b0c497497365058 -
Trigger Event:
push
-
Statement type:
File details
Details for the file galsynthspec-0.1.1-py3-none-any.whl.
File metadata
- Download URL: galsynthspec-0.1.1-py3-none-any.whl
- Upload date:
- Size: 31.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae84f7a273c2705bd123cc8330bfa9dd56927b001f0c7a05c4afe47bae9cfc85
|
|
| MD5 |
a9b788f6ee646ed5a9206cd1d2e21e8d
|
|
| BLAKE2b-256 |
c07a041b0aac40a5a87459d3059aa684b42af19dce16b0e72c38eebac7170a39
|
Provenance
The following attestation bundles were made for galsynthspec-0.1.1-py3-none-any.whl:
Publisher:
continuous_integration.yml on robertdstein/galsynthspec
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
galsynthspec-0.1.1-py3-none-any.whl -
Subject digest:
ae84f7a273c2705bd123cc8330bfa9dd56927b001f0c7a05c4afe47bae9cfc85 - Sigstore transparency entry: 235575566
- Sigstore integration time:
-
Permalink:
robertdstein/galsynthspec@d0c420618b6bdbff7720b3049b0c497497365058 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/robertdstein
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
continuous_integration.yml@d0c420618b6bdbff7720b3049b0c497497365058 -
Trigger Event:
push
-
Statement type: