def mosaic_algorithm(sfe_ip, test_level_data, can_play_data):
    """
    Determine whether test level contains Mosaic or not
    :param sfe_ip:sfe ip
    :param test_level_data:test level
    :param can_play_data:can play level
    :return:mosaic_result
    """
    specan = Ektsfe(sfe_ip)
    specan.set_level_level_level(str(test_level_data) + " dBm")
    print("set_level_level_level:{}".format(str(test_level_data) + " dBm"))
    logging.info(
        "set_level_level_level:{}".format(str(test_level_data) + " dBm"))
    time.sleep(ekt_cfg.WAIT_FOR_INSTRUMENT_TIME)
    res = stb_tester_execute_testcase(
        ekt_cfg.STB_TESTER_URL, ekt_cfg.BANCH_ID,
        ["tests/front_end_test/testcases.py::test_recored"],
        "auto_front_end_test", "DSD4614iALM")
    print(res)
    write_test_result(
        "{}/ekt_log/mosic_result.txt".format(current_path),
        (time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))) +
        ": " + str(res) + "\r\n")
    if res == False:
        mosaic_algorithm_result = {
            "detect_motion_result": False,
            "detect_mosic_result": "Fail",
            "msg": "picture not move"
        }
        logging.info("level:{}, Mosaic results:fail".format(test_level_data))
        specan = Ektsfe(sfe_ip)
        specan.set_level_level_level(str(can_play_data) + " dBm")
        return mosaic_algorithm_result, "Fail"
    elif res == True:
        dict_result, mosaic_result = gevent_image_classification(
            ekt_cfg.CAPTURE_NUM, ekt_cfg.STB_TESTER_IP)
        # specan = Ektsfe(sfe_ip)
        # specan.set_level_level_level(str(can_play_data) + " dBm")
        print(dict_result, mosaic_result)
        write_test_result(
            "{}/ekt_log/mosic_result.txt".format(current_path),
            (time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))) +
            ": " + json.dumps(dict_result) + "   " + mosaic_result + "\r\n")
        mosaic_algorithm_result = {
            "detect_motion_result": True,
            "detect_mosic_result": mosaic_result,
            "msg": dict_result
        }
        logging.info("level:{}, Mosaic results:{}".format(
            test_level_data, mosaic_result))
        return mosaic_algorithm_result, mosaic_result
Example #2
0
def mosaic_algorithm_noise_cn(sfu_ip, test_cn_data, can_play_data):
    """
    judge if test CN contains mosaics
    :param sfu_ip: sfu ip
    :param test_cn_data:  test CN
    :param can_play_data: can play CN
    :return:mosaic_algorithm_result
    """
    specan = Ektsfu(sfu_ip)
    specan.set_noise_awgn_cn(str(test_cn_data))
    print ("set_noise_awgn_cn:{}".format(str(test_cn_data)))
    logging.info("set_noise_awgn_cn:{}".format(str(test_cn_data)))
    time.sleep(ekt_cfg.WAIT_FOR_INSTRUMENT_TIME)
    res = stb_tester_execute_testcase(ekt_cfg.STB_TESTER_URL, ekt_cfg.BANCH_ID,
                                      ["tests/front_end_test/testcases.py::test_recored"],
                                      "auto_front_end_test", "DSD4614iALM")
    print (res)
    if res == False:
        mosaic_algorithm_result = {
            "detect_motion_result": False,
            "detect_mosic_result": "Fail",
            "msg": "picture not move"
        }
        logging.info("noise_cn:{}, Mosaic results:fail".format(test_cn_data))
        specan = Ektsfu(sfu_ip)
        specan.set_noise_awgn_cn(str(can_play_data))
        return mosaic_algorithm_result
    elif res == True:
        dict_result, mosaic_result = gevent_image_classification(ekt_cfg.CAPTURE_NUM, ekt_cfg.STB_TESTER_IP)
        # specan = Ektsfu(sfu_ip)
        # specan.set_noise_awgn_cn(str(can_play_data))
        print (dict_result, mosaic_result)
        mosaic_algorithm_result = {
            "detect_motion_result": True,
            "detect_mosic_result": mosaic_result,
            "msg": dict_result
        }
        logging.info("noise_cn:{}, Mosaic results:{}".format(test_cn_data, mosaic_result))
        return mosaic_algorithm_result