diff --git a/docs/atomic/atomic_data.rst b/docs/atomic/atomic_data.rst index 8ac87a7aa72..9abc035ccbc 100644 --- a/docs/atomic/atomic_data.rst +++ b/docs/atomic/atomic_data.rst @@ -1,9 +1,11 @@ .. _atomic-data-download: -********************** -Atomic Data for TARDIS -********************** +*********** +Atomic Data +*********** + +The Atom Database for TARDIS is generated by the Carsus package. .. toctree:: atomic_data_description - current_public_table.rst + current_public_table diff --git a/docs/conf.py b/docs/conf.py index 6a38332ed07..a601b0006b8 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -36,7 +36,6 @@ 'astropy': ('http://docs.astropy.org/en/stable/', None), 'h5py': ('http://docs.h5py.org/en/latest/', None), 'pandas': ('http://pandas.pydata.org/pandas-docs/dev/', None), - 'astropy': ('http://docs.astropy.org/en/stable/', None) } # import sphinx_bootstrap_theme @@ -48,11 +47,12 @@ 'sphinx.ext.todo', 'sphinx.ext.mathjax', 'sphinx.ext.graphviz', + 'sphinx.ext.viewcode', 'numpydoc', 'nbsphinx', - 'sphinx.ext.autodoc', 'sphinx-jsonschema', - 'recommonmark' + 'recommonmark', + 'sphinxcontrib.apidoc' ] source_suffix = { @@ -78,7 +78,7 @@ templates_path = ['_templates'] # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. -exclude_patterns = ['_build', '_templates'] +exclude_patterns = ['_build', '_templates', '**.ipynb_checkpoints'] #exclude_patterns.append('_templates') # This is added to the end of RST files - a good place to put substitutions to @@ -90,7 +90,7 @@ # This does not *have* to match the package name, but typically does project = u'TARDIS' -author = u'TARDIS team' +author = u'TARDIS collaboration' copyright = u'2013, ' + author master_doc = 'index' @@ -106,6 +106,12 @@ release = tardis.__version__ +# -- APIDoc configuration ----------------------------------------------------- +apidoc_module_dir = '../tardis' +apidoc_output_dir = 'api' +apidoc_excluded_paths = ['*tests*', '*setup_package*'] +apidoc_separate_modules = True + # -- Options for HTML output --------------------------------------------------- # A NOTE ON HTML THEMES diff --git a/docs/configuration/configuration.rst b/docs/configuration/configuration.rst index 77db778ec7c..b6d1b07e7fd 100644 --- a/docs/configuration/configuration.rst +++ b/docs/configuration/configuration.rst @@ -7,8 +7,7 @@ Configuration File TARDIS uses the `YAML markup language `_ for its configuration files. There are several sections which allow different settings for the different aspects of the TARDIS calculation. An example -configuration file (with a small subset of the options that can be specified) can be downloaded :download:`here -<../examples/tardis_example.yml>`. +configuration file (with a small subset of the options that can be specified) can be downloaded at `example_yml`_. .. warning:: One should note that currently floats in YAML need to be specified in a special format: @@ -24,6 +23,10 @@ can be seen here: The following shows all the options (and their default settings) that are available for TARDIS. No other options are allowed or available + +.. contents:: Overview + :local: + Configuration Schema ==================== @@ -159,3 +162,5 @@ just an integer. Finally, the method option selects the final spectral synthesis interaction mode. Note also the limitations listed at the bottom of the dedicated page. + +.. include:: ../running/example_data.inc \ No newline at end of file diff --git a/docs/configuration/index.rst b/docs/configuration/index.rst index 0dfbed67cfb..96a0f931659 100644 --- a/docs/configuration/index.rst +++ b/docs/configuration/index.rst @@ -11,8 +11,8 @@ and pages provide more details concerning the TARDIS configuration process. .. toctree:: - :maxdepth: 3 + :maxdepth: 2 configuration config_validator - read_configuration.ipynb + read_configuration diff --git a/docs/workflow/azure_links.inc b/docs/development/azure_links.inc similarity index 100% rename from docs/workflow/azure_links.inc rename to docs/development/azure_links.inc diff --git a/docs/workflow/continuous_integration.rst b/docs/development/continuous_integration.rst similarity index 100% rename from docs/workflow/continuous_integration.rst rename to docs/development/continuous_integration.rst diff --git a/docs/developer_faq.rst b/docs/development/developer_faq.rst similarity index 100% rename from docs/developer_faq.rst rename to docs/development/developer_faq.rst diff --git a/docs/workflow/git_links.inc b/docs/development/git_links.inc similarity index 100% rename from docs/workflow/git_links.inc rename to docs/development/git_links.inc diff --git a/docs/workflow/git_workflow.rst b/docs/development/git_workflow.rst similarity index 100% rename from docs/workflow/git_workflow.rst rename to docs/development/git_workflow.rst diff --git a/docs/workflow/images/Bootcamp-Fork.png b/docs/development/images/Bootcamp-Fork.png similarity index 100% rename from docs/workflow/images/Bootcamp-Fork.png rename to docs/development/images/Bootcamp-Fork.png diff --git a/docs/workflow/images/branch_dropdown.png b/docs/development/images/branch_dropdown.png similarity index 100% rename from docs/workflow/images/branch_dropdown.png rename to docs/development/images/branch_dropdown.png diff --git a/docs/workflow/images/lock.png b/docs/development/images/lock.png similarity index 100% rename from docs/workflow/images/lock.png rename to docs/development/images/lock.png diff --git a/docs/workflow/images/pull_button.png b/docs/development/images/pull_button.png similarity index 100% rename from docs/workflow/images/pull_button.png rename to docs/development/images/pull_button.png diff --git a/docs/workflow/images/secure_file.png b/docs/development/images/secure_file.png similarity index 100% rename from docs/workflow/images/secure_file.png rename to docs/development/images/secure_file.png diff --git a/docs/workflow/images/variables.png b/docs/development/images/variables.png similarity index 100% rename from docs/workflow/images/variables.png rename to docs/development/images/variables.png diff --git a/docs/workflow/development_workflow.rst b/docs/development/index.rst similarity index 73% rename from docs/workflow/development_workflow.rst rename to docs/development/index.rst index 99693e9e5c7..e4fe42e68e9 100644 --- a/docs/workflow/development_workflow.rst +++ b/docs/development/index.rst @@ -8,20 +8,32 @@ workflow is taken from `Astropy `_ and credit belongs to the Astropy team for designing it. +.. toctree:: + :maxdepth: 2 + + running_tests + issues .. toctree:: + :maxdepth: 2 + :caption: Git and coding workflow git_workflow - release_workflow + .. toctree:: + :maxdepth: 2 + :caption: TARDIS core team instructions + release_workflow update_refdata + continuous_integration + developer_faq + + -.. toctree:: - continuous_integration diff --git a/docs/yml_files/integration.yml b/docs/development/integration.yml similarity index 100% rename from docs/yml_files/integration.yml rename to docs/development/integration.yml diff --git a/docs/issues.rst b/docs/development/issues.rst similarity index 100% rename from docs/issues.rst rename to docs/development/issues.rst diff --git a/docs/workflow/known_projects.inc b/docs/development/known_projects.inc similarity index 100% rename from docs/workflow/known_projects.inc rename to docs/development/known_projects.inc diff --git a/docs/workflow/links.inc b/docs/development/links.inc similarity index 100% rename from docs/workflow/links.inc rename to docs/development/links.inc diff --git a/docs/workflow/release_workflow.rst b/docs/development/release_workflow.rst similarity index 100% rename from docs/workflow/release_workflow.rst rename to docs/development/release_workflow.rst diff --git a/docs/running_tests.rst b/docs/development/running_tests.rst similarity index 97% rename from docs/running_tests.rst rename to docs/development/running_tests.rst index 2a3b5633bc2..8680331da4b 100644 --- a/docs/running_tests.rst +++ b/docs/development/running_tests.rst @@ -52,7 +52,7 @@ or generate new ones. Both of of these require a configuration file for the integration tests: -.. literalinclude:: yml_files/integration.yml +.. literalinclude:: integration.yml :language: yaml Inside the atomic data directory there needs to be atomic data for each of @@ -63,7 +63,7 @@ use very few packets to generate the references and thus make the process much faster - THIS IS ONLY FOR DEBUGGING PURPOSES. The ``-s`` option ensures that TARDIS prints out the progress: -.. code-block:: +.. code-block:: shell > python setup.py test --args="--integration=integration.yml -m integration --generate-reference --less-packets" @@ -71,7 +71,7 @@ TARDIS prints out the progress: To run the test after having run the ``--generate-references`` all that is needed is: -.. code-block:: +.. code-block:: shell > python setup.py test --args="--integration=integration.yml -m integration --less-packets" --remote-data diff --git a/docs/workflow/this_project.inc b/docs/development/this_project.inc similarity index 100% rename from docs/workflow/this_project.inc rename to docs/development/this_project.inc diff --git a/docs/workflow/update_refdata.rst b/docs/development/update_refdata.rst similarity index 100% rename from docs/workflow/update_refdata.rst rename to docs/development/update_refdata.rst diff --git a/docs/index.rst b/docs/index.rst index 262b560e518..d7646934154 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -17,63 +17,87 @@ Tardis Core Package Documentation TARDIS is an open-source Monte Carlo radiative-transfer spectral synthesis code for 1D models of supernova ejecta. It is designed for rapid spectral modelling -of supernovae. It is developed and maintained by a multi-disciplinary team +of supernovae. It is developed and maintained by a :ref:`multi-disciplinary team ` including software engineers, computer scientists, statisticians, and astrophysicists. If you use this code for any publications or presentations please follow our citation guidelines in :ref:`tardiscredits` -User modifications and additions that lead to publications need to be handed -back to the community by incorporating them into TARDIS. +User modifications and additions that lead to publications **need to be handed +back to the community** by incorporating them into TARDIS. Please contact the TARDIS team via the `github page `_ if you have questions or need assistance. -============ -Using Tardis -============ + .. toctree:: :maxdepth: 2 + :hidden: installation - CHANGELOG.md - quickstart + quickstart/quickstart + + + +.. toctree:: + :maxdepth: 3 + :caption: Using TARDIS + :hidden: + + running/index - examples/index - scripts/index - team - credits -====================== -Looking under the hood -====================== .. toctree:: :maxdepth: 2 + :caption: The Physics of TARDIS + :hidden: + + Physics overview + physics/plasma/index + physics/montecarlo/index + + +.. toctree:: + :maxdepth: 2 + :caption: Research with TARDIS + :hidden: + + Overview + + +.. toctree:: + :maxdepth: 2 + :caption: Team & Credits + :hidden: + + team + credits - atomic/atomic_data - physics/index - montecarlo/index +.. toctree:: + :maxdepth: 2 + :caption: Developers Guide + :hidden: -================= -Developing Tardis -================= + development/index + CHANGELOG.md .. toctree:: :maxdepth: 2 + :caption: API + :hidden: + + api/modules - issues - workflow/development_workflow - running_tests -========== -References -========== .. toctree:: + :caption: References + :hidden: + zreferences ==== diff --git a/docs/installation.rst b/docs/installation.rst index 91e1d10406d..58dd31d4e60 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -16,19 +16,19 @@ simple TARDIS calculations. .. warning:: - TARDIS is currently only compatbile with Python 2.7. + TARDIS is only compatbile with Python >3.6 .. note:: - We strongly recommond to install TARDIS within an Anaconda environment and + We strongly recommend to install TARDIS within an Anaconda environment and to always use the lastest github development version. Requirements ============ -You can see a list of all the requirements of TARDIS in the `environment definition file `_. +You can see a list of all the requirements of TARDIS in the `environment definition file `_. -TARDIS is using astropy's excellent installation helpers and thus uses similar -instructions to astropy. +TARDIS is using Astropy's excellent installation helpers and thus uses similar +instructions to Astropy. .. _anaconda_inst_label: @@ -45,13 +45,13 @@ machine. The next step is to create an environment for TARDIS that contains all of the necessary packages (this ensures that TARDIS requirements won't clash with any other python installs on disc:: -First, download the `environment definition file `_ from:: +First, download the `environment definition file `_ from:: - https://raw.githubusercontent.com/tardis-sn/tardis/master/tardis_env27.yml + https://raw.githubusercontent.com/tardis-sn/tardis/master/tardis_env3.yml To create the environment, change to the directory that you downloaded the environment definition file and run:: - conda env create -f tardis_env27.yml + conda env create -f tardis_env3.yml Then to activate this environment simply do:: @@ -68,7 +68,8 @@ and after you are done with TARDIS you can deactivate:: One does not need to recreate the environment, but simply activate it every time TARDIS is used. -Since TARDIS has reached a mature state, we recommend always installing the latest development version:: +Since TARDIS has reached a mature state, we recommend always installing the +latest development version:: pip install git+https://github.com/tardis-sn/tardis @@ -78,6 +79,12 @@ Alternatively, you can manually clone our repository and install TARDIS by cd tardis python setup.py install + +.. _install_openmp: +Enabling parallel execution with OpenMP +--------------------------------------- + + Manually, cloning the repository enables other options such as running the code in parallel (enabling OpenMP). In general we encourage to download the compilers from `conda` as we then can ensure that they work with TARDIS. Within the TARDIS conda environment do:: @@ -92,13 +99,12 @@ For Linux:: conda install -c conda-forge openmp -To compile TARDIS for parallel execution: +To compile TARDIS for parallel execution:: python setup.py install --with-openmp .. _troubleshooting_inst_label: - Installation Troubles (FAQ) =========================== diff --git a/docs/notebooks/csvy_test.ipynb b/docs/models/csy/csvy_test.ipynb similarity index 100% rename from docs/notebooks/csvy_test.ipynb rename to docs/models/csy/csvy_test.ipynb diff --git a/docs/examples/.ipynb_checkpoints/Custom_Density_And_Boundary_Velocities-checkpoint.ipynb b/docs/models/examples/.ipynb_checkpoints/Custom_Density_And_Boundary_Velocities-checkpoint.ipynb similarity index 100% rename from docs/examples/.ipynb_checkpoints/Custom_Density_And_Boundary_Velocities-checkpoint.ipynb rename to docs/models/examples/.ipynb_checkpoints/Custom_Density_And_Boundary_Velocities-checkpoint.ipynb diff --git a/docs/examples/Custom_Density_And_Boundary_Velocities.ipynb b/docs/models/examples/Custom_Density_And_Boundary_Velocities.ipynb similarity index 100% rename from docs/examples/Custom_Density_And_Boundary_Velocities.ipynb rename to docs/models/examples/Custom_Density_And_Boundary_Velocities.ipynb diff --git a/docs/examples/abund.dat b/docs/models/examples/abund.dat similarity index 100% rename from docs/examples/abund.dat rename to docs/models/examples/abund.dat diff --git a/docs/examples/abundancecust.rst b/docs/models/examples/abundancecust.rst similarity index 99% rename from docs/examples/abundancecust.rst rename to docs/models/examples/abundancecust.rst index 12d6c5769a9..0cdfbb6a1e3 100644 --- a/docs/examples/abundancecust.rst +++ b/docs/models/examples/abundancecust.rst @@ -1,3 +1,5 @@ +.. _abundancecust: + ************************************* Using a custom stratified composition ************************************* diff --git a/docs/examples/abundanceuni.rst b/docs/models/examples/abundanceuni.rst similarity index 100% rename from docs/examples/abundanceuni.rst rename to docs/models/examples/abundanceuni.rst diff --git a/docs/models/examples/csvy_full_rad.csvy b/docs/models/examples/csvy_full_rad.csvy new file mode 100644 index 00000000000..f8f527c1b22 --- /dev/null +++ b/docs/models/examples/csvy_full_rad.csvy @@ -0,0 +1,30 @@ +--- +name: csvy_full +model_density_time_0: 1 day +description: Example csvy config file for TARDIS. +tardis_model_config_version: v1.0 +datatype: + fields: + - name: velocity + unit: km/s + desc: velocities of shell outer bounderies. + - name: density + unit: g/cm^3 + desc: density of shell. + - name: t_rad + unit: K + desc: radiative temperature. + - name: H + desc: fractional H abundance + - name: He + desc: fractional He abundance + - name: Ni56 + desc: fractional Ni56 abundance + +v_inner_boundary: 9000 km/s +v_outer_boundary: 12000 km/s +--- +velocity,density,t_rad,H,He,Ni56 +9000, 5e-10, 7000, 1.0, 1.0, 1.0 +10500, 2.0e-10, 7000, 0.0, 0.99, 0.01 +12000, 9e-11, 7000, 0.4, 0.58, 0.02 diff --git a/docs/examples/density.dat b/docs/models/examples/density.dat similarity index 100% rename from docs/examples/density.dat rename to docs/models/examples/density.dat diff --git a/docs/examples/densitycust.rst b/docs/models/examples/densitycust.rst similarity index 99% rename from docs/examples/densitycust.rst rename to docs/models/examples/densitycust.rst index e18c754367b..417e7de7c5c 100644 --- a/docs/examples/densitycust.rst +++ b/docs/models/examples/densitycust.rst @@ -1,3 +1,5 @@ +.. _densitycust: + ****************************** Using a custom density profile ****************************** diff --git a/docs/examples/densityexp.rst b/docs/models/examples/densityexp.rst similarity index 100% rename from docs/examples/densityexp.rst rename to docs/models/examples/densityexp.rst diff --git a/docs/examples/densitypow.rst b/docs/models/examples/densitypow.rst similarity index 100% rename from docs/examples/densitypow.rst rename to docs/models/examples/densitypow.rst diff --git a/docs/examples/examples.rst b/docs/models/examples/examples.rst similarity index 100% rename from docs/examples/examples.rst rename to docs/models/examples/examples.rst diff --git a/docs/examples/index.rst b/docs/models/examples/index.rst similarity index 97% rename from docs/examples/index.rst rename to docs/models/examples/index.rst index bcf9b7673c6..9feb2709537 100644 --- a/docs/examples/index.rst +++ b/docs/models/examples/index.rst @@ -13,7 +13,7 @@ applications. modelconfig tardis_example - stella_to_tardis + Simple Parametrized Models ========================== diff --git a/docs/examples/modelconfig.rst b/docs/models/examples/modelconfig.rst similarity index 97% rename from docs/examples/modelconfig.rst rename to docs/models/examples/modelconfig.rst index 649504f583c..d838df5499b 100644 --- a/docs/examples/modelconfig.rst +++ b/docs/models/examples/modelconfig.rst @@ -1,3 +1,5 @@ +.. _modelconfig: + ************************** Ejecta Model Configuration ************************** diff --git a/docs/examples/run_simple_example.ipynb b/docs/models/examples/run_simple_example.ipynb similarity index 100% rename from docs/examples/run_simple_example.ipynb rename to docs/models/examples/run_simple_example.ipynb diff --git a/docs/examples/tardis_configv1_abundance_cust_example.yml b/docs/models/examples/tardis_configv1_abundance_cust_example.yml similarity index 100% rename from docs/examples/tardis_configv1_abundance_cust_example.yml rename to docs/models/examples/tardis_configv1_abundance_cust_example.yml diff --git a/docs/examples/tardis_configv1_abundance_uniform_example.yml b/docs/models/examples/tardis_configv1_abundance_uniform_example.yml similarity index 100% rename from docs/examples/tardis_configv1_abundance_uniform_example.yml rename to docs/models/examples/tardis_configv1_abundance_uniform_example.yml diff --git a/docs/examples/tardis_configv1_density_cust_example.yml b/docs/models/examples/tardis_configv1_density_cust_example.yml similarity index 100% rename from docs/examples/tardis_configv1_density_cust_example.yml rename to docs/models/examples/tardis_configv1_density_cust_example.yml diff --git a/docs/examples/tardis_configv1_density_exponential_example.yml b/docs/models/examples/tardis_configv1_density_exponential_example.yml similarity index 100% rename from docs/examples/tardis_configv1_density_exponential_example.yml rename to docs/models/examples/tardis_configv1_density_exponential_example.yml diff --git a/docs/examples/tardis_configv1_density_power_law_example.yml b/docs/models/examples/tardis_configv1_density_power_law_example.yml similarity index 100% rename from docs/examples/tardis_configv1_density_power_law_example.yml rename to docs/models/examples/tardis_configv1_density_power_law_example.yml diff --git a/docs/examples/tardis_configv1_isotope_abundance_cust_example.yml b/docs/models/examples/tardis_configv1_isotope_abundance_cust_example.yml similarity index 100% rename from docs/examples/tardis_configv1_isotope_abundance_cust_example.yml rename to docs/models/examples/tardis_configv1_isotope_abundance_cust_example.yml diff --git a/docs/examples/tardis_example.rst b/docs/models/examples/tardis_example.rst similarity index 100% rename from docs/examples/tardis_example.rst rename to docs/models/examples/tardis_example.rst diff --git a/docs/examples/tardis_example.yml b/docs/models/examples/tardis_example.yml similarity index 100% rename from docs/examples/tardis_example.yml rename to docs/models/examples/tardis_example.yml diff --git a/docs/examples/tardis_model_abund.csv b/docs/models/examples/tardis_model_abund.csv similarity index 100% rename from docs/examples/tardis_model_abund.csv rename to docs/models/examples/tardis_model_abund.csv diff --git a/docs/examples/test_abund.dat b/docs/models/examples/test_abund.dat similarity index 100% rename from docs/examples/test_abund.dat rename to docs/models/examples/test_abund.dat diff --git a/docs/examples/test_density.txt b/docs/models/examples/test_density.txt similarity index 100% rename from docs/examples/test_density.txt rename to docs/models/examples/test_density.txt diff --git a/docs/models/index.rst b/docs/models/index.rst new file mode 100644 index 00000000000..b0bb864dabb --- /dev/null +++ b/docs/models/index.rst @@ -0,0 +1,55 @@ +***** +Model +***** + +TARDIS requires a model of the homologously expanding ejecta in order to run a simulation. +A model will include information like the velocity shell structure, abundances, density, etc. +TARDIS offers two ways of specifying the model: either directly in the configuration yaml file +or separately in a model.csvy file. See `here `_ for an explanation of +the csvy file format and :ref:`here <../running/configuration/config-file>` for a link to the csvy_model schema. + +.. note:: + We highly recommend using the cleaner csvy format. + +CSVY Model +========== + +The TARDIS YAML delimiter for csvy files is ``---``. This means that each csvy model +file has the following structure: The first line of the file is the YAML delimiter, +followed by the YAML portion of the csvy model. A line consisting of only the YAML +delimiter separates the YAML portion of the csvy file from the csv part. The YAML part +of the csvy file is for setting model parameters like **v_inner_boundary** or +**model_density_time_0** while the csv part of the file is for setting profiles of +physical parameters of the model (e.g. abundances, radiative temperature, dilution factor, etc). +If you use the csvy model, then you will need to specify the path to the csvy model file +in the main TARDIS configuration file: + +.. code-block:: + + csvy_model: /path/to/model.csvy + +Example CSVY Model +================== + +Below we provide an example model.csvy file. + +.. literalinclude:: examples/csvy_full_rad.csvy + +Using the Config Model +====================== + +Although we strongly recommend using the CSVY Model, TARDIS also allows the user +to define custom density and abundance profiles in separate files and reference +these files directly in the main TARDIS configuration file. For further details, +see the following links: + +.. toctree:: + :maxdepth: 1 + + examples/modelconfig + examples/densityexp + examples/densitypow + examples/densitycust + examples/abundanceuni + examples/abundancecust + diff --git a/docs/news.rst b/docs/news.rst index 4ded50877ff..a9773400a91 100644 --- a/docs/news.rst +++ b/docs/news.rst @@ -1,3 +1,5 @@ + + GSOC 2017 --------- diff --git a/docs/physics/index.rst b/docs/physics/index.rst index 0a4697f2472..ce7f8b15dbe 100644 --- a/docs/physics/index.rst +++ b/docs/physics/index.rst @@ -1,6 +1,6 @@ -************************************ -Behind the scenes: Physics of TARDIS -************************************ +***************** +Physics of TARDIS +***************** .. warning:: @@ -23,10 +23,11 @@ Currently some information are available for .. toctree:: new_plasma + montecarlo/index Old Physics Section of the TARDIS Docu (Outdated) -====================================== +================================================= .. note:: The following entries reflects the physics section of the old TARDIS @@ -37,7 +38,6 @@ Old Physics Section of the TARDIS Docu (Outdated) .. toctree:: physical_quantities - montecarlo - new_plasma + montecarlo_old plasma/index diff --git a/docs/montecarlo/basicprinciples.rst b/docs/physics/montecarlo/basicprinciples.rst similarity index 100% rename from docs/montecarlo/basicprinciples.rst rename to docs/physics/montecarlo/basicprinciples.rst diff --git a/docs/montecarlo/discretization.rst b/docs/physics/montecarlo/discretization.rst similarity index 100% rename from docs/montecarlo/discretization.rst rename to docs/physics/montecarlo/discretization.rst diff --git a/docs/montecarlo/estimators.rst b/docs/physics/montecarlo/estimators.rst similarity index 100% rename from docs/montecarlo/estimators.rst rename to docs/physics/montecarlo/estimators.rst diff --git a/docs/graphics/optical_depth_summation.png b/docs/physics/montecarlo/images/optical_depth_summation.png similarity index 100% rename from docs/graphics/optical_depth_summation.png rename to docs/physics/montecarlo/images/optical_depth_summation.png diff --git a/docs/graphics/scatter_downbranch_ma.png b/docs/physics/montecarlo/images/scatter_downbranch_ma.png similarity index 100% rename from docs/graphics/scatter_downbranch_ma.png rename to docs/physics/montecarlo/images/scatter_downbranch_ma.png diff --git a/docs/graphics/spherical_symmetry.png b/docs/physics/montecarlo/images/spherical_symmetry.png similarity index 100% rename from docs/graphics/spherical_symmetry.png rename to docs/physics/montecarlo/images/spherical_symmetry.png diff --git a/docs/montecarlo/index.rst b/docs/physics/montecarlo/index.rst similarity index 100% rename from docs/montecarlo/index.rst rename to docs/physics/montecarlo/index.rst diff --git a/docs/montecarlo/lineinteraction.rst b/docs/physics/montecarlo/lineinteraction.rst similarity index 99% rename from docs/montecarlo/lineinteraction.rst rename to docs/physics/montecarlo/lineinteraction.rst index 8df4319efce..3d3be867e81 100644 --- a/docs/montecarlo/lineinteraction.rst +++ b/docs/physics/montecarlo/lineinteraction.rst @@ -94,5 +94,5 @@ shows the situation in the resonant scatter mode, the middle one for the downbranching scheme and the right one the macro atom results. .. image:: - ../graphics/scatter_downbranch_ma.png + images/scatter_downbranch_ma.png :width: 700 diff --git a/docs/montecarlo/propagation.rst b/docs/physics/montecarlo/propagation.rst similarity index 99% rename from docs/montecarlo/propagation.rst rename to docs/physics/montecarlo/propagation.rst index 8ea6bd635aa..1a5b98f7989 100644 --- a/docs/montecarlo/propagation.rst +++ b/docs/physics/montecarlo/propagation.rst @@ -58,7 +58,7 @@ following sketch (taken from :cite:`Noebauer2014`): .. image:: - ../graphics/spherical_symmetry.png + images/spherical_symmetry.png :width: 400 @@ -182,7 +182,7 @@ the sketch below (taken from :cite:`Noebauer2014`, adapted from :cite:`Mazzali1993`): .. image:: - ../graphics/optical_depth_summation.png + images/optical_depth_summation.png :width: 400 Three possible cases are highlighted. In the first case, the drawn optical diff --git a/docs/montecarlo/randomsampling.rst b/docs/physics/montecarlo/randomsampling.rst similarity index 100% rename from docs/montecarlo/randomsampling.rst rename to docs/physics/montecarlo/randomsampling.rst diff --git a/docs/montecarlo/sourceintegration.rst b/docs/physics/montecarlo/sourceintegration.rst similarity index 98% rename from docs/montecarlo/sourceintegration.rst rename to docs/physics/montecarlo/sourceintegration.rst index ba151a01641..f5b4d9b3f3a 100644 --- a/docs/montecarlo/sourceintegration.rst +++ b/docs/physics/montecarlo/sourceintegration.rst @@ -1,6 +1,8 @@ -******************************** +.. _source_integration: + +***************************************** Direct integration of the radiation field -******************************** +***************************************** :cite:`Lucy1999a` describes an alternative method for the generation of synthetic supernova spectra. Instead of using the frequency and energy of diff --git a/docs/montecarlo/virtualpackets.rst b/docs/physics/montecarlo/virtualpackets.rst similarity index 99% rename from docs/montecarlo/virtualpackets.rst rename to docs/physics/montecarlo/virtualpackets.rst index 20b4adb2dc6..1b1f7fce41b 100644 --- a/docs/montecarlo/virtualpackets.rst +++ b/docs/physics/montecarlo/virtualpackets.rst @@ -1,3 +1,5 @@ +.. _virtual_packets: + **************************************** Spectrum Generation with Virtual Packets **************************************** diff --git a/docs/physics/montecarlo.rst b/docs/physics/montecarlo_old.rst similarity index 100% rename from docs/physics/montecarlo.rst rename to docs/physics/montecarlo_old.rst diff --git a/docs/physics/plasma/plasma.rst b/docs/physics/plasma/plasma.rst index c7a839c9776..9d2379016ac 100644 --- a/docs/physics/plasma/plasma.rst +++ b/docs/physics/plasma/plasma.rst @@ -55,19 +55,13 @@ Here's an example how to instantiate a simple base plasma:: 28 0.5 513016973.936 26 0.5 539183641.472 - - - - - - Plasma Types ------------ .. toctree:: :maxdepth: 0 - plasma_doc/lte_plasma.rst - plasma_doc/nebular_plasma.rst + lte_plasma.rst + nebular_plasma.rst .. _tau_sobolev: @@ -90,10 +84,12 @@ This function calculates the Sobolev optical depth :math:`\tau_\textrm{Sobolev}` +.. toctree:: + :maxdepth: 1 -.. include:: plasma_doc/macroatom.rst -.. include:: plasma_doc/nlte.rst + macroatom.rst + nlte.rst -.. automodapi:: tardis.plasma_array +.. .. automodapi:: tardis.plasma_array diff --git a/docs/quickstart.rst b/docs/quickstart.rst deleted file mode 100644 index fb9e0177b0b..00000000000 --- a/docs/quickstart.rst +++ /dev/null @@ -1,108 +0,0 @@ -.. _running: - -**************** -Quickstart Guide -**************** - -To run TARDIS requires two files. The atomic database (for more info refer to -:ref:`atomic-data-download`) and a configuration file (more info at -:ref:`config-file`). You can obtain a copy of the atomic database from the -`tardis-refdata `_ repository -(``atom_data`` subfolder). We recommended to use the -``kurucz_cd23_chianti_H_He.h5`` dataset. - - -Running TARDIS interactively in a Jupyter notebook (recommended) -================================================================ - -To get more information from each run of TARDIS one can run it interactively and -have full access to the model properties (as described in :ref:`physical_quantities`) - -.. toctree:: - :maxdepth: 1 - - examples/run_simple_example.ipynb - - -Running TARDIS in the commandline -================================= - -After installing TARDIS just download the configuration file from the -`tardis-setups `_ and the standard -atomic data set from the `tardis-refdata -`_ repository and run TARDIS. -Assuming you have ``wget``, you could follow the procedure: - - -.. code-block:: none - - mkdir tardis_example - cd tardis_example - wget https://raw.githubusercontent.com/tardis-sn/tardis-setups/master/2014/2014_kerzendorf_sim/appendix_A1/tardis_example.yml - wget https://github.com/tardis-sn/tardis-refdata/raw/master/atom_data/kurucz_cd23_chianti_H_He.h5 - tardis tardis_example.yml output_spectrum.dat - - -Then plot the output_spectrum.dat with your favourite plotting program. Here's an example how to do this with python. -(The only thing you need to install is ipython and matplotlib - in addition to TARDIS's requirements) - -.. code-block:: python - - ipython --pylab - >>> tardis_spec = loadtxt('output_spectrum.dat') - >>> plot(tardis_spec[:,0], tardis_spec[:,1]) - -More atomic datasets can be downloaded from :ref:`atomic-data-download`. - - -Graphical User Interface -======================== - -To get a detailed explanation on gui layout go to :ref:`gui_explanation` . - -**To setup and run the GUI(under development) follow these steps:** - -The gui can use one of two python bindings for qt, namely PyQt4 -and PySide. You can choose which binding is used by setting the -environment variable QT_API in your bash. - -**1**. Installing required packages - -.. code-block:: none - - source activate tardis - conda install ipython=3.0.0 pyside=1.2.1 shiboken=1.2.1 - - -**2**. Choosing between PySide and PyQt4 - -.. code-block:: none - - #To choose PySide - export QT_API=pyside - - #To choose PyQt - export QT_API=pyqt - -**3**. An example of creating a model and GUI - -To show the gui from the ipython shell use the following commands. - -.. code-block:: none - - ipython --pylab=qt4 - -.. code-block:: python - - >>> from tardis import run_tardis - >>> mdl = run_tardis('yamlconfigfile.yml', 'atomdatafile.h5') - >>> from tardis.gui import interface - >>> interface.show(mdl) - -If you just want to run from a configuration file and show the results, you can -do that outside the ipython shell.To do this navigate to the folder where you -installed tardis and go to tardis/tardis/gui, and use the following command. - -.. code-block:: none - - python interface.py path-to-yaml-configuration-file path-to-atomic-data-file diff --git a/docs/quickstart/quickstart.ipynb b/docs/quickstart/quickstart.ipynb new file mode 100644 index 00000000000..66464209843 --- /dev/null +++ b/docs/quickstart/quickstart.ipynb @@ -0,0 +1,1242 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Quickstart ###" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "After the [installation](../installation.rst) start a jupyter server executing `jupyter notebook` on the commandline in a directory that contains the configuration file (in our example `tardis_example.yml`). The atomic database (for more info refer to [atomic data](../atomic/atomic_data.rst) ) and a configuration file (more info at [configuration](../running/configuration/configuration.rst) ). You can obtain a copy of the atomic database from the\n", + "(https://github.com/tardis-sn/tardis-refdata) repository\n", + "(`atom_data` subfolder). We recommended to use the\n", + "`kurucz_cd23_chianti_H_He.h5` dataset (which is auto-downloaded in the second cell already)." + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/Users/wkerzend/miniconda/envs/tardis3/lib/python3.6/site-packages/tqdm/autonotebook/__init__.py:14: TqdmExperimentalWarning: Using `tqdm.autonotebook.tqdm` in notebook mode. Use `tqdm.tqdm` instead to force console mode (e.g. in jupyter console)\n", + " \" (e.g. in jupyter console)\", TqdmExperimentalWarning)\n" + ] + } + ], + "source": [ + "from tardis import run_tardis\n", + "from tardis.io.atom_data.util import download_atom_data" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Downloading the atomic data ####" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[\u001b[1mtardis.io.atom_data.atom_web_download\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Downloading atomic data from https://media.githubusercontent.com/media/tardis-sn/tardis-refdata/master/atom_data/kurucz_cd23_chianti_H_He.h5 to /Users/wkerzend/projects/tardis/tardis-data/kurucz_cd23_chianti_H_He.h5 (\u001b[1matom_web_download.py\u001b[0m:37)\n" + ] + } + ], + "source": [ + "# the data is automatically downloaded\n", + "download_atom_data('kurucz_cd23_chianti_H_He')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Running the simulation (long output) ####" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[\u001b[1mpy.warnings \u001b[0m][\u001b[1;33mWARNING\u001b[0m] /Users/wkerzend/miniconda/envs/tardis3/lib/python3.6/importlib/_bootstrap.py:219: QAWarning: pyne.data is not yet QA compliant.\n", + " return f(*args, **kwds)\n", + " (\u001b[1mwarnings.py\u001b[0m:99)\n", + "[\u001b[1mpy.warnings \u001b[0m][\u001b[1;33mWARNING\u001b[0m] /Users/wkerzend/miniconda/envs/tardis3/lib/python3.6/importlib/_bootstrap.py:219: QAWarning: pyne.material is not yet QA compliant.\n", + " return f(*args, **kwds)\n", + " (\u001b[1mwarnings.py\u001b[0m:99)\n", + "[\u001b[1mpy.warnings \u001b[0m][\u001b[1;33mWARNING\u001b[0m] /Users/wkerzend/miniconda/envs/tardis3/lib/python3.6/site-packages/astropy/units/quantity.py:1067: AstropyDeprecationWarning: The truth value of a Quantity is ambiguous. In the future this will raise a ValueError.\n", + " AstropyDeprecationWarning)\n", + " (\u001b[1mwarnings.py\u001b[0m:99)\n", + "[\u001b[1mtardis.plasma.standard_plasmas\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Reading Atomic Data from kurucz_cd23_chianti_H_He.h5 (\u001b[1mstandard_plasmas.py\u001b[0m:74)\n", + "[\u001b[1mtardis.io.atom_data.util\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Atom Data kurucz_cd23_chianti_H_He.h5 not found in local path. Exists in TARDIS Data repo /Users/wkerzend/projects/tardis/tardis-data/kurucz_cd23_chianti_H_He.h5 (\u001b[1mutil.py\u001b[0m:29)\n", + "[\u001b[1mpy.warnings \u001b[0m][\u001b[1;33mWARNING\u001b[0m] /Users/wkerzend/miniconda/envs/tardis3/lib/python3.6/site-packages/IPython/core/interactiveshell.py:3267: PerformanceWarning: indexing past lexsort depth may impact performance.\n", + " exec(code_obj, self.user_global_ns, self.user_ns)\n", + " (\u001b[1mwarnings.py\u001b[0m:99)\n", + "[\u001b[1mtardis.io.atom_data.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Read Atom Data with UUID=6f7b09e887a311e7a06b246e96350010 and MD5=864f1753714343c41f99cb065710cace. (\u001b[1mbase.py\u001b[0m:184)\n", + "[\u001b[1mtardis.io.atom_data.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Non provided atomic data: synpp_refs, photoionization_data (\u001b[1mbase.py\u001b[0m:187)\n", + "[\u001b[1mpy.warnings \u001b[0m][\u001b[1;33mWARNING\u001b[0m] /Users/wkerzend/miniconda/envs/tardis3/lib/python3.6/site-packages/astropy/units/quantity.py:1067: AstropyDeprecationWarning: The truth value of a Quantity is ambiguous. In the future this will raise a ValueError.\n", + " AstropyDeprecationWarning)\n", + " (\u001b[1mwarnings.py\u001b[0m:99)\n", + "[\u001b[1mpy.warnings \u001b[0m][\u001b[1;33mWARNING\u001b[0m] /Users/wkerzend/python/tardis/tardis/plasma/properties/ion_population.py:63: FutureWarning: \n", + "Passing list-likes to .loc or [] with any missing label will raise\n", + "KeyError in the future, you can use .reindex() as an alternative.\n", + "\n", + "See the documentation here:\n", + "https://pandas.pydata.org/pandas-docs/stable/indexing.html#deprecate-loc-reindex-listlike\n", + " partition_function.index].dropna())\n", + " (\u001b[1mwarnings.py\u001b[0m:99)\n", + "[\u001b[1mpy.warnings \u001b[0m][\u001b[1;33mWARNING\u001b[0m] /Users/wkerzend/miniconda/envs/tardis3/lib/python3.6/site-packages/astropy/units/equivalencies.py:90: RuntimeWarning: divide by zero encountered in double_scalars\n", + " (si.m, si.Hz, lambda x: _si.c.value / x),\n", + " (\u001b[1mwarnings.py\u001b[0m:99)\n", + "[\u001b[1mpy.warnings \u001b[0m][\u001b[1;33mWARNING\u001b[0m] /Users/wkerzend/miniconda/envs/tardis3/lib/python3.6/site-packages/astropy/units/quantity.py:1067: AstropyDeprecationWarning: The truth value of a Quantity is ambiguous. In the future this will raise a ValueError.\n", + " AstropyDeprecationWarning)\n", + " (\u001b[1mwarnings.py\u001b[0m:99)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Starting iteration 1/20 (\u001b[1mbase.py\u001b[0m:266)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Luminosity emitted = 7.96915e+42 erg / s Luminosity absorbed = 2.63370e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (\u001b[1mbase.py\u001b[0m:357)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Plasma stratification:\n", + "\t t_rad next_t_rad w next_w\n", + "\tShell \n", + "\t0 9926.501965 10171.209103 0.400392 0.500372\n", + "\t5 9852.611678 10306.111379 0.211205 0.191331\n", + "\t10 9779.813302 10174.379204 0.142695 0.116864\n", + "\t15 9708.082813 9910.442275 0.104556 0.085962\n", + "\n", + " (\u001b[1mbase.py\u001b[0m:348)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] t_inner 9933.952 K -- next t_inner 11453.040 K (\u001b[1mbase.py\u001b[0m:350)\n", + "[\u001b[1mpy.warnings \u001b[0m][\u001b[1;33mWARNING\u001b[0m] /Users/wkerzend/python/tardis/tardis/plasma/properties/ion_population.py:63: FutureWarning: \n", + "Passing list-likes to .loc or [] with any missing label will raise\n", + "KeyError in the future, you can use .reindex() as an alternative.\n", + "\n", + "See the documentation here:\n", + "https://pandas.pydata.org/pandas-docs/stable/indexing.html#deprecate-loc-reindex-listlike\n", + " partition_function.index].dropna())\n", + " (\u001b[1mwarnings.py\u001b[0m:99)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Starting iteration 2/20 (\u001b[1mbase.py\u001b[0m:266)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Luminosity emitted = 1.40398e+43 erg / s Luminosity absorbed = 4.68639e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (\u001b[1mbase.py\u001b[0m:357)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Plasma stratification:\n", + "\t t_rad next_t_rad w next_w\n", + "\tShell \n", + "\t0 10171.209103 11518.516702 0.500372 0.538298\n", + "\t5 10306.111379 11554.412119 0.191331 0.217946\n", + "\t10 10174.379204 11373.574056 0.116864 0.132935\n", + "\t15 9910.442275 11040.788763 0.085962 0.099700\n", + "\n", + " (\u001b[1mbase.py\u001b[0m:348)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] t_inner 11453.040 K -- next t_inner 9948.201 K (\u001b[1mbase.py\u001b[0m:350)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Starting iteration 3/20 (\u001b[1mbase.py\u001b[0m:266)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Luminosity emitted = 8.16814e+42 erg / s Luminosity absorbed = 2.50161e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (\u001b[1mbase.py\u001b[0m:357)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Plasma stratification:\n", + "\t t_rad next_t_rad w next_w\n", + "\tShell \n", + "\t0 11518.516702 10501.129902 0.538298 0.438591\n", + "\t5 11554.412119 10869.940791 0.217946 0.160809\n", + "\t10 11373.574056 10558.269547 0.132935 0.103807\n", + "\t15 11040.788763 10185.648701 0.099700 0.079165\n", + "\n", + " (\u001b[1mbase.py\u001b[0m:348)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] t_inner 9948.201 K -- next t_inner 11328.896 K (\u001b[1mbase.py\u001b[0m:350)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Starting iteration 4/20 (\u001b[1mbase.py\u001b[0m:266)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Luminosity emitted = 1.34487e+43 erg / s Luminosity absorbed = 4.47931e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (\u001b[1mbase.py\u001b[0m:357)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Plasma stratification:\n", + "\t t_rad next_t_rad w next_w\n", + "\tShell \n", + "\t0 10501.129902 11527.008679 0.438591 0.512509\n", + "\t5 10869.940791 11706.138980 0.160809 0.196458\n", + "\t10 10558.269547 11444.208532 0.103807 0.124092\n", + "\t15 10185.648701 11085.857161 0.079165 0.093694\n", + "\n", + " (\u001b[1mbase.py\u001b[0m:348)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] t_inner 11328.896 K -- next t_inner 10054.300 K (\u001b[1mbase.py\u001b[0m:350)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Starting iteration 5/20 (\u001b[1mbase.py\u001b[0m:266)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Luminosity emitted = 8.44348e+42 erg / s Luminosity absorbed = 2.68000e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (\u001b[1mbase.py\u001b[0m:357)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Plasma stratification:\n", + "\t t_rad next_t_rad w next_w\n", + "\tShell \n", + "\t0 11527.008679 10659.382763 0.512509 0.433573\n", + "\t5 11706.138980 11038.244897 0.196458 0.158494\n", + "\t10 11444.208532 10790.696726 0.124092 0.099660\n", + "\t15 11085.857161 10450.666394 0.093694 0.074550\n", + "\n", + " (\u001b[1mbase.py\u001b[0m:348)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] t_inner 10054.300 K -- next t_inner 11261.489 K (\u001b[1mbase.py\u001b[0m:350)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Starting iteration 6/20 (\u001b[1mbase.py\u001b[0m:266)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Luminosity emitted = 1.32492e+43 erg / s Luminosity absorbed = 4.26229e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (\u001b[1mbase.py\u001b[0m:357)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Plasma stratification:\n", + "\t t_rad next_t_rad w next_w\n", + "\tShell \n", + "\t0 10659.382763 11507.437689 0.433573 0.499441\n", + "\t5 11038.244897 11634.568776 0.158494 0.197953\n", + "\t10 10790.696726 11418.594559 0.099660 0.124085\n", + "\t15 10450.666394 10999.619473 0.074550 0.094676\n", + "\n", + " (\u001b[1mbase.py\u001b[0m:348)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] t_inner 11261.489 K -- next t_inner 10069.444 K (\u001b[1mbase.py\u001b[0m:350)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Starting iteration 7/20 (\u001b[1mbase.py\u001b[0m:266)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Luminosity emitted = 8.49858e+42 erg / s Luminosity absorbed = 2.69247e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (\u001b[1mbase.py\u001b[0m:357)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Plasma stratification:\n", + "\t t_rad next_t_rad w next_w\n", + "\tShell \n", + "\t0 11507.437689 10679.650246 0.499441 0.431088\n", + "\t5 11634.568776 11048.266431 0.197953 0.157179\n", + "\t10 11418.594559 10825.714870 0.124085 0.098608\n", + "\t15 10999.619473 10506.321595 0.094676 0.073794\n", + "\n", + " (\u001b[1mbase.py\u001b[0m:348)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] t_inner 10069.444 K -- next t_inner 11241.826 K (\u001b[1mbase.py\u001b[0m:350)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Starting iteration 8/20 (\u001b[1mbase.py\u001b[0m:266)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Luminosity emitted = 1.30632e+43 erg / s Luminosity absorbed = 4.31719e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (\u001b[1mbase.py\u001b[0m:357)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Plasma stratification:\n", + "\t t_rad next_t_rad w next_w\n", + "\tShell \n", + "\t0 10679.650246 11459.828312 0.431088 0.506176\n", + "\t5 11048.266431 11688.139012 0.157179 0.193468\n", + "\t10 10825.714870 11441.768967 0.098608 0.122412\n", + "\t15 10506.321595 11099.449886 0.073794 0.090915\n", + "\n", + " (\u001b[1mbase.py\u001b[0m:348)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] t_inner 11241.826 K -- next t_inner 10123.177 K (\u001b[1mbase.py\u001b[0m:350)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Starting iteration 9/20 (\u001b[1mbase.py\u001b[0m:266)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Luminosity emitted = 8.68357e+42 erg / s Luminosity absorbed = 2.75015e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (\u001b[1mbase.py\u001b[0m:357)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Plasma stratification:\n", + "\t t_rad next_t_rad w next_w\n", + "\tShell \n", + "\t0 11459.828312 10666.223660 0.506176 0.445097\n", + "\t5 11688.139012 11000.288585 0.193468 0.163424\n", + "\t10 11441.768967 10822.884326 0.122412 0.101641\n", + "\t15 11099.449886 10384.181273 0.090915 0.078432\n", + "\n", + " (\u001b[1mbase.py\u001b[0m:348)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] t_inner 10123.177 K -- next t_inner 11180.783 K (\u001b[1mbase.py\u001b[0m:350)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Starting iteration 10/20 (\u001b[1mbase.py\u001b[0m:266)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Luminosity emitted = 1.28170e+43 erg / s Luminosity absorbed = 4.19511e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (\u001b[1mbase.py\u001b[0m:357)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Plasma stratification:\n", + "\t t_rad next_t_rad w next_w\n", + "\tShell \n", + "\t0 10666.223660 11427.410445 0.445097 0.500788\n", + "\t5 11000.288585 11612.349822 0.163424 0.193129\n", + "\t10 10822.884326 11373.245169 0.101641 0.121622\n", + "\t15 10384.181273 11047.955461 0.078432 0.090937\n", + "\n", + " (\u001b[1mbase.py\u001b[0m:348)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] t_inner 11180.783 K -- next t_inner 10164.432 K (\u001b[1mbase.py\u001b[0m:350)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Starting iteration 11/20 (\u001b[1mbase.py\u001b[0m:266)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Luminosity emitted = 8.79074e+42 erg / s Luminosity absorbed = 2.82804e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (\u001b[1mbase.py\u001b[0m:357)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Plasma stratification:\n", + "\t t_rad next_t_rad w next_w\n", + "\tShell \n", + "\t0 11427.410445 10741.337822 0.500788 0.439938\n", + "\t5 11612.349822 11230.515356 0.193129 0.153637\n", + "\t10 11373.245169 10870.696315 0.121622 0.101050\n", + "\t15 11047.955461 10538.170159 0.090937 0.074680\n", + "\n", + " (\u001b[1mbase.py\u001b[0m:348)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] t_inner 10164.432 K -- next t_inner 11157.711 K (\u001b[1mbase.py\u001b[0m:350)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Starting iteration 12/20 (\u001b[1mbase.py\u001b[0m:266)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Luminosity emitted = 1.27128e+43 erg / s Luminosity absorbed = 4.15415e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (\u001b[1mbase.py\u001b[0m:357)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Plasma stratification:\n", + "\t t_rad next_t_rad w next_w\n", + "\tShell \n", + "\t0 10741.337822 11507.877578 0.439938 0.483114\n", + "\t5 11230.515356 11808.852053 0.153637 0.181826\n", + "\t10 10870.696315 11557.412757 0.101050 0.113563\n", + "\t15 10538.170159 11117.762050 0.074680 0.087418\n", + "\n", + " (\u001b[1mbase.py\u001b[0m:348)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] t_inner 11157.711 K -- next t_inner 10184.966 K (\u001b[1mbase.py\u001b[0m:350)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Starting iteration 13/20 (\u001b[1mbase.py\u001b[0m:266)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Luminosity emitted = 8.90399e+42 erg / s Luminosity absorbed = 2.80864e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (\u001b[1mbase.py\u001b[0m:357)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Plasma stratification:\n", + "\t t_rad next_t_rad w next_w\n", + "\tShell \n", + "\t0 11507.877578 10727.217531 0.483114 0.443706\n", + "\t5 11808.852053 11171.758889 0.181826 0.160824\n", + "\t10 11557.412757 10971.722637 0.113563 0.098588\n", + "\t15 11117.762050 10574.916600 0.087418 0.075266\n", + "\n", + " (\u001b[1mbase.py\u001b[0m:348)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] t_inner 10184.966 K -- next t_inner 11108.923 K (\u001b[1mbase.py\u001b[0m:350)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Starting iteration 14/20 (\u001b[1mbase.py\u001b[0m:266)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Luminosity emitted = 1.25052e+43 erg / s Luminosity absorbed = 4.07335e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (\u001b[1mbase.py\u001b[0m:357)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Plasma stratification:\n", + "\t t_rad next_t_rad w next_w\n", + "\tShell \n", + "\t0 10727.217531 11413.626870 0.443706 0.489526\n", + "\t5 11171.758889 11697.006992 0.160824 0.184795\n", + "\t10 10971.722637 11424.445844 0.098588 0.116722\n", + "\t15 10574.916600 11047.434163 0.075266 0.088067\n", + "\n", + " (\u001b[1mbase.py\u001b[0m:348)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] t_inner 11108.923 K -- next t_inner 10224.266 K (\u001b[1mbase.py\u001b[0m:350)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Starting iteration 15/20 (\u001b[1mbase.py\u001b[0m:266)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Luminosity emitted = 9.00727e+42 erg / s Luminosity absorbed = 2.88724e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (\u001b[1mbase.py\u001b[0m:357)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Plasma stratification:\n", + "\t t_rad next_t_rad w next_w\n", + "\tShell \n", + "\t0 11413.626870 10712.622749 0.489526 0.455660\n", + "\t5 11697.006992 11125.894032 0.184795 0.164091\n", + "\t10 11424.445844 10816.390451 0.116722 0.104037\n", + "\t15 11047.434163 10421.687097 0.088067 0.080401\n", + "\n", + " (\u001b[1mbase.py\u001b[0m:348)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] t_inner 10224.266 K -- next t_inner 11087.666 K (\u001b[1mbase.py\u001b[0m:350)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Starting iteration 16/20 (\u001b[1mbase.py\u001b[0m:266)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Luminosity emitted = 1.23781e+43 erg / s Luminosity absorbed = 4.07435e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (\u001b[1mbase.py\u001b[0m:357)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Plasma stratification:\n", + "\t t_rad next_t_rad w next_w\n", + "\tShell \n", + "\t0 10712.622749 11352.158138 0.455660 0.500754\n", + "\t5 11125.894032 11644.968350 0.164091 0.185289\n", + "\t10 10816.390451 11320.695930 0.104037 0.119195\n", + "\t15 10421.687097 10965.228363 0.080401 0.089940\n", + "\n", + " (\u001b[1mbase.py\u001b[0m:348)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] t_inner 11087.666 K -- next t_inner 10256.946 K (\u001b[1mbase.py\u001b[0m:350)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Starting iteration 17/20 (\u001b[1mbase.py\u001b[0m:266)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Luminosity emitted = 9.18956e+42 erg / s Luminosity absorbed = 2.86249e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (\u001b[1mbase.py\u001b[0m:357)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Plasma stratification:\n", + "\t t_rad next_t_rad w next_w\n", + "\tShell \n", + "\t0 11352.158138 10738.799194 0.500754 0.452965\n", + "\t5 11644.968350 11210.269586 0.185289 0.160945\n", + "\t10 11320.695930 10911.463205 0.119195 0.103910\n", + "\t15 10965.228363 10545.065525 0.089940 0.078433\n", + "\n", + " (\u001b[1mbase.py\u001b[0m:348)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] t_inner 10256.946 K -- next t_inner 11012.230 K (\u001b[1mbase.py\u001b[0m:350)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Starting iteration 18/20 (\u001b[1mbase.py\u001b[0m:266)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Luminosity emitted = 1.20741e+43 erg / s Luminosity absorbed = 3.93375e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (\u001b[1mbase.py\u001b[0m:357)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Plasma stratification:\n", + "\t t_rad next_t_rad w next_w\n", + "\tShell \n", + "\t0 10738.799194 11316.665617 0.452965 0.492135\n", + "\t5 11210.269586 11599.094127 0.160945 0.183929\n", + "\t10 10911.463205 11403.508986 0.103910 0.114400\n", + "\t15 10545.065525 10958.974248 0.078433 0.087415\n", + "\n", + " (\u001b[1mbase.py\u001b[0m:348)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] t_inner 11012.230 K -- next t_inner 10314.623 K (\u001b[1mbase.py\u001b[0m:350)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Starting iteration 19/20 (\u001b[1mbase.py\u001b[0m:266)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Luminosity emitted = 9.29848e+42 erg / s Luminosity absorbed = 3.02011e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (\u001b[1mbase.py\u001b[0m:357)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Plasma stratification:\n", + "\t t_rad next_t_rad w next_w\n", + "\tShell \n", + "\t0 11316.665617 10862.505720 0.492135 0.444495\n", + "\t5 11599.094127 11194.462074 0.183929 0.162842\n", + "\t10 11403.508986 11065.620645 0.114400 0.099372\n", + "\t15 10958.974248 10599.851144 0.087415 0.077690\n", + "\n", + " (\u001b[1mbase.py\u001b[0m:348)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] t_inner 10314.623 K -- next t_inner 11009.102 K (\u001b[1mbase.py\u001b[0m:350)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Starting iteration 20/20 (\u001b[1mbase.py\u001b[0m:266)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Luminosity emitted = 1.21062e+43 erg / s Luminosity absorbed = 3.88405e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (\u001b[1mbase.py\u001b[0m:357)\n", + "[\u001b[1mtardis.simulation.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Simulation finished in 20 iterations and took 22.57 s (\u001b[1mbase.py\u001b[0m:306)\n" + ] + } + ], + "source": [ + "#TARDIS now uses the data in the data repo\n", + "sim = run_tardis('tardis_example.yml')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Plotting the Spectrum ####" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Populating the interactive namespace from numpy and matplotlib\n" + ] + }, + { + "data": { + "application/javascript": [ + "/* Put everything inside the global mpl namespace */\n", + "window.mpl = {};\n", + "\n", + "\n", + "mpl.get_websocket_type = function() {\n", + " if (typeof(WebSocket) !== 'undefined') {\n", + " return WebSocket;\n", + " } else if (typeof(MozWebSocket) !== 'undefined') {\n", + " return MozWebSocket;\n", + " } else {\n", + " alert('Your browser does not have WebSocket support.' +\n", + " 'Please try Chrome, Safari or Firefox ≥ 6. ' +\n", + " 'Firefox 4 and 5 are also supported but you ' +\n", + " 'have to enable WebSockets in about:config.');\n", + " };\n", + "}\n", + "\n", + "mpl.figure = function(figure_id, websocket, ondownload, parent_element) {\n", + " this.id = figure_id;\n", + "\n", + " this.ws = websocket;\n", + "\n", + " this.supports_binary = (this.ws.binaryType != undefined);\n", + "\n", + " if (!this.supports_binary) {\n", + " var warnings = document.getElementById(\"mpl-warnings\");\n", + " if (warnings) {\n", + " warnings.style.display = 'block';\n", + " warnings.textContent = (\n", + " \"This browser does not support binary websocket messages. \" +\n", + " \"Performance may be slow.\");\n", + " }\n", + " }\n", + "\n", + " this.imageObj = new Image();\n", + "\n", + " this.context = undefined;\n", + " this.message = undefined;\n", + " this.canvas = undefined;\n", + " this.rubberband_canvas = undefined;\n", + " this.rubberband_context = undefined;\n", + " this.format_dropdown = undefined;\n", + "\n", + " this.image_mode = 'full';\n", + "\n", + " this.root = $('
');\n", + " this._root_extra_style(this.root)\n", + " this.root.attr('style', 'display: inline-block');\n", + "\n", + " $(parent_element).append(this.root);\n", + "\n", + " this._init_header(this);\n", + " this._init_canvas(this);\n", + " this._init_toolbar(this);\n", + "\n", + " var fig = this;\n", + "\n", + " this.waiting = false;\n", + "\n", + " this.ws.onopen = function () {\n", + " fig.send_message(\"supports_binary\", {value: fig.supports_binary});\n", + " fig.send_message(\"send_image_mode\", {});\n", + " if (mpl.ratio != 1) {\n", + " fig.send_message(\"set_dpi_ratio\", {'dpi_ratio': mpl.ratio});\n", + " }\n", + " fig.send_message(\"refresh\", {});\n", + " }\n", + "\n", + " this.imageObj.onload = function() {\n", + " if (fig.image_mode == 'full') {\n", + " // Full images could contain transparency (where diff images\n", + " // almost always do), so we need to clear the canvas so that\n", + " // there is no ghosting.\n", + " fig.context.clearRect(0, 0, fig.canvas.width, fig.canvas.height);\n", + " }\n", + " fig.context.drawImage(fig.imageObj, 0, 0);\n", + " };\n", + "\n", + " this.imageObj.onunload = function() {\n", + " fig.ws.close();\n", + " }\n", + "\n", + " this.ws.onmessage = this._make_on_message_function(this);\n", + "\n", + " this.ondownload = ondownload;\n", + "}\n", + "\n", + "mpl.figure.prototype._init_header = function() {\n", + " var titlebar = $(\n", + " '
');\n", + " var titletext = $(\n", + " '
');\n", + " titlebar.append(titletext)\n", + " this.root.append(titlebar);\n", + " this.header = titletext[0];\n", + "}\n", + "\n", + "\n", + "\n", + "mpl.figure.prototype._canvas_extra_style = function(canvas_div) {\n", + "\n", + "}\n", + "\n", + "\n", + "mpl.figure.prototype._root_extra_style = function(canvas_div) {\n", + "\n", + "}\n", + "\n", + "mpl.figure.prototype._init_canvas = function() {\n", + " var fig = this;\n", + "\n", + " var canvas_div = $('
');\n", + "\n", + " canvas_div.attr('style', 'position: relative; clear: both; outline: 0');\n", + "\n", + " function canvas_keyboard_event(event) {\n", + " return fig.key_event(event, event['data']);\n", + " }\n", + "\n", + " canvas_div.keydown('key_press', canvas_keyboard_event);\n", + " canvas_div.keyup('key_release', canvas_keyboard_event);\n", + " this.canvas_div = canvas_div\n", + " this._canvas_extra_style(canvas_div)\n", + " this.root.append(canvas_div);\n", + "\n", + " var canvas = $('');\n", + " canvas.addClass('mpl-canvas');\n", + " canvas.attr('style', \"left: 0; top: 0; z-index: 0; outline: 0\")\n", + "\n", + " this.canvas = canvas[0];\n", + " this.context = canvas[0].getContext(\"2d\");\n", + "\n", + " var backingStore = this.context.backingStorePixelRatio ||\n", + "\tthis.context.webkitBackingStorePixelRatio ||\n", + "\tthis.context.mozBackingStorePixelRatio ||\n", + "\tthis.context.msBackingStorePixelRatio ||\n", + "\tthis.context.oBackingStorePixelRatio ||\n", + "\tthis.context.backingStorePixelRatio || 1;\n", + "\n", + " mpl.ratio = (window.devicePixelRatio || 1) / backingStore;\n", + "\n", + " var rubberband = $('');\n", + " rubberband.attr('style', \"position: absolute; left: 0; top: 0; z-index: 1;\")\n", + "\n", + " var pass_mouse_events = true;\n", + "\n", + " canvas_div.resizable({\n", + " start: function(event, ui) {\n", + " pass_mouse_events = false;\n", + " },\n", + " resize: function(event, ui) {\n", + " fig.request_resize(ui.size.width, ui.size.height);\n", + " },\n", + " stop: function(event, ui) {\n", + " pass_mouse_events = true;\n", + " fig.request_resize(ui.size.width, ui.size.height);\n", + " },\n", + " });\n", + "\n", + " function mouse_event_fn(event) {\n", + " if (pass_mouse_events)\n", + " return fig.mouse_event(event, event['data']);\n", + " }\n", + "\n", + " rubberband.mousedown('button_press', mouse_event_fn);\n", + " rubberband.mouseup('button_release', mouse_event_fn);\n", + " // Throttle sequential mouse events to 1 every 20ms.\n", + " rubberband.mousemove('motion_notify', mouse_event_fn);\n", + "\n", + " rubberband.mouseenter('figure_enter', mouse_event_fn);\n", + " rubberband.mouseleave('figure_leave', mouse_event_fn);\n", + "\n", + " canvas_div.on(\"wheel\", function (event) {\n", + " event = event.originalEvent;\n", + " event['data'] = 'scroll'\n", + " if (event.deltaY < 0) {\n", + " event.step = 1;\n", + " } else {\n", + " event.step = -1;\n", + " }\n", + " mouse_event_fn(event);\n", + " });\n", + "\n", + " canvas_div.append(canvas);\n", + " canvas_div.append(rubberband);\n", + "\n", + " this.rubberband = rubberband;\n", + " this.rubberband_canvas = rubberband[0];\n", + " this.rubberband_context = rubberband[0].getContext(\"2d\");\n", + " this.rubberband_context.strokeStyle = \"#000000\";\n", + "\n", + " this._resize_canvas = function(width, height) {\n", + " // Keep the size of the canvas, canvas container, and rubber band\n", + " // canvas in synch.\n", + " canvas_div.css('width', width)\n", + " canvas_div.css('height', height)\n", + "\n", + " canvas.attr('width', width * mpl.ratio);\n", + " canvas.attr('height', height * mpl.ratio);\n", + " canvas.attr('style', 'width: ' + width + 'px; height: ' + height + 'px;');\n", + "\n", + " rubberband.attr('width', width);\n", + " rubberband.attr('height', height);\n", + " }\n", + "\n", + " // Set the figure to an initial 600x600px, this will subsequently be updated\n", + " // upon first draw.\n", + " this._resize_canvas(600, 600);\n", + "\n", + " // Disable right mouse context menu.\n", + " $(this.rubberband_canvas).bind(\"contextmenu\",function(e){\n", + " return false;\n", + " });\n", + "\n", + " function set_focus () {\n", + " canvas.focus();\n", + " canvas_div.focus();\n", + " }\n", + "\n", + " window.setTimeout(set_focus, 100);\n", + "}\n", + "\n", + "mpl.figure.prototype._init_toolbar = function() {\n", + " var fig = this;\n", + "\n", + " var nav_element = $('
')\n", + " nav_element.attr('style', 'width: 100%');\n", + " this.root.append(nav_element);\n", + "\n", + " // Define a callback function for later on.\n", + " function toolbar_event(event) {\n", + " return fig.toolbar_button_onclick(event['data']);\n", + " }\n", + " function toolbar_mouse_event(event) {\n", + " return fig.toolbar_button_onmouseover(event['data']);\n", + " }\n", + "\n", + " for(var toolbar_ind in mpl.toolbar_items) {\n", + " var name = mpl.toolbar_items[toolbar_ind][0];\n", + " var tooltip = mpl.toolbar_items[toolbar_ind][1];\n", + " var image = mpl.toolbar_items[toolbar_ind][2];\n", + " var method_name = mpl.toolbar_items[toolbar_ind][3];\n", + "\n", + " if (!name) {\n", + " // put a spacer in here.\n", + " continue;\n", + " }\n", + " var button = $('