コード例 #1
0
ファイル: ztable.py プロジェクト: MetaMichael/examsage
 def __init__(self):
     pdf_path = Arguments(self.filename)
     pdf_path.escape = False
     options = Options(pages=r'{1,2}')
     options.escape = False
     pdf_length = Arguments('-2')
     pdf_length.escape = False
     super().__init__(data=[
         NewPage(),
         Command('includepdf', pdf_path, options),
         Command('addtocounter', 'page', None, extra_arguments=pdf_length),
     ])
     self.packages.append(Package('pdfpages'))
コード例 #2
0
 def _document_fe_graph(self) -> None:
     """Add FE execution graphs into the traceability document.
     """
     with self.doc.create(Section("FastEstimator Architecture")):
         for mode in self.system.pipeline.data.keys():
             scheduled_items = self.system.pipeline.get_scheduled_items(
                 mode) + self.system.network.get_scheduled_items(mode) + self.system.traces
             signature_epochs = get_signature_epochs(scheduled_items, total_epochs=self.system.epoch_idx, mode=mode)
             epochs_with_data = self.system.pipeline.get_epochs_with_data(total_epochs=self.system.epoch_idx,
                                                                          mode=mode)
             if set(signature_epochs) & epochs_with_data:
                 self.doc.append(NoEscape(r'\FloatBarrier'))
                 with self.doc.create(Subsection(mode.capitalize())):
                     for epoch in signature_epochs:
                         if epoch not in epochs_with_data:
                             continue
                         self.doc.append(NoEscape(r'\FloatBarrier'))
                         with self.doc.create(
                                 Subsubsection(f"Epoch {epoch}",
                                               label=Label(Marker(name=f"{mode}{epoch}", prefix="ssubsec")))):
                             diagram = self._draw_diagram(mode, epoch)
                             ltx = d2t.dot2tex(diagram.to_string(), figonly=True)
                             args = Arguments(**{'max width': r'\textwidth, max height=0.9\textheight'})
                             args.escape = False
                             with self.doc.create(Center()):
                                 with self.doc.create(AdjustBox(arguments=args)) as box:
                                     box.append(NoEscape(ltx))