Exemple #1
0
def get_log_file_name() -> str:
    """
    Get the full path to the log file currently used.
    """
    return os.path.join(get_qcodes_user_path(),
                        LOGGING_DIR,
                        generate_log_file_name())
Exemple #2
0
def start_command_history_logger(log_dir: Optional[str] = None) -> None:
    """
    Start logging of the history of the interactive command shell.
    Works only with IPython and Jupyter. Call function again to set new path
    to log file.

    Args:
        log_dir: directory where log shall be stored to. If left out, defaults
            to ``~/.qcodes/logs/command_history.log``
    """
    from IPython import get_ipython
    ipython = get_ipython()
    if ipython is None:
        log.warning("Command history can't be saved"
                    " outside of IPython/Jupyter")
        return

    log_dir = log_dir or os.path.join(get_qcodes_user_path(), LOGGING_DIR)
    filename = os.path.join(log_dir, HISTORY_LOG_NAME)
    os.makedirs(os.path.dirname(filename), exist_ok=True)

    ipython.magic("%logstop")
    ipython.magic("%logstart -t -o {} {}".format(filename, "append"))
    log.info("Started logging IPython history")
Exemple #3
0
from qcodes.instrument.parameter import (Parameter, ManualParameter,
                                         DelegateParameter, _BaseParameter)
import qcodes.utils.validators as validators
from qcodes.monitor.monitor import Monitor

from qcodes.actions import _actions_snapshot

log = logging.getLogger(__name__)

PARAMETER_ATTRIBUTES = [
    'label', 'unit', 'scale', 'inter_delay', 'post_delay', 'step', 'offset'
]

SCHEMA_TEMPLATE_PATH = os.path.join(get_qcodes_path('dist', 'schemas'),
                                    'station-template.schema.json')
SCHEMA_PATH = get_qcodes_user_path('schemas', 'station.schema.json')
STATION_YAML_EXT = '*.station.yaml'


def get_config_enable_forced_reconnect() -> bool:
    return qcodes.config["station"]["enable_forced_reconnect"]


def get_config_default_folder() -> Optional[str]:
    return qcodes.config["station"]["default_folder"]


def get_config_default_file() -> Optional[str]:
    return qcodes.config["station"]["default_file"]