diff --git a/docs/index.rst b/docs/index.rst index daf06ce9cd7..b337d98fae0 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -54,22 +54,24 @@ Mission Statement .. toctree:: :maxdepth: 3 - :caption: Using TARDIS + :caption: Input/Output :hidden: - - using/components/index - using/visualization/index - using/interaction/index - using/parallelisation/index + + io/configuration/index + io/optional/index + io/visualization/index + io/output/index .. toctree:: :maxdepth: 2 - :caption: The Physics of TARDIS + :caption: Physics Walkthrough :hidden: + physics/setup/index physics/montecarlo/index - physics/plasma/index + physics/est_and_conv/index + physics/spectrum/index .. toctree:: @@ -116,6 +118,14 @@ Mission Statement zreferences + +.. toctree:: + :maxdepth: 2 + :caption: Outdated + :hidden: + + outdated/index + ---- News ---- diff --git a/docs/using/components/atomic/atomic_data.rst b/docs/io/configuration/components/atomic/atomic_data.rst similarity index 100% rename from docs/using/components/atomic/atomic_data.rst rename to docs/io/configuration/components/atomic/atomic_data.rst diff --git a/docs/using/components/atomic/atomic_data_description.rst b/docs/io/configuration/components/atomic/atomic_data_description.rst similarity index 100% rename from docs/using/components/atomic/atomic_data_description.rst rename to docs/io/configuration/components/atomic/atomic_data_description.rst diff --git a/docs/using/components/atomic/current_public_table.rst b/docs/io/configuration/components/atomic/current_public_table.rst similarity index 100% rename from docs/using/components/atomic/current_public_table.rst rename to docs/io/configuration/components/atomic/current_public_table.rst diff --git a/docs/io/configuration/components/index.rst b/docs/io/configuration/components/index.rst new file mode 100644 index 00000000000..d1a18435b29 --- /dev/null +++ b/docs/io/configuration/components/index.rst @@ -0,0 +1,40 @@ +.. _config-components: + +************************ +Configuration Components +************************ + +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 `here +`_. + +.. warning:: + One should note that currently floats in YAML that are expressed in scientific notation + need to be specified in a special format: + any pure floats in scientific notation need to have a +/- after the "e", e.g. 2e+5 + + +The TARDIS configuration consists of multiple sections that pertain to certain parts of the code. We will use the +schemas to show what options are available. Our schema mark-up defines names in bold-fat as required and can be seen here: + +.. note:: + + The following shows all the options (and their default settings) that are available for TARDIS. No other options + are allowed or available. + +The base schema outlines the main components of the TARDIS configuration. Schemas for these components are linked +in the base schema, and important information about the configuration is linked below. + +.. jsonschema:: schemas/base.yml + +.. toctree:: + :maxdepth: 2 + + supernova + atomic/atomic_data + plasma + models/index + montecarlo + spectrum \ No newline at end of file diff --git a/docs/using/interaction/Custom_TARDIS_Model_Tutorial.ipynb b/docs/io/configuration/components/models/Custom_TARDIS_Model_Tutorial.ipynb similarity index 99% rename from docs/using/interaction/Custom_TARDIS_Model_Tutorial.ipynb rename to docs/io/configuration/components/models/Custom_TARDIS_Model_Tutorial.ipynb index 8fd71e88da4..38f081d41f2 100644 --- a/docs/using/interaction/Custom_TARDIS_Model_Tutorial.ipynb +++ b/docs/io/configuration/components/models/Custom_TARDIS_Model_Tutorial.ipynb @@ -49,7 +49,7 @@ "* The second column lists the velocities of the outer boundary of the cell in km/s.\n", "* The third column lists the density of the cell.\n", "\n", - "## Important: \n", + "### Important: \n", "The __default behavior__ of TARDIS is to use the first shell as the inner boundary. This means that v_inner_boundary = 9500, and the corresponding density 9e-16 is ignored because it is within the inner boundary. It can be replaced by an arbitrary number. The outer boundary of the last shell will be used as v_outer_boundary, so the default behavior will set v_outer_boundary = 12000." ] }, @@ -79,7 +79,7 @@ "* The first line indicates which elements (or isotopes) correspond to which columns.\n", "* After a skipped line, each row specifies the chemical abundance of one shell. Therefore the numbers in a given row should sum to 1.0\n", "\n", - "## Important: \n", + "### Important: \n", "Note that there are only 2 shells specified in this abundance file (despite the custom density file having 3 lines). This is because the custom density file specifies the boundaries of the shells, while the abundance file specifies the abundances within each shell." ] }, @@ -391,7 +391,7 @@ "\n", "In addition to specifying custom density and abundance files, the user can set the v_inner_boundary and v_outer_boundary velocities in the YAML config file. This can cause some confusion, so we carefully go through some examples.\n", "\n", - "## Important: \n", + "### Important: \n", "Boundary velocities set in the YAML config file must be __within__ the velocity range specified in the custom density file (if one is provided)." ] }, @@ -767,7 +767,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Important: \n", + "### Important: \n", "Notice that the inner and outer boundary velocities are the ones specifically set by the user." ] } @@ -793,4 +793,4 @@ }, "nbformat": 4, "nbformat_minor": 2 -} +} \ No newline at end of file diff --git a/docs/io/configuration/components/models/abundancecust/abund.dat b/docs/io/configuration/components/models/abundancecust/abund.dat new file mode 120000 index 00000000000..c34f6fb1209 --- /dev/null +++ b/docs/io/configuration/components/models/abundancecust/abund.dat @@ -0,0 +1 @@ +../../../../../../tardis/io/tests/data/abund.dat \ No newline at end of file diff --git a/docs/using/components/models/abundancecust/abundancecust.rst b/docs/io/configuration/components/models/abundancecust/abundancecust.rst similarity index 100% rename from docs/using/components/models/abundancecust/abundancecust.rst rename to docs/io/configuration/components/models/abundancecust/abundancecust.rst diff --git a/docs/using/components/models/abundancecust/tardis_configv1_abundance_cust_example.yml b/docs/io/configuration/components/models/abundancecust/tardis_configv1_abundance_cust_example.yml similarity index 100% rename from docs/using/components/models/abundancecust/tardis_configv1_abundance_cust_example.yml rename to docs/io/configuration/components/models/abundancecust/tardis_configv1_abundance_cust_example.yml diff --git a/docs/using/components/models/abundancecust/tardis_configv1_isotope_abundance_cust_example.yml b/docs/io/configuration/components/models/abundancecust/tardis_configv1_isotope_abundance_cust_example.yml similarity index 100% rename from docs/using/components/models/abundancecust/tardis_configv1_isotope_abundance_cust_example.yml rename to docs/io/configuration/components/models/abundancecust/tardis_configv1_isotope_abundance_cust_example.yml diff --git a/docs/using/components/models/abundancecust/tardis_model_abund.csv b/docs/io/configuration/components/models/abundancecust/tardis_model_abund.csv similarity index 100% rename from docs/using/components/models/abundancecust/tardis_model_abund.csv rename to docs/io/configuration/components/models/abundancecust/tardis_model_abund.csv diff --git a/docs/using/components/models/abundanceuni/abundanceuni.rst b/docs/io/configuration/components/models/abundanceuni/abundanceuni.rst similarity index 100% rename from docs/using/components/models/abundanceuni/abundanceuni.rst rename to docs/io/configuration/components/models/abundanceuni/abundanceuni.rst diff --git a/docs/using/components/models/abundanceuni/tardis_configv1_abundance_uniform_example.yml b/docs/io/configuration/components/models/abundanceuni/tardis_configv1_abundance_uniform_example.yml similarity index 100% rename from docs/using/components/models/abundanceuni/tardis_configv1_abundance_uniform_example.yml rename to docs/io/configuration/components/models/abundanceuni/tardis_configv1_abundance_uniform_example.yml diff --git a/docs/using/interaction/converters/cmfgen.rst b/docs/io/configuration/components/models/converters/cmfgen.rst similarity index 100% rename from docs/using/interaction/converters/cmfgen.rst rename to docs/io/configuration/components/models/converters/cmfgen.rst diff --git a/docs/using/interaction/converters/mesa.stella.dat b/docs/io/configuration/components/models/converters/mesa.stella.dat similarity index 100% rename from docs/using/interaction/converters/mesa.stella.dat rename to docs/io/configuration/components/models/converters/mesa.stella.dat diff --git a/docs/using/interaction/converters/stella_to_tardis.ipynb b/docs/io/configuration/components/models/converters/stella_to_tardis.ipynb similarity index 100% rename from docs/using/interaction/converters/stella_to_tardis.ipynb rename to docs/io/configuration/components/models/converters/stella_to_tardis.ipynb diff --git a/docs/using/components/models/csvy_full_rad.csvy b/docs/io/configuration/components/models/csvy_full_rad.csvy similarity index 100% rename from docs/using/components/models/csvy_full_rad.csvy rename to docs/io/configuration/components/models/csvy_full_rad.csvy diff --git a/docs/using/interaction/data/abund.dat b/docs/io/configuration/components/models/data/abund.dat similarity index 100% rename from docs/using/interaction/data/abund.dat rename to docs/io/configuration/components/models/data/abund.dat diff --git a/docs/using/interaction/data/config_init_trad.yml b/docs/io/configuration/components/models/data/config_init_trad.yml similarity index 100% rename from docs/using/interaction/data/config_init_trad.yml rename to docs/io/configuration/components/models/data/config_init_trad.yml diff --git a/docs/using/interaction/data/config_no_init_trad.yml b/docs/io/configuration/components/models/data/config_no_init_trad.yml similarity index 100% rename from docs/using/interaction/data/config_no_init_trad.yml rename to docs/io/configuration/components/models/data/config_no_init_trad.yml diff --git a/docs/using/interaction/data/density.txt b/docs/io/configuration/components/models/data/density.txt similarity index 100% rename from docs/using/interaction/data/density.txt rename to docs/io/configuration/components/models/data/density.txt diff --git a/docs/using/components/models/densitycust/Custom_Density_And_Boundary_Velocities.ipynb b/docs/io/configuration/components/models/densitycust/Custom_Density_And_Boundary_Velocities.ipynb similarity index 100% rename from docs/using/components/models/densitycust/Custom_Density_And_Boundary_Velocities.ipynb rename to docs/io/configuration/components/models/densitycust/Custom_Density_And_Boundary_Velocities.ipynb diff --git a/docs/io/configuration/components/models/densitycust/density.dat b/docs/io/configuration/components/models/densitycust/density.dat new file mode 120000 index 00000000000..90024546c88 --- /dev/null +++ b/docs/io/configuration/components/models/densitycust/density.dat @@ -0,0 +1 @@ +../../../../../../tardis/io/tests/data/density.dat \ No newline at end of file diff --git a/docs/using/components/models/densitycust/densitycust.rst b/docs/io/configuration/components/models/densitycust/densitycust.rst similarity index 100% rename from docs/using/components/models/densitycust/densitycust.rst rename to docs/io/configuration/components/models/densitycust/densitycust.rst diff --git a/docs/using/components/models/densitycust/tardis_configv1_density_cust_example.yml b/docs/io/configuration/components/models/densitycust/tardis_configv1_density_cust_example.yml similarity index 100% rename from docs/using/components/models/densitycust/tardis_configv1_density_cust_example.yml rename to docs/io/configuration/components/models/densitycust/tardis_configv1_density_cust_example.yml diff --git a/docs/using/components/models/densitycust/test_abund.dat b/docs/io/configuration/components/models/densitycust/test_abund.dat similarity index 100% rename from docs/using/components/models/densitycust/test_abund.dat rename to docs/io/configuration/components/models/densitycust/test_abund.dat diff --git a/docs/using/components/models/densitycust/test_config.yml b/docs/io/configuration/components/models/densitycust/test_config.yml similarity index 100% rename from docs/using/components/models/densitycust/test_config.yml rename to docs/io/configuration/components/models/densitycust/test_config.yml diff --git a/docs/using/components/models/densitycust/test_config_ex1.yml b/docs/io/configuration/components/models/densitycust/test_config_ex1.yml similarity index 100% rename from docs/using/components/models/densitycust/test_config_ex1.yml rename to docs/io/configuration/components/models/densitycust/test_config_ex1.yml diff --git a/docs/using/components/models/densitycust/test_config_ex2.yml b/docs/io/configuration/components/models/densitycust/test_config_ex2.yml similarity index 100% rename from docs/using/components/models/densitycust/test_config_ex2.yml rename to docs/io/configuration/components/models/densitycust/test_config_ex2.yml diff --git a/docs/using/components/models/densitycust/test_config_ex3.yml b/docs/io/configuration/components/models/densitycust/test_config_ex3.yml similarity index 100% rename from docs/using/components/models/densitycust/test_config_ex3.yml rename to docs/io/configuration/components/models/densitycust/test_config_ex3.yml diff --git a/docs/using/components/models/densitycust/test_density.txt b/docs/io/configuration/components/models/densitycust/test_density.txt similarity index 100% rename from docs/using/components/models/densitycust/test_density.txt rename to docs/io/configuration/components/models/densitycust/test_density.txt diff --git a/docs/using/components/models/densityexp/densityexp.rst b/docs/io/configuration/components/models/densityexp/densityexp.rst similarity index 100% rename from docs/using/components/models/densityexp/densityexp.rst rename to docs/io/configuration/components/models/densityexp/densityexp.rst diff --git a/docs/using/components/models/densityexp/tardis_configv1_density_exponential_example.yml b/docs/io/configuration/components/models/densityexp/tardis_configv1_density_exponential_example.yml similarity index 100% rename from docs/using/components/models/densityexp/tardis_configv1_density_exponential_example.yml rename to docs/io/configuration/components/models/densityexp/tardis_configv1_density_exponential_example.yml diff --git a/docs/using/components/models/densitypow/densitypow.rst b/docs/io/configuration/components/models/densitypow/densitypow.rst similarity index 100% rename from docs/using/components/models/densitypow/densitypow.rst rename to docs/io/configuration/components/models/densitypow/densitypow.rst diff --git a/docs/using/components/models/densitypow/tardis_configv1_density_power_law_example.yml b/docs/io/configuration/components/models/densitypow/tardis_configv1_density_power_law_example.yml similarity index 100% rename from docs/using/components/models/densitypow/tardis_configv1_density_power_law_example.yml rename to docs/io/configuration/components/models/densitypow/tardis_configv1_density_power_law_example.yml diff --git a/docs/using/example_data.inc b/docs/io/configuration/components/models/example_data.inc similarity index 100% rename from docs/using/example_data.inc rename to docs/io/configuration/components/models/example_data.inc diff --git a/docs/io/configuration/components/models/index.rst b/docs/io/configuration/components/models/index.rst new file mode 100644 index 00000000000..29cdea57534 --- /dev/null +++ b/docs/io/configuration/components/models/index.rst @@ -0,0 +1,172 @@ +.. _model-csvy-and-config: + +****** +Models +****** + +TARDIS requires a model of the homologously expanding ejecta in order to run a simulation (see :ref:`model`). +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 ` for a link to the csvy_model schema. + +.. note:: + We highly recommend using the cleaner CSVY format. + +.. contents:: + :local: + + +.. _csvy-model: + +CSVY Model +========== + +TARDIS allows users to use a CSVY file to input information about the model: + +.. jsonschema:: ../schemas/csvy_model.yml + +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. + +Example CSVY Model +------------------ + +We provide an example CSVY model file: + +.. literalinclude:: csvy_full_rad.csvy + + +.. _model-config: + +Model Configuration +=================== + +Although we strongly recommend using the CSVY Model, TARDIS also allows the user +to define structure and abundance profiles in separate files and reference +these files directly in the main TARDIS configuration file: + +.. jsonschema:: ../schemas/model.yml + +For an example of this in use, see :ref:`tardis-example`. + + +Structure, Density, and Abundance +================================= + +Structure +--------- + +All types of ``structure`` definitions have two keywords in common: ``v_inner_boundary`` and ``v_outer_boundary``. + +In the ``structure`` section, one can specify a ``file`` section containing a ``type`` parameter +(currently only ``artis`` is supported``) and a ``name`` parameter giving a path top a file. + +If one doesn't specify a ``file`` section, the code requires two sections (``velocities`` and ``densities``) and a +parameter ``no_of_shells``. ``no_of_shells`` is the requested number of shells for a model. The ``velocity`` section +requires a ``type``. Currently, only ``linear`` is supported. + +.. jsonschema:: ../schemas/model_definitions.yml#/definitions/structure/file + +.. jsonschema:: ../schemas/model_definitions.yml#/definitions/structure/specific + + +Density +------- + +In the ``densities`` section the ``type`` parameter again decides on the parameters. The type ``uniform`` only needs a +``value`` parameter with a density compatible quantity. The type ``branch85_w7`` uses a seven-order polynomial fit to +the W7 model and is parametrised by time since explosion. The parameters ``time_0`` and ``density_coefficient`` are set +to sensible defaults and should not be changed. + +.. jsonschema:: ../schemas/model_definitions.yml#/definitions/density/branch85_w7 + +.. jsonschema:: ../schemas/model_definitions.yml#/definitions/density/exponential + +.. toctree:: + :maxdepth: 1 + + densityexp/densityexp + + +.. jsonschema:: ../schemas/model_definitions.yml#/definitions/density/power_law + +.. toctree:: + :maxdepth: 1 + + densitypow/densitypow + + +.. jsonschema:: ../schemas/model_definitions.yml#/definitions/density/uniform + +Custom Density +^^^^^^^^^^^^^^ + +TARDIS also allows for a custom density profile: + +.. toctree:: + :maxdepth: 1 + + densitycust/densitycust + + +Abundance +--------- + +The ``abundance`` section has a possible ``file`` parameter with ``type`` (currently only ``artis`` is allowed) +and a ``name`` parameter giving a path to a file containing the abundance information. + +.. warning:: + In contrast to the ``structure`` section, the ``abundance`` section will not ignore abundances set in the rest of + the section but merely will overwrite the abundances given in the file section. + +The rest of the section can be used to configure uniform abundances for all shells, by giving the atom name and a +relative abundance fraction. If it does not add up to 1., TARDIS will warn --- but normalize the numbers. + + +.. jsonschema:: ../schemas/model_definitions.yml#/definitions/abundances/file + +.. toctree:: + :maxdepth: 1 + + abundancecust/abundancecust + + +.. jsonschema:: ../schemas/model_definitions.yml#/definitions/abundances/uniform + +.. toctree:: + :maxdepth: 1 + + abundanceuni/abundanceuni + + +Tutorials +========= + +.. toctree:: + :maxdepth: 2 + + Custom_TARDIS_Model_Tutorial + + +.. _converters: + +Model Converters +================ + +There are a variety of formats for models from other codes +(both hydro and radiative transfer) that can be converted to TARDIS input files. +Here we aim to provide converters for the most commonly used file formats. + +.. toctree:: + :maxdepth: 2 + + converters/stella_to_tardis + converters/cmfgen \ No newline at end of file diff --git a/docs/io/configuration/components/montecarlo.rst b/docs/io/configuration/components/montecarlo.rst new file mode 100644 index 00000000000..abba8d753ad --- /dev/null +++ b/docs/io/configuration/components/montecarlo.rst @@ -0,0 +1,45 @@ +.. _montecarlo-config: + +************************* +Monte Carlo Configuration +************************* + +The ``montecarlo`` section describes the parameters for the Monte Carlo radiation transport and convergence criteria: + +.. jsonschema:: schemas/montecarlo.yml + +The ``seed`` parameter seeds the random number generator first for the creation of the packets +(:math:`\nu` and :math:`\mu`) and then the interactions in the actual Monte Carlo process. +The ``no_of_packets`` parameter can take a float number for input convenience and gives the number of packets normally +used in each Monte Carlo loop. The parameters ``last_no_of_packets`` and ``no_of_virtual_packets`` influence the last run +of the Monte Carlo loop (which calculates the final spectrum!) when the radiation field should have converged. ``last_no_of_packets`` is normally higher than +``no_of_packets`` to create a less noisy output spectrum. ``no_of_virtual_packets`` can also be set to greater than 0 (a useful number is 3) to +use the Virtual Packet formalism. Increasing this number drastically increases computational costs (and memory requirements if they are logged). +The ``iterations`` parameter describes the maximum number of Monte Carlo loops executed in a simulation before it ends. Convergence criteria can be used to make the simulation stop +sooner when the convergence threshold has been reached (see :ref:`convergence`). + +Convergence Strategy +-------------------- + +The ``convergence_criteria`` section has a ``type`` keyword. Currently, one type is allowed: ``damped``. +All convergence criteria can be specified separately for the three variables for which convergence can be checked +(``t_inner``, ``t_rad``, ``ws``) by specifying subsections in the ``convergence_criteria`` of the same name. These then +override the defaults. Two more schemas are presented that further explain the ``damped`` and +``custom`` convergence strategies: + +.. jsonschema:: schemas/montecarlo_definitions.yml#/definitions/convergence_strategy/damped + +``damped`` only has one parameter ``damping-constant`` and does not check for convergence. This can be used to fix the +temperature of the inner boundary. + +.. jsonschema:: schemas/montecarlo_definitions.yml#/definitions/convergence_strategy/custom + + +.. _parallelization: + +Parallel Execution with Numba +----------------------------- +The ``montecarlo`` section of the Configuration file accepts the parameter ``nthreads`` which sets the number of +threads to be used for parallelisation. Setting the value of the parameter between 1 and the environment variable +``NUMBA_NUM_THREADS`` (which is, by default, the number of CPU cores on your system) will automatically invoke Numba +to parallelise the code. (See :ref:`config-file` section). \ No newline at end of file diff --git a/docs/io/configuration/components/plasma.rst b/docs/io/configuration/components/plasma.rst new file mode 100644 index 00000000000..8133f0aa483 --- /dev/null +++ b/docs/io/configuration/components/plasma.rst @@ -0,0 +1,33 @@ +.. _plasma-config: + +******************** +Plasma Configuration +******************** + +The plasma configuration gives TARDIS the necessary information to calculate the plasma state (see :ref:`plasma`): + +.. jsonschema:: schemas/plasma.yml + +``inital_t_inner`` is initial temperature (will be updated for most modes of TARDIS --- see convergence section) of the black-body on the inner +boundary. ``initial_t_rad`` is the initial radiation temperature (will be updated for most modes of TARDIS - see convergence section). For debugging purposes and to compare to +:term:`synapps` calculations one can disable the electron scattering. TARDIS will issue a warning that this is not physical. +There are currently two ``plasma_type`` options available: ``nebular`` and ``lte``, which tell TARDIS how to run the +ionization equilibrium and level population calculations (see :ref:`plasma` for more information). +The radiative rates describe how to calculate the :math:`J_\textrm{blue}` needed for the :ref:`nlte` calculations and +:ref:`macroatom` calculations. There are three options for ``radiative_rates_type``: + +1) ``lte``, in which +:math:`J_\textrm{blue} = \textrm{Blackbody}(T_\textrm{rad})` + +2) ``nebular`` in which +:math:`J_\textrm{blue} = W \times \textrm{Blackbody}(T_\textrm{rad})` + +3) ``detailed`` in which the :math:`J_\textrm{blue}` +are calculated using an estimator (this is described in :ref:`estimators`). + +TARDIS currently supports three different kinds of line interaction: ``scatter`` --- a resonance scattering implementation, +``macroatom`` --- the most complex form of line interaction described in :ref:`macroatom` and ``downbranch`` a simplified +version of ``macroatom`` in which only downward transitions are allowed (see :ref:`lineinteraction`). + +Finally, ``w_epsilon`` describes the dilution factor to use to calculate :math:`J_\textrm{blue}` that are 0, which +causes problemsl with the code (so :math:`J_\textrm{blue}` are set to a very small number). \ No newline at end of file diff --git a/docs/using/components/configuration/schemas b/docs/io/configuration/components/schemas similarity index 100% rename from docs/using/components/configuration/schemas rename to docs/io/configuration/components/schemas diff --git a/docs/io/configuration/components/spectrum.rst b/docs/io/configuration/components/spectrum.rst new file mode 100644 index 00000000000..75cd7eab5c2 --- /dev/null +++ b/docs/io/configuration/components/spectrum.rst @@ -0,0 +1,22 @@ +.. _spectrum-config: + +********************** +Spectrum Configuration +********************** + +Finally, the spectrum configuration tells TARDIS information needed for spectrum generation (see :ref:`spectrum`): + +.. jsonschema:: schemas/spectrum.yml + +``Start`` and ``end`` are given as Quantities with units. If they are given in +frequency space they are switched around if necessary. The number of bins is +just an integer. Finally, the method option selects the final spectral synthesis mode. Currently, there are three options: + +* real: construct spectrum from the real packet population alone +* virtual: use the :ref:`virtual packet scheme ` for spectral synthesis +* integrated: use the :ref:`formal integral method ` of Lucy 1999 + +.. warning:: + Currently, the "integrated" mode only works with the downbranching line + interaction mode. Note also the limitations listed at the bottom of the + dedicated page. diff --git a/docs/io/configuration/components/supernova.rst b/docs/io/configuration/components/supernova.rst new file mode 100644 index 00000000000..a3574237e2d --- /dev/null +++ b/docs/io/configuration/components/supernova.rst @@ -0,0 +1,12 @@ +.. _supernova-config: + +*********************** +Supernova Configuration +*********************** + +The supernova component of the configuration file contains some key information about the supernova being modeled: + +.. jsonschema:: schemas/supernova.yml + +During a run of TARDIS, we attempt to converge the output spectrum to match the requested luminosity +(see :ref:`est_and_conv`). \ No newline at end of file diff --git a/docs/using/components/configuration/config_validator.rst b/docs/io/configuration/config_validator.rst similarity index 100% rename from docs/using/components/configuration/config_validator.rst rename to docs/io/configuration/config_validator.rst diff --git a/docs/using/components/models/examples/tardis_example.rst b/docs/io/configuration/example.rst similarity index 69% rename from docs/using/components/models/examples/tardis_example.rst rename to docs/io/configuration/example.rst index 5ab53d5435e..49ee351be29 100644 --- a/docs/using/components/models/examples/tardis_example.rst +++ b/docs/io/configuration/example.rst @@ -1,11 +1,13 @@ -tardis_example --------------- +.. _tardis-example: + +**************************** +Tardis Example Configuration +**************************** The simple and fast TARDIS setup is provided by ``tardis_example.yml`` which -may be obtained from `tardis-setups -`_ repository. It is located in -the ``tardis-setups/2014/2014_kerzendorf_sim/appendix_A1`` subfolder. We suggest every new user of TARDIS to run this -setup first. +may be obtained `here +`_. We suggest every new user of TARDIS to run this +setup first, which can be done using the :doc:`quickstart guide <../../quickstart/quickstart>`. It calculates a spectrum for a Type Ia supernova model 13 days after explosion, requesting a total output luminosity of @@ -30,11 +32,3 @@ The following YAML file summarizes the tardis_example setup: treatments and the reduced abundance set, this TARDIS setup serves for illustrative purposes and not for detailed SNe Ia spectral synthesis calculations. - -See the following link for an example of running TARDIS with this setup in a Jupyter notebook: - -.. toctree:: - :maxdepth: 1 - - run_simple_example - diff --git a/docs/io/configuration/index.rst b/docs/io/configuration/index.rst new file mode 100644 index 00000000000..b7293213f39 --- /dev/null +++ b/docs/io/configuration/index.rst @@ -0,0 +1,20 @@ +.. _config-file: + +****************************** +Configuration (Required Input) +****************************** + + +The necessary parameters for a TARDIS simulation are provided via a `YAML `_ +configuration file. The following sections respectively describes what can or must be included in the +configuration file, shows an example configuration file, describes how TARDIS checks to make sure a configuration +file is valid, and demonstrates how a YAML configuration file is read in. + + +.. toctree:: + :maxdepth: 1 + + components/index + example + config_validator + read_configuration diff --git a/docs/using/components/configuration/read_configuration.ipynb b/docs/io/configuration/read_configuration.ipynb similarity index 100% rename from docs/using/components/configuration/read_configuration.ipynb rename to docs/io/configuration/read_configuration.ipynb diff --git a/docs/using/interaction/tardis_example.yml b/docs/io/configuration/tardis_example.yml similarity index 100% rename from docs/using/interaction/tardis_example.yml rename to docs/io/configuration/tardis_example.yml diff --git a/docs/using/images/LineInfo.png b/docs/io/images/LineInfo.png similarity index 100% rename from docs/using/images/LineInfo.png rename to docs/io/images/LineInfo.png diff --git a/docs/using/images/OpeningScreen.png b/docs/io/images/OpeningScreen.png similarity index 100% rename from docs/using/images/OpeningScreen.png rename to docs/io/images/OpeningScreen.png diff --git a/docs/using/images/ShellInfo.png b/docs/io/images/ShellInfo.png similarity index 100% rename from docs/using/images/ShellInfo.png rename to docs/io/images/ShellInfo.png diff --git a/docs/using/images/line_info_spectrum_modebar.gif b/docs/io/images/line_info_spectrum_modebar.gif similarity index 100% rename from docs/using/images/line_info_spectrum_modebar.gif rename to docs/io/images/line_info_spectrum_modebar.gif diff --git a/docs/using/images/line_info_spectrum_rangeslider.gif b/docs/io/images/line_info_spectrum_rangeslider.gif similarity index 100% rename from docs/using/images/line_info_spectrum_rangeslider.gif rename to docs/io/images/line_info_spectrum_rangeslider.gif diff --git a/docs/using/images/line_info_spectrum_selection.gif b/docs/io/images/line_info_spectrum_selection.gif similarity index 100% rename from docs/using/images/line_info_spectrum_selection.gif rename to docs/io/images/line_info_spectrum_selection.gif diff --git a/docs/using/images/line_info_widget_demo.gif b/docs/io/images/line_info_widget_demo.gif similarity index 100% rename from docs/using/images/line_info_widget_demo.gif rename to docs/io/images/line_info_widget_demo.gif diff --git a/docs/using/images/sdec_ply_interaction.gif b/docs/io/images/sdec_ply_interaction.gif similarity index 100% rename from docs/using/images/sdec_ply_interaction.gif rename to docs/io/images/sdec_ply_interaction.gif diff --git a/docs/using/images/shell_info_widget_demo.gif b/docs/io/images/shell_info_widget_demo.gif similarity index 100% rename from docs/using/images/shell_info_widget_demo.gif rename to docs/io/images/shell_info_widget_demo.gif diff --git a/docs/using/interaction/callback_example.ipynb b/docs/io/optional/callback_example.ipynb similarity index 100% rename from docs/using/interaction/callback_example.ipynb rename to docs/io/optional/callback_example.ipynb diff --git a/docs/using/interaction/custom_source.ipynb b/docs/io/optional/custom_source.ipynb similarity index 100% rename from docs/using/interaction/custom_source.ipynb rename to docs/io/optional/custom_source.ipynb diff --git a/docs/io/optional/index.rst b/docs/io/optional/index.rst new file mode 100644 index 00000000000..de5fe67d99b --- /dev/null +++ b/docs/io/optional/index.rst @@ -0,0 +1,16 @@ +*************** +Optional Inputs +*************** + +TARDIS also allows other inputs that are passed as arguments into the ``run_tardis`` function. + +.. toctree:: + :maxdepth: 1 + + custom_source + callback_example + + +Additionally, ``run_tardis`` can take in a filepath for the atomic data and a boolian for virtual packet logging, both of +which are also options in the :ref:`configuration file `. The options to pass them inside ``run_tardis`` +may be removed in a future release of the code. \ No newline at end of file diff --git a/docs/using/visualization/tardis_example.yml b/docs/io/optional/tardis_example.yml similarity index 100% rename from docs/using/visualization/tardis_example.yml rename to docs/io/optional/tardis_example.yml diff --git a/docs/using/interaction/access_iterations.rst b/docs/io/output/access_iterations.rst similarity index 74% rename from docs/using/interaction/access_iterations.rst rename to docs/io/output/access_iterations.rst index e87a75d1723..1d16a383968 100644 --- a/docs/using/interaction/access_iterations.rst +++ b/docs/io/output/access_iterations.rst @@ -2,6 +2,11 @@ Access information about individual iterations ********************************************** +Various information about numerical and physical properties of a Tardis +simulation are stored during a run and can be accessed afterwards. Here, we +describe how some of this information, which we deem most useful for typical +use cases, can be accessed. + Currently we store information about the plasma state and the inner boundary for each iteration. This is saved in the simulation object and can be accessed via diff --git a/docs/using/interaction/hdf_writer.ipynb b/docs/io/output/hdf_writer.ipynb similarity index 100% rename from docs/using/interaction/hdf_writer.ipynb rename to docs/io/output/hdf_writer.ipynb diff --git a/docs/io/output/index.rst b/docs/io/output/index.rst new file mode 100644 index 00000000000..ae66cbeee35 --- /dev/null +++ b/docs/io/output/index.rst @@ -0,0 +1,12 @@ +****************** +Additional Outputs +****************** + +In addition to the widgets, TARDIS can output information in several other forms: + +.. toctree:: + :maxdepth: 1 + + physical_quantities + access_iterations + to_hdf \ No newline at end of file diff --git a/docs/using/interaction/physical_quantities.ipynb b/docs/io/output/physical_quantities.ipynb similarity index 100% rename from docs/using/interaction/physical_quantities.ipynb rename to docs/io/output/physical_quantities.ipynb diff --git a/docs/io/output/tardis_example.yml b/docs/io/output/tardis_example.yml new file mode 120000 index 00000000000..665fe53411f --- /dev/null +++ b/docs/io/output/tardis_example.yml @@ -0,0 +1 @@ +../../tardis_example.yml \ No newline at end of file diff --git a/docs/using/interaction/to_hdf.rst b/docs/io/output/to_hdf.rst similarity index 82% rename from docs/using/interaction/to_hdf.rst rename to docs/io/output/to_hdf.rst index 80fbba941a8..91d793d3c06 100644 --- a/docs/using/interaction/to_hdf.rst +++ b/docs/io/output/to_hdf.rst @@ -6,7 +6,10 @@ You can ask TARDIS to store the state of each iteration of the simulation you are running. To see an example of how this can be achieved see the following jupyter notebook. -:ref:`to_hdf_notebook` +.. toctree:: + :maxdepth: 2 + + to_hdf_notebook Using HDFWriter @@ -14,4 +17,6 @@ Using HDFWriter Examples on how to use HDFWriter to store properties of a class in a HDF file. -:ref:`hdf_writer` +.. toctree:: + + hdf_writer diff --git a/docs/using/interaction/to_hdf_notebook.ipynb b/docs/io/output/to_hdf_notebook.ipynb similarity index 100% rename from docs/using/interaction/to_hdf_notebook.ipynb rename to docs/io/output/to_hdf_notebook.ipynb diff --git a/docs/using/tardis_example.yml b/docs/io/tardis_example.yml similarity index 100% rename from docs/using/tardis_example.yml rename to docs/io/tardis_example.yml diff --git a/docs/using/visualization/generating_widgets.ipynb b/docs/io/visualization/generating_widgets.ipynb similarity index 100% rename from docs/using/visualization/generating_widgets.ipynb rename to docs/io/visualization/generating_widgets.ipynb diff --git a/docs/using/visualization/index.rst b/docs/io/visualization/index.rst similarity index 100% rename from docs/using/visualization/index.rst rename to docs/io/visualization/index.rst diff --git a/docs/using/visualization/sdec_plot.ipynb b/docs/io/visualization/sdec_plot.ipynb similarity index 100% rename from docs/using/visualization/sdec_plot.ipynb rename to docs/io/visualization/sdec_plot.ipynb diff --git a/docs/io/visualization/tardis_example.yml b/docs/io/visualization/tardis_example.yml new file mode 120000 index 00000000000..665fe53411f --- /dev/null +++ b/docs/io/visualization/tardis_example.yml @@ -0,0 +1 @@ +../../tardis_example.yml \ No newline at end of file diff --git a/docs/using/visualization/using_widgets.rst b/docs/io/visualization/using_widgets.rst similarity index 100% rename from docs/using/visualization/using_widgets.rst rename to docs/io/visualization/using_widgets.rst diff --git a/docs/using/interaction/commandline.rst b/docs/outdated/commandline.rst similarity index 100% rename from docs/using/interaction/commandline.rst rename to docs/outdated/commandline.rst diff --git a/docs/outdated/index.rst b/docs/outdated/index.rst new file mode 100644 index 00000000000..178d585a3ea --- /dev/null +++ b/docs/outdated/index.rst @@ -0,0 +1,25 @@ +********************** +Outdated Documentation +********************** + +The following pages are no longer relevant to the most recent release of TARDIS: + +.. warning:: Please update to a newer version of TARDIS. The most recent version number can be found near the top of the documentation sidebar. + +.. toctree:: + + commandline + old_gui + openmp + old_install + + +The following pages are no longer applicable to the TARDIS documentation in its current form, but will be edited +and incorporated back into the documentation in the future: + +.. toctree:: + + init_trad_bug + isotope_pd_subclass + integrator + using_formal_integral \ No newline at end of file diff --git a/docs/using/interaction/init_trad_bug.ipynb b/docs/outdated/init_trad_bug.ipynb similarity index 100% rename from docs/using/interaction/init_trad_bug.ipynb rename to docs/outdated/init_trad_bug.ipynb diff --git a/docs/using/interaction/integrator.ipynb b/docs/outdated/integrator.ipynb similarity index 100% rename from docs/using/interaction/integrator.ipynb rename to docs/outdated/integrator.ipynb diff --git a/docs/using/interaction/isotope_pd_subclass.ipynb b/docs/outdated/isotope_pd_subclass.ipynb similarity index 100% rename from docs/using/interaction/isotope_pd_subclass.ipynb rename to docs/outdated/isotope_pd_subclass.ipynb diff --git a/docs/using/interaction/old_gui.rst b/docs/outdated/old_gui.rst similarity index 100% rename from docs/using/interaction/old_gui.rst rename to docs/outdated/old_gui.rst diff --git a/docs/outdated/old_install.rst b/docs/outdated/old_install.rst new file mode 100644 index 00000000000..26bbea58ef5 --- /dev/null +++ b/docs/outdated/old_install.rst @@ -0,0 +1,56 @@ +************************** +Outdated Installation FAQs +************************** + +We highly encourage with any installation problems to try the recommended install +method because this often fixes problems. Here are some common problems when +installing and their fixes: + +**Problem:** While building TARDIS via ``python setup.py`` build you +may encounter the following error:: + + error: tardis/montecarlo/montecarlo.c: Could not find C file tardis/montecarlo/montecarlo.c for Cython file tardis/montecarlo/montecarlo.pyx when building extension tardis.montecarlo.montecarlo. Cython must be installed to build from a git checkout. + + +**Solution:** There are several solutions to this problem. A clean checkout will +help. To clean up your repository please try ``python setup.py clean`` and +then ``git clean -dfx`` (**WARNING** will delete any non-TARDIS file in that directory) +This will often clean this problem. If it still persists: + +Go into the tardis/montecarlo directory and build montecarlo.c by hand:: + + cython montecarlo.pyx + +Then, ``python setup.py build`` should run without problems. + + +**Problem:** when trying to set up CC=gcc python setup.py develop --with-openmp the following error popped up: +from tardis/_compiler.c:1: /Users/yssavo/miniconda2/envs/tardis-show2/lib/gcc/x86_64-apple-darwin13.4.0/5.2.0/include-fixed/limits.h:168:61: fatal error: limits.h: No such file or directory + +**Solution:** Run on terminal: + + open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg + +**Problem:** Symbol not found: _GOMP_parallel when compiling with `--with-openmp` + +**Solution:** Install gcc8 from macports and then install with these flags: `link_args = ['-fopenmp','-Wl,-rpath,/opt/local/lib/gcc8/']` + +**Problem:** While building TARDIS (via python 2.7) via ``python setup.py`` build you +may encounter the following error:: + + TypeError: super() argument 1 must be type, not None + + ---------------------------------------- + Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-req-build-wPB39p/ + + +**Solution:** The cause for this problem is Sphinx or Sphinx version. It can be easily solved by installing Sphinx 1.5.6. + The command for the same is : + + pip install sphinx==1.5.6 + + or + + conda install sphinx==1.5.6 + +Then, ``python setup.py build install`` should run without problems. diff --git a/docs/outdated/openmp.rst b/docs/outdated/openmp.rst new file mode 100644 index 00000000000..97f191712ff --- /dev/null +++ b/docs/outdated/openmp.rst @@ -0,0 +1,26 @@ +****************************** +Parallel execution with OpenMP +****************************** + +.. note:: TARDIS no longer uses C, and thus OpenMP is not relevant to TARDIS. + +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 downloading the compilers from `conda` as we then can ensure that they work with TARDIS. +Within the TARDIS conda environment do:: + + conda install -c conda-forge compilers + +For macOS:: + + conda install -c conda-forge llvm-openmp + +For Linux:: + + conda install -c conda-forge openmp + +To compile TARDIS for parallel execution:: + + python setup.py install --with-openmp \ No newline at end of file diff --git a/docs/using/interaction/using_formal_integral.rst b/docs/outdated/using_formal_integral.rst similarity index 94% rename from docs/using/interaction/using_formal_integral.rst rename to docs/outdated/using_formal_integral.rst index b4156a6672d..7c03d44ded7 100644 --- a/docs/using/interaction/using_formal_integral.rst +++ b/docs/outdated/using_formal_integral.rst @@ -6,7 +6,7 @@ In addition to generating the final Monte Carlo spectrum from the population of Monte Carlo packets and the implemented variant of the "peeling-off" technique (see :ref:`virtual_packets`), TARDIS supports spectral synthesis with so-called formal integral method by :cite:`Lucy1999a` (see a detailed -description of the method at :ref:`source_integration`) +description of the method at :ref:`formal_integral`) Using the Formal Integral Method ================================ @@ -24,5 +24,5 @@ is a lazy property so it will be only generated (and then cached) once it is accessed. The spectrum integration routine is Open-MP parallelized, so this process may be significantly sped-up if TARDIS is built with the ``--with-openmp`` option and more then one thread is used. More instructions on -how to enable parallelisation of the code is given in the :ref:`parallelisation` +how to enable parallelisation of the code is given in the :ref:`parallelization` section. diff --git a/docs/physics/montecarlo/estimators.rst b/docs/physics/est_and_conv/estimators.rst similarity index 99% rename from docs/physics/montecarlo/estimators.rst rename to docs/physics/est_and_conv/estimators.rst index 6b6f599f71f..7a44735ce40 100644 --- a/docs/physics/montecarlo/estimators.rst +++ b/docs/physics/est_and_conv/estimators.rst @@ -1,3 +1,5 @@ +.. _estimators: + *********************************** Volume-based Monte Carlo Estimators *********************************** diff --git a/docs/physics/est_and_conv/index.rst b/docs/physics/est_and_conv/index.rst new file mode 100644 index 00000000000..ad323ee1169 --- /dev/null +++ b/docs/physics/est_and_conv/index.rst @@ -0,0 +1,9 @@ +.. _est_and_conv: + +************************** +Estimators and Convergence +************************** + +.. toctree:: + + estimators \ No newline at end of file diff --git a/docs/physics/montecarlo/basicprinciples.rst b/docs/physics/montecarlo/basicprinciples.rst index 1742f2a4492..62703df12f6 100644 --- a/docs/physics/montecarlo/basicprinciples.rst +++ b/docs/physics/montecarlo/basicprinciples.rst @@ -22,7 +22,7 @@ solved in a stochastic process. The initial properties of these photons are randomly (in a probabilistic sense) assigned in accordance with the macroscopic properties of the radiation field (see :doc:`Discretization `) and in a similar manner the decisions about when, where and how the machine -photons interact with the surrounding material are made (see :doc:`Propagation +photons interact with the surrounding material are made (see :ref:`Propagation `). If this process is repeated for a large enough number of machine photons, the ensemble behaviour and thus the macroscopic evolution of the -radiation field is recovered (see :doc:`Estimators `). +radiation field is recovered (see :ref:`Estimators `). diff --git a/docs/physics/montecarlo/index.rst b/docs/physics/montecarlo/index.rst index 9f5c3faf8c5..d70b011f166 100644 --- a/docs/physics/montecarlo/index.rst +++ b/docs/physics/montecarlo/index.rst @@ -1,6 +1,8 @@ -****************** -Monte Carlo Primer -****************** +.. _montecarlo: + +********************* +Monte Carlo Iteration +********************* The following pages provide a very basic introduction to Monte Carlo radiative transfer techniques as they are used in TARDIS. All the information listed here diff --git a/docs/physics/setup/index.rst b/docs/physics/setup/index.rst new file mode 100644 index 00000000000..0e2763ea389 --- /dev/null +++ b/docs/physics/setup/index.rst @@ -0,0 +1,8 @@ +.. _setup: + +************************* +Setting Up the Simulation +************************* + +.. toctree:: + plasma/index \ No newline at end of file diff --git a/docs/physics/plasma/helium_nlte.rst b/docs/physics/setup/plasma/helium_nlte.rst similarity index 100% rename from docs/physics/plasma/helium_nlte.rst rename to docs/physics/setup/plasma/helium_nlte.rst diff --git a/docs/physics/plasma/index.rst b/docs/physics/setup/plasma/index.rst similarity index 100% rename from docs/physics/plasma/index.rst rename to docs/physics/setup/plasma/index.rst diff --git a/docs/physics/plasma/lte_plasma.rst b/docs/physics/setup/plasma/lte_plasma.rst similarity index 100% rename from docs/physics/plasma/lte_plasma.rst rename to docs/physics/setup/plasma/lte_plasma.rst diff --git a/docs/physics/plasma/macroatom.rst b/docs/physics/setup/plasma/macroatom.rst similarity index 100% rename from docs/physics/plasma/macroatom.rst rename to docs/physics/setup/plasma/macroatom.rst diff --git a/docs/physics/plasma/nebular_plasma.rst b/docs/physics/setup/plasma/nebular_plasma.rst similarity index 100% rename from docs/physics/plasma/nebular_plasma.rst rename to docs/physics/setup/plasma/nebular_plasma.rst diff --git a/docs/physics/plasma/nlte.rst b/docs/physics/setup/plasma/nlte.rst similarity index 100% rename from docs/physics/plasma/nlte.rst rename to docs/physics/setup/plasma/nlte.rst diff --git a/docs/physics/plasma/plasma_plots/lte_ionization_balance.py b/docs/physics/setup/plasma/plasma_plots/lte_ionization_balance.py similarity index 100% rename from docs/physics/plasma/plasma_plots/lte_ionization_balance.py rename to docs/physics/setup/plasma/plasma_plots/lte_ionization_balance.py diff --git a/docs/physics/plasma/plasma_plots/nebular_ionization_balance.py b/docs/physics/setup/plasma/plasma_plots/nebular_ionization_balance.py similarity index 100% rename from docs/physics/plasma/plasma_plots/nebular_ionization_balance.py rename to docs/physics/setup/plasma/plasma_plots/nebular_ionization_balance.py diff --git a/docs/physics/spectralsynthesis.rst b/docs/physics/spectralsynthesis.rst deleted file mode 100644 index fdc90f105f9..00000000000 --- a/docs/physics/spectralsynthesis.rst +++ /dev/null @@ -1,5 +0,0 @@ -*********************************** -Spectrum formation in SNe Ia ejecta -*********************************** - -Hopefully coming soon diff --git a/docs/physics/spectrum/index.rst b/docs/physics/spectrum/index.rst new file mode 100644 index 00000000000..38e7a872654 --- /dev/null +++ b/docs/physics/spectrum/index.rst @@ -0,0 +1,9 @@ +.. _spectrum: + +******************* +Spectrum Generation +******************* + +.. toctree:: + virtualpackets + sourceintegration \ No newline at end of file diff --git a/docs/physics/montecarlo/sourceintegration.rst b/docs/physics/spectrum/sourceintegration.rst similarity index 99% rename from docs/physics/montecarlo/sourceintegration.rst rename to docs/physics/spectrum/sourceintegration.rst index 165f6e5129e..c06a621feae 100644 --- a/docs/physics/montecarlo/sourceintegration.rst +++ b/docs/physics/spectrum/sourceintegration.rst @@ -1,4 +1,4 @@ -.. _source_integration: +.. _formal_integral: ***************************************** Direct integration of the radiation field diff --git a/docs/physics/montecarlo/virtualpackets.rst b/docs/physics/spectrum/virtualpackets.rst similarity index 99% rename from docs/physics/montecarlo/virtualpackets.rst rename to docs/physics/spectrum/virtualpackets.rst index c1d2e174038..e64c025180c 100644 --- a/docs/physics/montecarlo/virtualpackets.rst +++ b/docs/physics/spectrum/virtualpackets.rst @@ -59,7 +59,7 @@ optical depth. In particular, it contributes with the to the emergent luminosity in the frequency interval :math:`[\nu, \nu + \Delta \nu]`. Here, :math:`\Delta t` denotes the physical duration of the simulation step (the same duration which is used during the initialization process at the -photosphere, see :doc:`Propagation `), and :math:`\varepsilon` is +photosphere, see :ref:`Propagation `), and :math:`\varepsilon` is the energy of the virtual packet when it was generated. .. note:: diff --git a/docs/physics/tardisprocedure.rst b/docs/physics/tardisprocedure.rst deleted file mode 100644 index 030435d30d4..00000000000 --- a/docs/physics/tardisprocedure.rst +++ /dev/null @@ -1,5 +0,0 @@ -*************************** -TARDIS simulation procedure -*************************** - -Hopefully coming soon. diff --git a/docs/research/code_comparison/toy_models/reading blondin toymodel.ipynb b/docs/research/code_comparison/toy_models/reading blondin toymodel.ipynb index 81764f130cc..64bb0827889 100644 --- a/docs/research/code_comparison/toy_models/reading blondin toymodel.ipynb +++ b/docs/research/code_comparison/toy_models/reading blondin toymodel.ipynb @@ -140,7 +140,7 @@ "We assume $T_\\textrm{electron} = 0.9 T_\\textrm{radiative}$\n", "\n", "\n", - "[Plasma assumptions](../../../physics/plasma/nebular_plasma.rst)\n", + "[Plasma assumptions](../../../physics/setup/plasma/nebular_plasma.rst)\n", "\n", "\n", "[Line interaction assumptions](../../../physics/montecarlo/lineinteraction.rst)\n", @@ -6392,4 +6392,4 @@ }, "nbformat": 4, "nbformat_minor": 2 -} +} \ No newline at end of file diff --git a/docs/using/components/configuration/configuration.rst b/docs/using/components/configuration/configuration.rst deleted file mode 100644 index cacf5f927ac..00000000000 --- a/docs/using/components/configuration/configuration.rst +++ /dev/null @@ -1,197 +0,0 @@ -.. _config-file: - -****************** -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 at `example_yml`_. - -.. warning:: - One should note that currently floats in YAML need to be specified in a special format: - any pure floats need to have a +/- after the "e", e.g. 2e+5 - - -The TARDIS configuration consists of multiple sections that pertain to certain parts of the code. We will use the -schemas to show what options are available. Our schema mark-up defines names in bold-fat as required and can be seen here: - -.. note:: - - 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 -==================== - -.. jsonschema:: schemas/base.yml - - -The base schema links to several other configuration parts - - -Supernova ---------- - -.. jsonschema:: schemas/supernova.yml - - -Model ------ - -The next sections, describing the model, are very hierarchical. The base level is ``model`` and contains two subsections: -``structure`` and ``abundances``. Both sections can either contain a ``file`` subsection that specifies a file and -file type where the information is stored or a number of other sections. - -.. jsonschema:: schemas/model.yml - -Abundances -^^^^^^^^^^ -The ``abundance`` section has a possible ``file`` parameter with ``type`` (currently only ``artis`` is allowed) -and a ``name`` parameter giving a path to a file containing the abundance information. - -.. warning:: - In contrast to the ``structure`` section, the ``abundance`` section will not ignore abundances set in the rest of - the section but merely will overwrite the abundances given in the file section. - -The rest of the section can be used to configure uniform abundances for all shells, by giving the atom name and a -relative abundance fraction. If it does not add up to 1., TARDIS will warn --- but normalize the numbers. - - -.. jsonschema:: schemas/model_definitions.yml#/definitions/abundances/file - -.. jsonschema:: schemas/model_definitions.yml#/definitions/abundances/uniform - -Structure -^^^^^^^^^ -All types of ``structure`` definitions have two keywords in common: ``v_inner_boundary`` and ``v_outer_boundary``. - -In the ``structure`` section, one can specify a ``file`` section containing a ``type`` parameter -(currently only ``artis`` is supported``) and a ``name`` parameter giving a path top a file. - -If one doesn't specify a ``file`` section, the code requires two sections (``velocities`` and ``densities``) and a -parameter ``no_of_shells``. ``no_of_shells`` is the requested number of shells for a model. The ``velocity`` section -requires a ``type``. Currently, only ``linear`` is supported. - -.. jsonschema:: schemas/model_definitions.yml#/definitions/structure/file - -.. jsonschema:: schemas/model_definitions.yml#/definitions/structure/specific - -Densities -""""""""" -In the ``densities`` section the ``type`` parameter again decides on the parameters. The type ``uniform`` only needs a -``value`` parameter with a density compatible quantity. The type ``branch85_w7`` uses a seven-order polynomial fit to -the W7 model and is parametrised by time since explosion. The parameters ``time_0`` and ``density_coefficient`` are set -to sensible defaults and should not be changed. - -.. jsonschema:: schemas/model_definitions.yml#/definitions/density/branch85_w7 - -.. jsonschema:: schemas/model_definitions.yml#/definitions/density/exponential - -.. jsonschema:: schemas/model_definitions.yml#/definitions/density/power_law - -.. jsonschema:: schemas/model_definitions.yml#/definitions/density/uniform - - -Plasma ------- - -.. jsonschema:: schemas/plasma.yml - -``inital_t_inner`` is initial temperature (will be updated for most modes of TARDIS --- see convergence section) of the black-body on the inner -boundary. ``initial_t_rad`` is the initial radiation temperature (will be updated for most modes of TARDIS - see convergence section). For debugging purposes and to compare to -:term:`synapps` calculations one can disable the electron scattering. TARDIS will issue a warning that this is not physical. -There are currently two ``plasma_type`` options available: ``nebular`` and ``lte``, which tell TARDIS how to run the -ionization equilibrium and level population calculations (see :ref:`plasma` for more information). -The radiative rates describe how to calculate the :math:`J_\textrm{blue}` needed for the :ref:`nlte` calculations and -:ref:`macroatom` calculations. There are three options for ``radiative_rates_type``: - -1) ``lte``, in which -:math:`J_\textrm{blue} = \textrm{Blackbody}(T_\textrm{rad})` - -2) ``nebular`` in which -:math:`J_\textrm{blue} = W \times \textrm{Blackbody}(T_\textrm{rad})` - -3) ``detailed`` in which the :math:`J_\textrm{blue}` -are calculated using an estimator (this is described in ??????). - -TARDIS currently supports three different kinds of line interaction: ``scatter`` --- a resonance scattering implementation, -``macroatom`` --- the most complex form of line interaction described in :ref:`macroatom` and ``downbranch`` a simplified -version of ``macroatom`` in which only downward transitions are allowed. - -Finally, ``w_epsilon`` describes the dilution factor to use to calculate :math:`J_\textrm{blue}` that are 0, which -causes problemsl with the code (so :math:`J_\textrm{blue}` are set to a very small number). - -NLTE -^^^^ - -.. code-block:: yaml - - nlte: - coronal_approximation: True - classical_nebular: False - -The NLTE configuration currently allows setting ``coronal_approximation``, which sets all :math:`J_\textrm{blue}` to 0. -This is useful for debugging with :term:`chianti` for example. Furthermore, one can enable 'classical_nebular' to set all -:math:`\beta_\textrm{Sobolev}` to 1. Both options are used for checking with other codes and should not be enabled in -normal operations. - - - -Monte Carlo ------------ - -The ``montecarlo`` section describes the parameters for the Monte Carlo radiation transport and convergence criteria: - -.. jsonschema:: schemas/montecarlo.yml - -.. jsonschema:: schemas/montecarlo_definitions.yml#/definitions/convergence_strategy/damped - -.. jsonschema:: schemas/montecarlo_definitions.yml#/definitions/convergence_strategy/custom - -The ``seed`` parameter seeds the random number generator first for the creation of the packets -(:math:`\nu` and :math:`\mu`) and then the interactions in the actual Monte Carlo process. -The ``no_of_packets`` parameter can take a float number for input convenience and gives the number of packets normally -used in each Monte Carlo loop. The parameters ``last_no_of_packets`` and ``no_of_virtual_packets`` influence the last run -of the Monte Carlo loop (which calculates the final spectrum!) when the radiation field should have converged. ``last_no_of_packets`` is normally higher than -``no_of_packets`` to create a less noisy output spectrum. ``no_of_virtual_packets`` can also be set to greater than 0 (a useful number is 3) to -use the Virtual Packet formalism. Increasing this number drastically increases computational costs (and memory requirements if they are logged). -The ``iterations`` parameter describes the maximum number of Monte Carlo loops executed in a simulation before it ends. Convergence criteria can be used to make the simulation stop -sooner when the convergence threshold has been reached. - -The ``convergence_criteria`` section again has a ``type`` keyword. Currently, one type is allowed: ``damped``. -All convergence criteria can be specified separately for the three variables for which convergence can be checked -(``t_inner``, ``t_rad``, ``ws``) by specifying subsections in the ``convergence_criteria`` of the same name. These then -override the defaults. - - -``damped`` only has one parameter ``damping-constant`` and does not check for convergence. This can be used to fix the -temperature of the inner boundary (by increasing the ``convergence_criteria`` and - - - -Spectrum --------- - -.. jsonschema:: schemas/spectrum.yml - -``Start`` and ``end`` are given as Quantities with units. If they are given in -frequency space they are switched around if necessary. The number of bins is -just an integer. Finally, the method option selects the final spectral synthesis mode. Currently, there are three options: - -* real: construct spectrum from the real packet population alone -* virtual: use the :doc:`virtual packet scheme <../../../physics/montecarlo/virtualpackets>` for spectral synthesis -* integrated: use the :doc:`formal integral method <../../../physics/montecarlo/sourceintegration>` of Lucy 1999 - -.. warning:: - Currently, the "integrated" mode only works with the downbranching line - interaction mode. Note also the limitations listed at the bottom of the - dedicated page. - - -.. include:: ../../example_data.inc \ No newline at end of file diff --git a/docs/using/components/configuration/index.rst b/docs/using/components/configuration/index.rst deleted file mode 100644 index 96a0f931659..00000000000 --- a/docs/using/components/configuration/index.rst +++ /dev/null @@ -1,18 +0,0 @@ -************* -Configuration -************* - - -The bulk of the parameters for a TARDIS simulation are provided via a YAML -configuration file. In a first step, the integrity of the specified -configuration file is checked by a configuration validator. During this -process, missing entries are replaced by default values. The following sections -and pages provide more details concerning the TARDIS configuration process. - - -.. toctree:: - :maxdepth: 2 - - configuration - config_validator - read_configuration diff --git a/docs/using/components/index.rst b/docs/using/components/index.rst deleted file mode 100644 index 825c448c06b..00000000000 --- a/docs/using/components/index.rst +++ /dev/null @@ -1,17 +0,0 @@ -*********** -Components -*********** - -The TARDIS code needs three components to calculate spectra: - - -.. toctree:: - :maxdepth: 1 - - configuration/index - models/index - atomic/atomic_data - - -A quick start guide to run TARDIS can be found -`here <../../quickstart/quickstart.ipynb>`_. \ No newline at end of file diff --git a/docs/using/components/models/abundancecust/abund.dat b/docs/using/components/models/abundancecust/abund.dat deleted file mode 120000 index 7ec54d0de4c..00000000000 --- a/docs/using/components/models/abundancecust/abund.dat +++ /dev/null @@ -1 +0,0 @@ -../../../../../tardis/io/tests/data/abund.dat \ No newline at end of file diff --git a/docs/using/components/models/densitycust/density.dat b/docs/using/components/models/densitycust/density.dat deleted file mode 120000 index 687dacfb7fb..00000000000 --- a/docs/using/components/models/densitycust/density.dat +++ /dev/null @@ -1 +0,0 @@ -../../../../../tardis/io/tests/data/density.dat \ No newline at end of file diff --git a/docs/using/components/models/examples/run_simple_example.ipynb b/docs/using/components/models/examples/run_simple_example.ipynb deleted file mode 100644 index 212e922e371..00000000000 --- a/docs/using/components/models/examples/run_simple_example.ipynb +++ /dev/null @@ -1,1222 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Simple Jupyter TARDIS Example ###" - ] - }, - { - "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": "code", - "execution_count": 3, - "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" - ] - }, - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "33dd6796be49474b81854df7f5cf0778", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "HBox(children=(IntProgress(value=0, description='kurucz_cd23_chianti_H_He.h5', max=73704476, style=ProgressSty…" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - } - ], - "source": [ - "# the data is automatically downloaded\n", - "download_atom_data('kurucz_cd23_chianti_H_He')" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "[\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:76)\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:175)\n", - "[\u001b[1mtardis.io.atom_data.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] Non provided atomic data: synpp_refs, ion_cx_th_data, ion_cx_sp_data (\u001b[1mbase.py\u001b[0m:178)\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:59: 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:59: 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", - "[\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" - ] - }, - { - "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 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", - "[\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" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "[\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 23.02 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": "code", - "execution_count": 5, - "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/site-packages/matplotlib/style/core.py:167: UserWarning: In /Users/wkerzend/.matplotlib/stylelib/talk_default.mplstyle: \n", - "The text.latex.unicode rcparam was deprecated in Matplotlib 2.2 and will be removed in 3.1.\n", - " styles = read_style_directory(stylelib_path)\n", - " (\u001b[1mwarnings.py\u001b[0m:99)\n", - "Populating the interactive namespace from numpy and matplotlib\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/montecarlo/formal_integral.py:167: FutureWarning: Method .as_matrix will be removed in a future version. Use .values instead.\n", - " result = pd.DataFrame(att_S_ul.as_matrix(), index=transitions.transition_line_id.values)\n", - " (\u001b[1mwarnings.py\u001b[0m:99)\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 = $('