The SKIRT project
advanced radiative transfer for astrophysics
Creating resources and resource packs

Introduction

SKIRT offers many "built-in" simulation components that require a significant amount of data, such as source spectra or optical medium properties. This information is loaded from external resource files located next to the SKIRT executable. The available resource files are bundled in resource packs which can be downloaded and installed separately from the source code (see Download the SKIRT resource files). The Core resource pack is obligatory; the other packs are optional so that users can avoid using disk space for resources that are not used in their simulations.

Most resource files are distributed in the binary "stored table" file format with the ".stab" filename extension. The use of this SKIRT-specific file format avoids implementing a plethora of input data formats in SKIRT and allows efficient loading of the file contents. As a result, resource data obtained from third parties must be converted to stored table format before being included in a resource pack. Resource packs are simply ZIP archives.

In conjunction with the download procedure, SKIRT implements a versioning system for resource packs. A resource pack advertises its version number as part of its file name and in a tiny text file enclosed in the pack. On the other hand, the SKIRT code includes a text file listing the expected version for each of the known resource packs. This way, SKIRT can log an error or warning message if there is a mismatch between the expected and installed versions.

Within the SKIRT code, resource files are identified by their filename, without any directory or path information. In other words, a resource file can be located in any (nested) subdirectory of a resource pack. On the other hand, this means that resource file names must be unique across all resource packs.

The Resources9 directory contains the orginal data obtained from a third party where applicable, the corresponding "stored table" files consumed by SKIRT, the resource packs to be made available for public download, the specifications for converting between these formats, and the procedures for publishing the resource packs to the SKIRT data file server.

Specifying a SKIRT resource

As indicated in the introduction, the input data for a resource is often available in a file format not under the control of the SKIRT team. Such data needs to be converted to stored table format.

Each (nested) subdirectory of the Resources9/OriginalData directory contains the following files:

  • A Notes.txt text file with free format documentation on the source of the data.
  • A ConversionSpec.txt text file specifying the conversion mechanism for the resource data, including input and output file names.
  • Any required input files, possibly in one or more subdirectories.

The conversion specification drives the corresponding conversion functions found in the pts.storedtable package. A copy function is provided to handle cases where no conversion is needed. The output of the conversion operation is always stored in a subdirectory of the Resources9/StoredTables directory.

For more information, see:

Constructing a SKIRT resource

Once a SKIRT resource is properly specified as described in the previous section, it can be constructed using the PTS command "construct_skirt_resources". For example:

$ pts construct_skirt_resource --help
   ...
   positional arguments:
     ...
     subDirectory          name of subdirectory to process or . for all
     ...
$
$ pts construct_skirt_resource Sun
   Starting storedtable/construct_skirt_resources...
   Starting set Sun of 1 conversion specs
   Performing conversion spec Sun
   Created stored table file: /Users/.../SKIRT/Resources9/StoredTables/SED/SunSED.stab
   Finished set of conversion specs
   Finished storedtable/construct_skirt_resources.
$
$ pts construct_skirt_resource .
   ...
$

For more information, see pts.storedtable.do.construct_skirt_resources.

Specifying a SKIRT resource pack

As indicated in the introduction, SKIRT resources are bundled in resource packs for distribution to users. The Resources9/Publish/Definitions directory contains the resource pack specification. Each specification directory contains the following files:

  • version.txt : the current version number of the resource pack
  • include.txt : a list of names, relative to Resources9/StoredTables, for directories containing the resource files to be included in the resource pack
  • history.txt : a free form text file briefly describing the contents of the resource pack and the changes to each version

For more information, see pts.admin.do.create_resource_archives.

Creating a SKIRT resource pack

To actually create resource packs from their specification, use the PTS command "create_resource_archives". Without arguments, the command creates a resource pack for all available specifications. Use the –name option to create just a single resource pack. For example:

$ pts create_resource_archives --help
   ...
   optional arguments:
     -h, --help            show this help message and exit
     --name <str>          create only the resource archive with this name (default: )
$
$ pts create_resource_archives --name ExtraDust
   Starting admin/create_resource_archives...
   Creating archive /Users/.../SKIRT/Resources9/Publish/Archives/SKIRT9_Resources_ExtraDust_v3.zip...
     Including version.txt
     Including history.txt
     Including OpticalProps_Extra/BegemannPorousAluminaOpticalProps.stab
     Including OpticalProps_Extra/HofmeisterPericlaseOpticalProps.stab
     Including OpticalProps_Extra/DorschnerOlivineOpticalProps.stab
   Finished admin/create_resource_archives.
$

The resulting ZIP archives are placed in the Resources9/Publish/Archives directory. It is important to leave previous resource pack versions in that directory until you are confident that they are no longer required by any SKIRT user.

For more information, see pts.admin.do.create_resource_archives.

Publishing resource packs

To publish resource packs to the Ghent University data file server, run the publishResources9.sh shell script with Resources9/Publish as the default directory.

For more information, see