Пример #1
0
def gen_example(idx, n_digits, n_nums, var_digits=0):
    assert(n_digits > 1)
    assert(var_digits < n_digits)

    sum = 0
    
    q_tab = Tabular(' c r ', row_height=1.2)
    a_tab = Tabular(' l l ', row_height=1.1)
    for n in range(0, n_nums):
        dgts_offst = randint(0, var_digits)

        min, max = pow(10, n_digits - 1 - dgts_offst), pow(10, n_digits - dgts_offst)
        assert(min < max)
        rnum = randint(min, max)
        if (n == 0) :
            q_tab.add_row(("", rnum))
        else:
            q_tab.add_row(("+", rnum))
        sum += rnum

    q_tab.add_hline()
    q_tab.add_empty_row()
    q_tab.add_empty_row()

    a_idx = bold(str(idx) + ":")
    a_tab.add_row((a_idx, sum))
        
    return (q_tab, a_tab)
Пример #2
0
    def cria_primeira_secao(self, cabecalho):
        colunas_section_1 = Tabularx('c c c')
        colunas_section_1.add_row([MultiColumn(3, align='c')])

        info_aluno = MiniPage(width=NoEscape(r'0.25\textwidth'),
                              pos='b',
                              align='l')
        graf_media = StandAloneGraphic(filename=self.path_graf_medias,
                                       image_options='width = 180 px')
        box_medias_aluno = MiniPage(width=NoEscape(r'0.23\textwidth'),
                                    pos='b',
                                    align='l')

        info_aluno.append(f'Nome: {self.resumo[1]} {self.resumo[2]}')
        info_aluno.append(NewLine())
        info_aluno.append(f'Número: {self.resumo[5]}')
        info_aluno.append(NewLine())
        info_aluno.append(f'Série: {self.resumo[4]}º ano')
        info_aluno.append(NewLine())
        info_aluno.append(f'Turma: {self.resumo[3]}')
        info_aluno.append(NewLine())
        info_aluno.append(NewLine())
        if self.resumo[9] >= 45:
            info_aluno.append(LargeText(f'Aprovado'))
        else:
            info_aluno.append(LargeText(f'Reprovado'))

        for i in range(3):
            info_aluno.append(NewLine())

        media_final = LargeText(f'Média final: {self.resumo[9]}')
        info_aluno_medias = Tabular('c | c | c', pos='b')
        info_aluno_medias.add_row(cabecalho, mapper=[bold])
        info_aluno_medias.add_hline()
        info_aluno_medias.add_empty_row()
        info_aluno_medias.add_row(
            [self.resumo[6], self.resumo[7], self.resumo[8]])

        box_medias_aluno.append(media_final)
        for i in range(3):
            box_medias_aluno.append(NewLine())

        box_medias_aluno.append(info_aluno_medias)
        for i in range(3):
            box_medias_aluno.append(NewLine())

        colunas_section_1.add_row([info_aluno, graf_media, box_medias_aluno])

        return colunas_section_1
Пример #3
0
    def cria_subsecao(self, cabecalho, tri):

        notas = []
        for n in range(4):
            if self.notas[tri][n + 1] < 0:
                notas.append(0)
            else:
                notas.append(self.notas[tri][n + 1])

        colunas_subsection_1 = Tabular('c c')
        colunas_subsection_1.add_row([MultiColumn(2, align='c')])

        if tri == 0:
            graf_1tri = StandAloneGraphic(filename=self.path_graf_1tri,
                                          image_options='width = 190 px')
        elif tri == 1:
            graf_1tri = StandAloneGraphic(filename=self.path_graf_2tri,
                                          image_options='width = 190 px')
        elif tri == 2:
            graf_1tri = StandAloneGraphic(filename=self.path_graf_3tri,
                                          image_options='width = 190 px')

        box_1tri = MiniPage(width=NoEscape(r'0.49\textwidth'), pos='b')

        info_aluno_1tri = Tabular('c | c | c | c', pos='b')
        info_aluno_1tri.add_row(cabecalho, mapper=[bold])
        info_aluno_1tri.add_hline()
        info_aluno_1tri.add_empty_row()

        info_aluno_1tri.add_row([notas[0], notas[1], notas[2], notas[3]])

        box_1tri.append(info_aluno_1tri)
        box_1tri.append(NewLine())
        box_1tri.append(NewLine())
        box_1tri.append('*As notas das redações estão entre 0 e 8')
        for i in range(3):
            box_1tri.append(NewLine())

        colunas_subsection_1.add_row([graf_1tri, box_1tri])

        return colunas_subsection_1
Пример #4
0
table1.add_row((5, 6, 7, 8))
table1.add_hline()
row_cells = ('9', MultiColumn(3, align='|c|', data='Multicolumn not on left'))
table1.add_row(row_cells)
table1.add_hline()

table2 = Tabular('|c|c|c|')
table2.add_hline()
table2.add_row((MultiRow(3, data='Multirow'), 1, 2))
table2.add_hline(2, 3)
table2.add_row(('', 3, 4))
table2.add_hline(2, 3)
table2.add_row(('', 5, 6))
table2.add_hline()
table2.add_row((MultiRow(3, data='Multirow2'), '', ''))
table2.add_empty_row()
table2.add_empty_row()
table2.add_hline()

table3 = Tabular('|c|c|c|')
table3.add_hline()
table3.add_row((MultiColumn(2,
                            align='|c|',
                            data=MultiRow(2, data='multi-col-row')), 'X'))
table3.add_row((MultiColumn(2, align='|c|', data=''), 'X'))
table3.add_hline()
table3.add_row(('X', 'X', 'X'))
table3.add_hline()

table4 = Tabular('|c|c|c|')
table4.add_hline()
Пример #5
0
table1.add_row((5, 6, 7, 8))
table1.add_hline()
row_cells = ("9", MultiColumn(3, align="|c|", data="Multicolumn not on left"))
table1.add_row(row_cells)
table1.add_hline()

table2 = Tabular("|c|c|c|")
table2.add_hline()
table2.add_row((MultiRow(3, data="Multirow"), 1, 2))
table2.add_hline(2, 3)
table2.add_row(("", 3, 4))
table2.add_hline(2, 3)
table2.add_row(("", 5, 6))
table2.add_hline()
table2.add_row((MultiRow(3, data="Multirow2"), "", ""))
table2.add_empty_row()
table2.add_empty_row()
table2.add_hline()

table3 = Tabular("|c|c|c|")
table3.add_hline()
table3.add_row((MultiColumn(2, align="|c|", data=MultiRow(2, data="multi-col-row")), "X"))
table3.add_row((MultiColumn(2, align="|c|", data=""), "X"))
table3.add_hline()
table3.add_row(("X", "X", "X"))
table3.add_hline()

table4 = Tabular("|c|c|c|")
table4.add_hline()
col1_cell = MultiRow(4, data="span-4")
col2_cell = MultiRow(2, data="span-2")
Пример #6
0
# bag = rosbag.Bag(sys.argv[1])
bag = rosbag.Bag('/home/kostas/results/local.bag')

mocap = file_interface.read_bag_trajectory(bag, '/mocap_pose')
odom = file_interface.read_bag_trajectory(bag, '/odometry/wheel_imu')
slam = file_interface.read_bag_trajectory(bag, '/poseupdate')
fuse = file_interface.read_bag_trajectory(bag, '/odometry/map')
bag.close()

loc_table = Tabular('l c c c c c c c')
loc_table.add_hline()
loc_table.add_row(
    ('Method', 'RMSE', 'Mean', 'Median', 'STD', 'Min', 'Max', 'SSE'))
loc_table.add_hline()
loc_table.add_empty_row()


def three_plots(ref, est, table, name):
    """Generates plots and statistics table into Report

    :ref: PoseTrajectory3D object that is used as reference
    :est: PoseTrajectory3D object that is plotted against reference
    :table: Tabular object that is generated by Tabular('c c')
    :name: String that is used as name for file and table entry
    :returns: translation of reference against estimation

    """
    ref, est = sync.associate_trajectories(ref, est)
    est, rot, tra, s = trajectory.align_trajectory(est,
                                                   ref,