Skip to main content

Support for Tensorflow Hub modules in GalSim

Project description

GalSim Hub

PyPI PyPI - License

GalSim Hub provides a collection of TensorFlow modules for GalSim.

TL;DR

GalSim Hub makes it easy to incorporate galaxy light profiles modelled by deep neural networks directly with a GalSim script:

import galsim
import galsim_hub
from astropy.table import Table

# Load a generative model from the online repository
model = galsim_hub.GenerativeGalaxyModel('hub:Lanusse2020')

# Defines the input conditions, for this model flux_radius, mag_auto, and redshift
catalog = Table([[5., 10. ,20.], [24., 24., 24.], [0.5, 0.5, 0.5] ],
             names=['flux_radius', 'mag_auto', 'zphot'])

# Sample light profiles for these parameters
profiles = model.sample(catalog)
...

You can read more, and try out a live demo here: colab link

Installation

To install:

 $ pip install --user galsim-hub

Note: GalSim-Hub currently assumes TensorFlow 1.15 to be installed, and will not try to install it as a dependency.

Usage

This module can be used directly under the GalSim Yaml driver:

 $ galsim examples/demo14.yaml

or from Python:

import galsim
import galsim_hub
from astropy.table import Table

# Load a generative model from the online repository
model = galsim_hub.GenerativeGalaxyModel('hub:Lanusse2020')

# Defines the input conditions, for this model flux_radius, mag_auto, and redshift
catalog = Table([[5., 10. ,20.], [24., 24., 24.], [0.5, 0.5, 0.5] ],
             names=['flux_radius', 'mag_auto', 'zphot'])

# Sample light profiles for these parameters
profiles = model.sample(catalog)
...

Adding a model to the repository

This repository is intended to host a collection of deep generative models, any new contributions are welcome. Submitting your model to the Hub means that it becomes trivially accessible to any GalSim user, increasing the chances that it will be used in practice :-)

To submit a model, please open a Pull Request adding a new folder under the hubdirectory. As the procedure is not currently completely documented, do not hesitate to reach out to the maintainers of the repository for guidance.

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

galsim_hub-0.0.1rc4.tar.gz (154.1 kB view hashes)

Uploaded Source

Supported by

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