Experimental and under development!
A framework for building deep learning models and pipelines for astrophysics applications. You can explore the available pipelines and related models online from the astromlp-app.
Install package from the git repository:
$ pip install git+https://github.com/nunorc/astromlp@master
The collection of models available from the astromlp-models repository is required, quick clone:
$ git clone https://github.com/nunorc/astromlp-models.git
And set the model_store
accordingly when necessary.
For development and exploring just clone astromlp recursively:
$ git clone --recurse-submodules https://github.com/nunorc/astromlp.git
and run code from the repository root, astromlp-models is set as a submodule of the
astromlp repository, and this is the default location for model_store
when used.
Just make sure all the requirements are available in your environment, check the
Installation section for details.
Import pipelines for a specific topic, for example to import
the One2One
, CherryPicked
and Universal
pipelines for galaxies characterization:
>>> from astromlp.galaxies import One2One, CherryPicked, Universal
Next, create an instance of the One2One pipeline, you may need to provide the location of the astromlp-models/model_store directory where the actual models live, for example:
>>> pipeline = One2One(model_store='./astromlp-models/model_store')
The galaxies pipelines are based on SDSS data, so the input to the pipeline if an SDSS object identifier (objid), for example to process the object 1237648720693755918 using the selected pipeline run:
>>> result = pipeline.process(1237648720693755918)
The result object is an instance of PipelineResult
, the outputs of the pipeline
processing:
>>> result
PipelineResult(redshift=0.0869317390024662, smass=23.44926865895589,
subclass='STARFORMING', gz2c='ScR')
The PipelineResult
object implements other methods that provide extra data, namely:
objid
: returns the SDSS object identifier;obj
: returns some information about the object from SDSS data;models
: returns the ensemble of models used;map
: returns the list of results of applying each individual model for each output.
You can easily create new ensembles of models using the MapReducPipeline
and passing the
list of outputs and corresponding models. For example, to create a pipeline that computes
the redshift using the i2r and f2r models:
>>> from astromlp.galaxies import MapReducePipeline
>>> pipeline = MapReducePipeline({ 'redshift': ['i2r', 'f2r'] })
Thank you to Dr. Andrew Humphrey for helping spawning this project and his contributions that helped improve this work.