def build(self): self.clear() self.add_line('<div class="navbar">') self.add_line() self.add_line(html.link('content', 'Home', colour=None), ind=1) self.add_line(html.link(join('content', 'Location.html'), 'Location', colour=None), ind=1) self.add_line() self.add_line(html.dropdown('DUTs', *self.get_dut_htmls(), n=0)) self.add_line( html.dropdown('Beamtests', Data.TestCampaigns, self.get_tc_htmls(), n=1)) self.add_line( html.dropdown('Single Runs', Data.TestCampaigns, self.get_tc_htmls(runs=True), n=2)) self.add_line( html.dropdown('scCVD', *self.get_dut_links(self.used( self.get_sccvd_dias())), n=3)) self.add_line( html.dropdown('pCVD', *self.get_dut_links(self.used(self.get_pcvd_dias())), n=4)) self.add_line( html.dropdown('Diodes', *self.get_dut_links( self.used(self.get_si_detectors())), n=5)) self.add_line(html.link(join('content', 'AmpBoards.html'), 'Amplifier Boards', colour=None), ind=1) self.add_line('</div>') self.save(add_root=False)
def get_dut_links(duts): return duts, [join('content', 'diamonds', dia) for dia in duts]
def get_tc_htmls(runs=False): return [ join('content', 'beamtests', tc, f'{"index" if runs else "RunPlans"}.html') for tc in Data.TestCampaigns ]
def get_dut_htmls(): return [['scCVD', 'pCVD', 'Silicon'], [ join('content', 'duts', f'{n}.html') for n in ['scCVD', 'pCVD', 'Si'] ]]
def __init__(self): super().__init__(join('content', 'nav.html')) self.DUTs = list(Data.DUTs.keys())
def set_filename(self, *name): self.FileName = join(*name) if name[0].startswith('/scratch') else join(Dir, *name)
def path(*dirs): return join('/psi2', *dirs) if 'http' not in dirs[0] else dirs[0]
def __init__(self, filename=None, ind_width=2): self.FileName = None if filename is None else filename if filename.startswith('/scratch') else join(Dir, filename) self.T = '' self.Header = '' self.Body = '' self.Scripts = '' self.W = ind_width self.PBar = PBar() self.Verbose = True
def prep_figures(rel_dir, title='', redo=False): for name in glob(join(Dir, rel_dir, '*.root')): if not isfile(name.replace('.root', '.html')) or redo: pal = 53 if 'SignalMap' in name else 55 if 'HitMap' in name else None make_root(name, f'{add_spaces(basename(name).replace(".root", ""))} {title}', pal=pal)
def link(target, name, active=False, center=False, new_tab=False, use_name=True, colour: Any = None, right=False, warn=True): target = join(target, '') if isdir(join(Dir, target)) else target if isfile(join(Dir, target)) or isfile(join(Dir, target, 'index.html')) and target.endswith('/') or 'http' in target: return a(name, style(center, right, colour=colour), *opts(active=active, new_tab=new_tab), *make_opt('href', path(target))) warning('The file {} does not exist!'.format(target), prnt=warn) return name if use_name else ''
import os from collections import namedtuple from src.utils import join, itows from src.tokens import SPACE, TAB, LF, PUSH, DUP, SWAP, POP, ADD, SUB, MUL, \ DIV, MOD, MARK, JUMP, JUMP_Z, JUMP_N, EXIT, CALL, END, STORE, LOAD, OUTC, \ OUTI, INC, INI Program = namedtuple('Program', 'name program stack heap') programs = [] ioread = Program( name='ioread', program=join(PUSH, itows(5), PUSH, itows(9), INC, INI, EXIT), stack=[], heap={9: ord('a'), 5: 1} ) programs.append(ioread) iowrite = Program( name='iowrite', program=join(PUSH, itows(5), PUSH, itows(97), OUTC, OUTI, EXIT), stack=[], heap={} ) programs.append(iowrite) subroutine = Program( name='subroutine', program=join(
def link_tcs(self, dut: DUT): return ', '.join( self.link(join(dut.RelDir, tc), tc) for tc in dut.get_tcs())