-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
Restructure The Repository to Create The Documentation using Sphinx and Sphinx Gallery #9
base: master
Are you sure you want to change the base?
Changes from all commits
164718a
8a34151
9105dea
2713fc0
14d8450
0b4bbce
0342659
1dfeaef
970c8a7
6575218
ada5447
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,3 +105,15 @@ venv.bak/ | |
|
||
# Mac OSX | ||
.DS_Store | ||
|
||
# Binary files | ||
*.pickle | ||
|
||
# Sphinx HTML Output | ||
html/ | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't get the sphinx/sphinx gallery folder structure. Could you explain to me? Usually Sphinx had There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I use a command that creates a folder called html. So it should remove this folder |
||
# Sphinx Gallery output | ||
*_examples/ | ||
|
||
# VScode | ||
.vscode/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Newline at the end of the file. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,8 +10,8 @@ supernova: | |
distance: 8.32 Mpc | ||
|
||
# standard atomic data base; get it from the tardis-refdata repository | ||
atom_data: /home/mew488/src/tardis-refdata/atom_data/kurucz_cd23_chianti_H_He.h5 | ||
#atom_data: kurucz_cd23_chianti_H_He.h5 | ||
# atom_data: /home/mew488/src/tardis-refdata/atom_data/kurucz_cd23_chianti_H_He.h5 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you can remove the commented line. |
||
atom_data: kurucz_cd23_chianti_H_He.h5 | ||
|
||
#csvy_model: /Users/marcwilliamson/Research/TARDIS/94I/nomoto_data/hach_fixed/16d.csvy | ||
csvy_model: hach_exact_csvy_16d.csvy | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line, and also | ||
# from the environment for the first two. | ||
SPHINXOPTS ?= | ||
SPHINXBUILD ?= sphinx-build | ||
SOURCEDIR = . | ||
BUILDDIR = _build | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
.PHONY: help Makefile | ||
|
||
# Catch-all target: route all unknown targets to Sphinx using the new | ||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Configuration file for the Sphinx documentation builder. | ||
# | ||
# This file only contains a selection of the most common options. For a full | ||
# list see the documentation: | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html | ||
|
||
# -- Path setup -------------------------------------------------------------- | ||
|
||
# If extensions (or modules to document with autodoc) are in another directory, | ||
# add these directories to sys.path here. If the directory is relative to the | ||
# documentation root, use os.path.abspath to make it absolute, like shown here. | ||
# | ||
# import os | ||
# import sys | ||
# sys.path.insert(0, os.path.abspath('.')) | ||
|
||
|
||
# -- Project information ----------------------------------------------------- | ||
|
||
project = "tardis-setups" | ||
copyright = "2022, Wolfgang Kerzendorf" | ||
author = "Wolfgang Kerzendorf" | ||
|
||
|
||
# -- General configuration --------------------------------------------------- | ||
|
||
# Add any Sphinx extension module names here, as strings. They can be | ||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom | ||
# ones. | ||
extensions = [ | ||
"sphinx_gallery.gen_gallery", | ||
] | ||
|
||
sphinx_gallery_conf = { | ||
"examples_dirs": [ | ||
"../tardis-setups/2014", | ||
"../tardis-setups/2020", | ||
], # path to your example scripts | ||
"gallery_dirs": [ | ||
"2014_examples", | ||
"2020_examples", | ||
], # path to where to save gallery generated output | ||
} | ||
|
||
# Add any paths that contain templates here, relative to this directory. | ||
templates_path = ["_templates"] | ||
|
||
# List of patterns, relative to source directory, that match files and | ||
# directories to ignore when looking for source files. | ||
# This pattern also affects html_static_path and html_extra_path. | ||
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] | ||
|
||
|
||
# -- Options for HTML output ------------------------------------------------- | ||
|
||
# The theme to use for HTML and HTML Help pages. See the documentation for | ||
# a list of builtin themes. | ||
# | ||
html_theme = "sphinx_rtd_theme" | ||
|
||
# Add any paths that contain custom static files (such as style sheets) here, | ||
# relative to this directory. They are copied after the builtin static files, | ||
# so a file named "default.css" will overwrite the builtin "default.css". | ||
html_static_path = ["_static"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
.. tardis-setups documentation master file, created by | ||
sphinx-quickstart on Mon Jun 20 17:55:16 2022. | ||
You can adapt this file completely to your liking, but it should at least | ||
contain the root `toctree` directive. | ||
|
||
Welcome to tardis-setups's documentation! | ||
========================================= | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: Contents: | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: Galleries: | ||
|
||
2014_examples/index | ||
2020_examples/index | ||
|
||
Indices and tables | ||
================== | ||
|
||
* :ref:`genindex` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
@ECHO OFF | ||
|
||
pushd %~dp0 | ||
|
||
REM Command file for Sphinx documentation | ||
|
||
if "%SPHINXBUILD%" == "" ( | ||
set SPHINXBUILD=sphinx-build | ||
) | ||
set SOURCEDIR=. | ||
set BUILDDIR=_build | ||
|
||
%SPHINXBUILD% >NUL 2>NUL | ||
if errorlevel 9009 ( | ||
echo. | ||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx | ||
echo.installed, then set the SPHINXBUILD environment variable to point | ||
echo.to the full path of the 'sphinx-build' executable. Alternatively you | ||
echo.may add the Sphinx directory to PATH. | ||
echo. | ||
echo.If you don't have Sphinx installed, grab it from | ||
echo.https://www.sphinx-doc.org/ | ||
exit /b 1 | ||
) | ||
|
||
if "%1" == "" goto help | ||
|
||
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
goto end | ||
|
||
:help | ||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
|
||
:end | ||
popd |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
2014 Examples | ||
================== | ||
|
||
Below is a gallery of examples. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
""" | ||
Tardis 2014 Example | ||
========================== | ||
|
||
This is the example output | ||
""" | ||
|
||
|
||
from tardis import run_tardis | ||
from tardis.io.config_reader import Configuration | ||
from tardis.io.atom_data.util import download_atom_data | ||
import matplotlib.pyplot as plt | ||
|
||
import sys | ||
|
||
sys.path.append("../") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this does not look like a sensible idea of implementing things. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We needed a couple of functions to be used across all the papers. So we needed to put them in a separate folder so that all the files could import them. The only way to access those functions is through this function. |
||
from setup_utils import config_modifier | ||
|
||
# %% | ||
# Uncomment this line if you need to download the dataset. | ||
|
||
|
||
download_atom_data("kurucz_cd23_chianti_H_He") | ||
|
||
# %% | ||
# Runs the example | ||
|
||
conf = Configuration.from_yaml( | ||
"../../2014/2014_kerzendorf_sim/appendix_A1/tardis_example.yml" | ||
) | ||
conf = config_modifier(conf) | ||
|
||
# %% | ||
sim = run_tardis(conf) | ||
|
||
|
||
# %% | ||
spectrum = sim.runner.spectrum | ||
spectrum_virtual = sim.runner.spectrum_virtual | ||
spectrum_integrated = sim.runner.spectrum_integrated | ||
|
||
plt.figure(figsize=(10, 6.5)) | ||
|
||
spectrum.plot(label="Normal packets") | ||
spectrum_virtual.plot(label="Virtual packets") | ||
spectrum_integrated.plot(label="Formal integral") | ||
|
||
plt.xlim(500, 9000) | ||
plt.title("TARDIS example model spectrum") | ||
plt.xlabel("Wavelength [$\AA$]") | ||
plt.ylabel("Luminosity density [erg/s/$\AA$]") | ||
plt.legend() | ||
plt.show() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Year 2020 Results | ||
================== | ||
|
||
Output of configuartion files uploaded in the year 2020. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
""" | ||
Williamson et al. (2020) Figure 2 t_explosion=16 days | ||
========================== | ||
|
||
|
||
Article: Williamson, Marc, Kerzendorf, Wolfgang, Modjaz, Maryam 2021, ApJ, | ||
“Modeling Type Ic Supernovae with TARDIS: Hidden Helium in SN 1994I?” (`ADS Link`_). | ||
|
||
Original Input Files: `YAML`_, `CSVY`_ | ||
|
||
Original Dataset: Data missing | ||
|
||
Original Spectra: | ||
|
||
Notes: Please note that the spectra obtained below is obtained by using a slightly | ||
modified configuration file. This is done to ensure that the spectra can be | ||
obtained using the computers hosted by us. | ||
|
||
.. _ADS Link: https://ui.adsabs.harvard.edu/abs/2021ApJ...908..150W | ||
.. _YAML: https://github.com/tardis-sn/tardis-setups/blob/master/2020/2020_williamson_94I/code_comp_setups/16d.yml | ||
.. _CSVY: https://github.com/tardis-sn/tardis-setups/blob/master/2020/2020_williamson_94I/code_comp_setups/hach_exact_csvy_16d.csvy | ||
""" | ||
|
||
|
||
from tardis import run_tardis | ||
from tardis.io.config_reader import Configuration | ||
from tardis.io.atom_data.util import download_atom_data | ||
import matplotlib.pyplot as plt | ||
|
||
import sys | ||
|
||
sys.path.append("../") | ||
from setup_utils import config_modifier | ||
|
||
# %% | ||
# Comment this line if you do not need to download the dataset. | ||
|
||
|
||
download_atom_data("kurucz_cd23_chianti_H_He") | ||
|
||
# %% | ||
conf = Configuration.from_yaml( | ||
"../../2020/2020_williamson_94I/code_comp_setups/16d.yml" | ||
) | ||
|
||
# %% | ||
# Note: Here the configuration is slightly modified to allow | ||
# the configuration file on a computer with lower configuration. | ||
|
||
conf = config_modifier(conf) | ||
# %% | ||
sim = run_tardis(conf) | ||
|
||
|
||
spectrum = sim.runner.spectrum | ||
spectrum_virtual = sim.runner.spectrum_virtual | ||
spectrum_integrated = sim.runner.spectrum_integrated | ||
|
||
plt.figure(figsize=(10, 6.5)) | ||
|
||
spectrum.plot(label="Normal packets") | ||
spectrum_virtual.plot(label="Virtual packets") | ||
spectrum_integrated.plot(label="Formal integral") | ||
|
||
plt.xlim(500, 9000) | ||
plt.title("TARDIS example model spectrum") | ||
plt.xlabel("Wavelength [$\AA$]") | ||
plt.ylabel("Luminosity density [erg/s/$\AA$]") | ||
plt.legend() | ||
plt.show() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We try to not pickle objects in TARDIS.