Skip to content

Commit

Permalink
Fixing JSON Schema not Rendering Properly in the Documentation (#1594)
Browse files Browse the repository at this point in the history
* Fixing JSON Schema not rendering in the documentation

* Restructuring the configurational abstract

* Moving the documentation part to relevant sections
  • Loading branch information
DhruvSondhi authored Jun 3, 2021
1 parent 2bba59c commit 44765a4
Show file tree
Hide file tree
Showing 5 changed files with 342 additions and 297 deletions.
58 changes: 42 additions & 16 deletions docs/using/components/configuration/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,29 +50,52 @@ 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.
``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.

The ``abundance`` section again 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.
.. jsonschema:: schemas/model_definitions.yml#/definitions/density/branch85_w7

.. 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.
.. jsonschema:: schemas/model_definitions.yml#/definitions/density/exponential

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/density/power_law

.. jsonschema:: schemas/model_definitions.yml#/definitions/density/uniform


Plasma
Expand Down Expand Up @@ -127,6 +150,10 @@ The ``montecarlo`` section describes the parameters for the Monte Carlo radiatio

.. 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
Expand All @@ -143,8 +170,8 @@ All convergence criteria can be specified separately for the three variables for
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
``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



Expand All @@ -162,10 +189,9 @@ just an integer. Finally, the method option selects the final 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.
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
170 changes: 4 additions & 166 deletions tardis/io/schemas/model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,171 +4,9 @@ additionalProperties: false
properties:
structure:
oneOf:
- $ref: '#/definitions/structure/file'
- $ref: '#/definitions/structure/specific'
- $ref: 'model_definitions.yml#/definitions/structure/specific'
- $ref: 'model_definitions.yml#/definitions/structure/file'
abundances:
oneOf:
- $ref: '#/definitions/abundances/file'
- $ref: '#/definitions/abundances/uniform'

definitions:
density:
branch85_w7:
type: object
additionalProperties: false
properties:
type:
enum:
- branch85_w7
w7_time_0:
type: quantity
default: 0.000231481 day
description: This needs no change - DO NOT TOUCH
w7_rho_0:
type: quantity
default: 3e29 g/cm^3
description: This needs no change - DO NOT TOUCH
w7_v_0:
type: quantity
default: 1 km/s
description: This needs no change - DO NOT TOUCH
exponential:
type: object
additionalProperties: false
properties:
type:
enum:
- exponential
time_0:
type: quantity
description: Time at which the pure model densities are right
rho_0:
type: quantity
description: density at time_0
v_0:
type: quantity
description: at what velocity the density rho_0 applies
required:
- rho_0
- v_0
power_law:
type: object
additionalProperties: false
properties:
type:
enum:
- power_law
time_0:
type: quantity
description: Time at which the pure model densities are right
rho_0:
type: quantity
description: density at time_0
v_0:
type: quantity
description: at what velocity the density rho_0 applies
exponent:
type: number
description: exponent for exponential density profile
required:
- rho_0
- v_0
- exponent
uniform:
type: object
additionalProperties: false
properties:
type:
enum:
- uniform
time_0:
type: quantity
description: Time at which the pure model densities are right
value:
type: quantity
description: value for uniform density
required:
- value
structure:
file:
type: object
additionalProperties: false
properties:
type:
enum:
- file
filename:
type: string
description: file name (with path) to structure model
filetype:
type: string
enum:
- simple_ascii
- artis
- cmfgen_model
description: file type
v_inner_boundary:
type: quantity
default: -1 km/s
description: location of the inner boundary chosen from the model
v_outer_boundary:
type: quantity
default: -1 km/s
description: location of the inner boundary chosen from the model
required:
- filename
- filetype
specific:
type: object
additionalProperties: false
properties:
type:
enum:
- specific
velocity:
type: object
properties:
start:
type: quantity
stop:
type: quantity
num:
type: number
multipleOf: 1.0
description: description of the boundaries of the shells
density:
oneOf:
- $ref: '#/definitions/density/branch85_w7'
- $ref: '#/definitions/density/exponential'
- $ref: '#/definitions/density/power_law'
- $ref: '#/definitions/density/uniform'
required:
- velocity
- density
abundances:
file:
type: object
additionalProperties: false
properties:
type:
enum:
- file
filetype:
type: string
description: type of abundance file to read in
filename:
type: string
description: filename
required:
- filetype
- filename
uniform:
type: object
properties:
type:
enum:
- uniform
additionalProperties:
type: number
minimum: 0
maximum: 1
- $ref: 'model_definitions.yml#/definitions/abundances/file'
- $ref: 'model_definitions.yml#/definitions/abundances/uniform'
Loading

0 comments on commit 44765a4

Please sign in to comment.