Exemplo n.º 1
0
def record(
    output_path,
    mode,
    duration,
    force_overwrite,
    no_calib,
    voltage,
    load,
    ldo_voltage,
    ldo_mode,
    start_time,
    warn_only,
):
    run_record(
        output_path=Path(output_path),
        mode=mode,
        duration=duration,
        force_overwrite=force_overwrite,
        no_calib=no_calib,
        harvesting_voltage=voltage,
        load=load,
        ldo_voltage=ldo_voltage,
        ldo_mode=ldo_mode,
        start_time=start_time,
        warn_only=warn_only,
    )
Exemplo n.º 2
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")
Exemplo n.º 3
0
def record(
    output,
    mode,
    length,
    force,
    no_calib,
    voltage,
    load,
    init_charge,
    start_time,
):
    pl_store = Path(output)
    if pl_store.is_dir():
        pl_store = pl_store / "rec.h5"

    run_record(
        pl_store,
        mode,
        length,
        force,
        no_calib,
        voltage,
        load,
        init_charge,
        start_time,
    )
Exemplo n.º 4
0
def record(
    output_path,
    mode,
    duration,
    force_overwrite,
    no_calib,
    start_time,
    warn_only,
):
    run_record(
        output_path=Path(output_path),
        mode=mode,
        duration=duration,
        force_overwrite=force_overwrite,
        no_calib=no_calib,
        start_time=start_time,
        warn_only=warn_only,
    )
Exemplo 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")
Exemplo 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")