format_as_list¶
- lsst.ts.standardscripts.format_as_list(value, recurrences)¶
Reformat single instance of the attribute
value
as a list with a specified number of recurrences .Configurations often allow a single value for an attribute to be passed that needs to be replicated as a list. This occurs when the (YAML) type is specified as an array but a user provides a single value (as a float/int/string etc). For example, an instrument setup for 5 different exposure times may only be given a single value for filter. However, often the single filter value needs to be reformatted of a list of length 5.
This function returns the input as a list, with the desired of recurrences.
- Parameters:
- value: `str, float, int, boolean`
A single element of any type. Must not be a list.
- recurrences: `int`
An integer specifying the number of occurrences and length of the returned list
- Returns:
- value_as_list:
list
A list of length
recurrences
, where all elements are the input parametervalue
- value_as_list: