Wednesday, May 13, 2015

A New Format For Galacticus Parameter Files

As part of the Galacticus v0.9.4 development, we've introduced a major change in the structure of Galacticus parameter files. This change provides three improvements:
  1. Allows for more compact XML;
  2. Makes associations between groups of parameters more clear (and prevents the need for extremely long parameter names!);
  3. Paves the way for more complete object composition within Galacticus defined directly through the XML parameter file.
As an example, here's the old format for parameter files showing setting of cosmological parameters:

 <parameters>
  <version>0.9.3</version>
  <!-- Cosmological parameters -->
  <parameter>
    <name>cosmologyParametersMethod</name>
    <value>simple</value>
  </parameter>
  <parameter>
    <name>H_0</name>
    <value>70.2</value>
  </parameter>
  <parameter>
    <name>Omega_Matter</name>
    <value>0.2725</value>
  </parameter>
  <parameter>
    <name>Omega_DE</name>
    <value>0.7275</value>
  </parameter>
  <parameter>
    <name>Omega_b</name>
    <value>0.0455</value>
  </parameter>
  <parameter>
    <name>T_CMB</name>
    <value>2.72548</value>
  </parameter>

</parameters>

In the new format, this same set of parameters is described as:

<parameters>
  <formatVersion>2</formatVersion>
  <version>0.9.4</version>
  <!-- Cosmological parameters and options -->
  <cosmologyParametersMethod value="simple">
    <HubbleConstant  value="70.2"   />
    <OmegaMatter     value="0.2725" />
    <OmegaDarkEnergy value="0.7275" />
    <OmegaBaryon     value="0.0455" />
    <temperatureCMB  value="2.72548"/>
  </cosmologyParametersMethod>

</parameters>

The parameter name is now simply the name of each XML element, and the parameter value is stored as an attribute of the element. (You can also store the value in a <value> element within each parameter if necessary.) In this example, values of the "simple" cosmology parameters method are now specified as subparameters within the cosmologyParametersMethod element itself.

If you have old-format parameter files, you can convert them to the new format using the migration script:

scripts/aux/parametersMigrate.pl oldParametersFile.xml newParametersFile.xml

Internally, this new format will be used to allow detailed construction of objects (e.g. the ability to construct multiple cosmological models each with different sets of cosmology parameters), and, for example, to construct nested sets of filters which can be applied to merger tree construction (e.g. build a tree → measure the tree information content → prune the tree → measure the information content again).