USER_CONFIG_DIR=os.path.join(os.path.expanduser("~"),".openflexure")#: str: Default path of the user-config directory, containing runtime-config and calibration files. Obtained from ``os.path.join(os.path.expanduser("~"), ".openflexure")``.
USER_CONFIG_FILE=os.path.join(USER_CONFIG_DIR,"microscoperc.yaml")#: str: Default path of the user microscoperc.yaml runtime-config file. Obtained from ``os.path.join(USER_CONFIG_DIR, "microscoperc.yaml")``
TYPES={
'stream_resolution':tuple,
'video_resolution':tuple,
'image_resolution':tuple,
'numpy_resolution':tuple,
'jpeg_quality':int,
'analog_gain':float,
'digital_gain':float,
}#: dict: Dictionary of expected types for common config parameters. Used by ``convert_config()``.
withopen(DEFAULT_CONFIG_PATH,'r')asdefaultrc:
DEFAULT_CONFIG=defaultrc.read()
defconvert_config(config:dict)->dict:
"""
Convert datatype of top-level config parameters based on the global TYPES dictionary.
classOpenflexureConfig():
expandable_keys=[
'picamera_settings',
'openflexure_stage_settings',
]#: List of keys that can be passed as a file path string and expanded automatically
Args:
config (dict): Dictionary representation of a loaded runtime-config.