The SKIRT project
advanced radiative transfer for astrophysics
Functions
pts.skiupgrade.skiupgrade Namespace Reference

Contains the upgradeSkiFile function for upgrading SKIRT parameter files. More...

Functions

def _addMediumSystemOptions (optionsTypeName, oldTypeName, oldPropName=None)
 
def _addScalarProperty (typeName, propName, propStringValue)
 Add a scalar property to a given type. More...
 
def _adjustDustSelfAbsorptionMode ()
 
def _adjustLyaExtinctionMode ()
 
def _changeBooleanToEnumeration (typeName, oldPropName, newPropName, newValueForFalse, newValueForTrue)
 Change Boolean property to enumeration property. More...
 
def _changeCompoundPropertyBaseType (typeName, propName, oldBaseType, newBaseType)
 Change the base type of a compound property for a given type. More...
 
def _changeCompoundPropertyName (typeName, oldPropName, newPropName)
 Change the name of a compound property for a given type. More...
 
def _changeScalarPropertyName (typeName, oldPropName, newPropName)
 Change the name of a scalar property for a given type. More...
 
def _changeToFormProbe (oldProbeName, probeName, formName, probeProps, formProps)
 
def _changeTypeName (oldTypeName, newTypeName)
 Rename a given type. More...
 
def _copyCompoundProperty (oldTypeName, oldPropName, newTypeName)
 Copy a compound property and its value from one type to another (the target type is assumed to exist) More...
 
def _getUpgradeDefinitions ()
 This private function returns a sequence of 2-tuples, each defining the XPath condition and XSLT template for a single modification to the ski file format. More...
 
def _moveScalarProperty (oldTypeName, oldPropName, newTypeName, newPropName=None)
 Move a scalar property and its value from one type to another, optionally using a new property name on the target type (the target type is assumed to exist). More...
 
def _removeCompoundProperty (typeName, oldPropName)
 Remove a compound property from a given type. More...
 
def _removeScalarProperty (typeName, oldPropName)
 Remove a scalar property from a given type. More...
 
def _removeScalarPropertyWithValue (typeName, oldPropName, oldValue)
 Remove a scalar property with a value starting with a given string from a given type. More...
 
def upgradeSkiFile (inpath, *backup=True, replace=True)
 This function upgrades the specified SKIRT 9 parameter file (ski file) so that it becomes appropriate for the latest SKIRT 9 version. More...
 

Detailed Description

Contains the upgradeSkiFile function for upgrading SKIRT parameter files.

The upgradeSkiFile function in this module allows upgrading SKIRT parameter files (ski files) between versions of SKIRT 9.

Function Documentation

◆ _addScalarProperty()

def pts.skiupgrade.skiupgrade._addScalarProperty (   typeName,
  propName,
  propStringValue 
)
private

Add a scalar property to a given type.

◆ _changeBooleanToEnumeration()

def pts.skiupgrade.skiupgrade._changeBooleanToEnumeration (   typeName,
  oldPropName,
  newPropName,
  newValueForFalse,
  newValueForTrue 
)
private

Change Boolean property to enumeration property.

◆ _changeCompoundPropertyBaseType()

def pts.skiupgrade.skiupgrade._changeCompoundPropertyBaseType (   typeName,
  propName,
  oldBaseType,
  newBaseType 
)
private

Change the base type of a compound property for a given type.

◆ _changeCompoundPropertyName()

def pts.skiupgrade.skiupgrade._changeCompoundPropertyName (   typeName,
  oldPropName,
  newPropName 
)
private

Change the name of a compound property for a given type.

◆ _changeScalarPropertyName()

def pts.skiupgrade.skiupgrade._changeScalarPropertyName (   typeName,
  oldPropName,
  newPropName 
)
private

Change the name of a scalar property for a given type.

◆ _changeTypeName()

def pts.skiupgrade.skiupgrade._changeTypeName (   oldTypeName,
  newTypeName 
)
private

Rename a given type.

◆ _copyCompoundProperty()

def pts.skiupgrade.skiupgrade._copyCompoundProperty (   oldTypeName,
  oldPropName,
  newTypeName 
)
private

Copy a compound property and its value from one type to another (the target type is assumed to exist)

◆ _getUpgradeDefinitions()

def pts.skiupgrade.skiupgrade._getUpgradeDefinitions ( )
private

This private function returns a sequence of 2-tuples, each defining the XPath condition and XSLT template for a single modification to the ski file format.

Using XSLT is extremely flexible, but unfortunately the XSLT language is fairly obscure an thus has a steep learning curve. To alleviate this problem to some extent, we provide a set of functions that generate upgrade definitions for specific types of changes, such as, for example, changing the name of a property. That way, as soon as the XSLT sheet for a particular type of change has been developed, it can be more easily reused for other, similar changes. As a result, this function consists of a sequence of calls to definition generators. New generators will have to be added as the need arises.

The comments before each set of generator calls identifies the change in the SKIRT 9 code requiring the corresponding ski file modification(s).

◆ _moveScalarProperty()

def pts.skiupgrade.skiupgrade._moveScalarProperty (   oldTypeName,
  oldPropName,
  newTypeName,
  newPropName = None 
)
private

Move a scalar property and its value from one type to another, optionally using a new property name on the target type (the target type is assumed to exist).

◆ _removeCompoundProperty()

def pts.skiupgrade.skiupgrade._removeCompoundProperty (   typeName,
  oldPropName 
)
private

Remove a compound property from a given type.

◆ _removeScalarProperty()

def pts.skiupgrade.skiupgrade._removeScalarProperty (   typeName,
  oldPropName 
)
private

Remove a scalar property from a given type.

◆ _removeScalarPropertyWithValue()

def pts.skiupgrade.skiupgrade._removeScalarPropertyWithValue (   typeName,
  oldPropName,
  oldValue 
)
private

Remove a scalar property with a value starting with a given string from a given type.

◆ upgradeSkiFile()

def pts.skiupgrade.skiupgrade.upgradeSkiFile (   inpath,
backup = True,
  replace = True 
)

This function upgrades the specified SKIRT 9 parameter file (ski file) so that it becomes appropriate for the latest SKIRT 9 version.

The upgrade process supports all ski files created by the SKIRT project version 9 tools (including the SKIRT command line Q&A and the graphical MakeUp wizard) since SKIRT 9 was publicly released. Ski files created for older SKIRT versions (such as SKIRT 7 and 8) cannot be upgraded to SKIRT 9 automatically. The function logs an appropriate error message when an unsupported file is specified.

The function accepts three arguments:

  • inpath: the absolute or relative path to the ski file to be handled; the filename extension should be ".ski"
  • backup: if the input ski file needs upgrading and backup is True (the default), a copy of the input ski file is created with a filename including a time stamp and ending with "_backupski.xml"
  • replace: if the input ski file needs upgrading and replace is True (the default), the input ski file is overwritten by the upgraded version; otherwise it is saved as a new file using a similar filename ending with "_upgradedski.xml"