Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jobovy/kimmy
Galactic chemical evolution in python
https://github.com/jobovy/kimmy
astronomy astrophysics physics python
Last synced: 11 days ago
JSON representation
Galactic chemical evolution in python
- Host: GitHub
- URL: https://github.com/jobovy/kimmy
- Owner: jobovy
- License: mit
- Created: 2018-07-06T17:24:27.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2022-04-11T15:38:51.000Z (almost 3 years ago)
- Last Synced: 2024-12-30T04:52:52.253Z (24 days ago)
- Topics: astronomy, astrophysics, physics, python
- Language: Jupyter Notebook
- Homepage:
- Size: 813 KB
- Stars: 8
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
- License: LICENSE
Awesome Lists containing this project
README
# kimmy
Galactic chemical evolution in python
[![image](http://img.shields.io/pypi/v/kimmy.svg)](https://pypi.python.org/pypi/kimmy/)
[![Binder](http://mybinder.org/badge.svg)](https://mybinder.org/v2/gh/jobovy/kimmy/main)## Overview
``kimmy`` contains simple tools to study chemical evolution in galaxies.
## Author
Jo Bovy (University of Toronto): bovy - at - astro - dot - utoronto - dot - ca
## Installation
Install the latest release with ``pip``
```
pip install kimmy
```
or install the latest version by cloning/forking/downloading the repository and installing using
```
sudo python setup.py install
```
or locally using
```
python setup.py install --user
```## Usage
For an example of usage, see the [example notebook](kimmy-example.ipynb). You can also launch a [Binder](https://mybinder.org/v2/gh/jobovy/kimmy/main) instance and directly play around with this notebook. _Or_ you can use [this](kimmy-example-pyodide.ipynb) [pyodide](https://github.com/pyodide/pyodide)-compatible version of the same notebook in [JupyterLite](https://github.com/jupyterlite/jupyterlite).
Currently, the only implemented feature is a simple one-zone chemical model with two elements ``O`` (for oxygen) and ``Fe`` (for iron). Initialize this model as
```
import kimmy
oz= kimmy.OneZone()
```
then for example compute the evolution of the default model and plot the [O/Fe] vs. [Fe/H] sequence
```
ts= numpy.linspace(0.001,10.,1001)*u.Gyr
plot(oz.Fe_H(ts),oz.O_Fe(ts))
```
To compute the distribution of [Fe/H], do for example,
```
FeHs= numpy.linspace(-1.525,1.225,56)
FeH_dist= [oz.Fe_H_DF(f) for f in FeHs]
```
and similar for the distribution of [O/H] and [O/Fe]. You can directly update the main parameters of the model and the model will be re-computed. For example, to set the outflow mass-loading parameter to one and plot the [O/Fe] vs. [Fe/H] sequence, do
```
ts= numpy.linspace(0.001,10.,1001)*u.Gyr
oz.eta= 1.
plot(oz.Fe_H(ts),oz.O_Fe(ts))
```
Keep in mind that once you change a parameter, it remains changed in the model. If you want to go back to the initial set of parameters that you used to initialize the instance, use ``oz.initial()``; if you want to go back to the default set of parameters, use ``oz.default()``. If you want to print the model you are using at any time, do
```
print(oz)
```
which prints a nicely formatted list of all of the model parameters.