...
 
Commits (5)
The contents of the files in the "data" directory have been obtained from the
scientific literature and are the intelectual property of their respective
authors. If you are the author of the contents of one of those files and feel
you have not been properly credited or have any other concern, please contact
mglatzle@mpa-garching.mpg.de.
All other files in this repository are distributed under GPLv3 as detailed
below.
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
......
# A toolbox for cosmic dust.
# `cosmic_dustbox`
A package that aims at bringing models of cosmic dust to Python to make working
with them easier.
*Note:* very early development at the moment so it does not yet do too many
useful things and the API _will_ change.
## Installation
- Clone the repo: `git clone
git@gitlab.mpcdf.mpg.de:mglatzle/cosmic_dustbox.git`
- `cd cosmic_dustbox`
- `python setup.py install`
## Examples
Note: `cosmic_dustbox` uses `astropy.units` throughout.
Evaluating the Weingartner & Draine 2001 size distributions for carbonaceous
and silicate grains for R\_V=3.1 and b\_C=6.0e-5 in case 'A' at a range of
grain sizes between 1 nm and 1 $\mu$:
```
>>> import astropy.units as u
>>> import cosmic_dustbox as cb
>>> import numpy as np
>>> sd_car, sd_sil = cb.sdist.WD01(3.1, 6.0, 'A')
>>> sizes = np.logspace(-9, -6, num=10)*u.m
>>> sd_car(sizes)
<Quantity [7.39939133e+00, 9.02469859e-02, 1.94996300e-02, 1.07158763e-03,
1.18483502e-04, 1.30850238e-05, 1.24648409e-06, 9.43835731e-08,
2.41782877e-09, 2.43258206e-15] 1 / m>
>>> sd_sil(sizes)
<Quantity [7.86318728e+000, 6.70676535e-001, 5.73425242e-002,
4.92807748e-003, 4.28146066e-004, 3.80362296e-005,
3.52990312e-006, 3.09011411e-007, 7.19725776e-020,
9.29346597e-263] 1 / m>
```
## Philosophy
In 1930, after confirming that distant stars in the Milky Way are dimmed more
strongly than one would expect from geometry, Trumpler conjectured the
existence of "dust particles of various sizes" in the interstellar space of our
......@@ -32,14 +69,14 @@ other grains, grains that have similar chemical composition and so on. So if we
are fine with some level of abstraction and generalization, our grain
collection could be represented like this:
![](figs/grain-pop.png)
![](docs/figs/grain-pop.png)
with color-coded chemical composition. How do we go about categorizing these
grains so that we can think in these categories without worrying about
individual grains? Two obvious properties to group by are the chemical
composition and the shape:
![](figs/grain-species.png)
![](docs/figs/grain-species.png)
The "blueprint grain", which we can rescale to obtain any of the grains in one
of the groups, is referred to as a grain species. So one of our groups is
......@@ -58,8 +95,10 @@ So, to recap, what we need to describe a collection of grains are:
This approach can be refined as needed by simply splitting grain species. In
the extreme, we would have one species per grain and each species would have a
delta-peak size distribution and we would be back to the overwhelming diversity
we started out from.
we started out from. The approach also sounds like it can almost directly be
translated into software. The size distribution class in `sdist.py` is already
in a somewhat advanced state so feel free to check it out.
# Literature
## Literature
"Physics of the Interstellar and Intergalactic Medium" by B. Draine provides
a good introduction (and more than that) to cosmic dust.
......@@ -22,11 +22,6 @@ class Crefin(object):
array shall correspond to grain size and the second axis to
wavelength. Note that this axis ordering is reversed wrt to the output
of `np.meshgrid`.
Attributes
----------
_f : callable
Directly taken from parameters.
"""
def __init__(self, f):
......@@ -146,9 +141,10 @@ class SGPAHCrefin(Crefin):
@classmethod
def parseCrefinFile(cls, path):
with open(path) as f:
data = _np.loadtxt(f, skiprows=5)
data = _np.loadtxt(f, skiprows=6)
f.seek(0)
next(f)
# skip tow lines
[next(f) for i in range(2)]
size = float(f.readline().split('=')[0])
return size, data
......
Downloaded from B. Draine's website at https://www.astro.princeton.edu/~draine/dust/dust.diel.html
ICOMP=18: Draine 2003 graphite E parallel to c
0.0100 = grain radius (micron)
20.00 = grain temperature (K)
......
Downloaded from B. Draine's website at https://www.astro.princeton.edu/~draine/dust/dust.diel.html
ICOMP=18: Draine 2003 graphite E parallel to c
0.1000 = grain radius (micron)
20.00 = grain temperature (K)
......
Downloaded from B. Draine's website at https://www.astro.princeton.edu/~draine/dust/dust.diel.html
ICOMP=19: Draine 2003 graphite E perp. c
0.0100 = grain radius (micron)
20.00 = grain temperature (K)
......
Downloaded from B. Draine's website at https://www.astro.princeton.edu/~draine/dust/dust.diel.html
ICOMP=19: Draine 2003 graphite E perp. c
0.1000 = grain radius (micron)
20.00 = grain temperature (K)
......
Downloaded from B. Draine's website at https://www.astro.princeton.edu/~draine/dust/dust.diel.html
ICOMP=11: Draine 2003 astrosilicate
0.1000 = grain radius (micron)
20.00 = grain temperature (K)
......
......@@ -301,6 +301,7 @@ def WD01(RV, bc, case):
)
return s_car + l_car, sil
###############################################################################
if __name__ == "__main__":
import doctest
......
# Welcome to MkDocs
For full documentation visit [mkdocs.org](https://mkdocs.org).
## Commands
* `mkdocs new [dir-name]` - Create a new project.
* `mkdocs serve` - Start the live-reloading docs server.
* `mkdocs build` - Build the documentation site.
* `mkdocs help` - Print this help message.
## Project layout
mkdocs.yml # The configuration file.
docs/
index.md # The documentation homepage.
... # Other markdown pages, images and other files.
with open('README.md') as fh:
long_desc = fh.read()
name = 'cosmic_dustbox'
version = '0.1.dev0'
authors = 'Martin Glatzle, Ayman Noureldin'
author_email = 'findessp@yandex.ru'
description = 'Toolbox for cosmic dust.'
url = 'https://github.com/findesgh/'+name
license = 'GPL-3.0'
site_name: cosmic_dustbox documentation
site_author: Martin Glatzle
theme: readthedocs
site_dir: docs/html_docs
pages:
- Introduction: 'index.md'
- Quick start: 'quickstart.md'
from setuptools import setup
import metadata as md
with open('README.md') as fh:
long_desc = fh.read()
name = 'cosmic_dustbox'
setup(
name=name,
version='0.1.dev0',
author_email='findessp@yandex.ru',
description='Toolbox for cosmic dust.',
long_description=long_desc,
name=md.name,
version=md.version,
author=md.authors,
author_email=md.author_email,
description=md.description,
long_description=md.long_desc,
long_description_content_type='text/markdown',
url='https://github.com/findesgh/'+name,
license='GPL-3.0',
packages=[name],
url=md.url,
license=md.license,
packages=[md.name],
install_requires=[
'numpy',
'astropy',
......