LSSTApplications
19.0.0-14-gb0260a2+d60062ef16,20.0.0+1540ce6389,20.0.0+7c6b12c2f9,20.0.0+ae956f52c5,20.0.0+be870186d9,20.0.0+e2e26847c2,20.0.0-1-g10df615+7683e4f082,20.0.0-1-g253301a+7c6b12c2f9,20.0.0-1-g2b7511a+46a6078777,20.0.0-1-g3dda6ea+606b36f8c0,20.0.0-1-g4d801e7+901ee84527,20.0.0-1-g5b95a8c+a5fa15ec54,20.0.0-1-gb058bd0+46a6078777,20.0.0-1-gb88604f+acecce4127,20.0.0-1-gc96f8cb+61a4a056b1,20.0.0-1-gedffbd8+4f0e391d5e,20.0.0-10-g0891cd99+aadc987f3e,20.0.0-10-g9a20bd332+576ca7b471,20.0.0-17-gcdbda88+ed0d4927ab,20.0.0-2-g4dae9ad+61a4a056b1,20.0.0-2-g61b8584+85c46248f3,20.0.0-2-gb780d76+f45b7d88f4,20.0.0-2-gf072044+7c6b12c2f9,20.0.0-21-g9bbb7f7+61a4a056b1,20.0.0-22-gc512666+9eba1c4719,20.0.0-23-g8900aa8+68630f7098,20.0.0-3-g1653f94+85c46248f3,20.0.0-3-g4cc78c6+63636aeed8,20.0.0-3-g750bffe+e05f822de9,20.0.0-3-gbd60e8c+ff10c6d78d,20.0.0-32-g15a0e07c+ff1c9f120b,20.0.0-4-g97dc21a+68630f7098,20.0.0-4-gfea843c+f45b7d88f4,20.0.0-5-g357b56b+f45b7d88f4,20.0.0-6-g9a5b7a1+2c4171520d,20.0.0-61-g4de25fb+e4dd172200,20.0.0-7-gcda7bf1+85e953d7e4,w.2020.43
LSSTDataManagementBasePackage
|
PAF is an LSST-specific format for Policy data that is optimized for human editing. It is very similar to property files commonly used in Java and Unix applications. A simple example might look like this:
#<?cfg paf policy ?> # # this is a comment # standalone: true # a boolean parameter (value is true or false) filter.threshold: 32.5 # a double parameter filter.maxIterations: 13 # an integer parameter label: Special Filter # a string value
Fuller examples can be in examples/policies
directory; see the files ending in the .paf extension.
It is recommended, but not required, that the first line of the policy file contain a content identifier: "#<?cfg paf policy ?>"
This line signals to the Policy framework that the file contains policy parameter names and values in PAF format, so that it can choose the proper parser. If this line does not appear, the framework can usually recognize the format either from the file extension (.paf) or from the first parameter definition.
One can be fairly liberal with the use of spacing. The following is legal:
standalone : true filter.threshold : 32.5 filter.maxIterations: 13 label : Special Filter # a string value
It is illegal to insert spaces within a parameter name.
Everything left of the first colon (:) is the parameter name which can either be a so-called "top-level" parameter name–one that contains no periods (.)–or a hierarchical name. Each field delimited by dots must begin with a letter and as a whole contain only letters or numbers. The following are legal names:
width Width WIDTH image2jpeg.cmd convolve.gauss1.width convolve.gauss2.width
The usual IEEE formats for floating point numbers are supported:
convolve.gauss1.width: 1.2 convolve.gauss2.width: 0.9 convolve.gauss1.width: .22 convolve.gauss2.width: 1.457e-02 convolve.gauss3.width: 1e-3
The strings true
and false
are recognized as boolean values:
standalone: true verbose: false
If you want a string value set to either "true"
or "false"
, enclose the value in quotes (see next section):
# These are string values, NOT booleans standalone: "true" verbose: "false"
Variations with different letter cases are not recognized as booleans; instead, they will be interpreted as strings:
# These are NOT booleans; they are loaded as strings standalone: True verbose: FALSE
A string value can be indicated by enclosing the value in double or single quotes (" or '). Single quotes can be used if the value is to explicitly include a double quote, and vice versa. The quotes can be omitted if the value...
The following are legal string-valued parameters:
label1: select a function label2: width label3: 'target image' label4: "the center's position" choices: "gaussian" 'box' "airy" # a 3-element array of string values help: "A long explanation can span across multiple lines as long as the value is enclosed in quotes. When multi-line values are parsed, each new-line character and its surrounding spaces will be replaced with a single space."
Array valued parameters can be formatted in one of two ways. They can either be placed one line, delimited by spaces:
standalone: true true false # boolean array filter.threshold: 32.5 0.9 .22 1.457e-02 # double array filter.maxIterations: 13 21 27 50 # integer array label: "joe" "fred" "evelyn" # a string value
or they can be broken up across several lines:
filter.threshold: 32.5 0.9 filter.threshold: .22 filter.threshold: 1.457e-02
In both examples above, "filter.threshold" will contain a 4-element array.
It is illegal to mix types within an array. It is also an error to separate array values with characters other than spaces (e.g. commas):
# ILLEGAL! filter.threshold: 3 4.7 # mixed types! graph.minimum: 5 graph.minimum: 3.2 # changed types! filter.threshold: 3, 4.7 # don't use commas! graph.labels: "x", "y" # don't use commas!
Hierarchical parameters can be indicated in two ways. The short hand version shown thus far captures the hierarchy in the parameter name with the use of dots (.):
filter.threshold: 32.5 # a double parameter filter.maxIterations: 13 # an integer parameter
In this example the name "filter" implicitly resolves to a Policy value–a set of named parameters–containing 2 parameters, "threshold" and "maxIterations". This can alternatively be written explicitly:
filter: { threshold: 32.5 maxIterations: 13 }
In this latter form, the "sub-parameters" must each be on a separate line. The can however share a line with the opening or closing brace:
filter: { threshold: 32.5 maxIterations: 13 }
Note that the opening brace must be on the same line as the Policy name:
# ILLEGAL! filter: { threshold: 32.5 maxIterations: 13 }
Note also that once you establish that a name is at the root of a hierachy (i.e. that it is of type Policy), it is illegal to assign another type to it:
filter.threshold: 32.5 filter: "Airy" # ERROR! Type for filter has changed!
It is possible to have an array of sub-Policies accessible via a single name. The way to accomplish this in the policy file is to repeat the use of the parameter name, giving each a different set of values:
filter: { threshold: 2.5 maxIterations: 150 } filter: { threshold: 32.5 maxIterations: 13 } filter: { threshold: 35.0 maxIterations: 13 }
If a parameters value starts with an at sign (@), the value type is assumed to be a Policy and the string following the @ is interpreted to be either a file path or URN. When parsed via (createParser()), an attempt will be made to open that file and read the contents as Policy. Each of the parameters given there will be assumed to be sub-parameters under the name given in the first policy file. For example, suppose a policy file contains:
filter: @filter_policy.paf
and the file filter_policy.paf contains:
threshold: 32.5 maxIterations: 13
This would be equivalent to the following defined in a single file:
filter.threshold: 32.5 filter.maxIterations: 13
By default, the createPolicy(policyFile) function will look for the referenced Policy files under the same directory as the original Policy file. Alternatively, you can pass an additional pathname to the function that will be assumed to contain the policy files to be included, e.g.:
p = Policy.createPolicy("policy.paf", "examples/policies")
If a parameters value starts with "@urn:eupspkg:", the value type is assumed to be a Policy in a directory that is determined by environment variables. For example:
filter: @urn:eupspkg:some_package:local/repository:path/to/filter.paf
This URN line consists of:
Further, "urn:eupspkg:" can be abbreviated as a second "@":
filter: @@some_package:local/repository:path/to/filter.paf