Esempio n. 1
0
def emulate(
    input_path,
    output_path,
    duration,
    force_overwrite,
    no_calib,
    start_time,
    enable_io,
    io_sel_target_a,
    pwr_sel_target_a,
    aux_voltage,
    virtsource,
    warn_only,
):
    if output_path is None:
        pl_store = None
    else:
        pl_store = Path(output_path)

    run_emulate(
        input_path=Path(input_path),
        output_path=pl_store,
        duration=duration,
        force_overwrite=force_overwrite,
        no_calib=no_calib,
        start_time=start_time,
        set_target_io_lvl_conv=enable_io,
        sel_target_for_io=io_sel_target_a,
        sel_target_for_pwr=pwr_sel_target_a,
        aux_target_voltage=aux_voltage,
        settings_virtsource=virtsource,
        warn_only=warn_only,
    )
Esempio n. 2
0
def emulate(
    input_path,
    output_path,
    duration,
    force_overwrite,
    no_calib,
    load,
    ldo_voltage,
    start_time,
    warn_only,
):
    if output_path is None:
        pl_store = None
    else:
        pl_store = Path(output_path)

    run_emulate(
        input_path=Path(input_path),
        output_path=pl_store,
        duration=duration,
        force_overwrite=force_overwrite,
        no_calib=no_calib,
        load=load,
        ldo_voltage=ldo_voltage,
        start_time=start_time,
        warn_only=warn_only,
    )
Esempio n. 3
0
def run(command, parameters: Dict, verbose):

    if verbose is not None:
        if verbose == 0:
            logger.setLevel(logging.ERROR)
        elif verbose == 1:
            logger.setLevel(logging.WARNING)
        elif verbose == 2:
            logger.setLevel(logging.INFO)
        elif verbose > 2:
            logger.setLevel(logging.DEBUG)

    if not isinstance(parameters, Dict):
        raise click.BadParameter(
            f"parameter-argument is not dict, but {type(parameters)} (last occurred with alpha-version of click-lib)"
        )

    if command == "record":
        if "output_path" in parameters.keys():
            parameters["output_path"] = Path(parameters["output_path"])
        run_record(**parameters)
    elif command == "emulate":
        if ("output_path" in parameters.keys()) and (parameters["output_path"]
                                                     is not None):
            parameters["output_path"] = Path(parameters["output_path"])
        if "input_path" in parameters.keys():
            parameters["input_path"] = Path(parameters["input_path"])
        run_emulate(**parameters)
    else:
        raise click.BadParameter(f"command {command} not supported")
Esempio n. 4
0
def emulate(input, output, length, force, no_calib, load, init_charge,
            start_time):
    if output is None:
        pl_store = None
    else:
        pl_store = Path(output)
        if pl_store.is_dir():
            pl_store = pl_store / "rec.h5"
        else:
            pl_store = Path("/var/shepherd/recordings") / output

    run_emulate(input, pl_store, length, force, no_calib, load, init_charge,
                start_time)
Esempio n. 5
0
def run(command, parameters: Dict, verbose):

    if verbose is not None:
        if verbose == 0:
            logger.setLevel(logging.ERROR)
        elif verbose == 1:
            logger.setLevel(logging.WARNING)
        elif verbose == 2:
            logger.setLevel(logging.INFO)
        elif verbose > 2:
            logger.setLevel(logging.DEBUG)

    if not isinstance(parameters, Dict):
        raise click.BadParameter(
            f"parameter-argument is not dict, but {type(parameters)} (last occurred with alpha-version of click-lib)"
        )

    # TODO: test input parameters before - crashes because of wrong parameters are ugly
    logger.info(f"CLI did process run()")
    if command == "record":
        if "output_path" in parameters.keys():
            parameters["output_path"] = Path(parameters["output_path"])
        run_record(**parameters)
    elif command == "emulate":
        if ("output_path" in parameters.keys()) and (parameters["output_path"]
                                                     is not None):
            parameters["output_path"] = Path(parameters["output_path"])
        if "input_path" in parameters.keys():
            parameters["input_path"] = Path(parameters["input_path"])
        emu_translator = {
            "enable_io": "set_target_io_lvl_conv",
            "io_sel_target_a": "sel_target_for_io",
            "pwr_sel_target_a": "sel_target_for_pwr",
            "aux_voltage": "aux_target_voltage",
            "virtsource": "settings_virtsource"
        }
        for key, value in emu_translator.items():
            if key in parameters.keys():
                parameters[value] = parameters[key]
                parameters.pop(key)
        run_emulate(**parameters)
    else:
        raise click.BadParameter(f"command {command} not supported")
Esempio n. 6
0
def run(command, parameters, verbose):

    if verbose is not None:
        if verbose == 0:
            logger.setLevel(logging.ERROR)
        elif verbose == 1:
            logger.setLevel(logging.WARNING)
        elif verbose == 2:
            logger.setLevel(logging.INFO)
        elif verbose > 2:
            logger.setLevel(logging.DEBUG)

    if command == "record":
        if "output" in parameters.keys():
            parameters["output"] = Path(parameters["output"])
        run_record(**parameters)
    elif command == "emulate":
        if "output" in parameters.keys():
            parameters["output"] = Path(parameters["output"])
        if "input" in parameters.keys():
            parameters["input"] = Path(parameters["input"])
        run_emulate(**parameters)
    else:
        raise click.BadParameter(f"command {command} not supported")