#!/usr/bin/env python import sys if len(sys.argv) != 3: print("""Create a tex file with the template of a NME report. """) print('Two parameters are required: experiment_name ANT1,ANT2,ANT3,..') sys.exit(0) exp_name = sys.argv[1] stations = sys.argv[2].split(',') outputfile = open(exp_name.lower()+'.tex', mode='w') def write_list(title, default_tag): text = title+'\n' text += '\n'.join([r'&{} % {}'.format(default_tag, i) for i in stations])+'\n'+r'\\'+'\n' return text outputfile.write(r"""\documentclass{report} \usepackage{lscape} \pagestyle{empty} \usepackage[a4paper]{geometry} \usepackage{upgreek} \setlength\unitlength{0.1cm}\def\sqbox{\linethickness{0.01pt} \begin{picture}(3,3)(0,0)\put(-0.75,-0.5){\dashbox{0.5}(3,3){}}\end{picture}} \def\phbox{$\phantom{\sqbox}$} \newcommand{\nobs}{\phbox} % phantom box \newcommand{\ntry}{$\bigcirc$} \newcommand{\okay}{$\bigotimes$} % cross \newcommand{\err}{\rule[-0.065cm]{0.3cm}{0.3cm}} % black dot (square) %% %% Default observing and session characteristics %% \def\obsband{XXX-band} % C, L, X, S, K, Q %%\def\repnr{07/...} % yy/ss ; ss in Roman numerals - obsolete \def\obssrc{SOURCE1 and SOURCE2} % source(s) observed \def\obslength{180} % duration of experiment in minutes \def\obsmode{512-18-2, dual pol.} % SCHED mode (somewhat obsolete) %% [total bit-rate (Mbps)]-[# channels]-[# bits] \def\refant{FULL STATION NAME} % reference antenna used for clock-search \def\obsdate{DATE} % dd/mm/yy \def\refdate{\obsdate; 49d 12h 00m} % dayofyear, hours minutes \def\expcode{EXPCODE} \def\repdate{TODAY} % dd/mm/yy \def\reporter{Benito Marcote} % support scientist \def\ssemail{marcote@jive.eu} % your email address %% %% Table header, no need to modify %% \begin{document} \begin{landscape} \hsize 23cm\vsize 17cm\voffset 2.5cm\hoffset -2.5cm \begin{table*} \begin{flushleft}\begin{tabular}[t]{lrr} {\huge Network Monitoring Report:}&{\huge\bf \obsband}&{\huge \expcode}\\ \noalign{\smallskip}\hline\hline\noalign{\smallskip} \end{tabular}\end{flushleft}\begin{flushleft}\begin{tabular}{lll} {\bf Source:} \obssrc&{\bf Length:} \obslength~min.& {\bf Observing mode:} Mk V, mode \obsmode\\ {\bf Reference antenna:} \refant&{\bf Date of observations:} \obsdate& {\bf Reference date:} \refdate\\ {\bf Experiment code:} \expcode&{\bf Date of report:}\hfill \repdate& {{\bf by:} \reporter}\\ \end{tabular}\end{flushleft}\begin{flushleft}\begin{tabular}{lcllcl} &\okay & According to expectation, no special remarks& $\phantom{0000}$&\sqbox & Station did not observe (not scheduled)\\ &\err & Problem occured - see enclosed footnote(s)& $\phantom{0000}$&\ntry & Entry not applicable/investigated\\ \end{tabular}\end{flushleft} """) outputfile.write(r'\begin{flushleft}\begin{tabular}{l|'+'c'*len(stations)+r'}'+'\n') outputfile.write(r"""\hline\noalign{\smallskip}\hline\noalign{\smallskip} """) outputfile.write('&'+'&'.join(stations)+r'\\'+'\n') outputfile.write(r"""\noalign{\smallskip}\hline\noalign{\smallskip} %% %% Entry of faults and numbers start here %% ====================================== %% %% \okay - according to expectation, no special remarks %% \sqbox - Did not observed (not scheduled) %% \err - Problem occured - see enclosed footnote(s) %% \ntry - Entry not applicable/investigated %% """) outputfile.write(write_list('Station has observed', r'\okay')) outputfile.write(write_list('Station produced fringes (ftp)', r'\okay')) outputfile.write(write_list('Station produced fringes (disk)', r'\okay')) for i in (0,1): outputfile.write(r'\noalign{\smallskip}'+'\n') outputfile.write(r'\cline{2-'+str(len(stations)+1)+r'}'+'\n') outputfile.write(r'\noalign{\smallskip}'+'\n') outputfile.write(write_list('Logs are available (within 72 hours)', r'\okay')) outputfile.write(write_list('Antabs on vlbeer (within 7 days)', r'\okay')) outputfile.write(write_list('Feedback on www (within 7 days)', r'\okay')) outputfile.write(r'\noalign{\smallskip}'+'\n') outputfile.write(write_list('GPS clock estimate gives fringes', r'\okay')) outputfile.write(r'\cline{2-'+str(len(stations)+1)+'}'+'\n') outputfile.write(r'% Find the values in ccsbeta, klxM file. Multiply by 10^6 to get ps/s'+'\n') outputfile.write(write_list('Clock rate in psec/sec', '$0$')) outputfile.write(r'\cline{2-'+str(len(stations)+1)+'}'+'\n') outputfile.write(r'\noalign{\smallskip}'+'\n') outputfile.write(write_list('Recording okay', r'\okay')) outputfile.write(r'\noalign{\smallskip}'+'\n') outputfile.write(write_list('Polarization setup okay', r'\okay')) outputfile.write(write_list('Strong signal amplitude', r'\okay')) outputfile.write(write_list('Sampler statistics okay', r'\okay')) outputfile.write(write_list('Please check BBC number(s):', r' ')) outputfile.write(r'\cline{2-'+str(len(stations)+1)+'}'+'\n') outputfile.write(r'\noalign{\smallskip}'+'\n') outputfile.write(write_list('Previous reported problem(s) corrected', r' ')) outputfile.write(write_list('Problem(s) first reported', r' ')) outputfile.write(r'\cline{2-'+str(len(stations)+1)+'}'+'\n') outputfile.write(write_list('See enclosed footnote(s):', r' ')) outputfile.write(r"""\noalign{\smallskip}\hline \noalign{\smallskip{\bf Enclosure:} Footnotes \obsband\ \expcode} \end{tabular}\end{flushleft} \end{table*} %\vfill \clearpage \hoffset -2.5cm \voffset -1.5cm {\huge Footnotes to the Network Monitoring Report:\ {\bf \obsband}\ \expcode} \smallskip\hrule\hrule\vspace{1cm}\parindent=0pt\parskip=4pt {\bf General:} {\bf ) XX, STATION:} Some note. \vspace{0.7cm}\hrule\smallskip{\it Questions? \ssemail} \hfill{Report ends} \end{landscape} \end{document} """) outputfile.close()