Example #1
0
 def _set_stats(self):
     self.critical_stats = Stat()
     self.all_stats = Stat()
     for suite in self.suites:
         suite.set_status()
         self._add_suite_to_stats(suite)
     for test in self.tests:
         self._add_test_to_stats(test)
Example #2
0
 def __init__(self, name, source=None, parent=None):
     _TestAndSuiteHelper.__init__(self, name, parent)
     self.source = source is not None and utils.normpath(source) or None
     self.metadata = utils.NormalizedDict()
     self.suites = []
     self.tests = []
     self.critical = _Critical()
     self.critical_stats = Stat()
     self.all_stats = Stat()
     if parent:
         parent.suites.append(self)
Example #3
0
 def __init__(self, source, destination, network, timeout, debug=False):
     self.src_host, self.src_port = source
     self.dst_host, self.dst_port = destination
     self.socket = network
     self.stat = Stat()
     self.timeout = timeout
     self.debug = debug
Example #4
0
class DataHandler:
    # composition
    calculator = Stat()

    @classmethod
    def get_raw_data(filename):
        """
        get_raw_data(filname) -> dict
        """
        workbook = op.load_workbook(filename)
        ac = workbook.active
        g = ac.rows
        student = dict()
        for name, score in g:
            student[name.value] = score.value

        return student

    def __init__(self):
        # 아직 인스턴스가 만들어지지 않았는데 생성자가 인스턴스 메소드를 호출하는게 논리적으로 맞지 않으므로 수정함
        # 물론 self.으로해도 잘 작동함
        self.year_class = filename.split('_')[1]
        self.raw_data = DataHandler.get_raw_data(filename)
        self.scores = list(self.raw_data.values())
        self.cache = {}

    def get_average(self):
        self.calculator.get_average()
        return avg

    def get_std_dev(self):
        pass
Example #5
0
 def __init__(self):
     # publishing as training data
     self.pub_teleop_vel = rospy.Publisher('train/cmd_vel',
                                           Twist,
                                           queue_size=1)
     self.pub_image = rospy.Publisher('train/image_raw',
                                      Image,
                                      queue_size=1)
     self.pub_intention = rospy.Publisher('train/intention',
                                          String,
                                          queue_size=1)
     self.name = "TeleController"
     # used for quatitive results
     self.stat = Stat(self.name)
Example #6
0
class DataHandler():
    #compostion
    calculater = Stat()

    @classmethod
    def get_raw_data(cls, filename):
        raw_data = {}
        wb = load_workbook(filename)
        ws = wb.active
        g = ws.rows
        for name_cell, scroll_cell in g:
            raw_data[name_cell.value] = scroll_cell.value
        return raw_data

    def __init__(self, filename):
        self.year_class = filename.split('_')[1]
        self.raw_data = DataHandler.get_raw_data(filename)
        self.scores = list(self.raw_data.values())
        self.cache = {}
Example #7
0
class DataHandler:
    evaluator = Stat()

    @classmethod
    def get_data_from_excel(cls, filename):
        """
        get_data_from_excel(filename)->{'name1' : 'score1', 'name2' : 'score2', ...}
        엑셀파일에서 데이터를 가져옵니다.
        반환값은 key가 학생 이름이고 value가 점수인 딕셔너리입니다.
        """
        raw_data = {}
        wb = load_workbook(filename)
        ws = wb.active
        g = ws.rows
        for name_cell, score_cell in g:
            raw_data[name_cell.value] = score_cell.value

        return raw_data

    def __init__(self, filename, year_class):
        self.rawdata = DataHandler.get_data_from_excel(filename)
        self.year_class = year_class
        self.cache = {}

    def get_scores(self):
        if 'scores' not in self.cache:
            self.cache['scores'] = list(self.rawdata.values())
        return self.cache.get('scores')

    def get_average(self):
        if 'average' not in self.cache:
            self.cache['average'] = self.evaluator.get_average(
                self.get_scores())
        return self.cache.get('average')

    def get_variance(self):
        if 'variance' not in self.cache:
            self.cache['variance'] = self.evaluator.get_variance(
                self.get_scores(), self.get_average())
        return self.cache.get('variance')

    def get_standard_deviation(self):
        if 'standard_deviation' not in self.cache:
            self.cache['standard_deviation'] = self.evaluator.get_std_dev(
                self.get_variance())
        return self.cache.get('standard_deviation')

    def evaluate_class(self, total_avrg, sd):
        """
        evaluate_class(total_avrg, sd)->None
        total_avrg : 학년 전체 성적 평균
        sd : 원하는 표준편차 기준
        """
        avrg = self.get_average()
        std_dev = self.get_standard_deviation()

        if avrg < 50 and std_dev > 20:
            print('성적이 너무 저조하고 학생들의 실력 차이가 너무 크다.')
        elif avrg > 50 and std_dev > 20:
            print('성적은 평균 이상이지만 학생들의 실력 차이가 크다. 주의 요망!')
        elif avrg < 50 and std_dev < 20:
            print('학생들의 실력 차이는 크지 않지만 성적이 너무 저조하다. 주의 요망!')
        elif avrg > 50 and std_dev < 20:
            print('성적도 평균 이상이고 학생들의 실력 차이도 크지 않다.')

    def get_evaluation(self, total_avrg, sd=20):
        print('*' * 50)
        print('{} 반 성적 분석 결과'.format(self.year_class))
        print('{} 반의 평균은 {}점이고 분산은 {}이며 표준편차는 {}이다.'.format(
            self.year_class, self.get_average(), self.get_variance(),
            self.get_standard_deviation()))
        print('*' * 50)
        print('{}반 종합 평가'.format(self.year_class))
        print('*' * 50)
        self.evaluate_class(total_avrg, sd)