Synopsis
Autonaming is a feature available in various tools for automatically naming an output file based upon the name of an input file.
Description
If the user specifies an output file name for a tool as "." (or more generally, "path/.") and the tool supports autonaming for that filename parameter, the tool will generate an output file name for the user. The name string will include fields from the input file name and a field selected by the tool.
The parameter section of a tool's help file will tell you if a particulat parameter supports the autoname facility: the autoname field will be set to "yes" for the parameter.
The autonaming library function parses an input file name into 4 fields: a path, a name, an extension, and a suffix. The suffix is defined as the part of the filename after (and including) the last '.'. The extension is defined as the part of the filename after (and including) the last '_' up to the suffix.
Some examples:
input file name | path | name | extension | suffix |
---|---|---|---|---|
"path/name_ext.suffix" | "path" | "name" | _ext" | .suffix" |
"path/name.suffix" | "path" | "name" | "" | .suffix" |
"path/name_ext" | "path" | "name" | "_ext" | "" |
The autonamer accepts an "extension" string chosen by the tool, which will be detailed in the description of the parameter. It replaces the parsed extension with this new extension. Thus, if the output name is "/outpath/.", the new extension is "txe", the input filename is "name", and the input suffix is ".fits", we will get "/outpath/name_txe.fits" as the automatic filename.
NOTES
- Autonaming always produces a filename with the same suffix as the input file. Thus, if the input is a ".fits" file, there is no way to generate a name ending in ".lis" by autonaming.
- There are times when the user wants the trailing "_foo" field in an input file name to be preserved. Autonaming will always replace it.
- Autonaming can get confused by DataModel filter specifications in the input filename.