Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional features #187

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
STARDIS Stellar Radiative transfer
----------------------------------

Welcome to STARDIS!
STARDIS is an LTE radiative transfer Python package that utilizes the TARDIS infrastructure
to generate synthetic stellar spectra. For more information about STARDIS,
including a quickstart notebook, physics walkthrough and installation instructions, go to our `documentation page <https://tardis-sn.github.io/stardis/>`_.
Or, try running the `quickstart notebook <docs/quickstart/quickstart.ipynb>`_ yourself!

To learn more about TARDIS, including documentation and collaborator information, go `here <https://tardis-sn.github.io/tardis/>`_.

License
-------

Expand Down
193 changes: 193 additions & 0 deletions docs/Tutorials/Mesa_model.ipynb

Large diffs are not rendered by default.

114 changes: 114 additions & 0 deletions docs/Tutorials/Running_in_Parallel.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Running the Simulation in Parallel"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You can change the number of threads that STARDIS uses with the n_threads keyword. \n",
"A few things to remember when running STARDIS in parallel: \n",
" \n",
"If no n_threads argument is provided, it defaults to 1 and runs in series. \n",
" \n",
"Set n_threads to 0 to use all available threads. \n",
" \n",
"The n_threads argument must be between the config version and the atom data, like this: \n",
"```\n",
"stardis_config_version: 1.0 \n",
"n_threads: 4 \n",
"atom_data: kurucz_cd23_chianti_H_He.h5\n",
"```\n",
"\n",
"In the [stardis_config_parallel](stardis_config_parallel.yml) file, an n_threads value of 4 is added to the example config. Try running this code yourself to see how n_threads affects STARDIS's efficiency."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "25723fa78e8d43ef8129a7667a39ebf8",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Iterations: 0/? [00:00<?, ?it/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "86699bb231414753bfb51786d4a12b7f",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Packets: 0/? [00:00<?, ?it/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Atomic Data kurucz_cd23_chianti_H_He already exists in /home/monkhayd/Downloads/tardis-data/kurucz_cd23_chianti_H_He.h5. Will not download - override with force_download=True.\n",
"WARNING: UnitsWarning: 'erg/cm2/s' contains multiple slashes, which is discouraged by the FITS standard [astropy.units.format.generic]\n",
"WARNING:astropy:UnitsWarning: 'erg/cm2/s' contains multiple slashes, which is discouraged by the FITS standard\n",
"/home/monkhayd/Software/tardis/tardis/plasma/properties/radiative_properties.py:93: RuntimeWarning: invalid value encountered in divide\n",
" (g_lower * n_upper) / (g_upper * n_lower)\n",
"/home/monkhayd/Software/tardis/tardis/plasma/properties/radiative_properties.py:93: RuntimeWarning: invalid value encountered in divide\n",
" (g_lower * n_upper) / (g_upper * n_lower)\n"
]
}
],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"from tardis.io.atom_data.util import download_atom_data\n",
"from stardis.base import run_stardis\n",
"from astropy import units as u, constants as const\n",
"\n",
"download_atom_data('kurucz_cd23_chianti_H_He')\n",
"tracing_lambdas = np.mgrid[6540:6590:.01]* u.Angstrom\n",
"\n",
"sim = run_stardis('Tutorial_data/stardis_config_parallel.yml', tracing_lambdas)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.5"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}
864 changes: 864 additions & 0 deletions docs/Tutorials/Tutorial_data/end_core_h_burn.mod

Large diffs are not rendered by default.

74 changes: 74 additions & 0 deletions docs/Tutorials/Tutorial_data/h_minus_cross_section_wbr.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
180.0,6.700000000000001e-20
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file shouldn't really be added. I don't dislike the idea of a tutorial_data directory, but we should not duplicate data. You can point the h_minus_cross_section file to the existing data directory in the main stardis directory, and the docs already has a sun.mod file that can be pointed to as well.

Also, I would not really call the config files "data." Rather, maybe it's better structure to have the mesa_model be its own directory with both the notebook and the .yml file needed, and similar for the parallel stardis notebook.

196.0,8.800000000000002e-20
214.0,1.17e-19
236.0,1.5500000000000002e-19
264.0,2.06e-19
298.0,2.8300000000000005e-19
343.0,4.14e-19
404.0,7.03e-19
491.0,1.2400000000000001e-18
626.0,2.3300000000000003e-18
1210.0,5.43e-18
1390.0,5.910000000000001e-18
1640.0,7.29e-18
1750.0,7.917999999999999e-18
2000.0,9.453e-18
2250.0,1.1080000000000001e-17
2500.0,1.275e-17
2750.0,1.4460000000000002e-17
3000.0,1.619e-17
3250.0,1.7920000000000003e-17
3500.0,1.965e-17
3750.0,2.1350000000000004e-17
4000.0,2.3020000000000002e-17
4250.0,2.465e-17
4500.0,2.624e-17
4750.0,2.777e-17
5000.0,2.923e-17
5250.0,3.0620000000000005e-17
5500.0,3.194e-17
5750.0,3.3170000000000005e-17
6000.0,3.432e-17
6250.0,3.537e-17
6500.0,3.6320000000000004e-17
6750.0,3.717e-17
7000.0,3.7909999999999996e-17
7250.0,3.854e-17
7500.0,3.9070000000000005e-17
7750.0,3.948e-17
8000.0,3.9770000000000003e-17
8250.0,3.995000000000001e-17
8500.0,4.001e-17
8750.0,3.995000000000001e-17
9000.0,3.9770000000000003e-17
9250.0,3.948e-17
9500.0,3.9060000000000006e-17
9750.0,3.8530000000000007e-17
10000.0,3.7890000000000004e-17
10250.0,3.7130000000000005e-17
10500.0,3.6250000000000004e-17
10750.0,3.5280000000000003e-17
11000.0,3.419e-17
11250.0,3.301e-17
11500.0,3.172e-17
11750.0,3.0340000000000003e-17
12000.0,2.887e-17
12250.0,2.7330000000000002e-17
12500.0,2.5710000000000003e-17
12750.0,2.402e-17
13000.0,2.2260000000000003e-17
13250.0,2.0460000000000004e-17
13500.0,1.862e-17
13750.0,1.674e-17
14000.0,1.485e-17
14250.0,1.295e-17
14500.0,1.107e-17
14750.0,9.211000000000001e-18
15000.0,7.407e-18
15250.0,5.677000000000001e-18
15500.0,4.052e-18
15750.0,2.5750000000000006e-18
16000.0,1.3019999999999999e-18
16100.0,8.697e-19
16200.0,4.974e-19
16300.0,1.989e-19
24 changes: 24 additions & 0 deletions docs/Tutorials/Tutorial_data/mesa_model_example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
stardis_config_version: 1.0
n_threads: 1
atom_data: kurucz_cd23_chianti_H_He.h5

model:
fname: Tutorial_data/end_core_h_burn.mod
type: mesa
truncate_to_shell: 40
final_atomic_number: 30

opacity:
file:
Hminus_bf: Tutorial_data/h_minus_cross_section_wbr.dat
bf:
H_I: {}
ff:
H_I: {}
disable_electron_scattering: False
line:
disable: False
broadening: [radiation, linear_stark, quadratic_stark, van_der_waals]
min: 6500 AA
max: 6600 AA
no_of_thetas: 20
24 changes: 24 additions & 0 deletions docs/Tutorials/Tutorial_data/opacity_example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
stardis_config_version: 1.0
n_threads: 1
atom_data: kurucz_cd23_chianti_H_He.h5

model:
fname: Tutorial_data/end_core_h_burn.mod
type: mesa
truncate_to_shell: 40
final_atomic_number: 30

opacity:
file:
Hminus_bf: ../../stardis/data/h2_plus_bf_S1994.dat
bf:
H_I: {}
ff:
H_I: {}
disable_electron_scattering: False
line:
disable: False
broadening: [radiation, linear_stark, quadratic_stark, van_der_waals]
min: 6500 AA
max: 6600 AA
no_of_thetas: 20
22 changes: 22 additions & 0 deletions docs/Tutorials/Tutorial_data/stardis_config_parallel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
stardis_config_version: 1.0
n_threads: 4
atom_data: kurucz_cd23_chianti_H_He.h5

model:
type: marcs
fname: Tutorial_data/sun.mod
final_atomic_number: 30
opacity:
file:
Hminus_bf: Tutorial_data/h_minus_cross_section_wbr.dat
bf:
H_I: {}
ff:
H_I: {}
disable_electron_scattering: False
line:
disable: False
broadening: [radiation, linear_stark, quadratic_stark, van_der_waals]
min: 6500 AA
max: 6600 AA
no_of_thetas: 20
Loading
Loading