Exemple #1
0
#!/usr/bin/python
# -*- coding: utf-8 -*-

import sys
import core.core_logging as log
import funtion.common as common
import os

logging = log.get_logger()

url = sys.argv[1]  # 服务地址
count = int(sys.argv[2])  # 测试次数

logging.info("-------------- 开始测试 ---------------")

logging.info("获取测试用例数据解析")
sheet = common.get_excel_sheet(os.path.abspath(os.getcwd()) + common.FILE_NAME)

logging.info("数据解析准备")
common.prepare_data()

logging.info("测试用例执行中")
if len(sys.argv) == 1:
    res = common.run_test(sheet, url)
else:
    for i in range(count):
        temp = str(i)
        print("-------------- 第 " + temp + " 次测试开始---------------")
        logging.info("-------------- 第 %d 次测试---------------", i)
        res = common.run_test(sheet, url)
        print("-------------- 第 " + temp + " 次测试结束---------------")
Exemple #2
0
#
# Author:
#     Mateusz Kruszyński <*****@*****.**>

import sys
#export PYTHONPATH=../../../:../../../openbci/:PYTHONPATH
sys.path.insert(1, '../../../')
sys.path.insert(1, '../../../openbci/')

import os.path
import math
from openbci.offline_analysis.obci_signal_processing import read_manager
import trigger_change
from core import core_logging as logger

LOGGER = logger.get_logger("trigger_analysis", "debug")

from pylab import *


def compare_send_and_received(sent_vals, sent_tss, rcv_vals, rcv_tss, f_name):
    sent_vals = sent_vals[1:]
    sent_tss = sent_tss[1:]
    rcv_vals = rcv_vals[1:]
    rcv_tss = rcv_tss[1:]
    if not sent_vals == [(x + 1) % 2 for x in rcv_vals]:
        LOGGER.error(''.join([
            "Values of the trigger received from amplifier are different from values sent to serial port.",
            " Received values length: ",
            str(len(rcv_vals)), ". Sent values length: ",
            str(len(sent_vals)), ". Processing aborted!"
Exemple #3
0
#
# Author:
#     Mateusz Kruszyński <*****@*****.**>

import os.path
import sys


# Set to true to run tests not using mx
TEST = False

if not TEST:
    try:
        from openbci.offline_analysis.obci_signal_processing import read_manager
        from core import core_logging as logger
        LOGGER = logger.get_logger("trigger_change", "debug")
    except ImportError, e:
        print(e)
        print("Set obci python path. If you are in current dir RUN: export PYTHONPATH=../../../:../../../openbci/:PYTHONPATH")
        sys.exit(1)

def get_trigger_sent_timestamps(p_read_mgr, p_asci_file_path=None):
    """
    Parameters:
    p_read_mgr - read manager with file with tags named 'trigger'
    or
    p_asci_file_path - a file with asci file with every line in format: 
                       start_trig_change(float) end_trig_change(float) trig_value(float)
    Return:
    a, b where:
    a - a list of subsequent trigger values
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# Author:
#     Mateusz Kruszyński <*****@*****.**>

import sys
#export PYTHONPATH=../../../:../../../openbci/:PYTHONPATH
sys.path.insert(1, '../../../')
sys.path.insert(1, '../../../openbci/')

import os.path
import math
from openbci.offline_analysis.obci_signal_processing import read_manager
import trigger_change
from core import core_logging as logger
LOGGER = logger.get_logger("trigger_analysis", "debug")

from pylab import *
def compare_send_and_received(sent_vals, sent_tss, rcv_vals, rcv_tss, f_name):
    sent_vals = sent_vals[1:]
    sent_tss = sent_tss[1:]
    rcv_vals = rcv_vals[1:]
    rcv_tss = rcv_tss[1:]
    if not sent_vals == [(x + 1) % 2 for x in rcv_vals]:
        LOGGER.error(''.join(["Values of the trigger received from amplifier are different from values sent to serial port.",
                              " Received values length: ", str(len(rcv_vals)),
                              ". Sent values length: ", str(len(sent_vals)),
                              ". Processing aborted!"]))
        sys.exit(1)

    tss_diff = [rcv_tss[i] - a for i, a in enumerate(sent_tss)]
# Author:
#     Mateusz Kruszyński <*****@*****.**>

import os.path
import sys


# Set to true to run tests not using mx
TEST = False

if not TEST:
    try:
        from openbci.offline_analysis.obci_signal_processing import read_manager
        from core import core_logging as logger

        LOGGER = logger.get_logger("trigger_change", "debug")
    except ImportError, e:
        print(e)
        print(
            "Set obci python path. If you are in current dir RUN: export PYTHONPATH=../../../:../../../openbci/:PYTHONPATH"
        )
        sys.exit(1)


def get_trigger_sent_timestamps(p_read_mgr, p_asci_file_path=None):
    """
    Parameters:
    p_read_mgr - read manager with file with tags named 'trigger'
    or
    p_asci_file_path - a file with asci file with every line in format: 
                       start_trig_change(float) end_trig_change(float) trig_value(float)