Skip to main content

A machine learning model to generate quasar spectra

Project description

QUEST: A machine learning framework to generate quasar spectra

QUEST is an implementation of a Variational Auto-Encoder (VAE) with the primary purpose of generating realistic quasar spectra and post-processing them to obtain synthetic quasar photometry. QUEST can also be used to reconstruct spectra with limited wavelength coverage, absorption systems, and even the continuum blueward of the Lyman-$\alpha$ emission line (with some caveats).

Check out the paper for a full breakdown of its capabilities and limitations.

Install instructions

We recommend installing QUEST in a dedicated virtual environment.

  1. Create and activate a virtual environment (e.g., using venv):

    python -m venv venv_name
    source venv_name/bin/activate  # Linux/macOS
    
  2. Install from source:

    git clone [https://github.com/cosmic-dawn-group/QUEST.git](https://github.com/cosmic-dawn-group/QUEST.git)
    cd QUEST
    pip install -e .
    
  3. or Install from PyPI:

    pip install QUEST
    

    Note: Updates on the PyPI version might lag slightly behind the main repository.

    A note of caution: QUEST has been tested as much as possible, but there are surely bugs and aspects to improve. Please report any issue you find using the GitHub Issues tab, or consider sending us an email (francesco.guarneri@uni-hamburg.de).

Environment variables

QUEST uses a few environment variables to set its output folders and ensure that it does not overuse resources on shared machines.

  • QUEST_LOCALPATH — General cache directory. This is the primary folder used to download all cached files and save generated spectra/photometry in the examples. If downloaded using the utilities included in QUEST, this will also contain the datasets used to train the model.
  • QUEST_LOG_TO_FILE - QUEST logs to the terminal by default. However, if this variable is set to True or 1, an additional log file will be created in QUEST_LOCALPATH.
  • AM_I_ON_SHARED_SERVER - If set to True or 1, QUEST will limit its resource usage (see details in __init__.py -- make sure to customize this to your needs!).
  • TORCH_SEED - Sets the overall seed for PyTorch. If this is not set, the seed defaults to 42. If negative, no seed is set. Otherwise, the seed will be set to the value of this variable.
  • TORCH_DEBUG - Effectively sets torch.autograd.set_detect_anomaly(True). This should only be used to debug issues with the model, as it greatly slows down any PyTorch operation.

Environment variables can be set (for example, in bash) using the export command:

export QUEST_LOCALPATH="/path/to/your/cache/folder"

Usage

Head over to the examples folder, where we've included Jupyter notebooks showing how to load the model for inference, sample from it, or generate synthetic photometry.

Contributing

Contributions are more than welcome! Please open an issue to report problems, open PRs to contribute to the code, or just let us know if you have any feature requests! We are a small team but are happy to receive feedback!

License

See LICENSE in the repository root.

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

quest_qso-1.0.tar.gz (9.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

quest_qso-1.0-py3-none-any.whl (9.5 MB view details)

Uploaded Python 3

File details

Details for the file quest_qso-1.0.tar.gz.

File metadata

  • Download URL: quest_qso-1.0.tar.gz
  • Upload date:
  • Size: 9.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.17

File hashes

Hashes for quest_qso-1.0.tar.gz
Algorithm Hash digest
SHA256 61ec911d98e9caa3448c7b6b2874e87ce59191a59786c8c21780a403935224f2
MD5 fe33226310c81d2205088a4b5331cee4
BLAKE2b-256 cfc507bac7337ea0f9d186e10b8d8a793ddf0ab0e4d41133a3c6de095ff0d0c7

See more details on using hashes here.

File details

Details for the file quest_qso-1.0-py3-none-any.whl.

File metadata

  • Download URL: quest_qso-1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.17

File hashes

Hashes for quest_qso-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2361d21c305ecaa651520177f4676af0953df9465c9cf2dda562368ef2cc64eb
MD5 9278b514bb04905dc4a33da6e221b505
BLAKE2b-256 f9956da786e874ad2512b2b647f820efe9177c6fadc325533b956b9ec6f48c38

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page