utils
– Utilities¶
Collection of utility variables and functions
Variables¶
-
libvhc.utils.
generic_virus_match
= '*virus/[0-9]*[a-z].fits'¶ Wildcard match for virus file
-
libvhc.utils.
recipe_match
= {}¶ Map between recipe name and the corresponding fits file names. Filled when loading the recipes
-
libvhc.utils.
default_drivers
= {}¶ Default drivers for every recipe. Filled when loading the recipes
-
libvhc.utils.
EXTRA_KEY
= 'VHCVERS'¶ When the VHC header keywords are saved in FITS files add one with the version of VHC used
-
libvhc.utils.
EXTRA_VALUE
= '1.0.0'¶ Version of VHC used
-
libvhc.utils.
EXTRA_COMMENT
= 'Latest VHC version used'¶ Comment attached to the header keyword
Get channel, amplifier and ids¶
-
libvhc.utils.
get_fplane
()[source]¶ Returns, creating it first if necessary, an instance of
FPlane
. The name of the fplane file is take from the configuration file section[fplane]
and optionfplane_file
.Returns:
-
libvhc.utils.
channel
(fname, section='DEFAULT')[source]¶ Extract the channel from the file name using regular expression matching.
The regex comes from the
re_pattern_ch
configuration entry.Parameters: - fname : string
name of the from which to extract the channel
- section : string, optional
name of the section containing the match.
Returns: - string
name of the channel
-
libvhc.utils.
amplifier
(fname, section='DEFAULT')[source]¶ Extract the amplifier from the file name using regular expression matching.
The regex comes from the
re_pattern_amp
configuration entry.Parameters: - fname : string
name of the from which to extract the channel
- section : string, optional
name of the section containing the match.
Returns: - string
name of the amplifier
-
libvhc.utils.
ifuslot
(fname, section='DEFAULT')[source]¶ Extract the slot id from the file name using regular expression matching.
The regex comes from the
re_pattern_id
configuration entry.Parameters: - fname : string
name of the from which to extract the channel
- section : string, optional
name of the section containing the match.
Returns: - string
slotid
Other utilities¶
-
libvhc.utils.
extra_value_with_conf_revision
(conf)[source]¶ If the
write_vhc_config_revision
option of the[headerkeys]
configuration section is set toyes
/true
, the revision number is extracted from the import configuration and added toEXTRA_VALUE
.Parameters: - conf : instance of
configparser.ConfigParser
configuration object
Returns: - _extra_value : string
extended version number
- conf : instance of
-
libvhc.utils.
common_parser_arguments
()[source]¶ Return a command line parser without help nor description. Useful for as parent parser.
Returns: - parser :
argparse.ArgumentParser
- parser :