25 Some helper classes and functions for outputing html and LaTeX pages
28 from __future__
import print_function
40 "COSIOTA":
"$\\cos{\\iota}$",
41 "PSI":
"$\\psi$ (rad)",
42 "PHI0":
"$\\phi_0$ (rad)",
48 "F1":
"$\\dot{f}$ (Hz/s)",
49 "F2":
"$\\ddot{f}$ (Hz/s$^2$)",
50 "F3":
"$f_3$ (Hz/s$^3$)",
51 "F4":
"$f_4$ (Hz/s$^4$)",
52 "F5":
"$f_5$ (Hz/s$^5$)",
53 "F6":
"$f_6$ (Hz/s$^6$)",
54 "F7":
"$f_7$ (Hz/s$^7$)",
55 "F8":
"$f_8$ (Hz/s$^8$)",
56 "F9":
"$f_9$ (Hz/s$^9$)",
57 "F10":
"$f_{10}$ (Hz/s$^{10}$)",
59 "PMRA":
"p.m. $\\alpha$ (rad/s)",
60 "PMDEC":
"p.m. $\\delta$ (rad/s)",
61 "PMDC":
"p.m. $\\delta$ (rad/s)",
63 "A1":
"$a \\sin{i}$ (lt s)",
64 "A1_2":
"$(a \\sin{i})_{2}$ (lt s)",
65 "A1_3":
"$(a \\sin{i})_{3}$ (lt s)",
68 "PB_2":
"$(P_b)_2$ (s)",
69 "PB_3":
"$(P_b)_3$ (s)",
71 "T0_2":
"$(T_0)_2$ (s)",
72 "T0_3":
"$(T_0)_3$ (s)",
73 "TASC":
"$T_{\\\textrm{asc}}$ (s)",
74 "OM":
"$\\omega_0$ (rad)",
75 "OM_2":
"$(\\omega_0)_2$ (rad)",
76 "OM_3":
"$(\\omega_0)_3$ (rad)",
77 "PBDT":
"$\\dot{P}$ (s/s)",
78 "PBDOT":
"$\\dot{P}$ (s/s)",
84 "FB0":
"$(f_b)_0$ (Hz)",
85 "FB1":
"$(f_b)_1$ (Hz)",
86 "FB2":
"$(f_b)_2$ (Hz)",
87 "FB3":
"$(f_b)_3$ (Hz)",
88 "FB4":
"$(f_b)_4$ (Hz)",
89 "FB5":
"$(f_b)_5$ (Hz)",
90 "FB6":
"$(f_b)_6$ (Hz)",
91 "FB7":
"$(f_b)_7$ (Hz)",
92 "FB8":
"$(f_b)_8$ (Hz)",
93 "FB9":
"$(f_b)_9$ (Hz)",
96 "ELL":
"$\\varepsilon$",
97 "H95":
"$h_0^{95\\%}$",
98 "H0UL":
"$h_0^{{{}\\%}}$",
99 "Q22":
"$Q_{22}$\\,(kg\\,m$^2$)",
100 "SDRAT":
"spin-down ratio",
101 "SDRAT95":
"$h_0^{95\\%}$/h_0^{\\rm sd}$",
102 "SDLIM":
"$h_0^{\\rm sd}$",
103 "F0ROT":
"$f_{\\rm rot}$ (Hz)",
104 "F0GW":
"$f_{\\rm gw}$ (Hz)",
105 "F1ROT":
"$\\dot{f}_{\\rm rot}$ (Hz/s)",
106 "F1GW":
"$\\dot{f}_{\\rm gw}$ (Hz/s)",
107 "SDPOWRAT":
"power ratio (\\%)",
108 "OMDOT":
"$\\dot{\\omega}$",
109 "OMDT":
"$\\dot{\\omega}$",
110 "EPS1":
"$\\epsilon_1$",
111 "EPS2":
"$\\epsilon_2$",
114 "C22UL":
"$C_{{22}}^{{{}\\%}}$",
115 "C21UL":
"$C_{{21}}^{{{}\\%}}$",
116 "PHI22":
"$\\phi_{22}$",
117 "PHI21":
"$\\phi_{21}$",
120 "I31UL":
"$I_{{31}}^{{{}\\%}}$",
121 "I21UL":
"$I_{{21}}^{{{}\\%}}$",
122 "LAMBDA":
"$\\lambda$ (rad)",
123 "COSTHETA":
"$\\cos{\\\theta}$",
124 "DIST":
"distance (kpc)",
126 "BSN":
"$\\log{}_{10}\\left(B_{\\\textrm{SvN}}\\right)$",
127 "BCI":
"$\\log{}_{10}\\left(B_{\\\textrm{CvI}}\\right)$",
128 "BCIN":
"$\\log{}_{10}\\left(B_{\\\textrm{CvIN}}\\right)$",
138 "F0":
"f<sub>0</sub> (Hz)",
139 "F1":
"f<sub>1</sub> (Hz/s)",
140 "F2":
"f<sub>2</sub> (Hz/s<sup>2</sup>)",
141 "F3":
"f<sub>3</sub> (Hz/s<sup>3</sup>)",
142 "F4":
"f<sub>4</sub> (Hz/s<sup>4</sup>)",
143 "F5":
"f<sub>5</sub> (Hz/s<sup>5</sup>)",
144 "F6":
"f<sub>6</sub> (Hz/s<sup>6</sup>)",
145 "F7":
"f<sub>7</sub> (Hz/s<sup>7</sup>)",
146 "F8":
"f<sub>8</sub> (Hz/s<sup>8</sup>)",
147 "F9":
"f<sub>9</sub> (Hz/s<sup>9</sup>)",
148 "F10":
"f<sub>10</sub> (Hz/s<sup>10</sup>)",
149 "F0ROT":
"f<sub>rotation</sub> (Hz)",
150 "F1ROT":
"Spin-down<sub>rotation</sub> (Hz/s)",
151 "F0GW":
"f<sub>GW</sub> (Hz)",
152 "F1GW":
"Spin-down<sub>GW</sub> (Hz/s)",
153 "PEPOCH":
"epoch (MJD)",
154 "A1":
"a sin<it>i</i> (lt s)",
155 "A1_2":
"(a sin<it>i</i>)<sub>2</sub> (lt s)",
156 "A1_3":
"(a sin<it>i</i>)<sub>3</sub> (lt s)",
157 "SINI":
"sin<it>i</it>$",
160 "ECC_2":
"<it>e</it><sub>2</sub>",
161 "ECC_3":
"<it>e</it><sub>3</sub>",
162 "EPS1":
"ε<sub>1</sub>",
163 "EPS2":
"ε<sub>2</sub>",
164 "T0":
"T<sub>0</sub> (MJD)",
165 "T0_2":
"(T<sub>0</sub>)<sub>2</sub> (MJD)",
166 "T0_3":
"(T<sub>0</sub>)<sub>3</sub> (MJD)",
167 "TASC":
"T<sub>asc</sub> (MJD)",
168 "OM":
"ω<sub>0</sub> (deg)",
169 "OM_2":
"(ω<sub>0</sub>)<sub>2</sub> (deg)",
170 "OM_3":
"(ω<sub>0</sub>)<sub>3</sub> (deg)",
171 "M2":
"<it>m</it><sub>2</sub> (kg)",
172 "MTOT":
"<it>M</it> (kg)",
173 "PB":
"<it>P</it><sub>b</sub> (days)",
174 "PB_2":
"(<it>P</it><sub>b</sub>)<sub>2</sub> (days)",
175 "PB_3":
"(<it>P</it><sub>b</sub>)<sub>3</sub> (days)",
176 "FB0":
"(<it>f</it><sub>b</sub>)<sub>0</sub> (Hz)",
177 "FB1":
"(<it>f</it><sub>b</sub>)<sub>1</sub> (Hz)",
178 "FB2":
"(<it>f</it><sub>b</sub>)<sub>2</sub> (Hz)",
179 "FB3":
"(<it>f</it><sub>b</sub>)<sub>3</sub> (Hz)",
180 "FB4":
"(<it>f</it><sub>b</sub>)<sub>4</sub> (Hz)",
181 "FB5":
"(<it>f</it><sub>b</sub>)<sub>5</sub> (Hz)",
182 "FB6":
"(<it>f</it><sub>b</sub>)<sub>6</sub> (Hz)",
183 "FB7":
"(<it>f</it><sub>b</sub>)<sub>7</sub> (Hz)",
184 "FB8":
"(<it>f</it><sub>b</sub>)<sub>8</sub> (Hz)",
185 "FB9":
"(<it>f</it><sub>b</sub>)<sub>9</sub> (Hz)",
186 "H0":
"h<sub>0</sub>",
187 "C21":
"C<sub>21</sub>",
188 "C21UL":
"C<sub>21</sub><sup>{}%</sup>",
189 "C22":
"C<sub>22</sub>",
190 "C22UL":
"C<sub>22</sub><sup>{}%</sup>",
191 "I21":
"I<sub>21</sub>",
192 "I21UL":
"I<sub>21</sub><sup>{}%</sup>",
193 "I31":
"I<sub>31</sub>",
194 "I31UL":
"I<sub>31</sub><sup>{}%</sup>",
195 "COSIOTA":
"cosι",
196 "PSI":
"ψ (rad)",
197 "PHI0":
"φ<sub>0</sub> (rad)",
198 "PHI21":
"φ<sub>21</sub> (rad)",
199 "PHI22":
"φ<sub>22</sub> (rad)",
200 "PMRA":
"p.m. α (rad/s)",
201 "PMDC":
"p.m. δ (rad/s)",
202 "PMDEC":
"p.m. δ (rad/s)",
204 "DIST":
"Distance (kpc)",
205 "SDLIM":
"Spin-down limit",
208 "H95":
"h<sub>0</sub><sup>95%</sup>",
209 "H0UL":
"h<sub>0</sub><sup>{}%</sup>",
210 "H0PRIOR":
"h<sub>0</sub><sup>95%</sup> prior",
211 "SDPOWRAT":
"power ratio (%)",
212 "Q22":
"Q<sub>22</sub> (kg m<sup>2</sup>)",
213 "BSN":
"log<sub>10</sub>(B<sub>SvN</sub>)",
214 "BCI":
"log<sub>10</sub>(B<sub>CvI</sub>)",
215 "BCIN":
"log<sub>10</sub>(B<sub>CvIN</sub>)",
216 "MAXL":
"log<sub>10</sub>(max. L)",
223 return round(x, -
int(math.floor(math.log10(abs(x))) - (sf - 1)))
231 if np.abs(fv) > 0.01
and np.abs(fv) < 1000.0:
233 return repr(round(fv, dp))
235 return "$%s$" % repr(round(fv, dp))
237 return exp_str(fv, dp, otype=horl)
248 def RA(f, stype="hms"):
309 return "%.1f" % float(
310 repr(44244.0 + (float(f) + 51.184) / 86400.0)
334 def T0(f, stype=None):
336 return dec_or_exp(repr((float(f) + 51.184) / 86400.0), dp=2)
338 return "%.2f" % float(
339 repr(44244.0 + ((float(f) + 51.184) / 86400.0))
344 return dec_or_exp(repr((float(f) + 51.184) / 86400.0), dp=2)
346 return "%.2f" % float(
347 repr(44244.0 + ((float(f) + 51.184) / 86400.0))
352 repr(float(f) * 180.0 / math.pi), dp=1
416 return "%d" % round(fsf)
419 return "%.1f" % float(f)
422 return "%d" % round(float(f))
461 return exp_str(float(f), 1,
"latex")
464 return exp_str(float(f), 1,
"latex")
467 return exp_str(float(f), 1,
"latex")
470 return exp_str(float(f), 1,
"latex")
473 return exp_str(float(f), 1,
"latex")
476 return exp_str(float(f), 1,
"latex")
479 return exp_str(float(f), 1,
"latex")
482 return exp_str(float(f), 1,
"latex")
485 return exp_str(float(f), 1,
"latex")
488 return exp_str(float(f), 1,
"latex")
491 return exp_str(float(f), 1,
"latex")
494 return exp_str(float(f), 1,
"latex")
497 return exp_str(float(f), 1,
"latex")
500 return exp_str(float(f), 1,
"latex")
539 return "%.1f" % float(f)
545 return exp_str(float(f), 1,
"latex")
548 return "%.2f" % float(f)
551 return "%.2f" % float(f)
554 return "%.2f" % float(f)
557 return exp_str(float(f), 1,
"latex")
560 return exp_str(float(f), 1,
"latex")
563 return exp_str(float(f), 1,
"latex")
566 return exp_str(float(f), 1,
"latex")
569 return exp_str(float(f), 1,
"latex")
572 return exp_str(float(f), 1,
"latex")
575 return exp_str(float(f), 1,
"latex")
578 return exp_str(float(f), 1,
"latex")
581 return exp_str(float(f), 1,
"latex")
584 return exp_str(float(f), 1,
"latex")
587 return exp_str(float(f), 1,
"latex")
590 return exp_str(float(f), 1,
"latex")
607 A class to create a html tag
611 self, tag, tagtext="", tagclass="", tagid="", tagstyle="", newline=False
628 '<{tag} class="{class}" id="{id}" style="{style}"{extra}>{text}</{tag}>'
634 Overload the += operator to append text to tagtext
636 if not isinstance(ttext, str)
and not isinstance(ttext, unicode):
637 raise ValueError(
"Error... appended text must be a string.")
647 if not isinstance(t, str)
and not isinstance(t, unicode):
648 raise ValueError(
"Error... 'tag' must be a string.")
654 return self.
_taginfo_taginfo[
"class"]
657 if not isinstance(tclass, str)
and not isinstance(tclass, unicode):
658 raise ValueError(
"Error... 'class' text must be a string.")
660 self.
_taginfo_taginfo[
"class"] = tclass
667 if not isinstance(tid, str)
and not isinstance(tid, unicode):
668 raise ValueError(
"Error... 'id' text must be a string.")
674 return self.
_taginfo_taginfo[
"style"]
677 if not isinstance(tstyle, str)
and not isinstance(tstyle, unicode):
678 raise ValueError(
"Error... 'style' text must be a string.")
680 self.
_taginfo_taginfo[
"style"] = tstyle
684 return self.
_taginfo_taginfo[
"text"]
687 if not isinstance(ttext, str)
and not isinstance(ttext, unicode):
688 raise ValueError(
"Error... tag text must be a string.")
690 self.
_taginfo_taginfo[
"text"] = ttext
694 return self.
_taginfo_taginfo[
"extra"]
697 if not isinstance(textra, str)
and not isinstance(textra, unicode):
698 raise ValueError(
"Error... 'extra' tag text must be a string.")
703 self.
_taginfo_taginfo[
"extra"] = space + textra
723 def __init__(self, link, linktext="", linkclass="", linkid="", linkstyle=""):
725 Input the link and the text that the link surrounds
730 htmltag.__init__(self,
"a", linktext, linkclass, linkid, linkstyle)
736 Class to make and return a html table
739 def __init__(self, tag="table", tableclass="", tableid="", tablestyle=""):
741 self,
"table", tagclass=tableclass, tagid=tableid, tagstyle=tablestyle
751 for row
in self.
_rows_rows:
753 for data
in row[
"data"]:
758 td, data[
"text"], data[
"class"], data[
"id"], data[
"style"]
760 datatag.set_tagextra(
761 'rowspan="{rowspan}" colspan="{colspan}"'.format(**data)
763 rowtxt += datatag.text +
" "
765 "tr", rowtxt, row[
"class"], row[
"id"], row[
"style"], newline=
True
767 innertable += rowtag.text
771 def addrow(self, rowclass="", rowid="", rowstyle=""):
773 Add a new empty row dictionary to the list and increment the current row index
775 row = {
"data": [],
"class": rowclass,
"id": rowid,
"style": rowstyle}
776 self.
_rows_rows.append(row)
784 if rowidx > self.
_nrows_nrows - 1:
786 "Warning... cannot delete row '%d'. Only %d row in table."
787 % (rowdix, self.
_nrows_nrows)
790 self.
_rows_rows.pop(rowidx)
806 Add table data <td> (or <th> is header is True) tags to a given row
811 if rowidx > len(self.
_rows_rows) - 1:
812 raise ValueError(
"Warning... row index is out of range.")
824 td[
"rowspan"] =
str(
int(rowspan))
826 td[
"colspan"] =
str(
int(colspan))
828 self.
_rows_rows[rowidx][
"data"].append(td)
836 Class to make a return a LaTeX table
850 Create a table environment with `ncolumns` columns positioned with `columnpos`
869 self.
_tableformat_tableformat =
"\\begin{{table}}{{{floatval}}}\n{preamble}\\caption{{{caption}\\label{{{label}}}}}\n\\begin{{tabular}}{{{columnalign}}}\n{table}\n\\end{{tabular}}\n{postamble}\n\\end{{table}}"
878 if isinstance(columnalign, list):
879 if len(columnalign) != self.
_ncolumns_ncolumns:
881 "Error... number of column alignments is not equal to the number of columns."
884 for ca
in columnalign:
885 if not isinstance(ca, str)
and not isinstance(ca, unicode):
887 "Error... columnalign must be a list of strings."
892 if isinstance(columnalign, str)
or isinstance(columnalign, unicode):
893 if len(columnalign) == 1:
898 raise TypeError(
"Error... columnalign must be a list or a string.")
912 self.
_tableinfo_tableinfo[
"caption"] = caption
920 self.
_tableinfo_tableinfo[
"floatval"] = floatval
924 self.
_tableinfo_tableinfo[
"preamble"] = preamble
932 self.
_tableinfo_tableinfo[
"postamble"] = postamble
940 row = {
"data": [],
"underline": underline}
941 self.
_rows_rows.append(row)
948 self.
addrowaddrow(underline=
True)
950 self.
_rows_rows[rowidx][
"underline"] =
True
952 def adddata(self, datatxt, multicolumn=0, mcalign="c", rowidx=None):
957 if rowidx > len(self.
_rows_rows) - 1:
958 raise ValueError(
"Warning... row index is out of range.")
960 rowdata = {
"text": datatxt}
962 rowdata[
"multicolumn"] = multicolumn
963 rowdata[
"mcalign"] = mcalign
965 self.
_rows_rows[rowidx][
"data"].append(rowdata)
971 for i, row
in enumerate(self.
_rows_rows):
974 for data
in row[
"data"]:
976 if isinstance(val, float)
or isinstance(
980 if "multicolumn" in data:
981 ncols += data[
"multicolumn"]
983 "\\multicolumn{%d}{%s}{%s} "
984 % (data[
"multicolumn"], data[
"mcalign"], val)
988 rowtxt.append(val +
" ")
989 if ncols != self.
_ncolumns_ncolumns
and (
990 len(rowtxt) != 0
and row[
"underline"] ==
False
992 raise ValueError(
"Error... too many or too few inputs in row '%d'." % i)
994 self.
_tableinfo_tableinfo[
"table"] +=
"&".join(rowtxt) +
"\\\n"
996 self.
_tableinfo_tableinfo[
"table"] +=
"\\hline\n"
1005 print(
"Precision must be less than 16 d.p.", file=sys.stderr)
1009 ssplit = s.split(
"e")
1010 if otype.lower() ==
"html":
1011 return "%.*f×10<sup>%d</sup>" % (p, float(ssplit[0]),
int(ssplit[1]))
1012 elif otype.lower() ==
"latex":
1013 return "\\ensuremath{%.*f\\!\\times\\!10^{%d}}" % (
1019 raise ValueError(
"Error... 'otype' must be 'html' or 'latex'.")
1024 if isinstance(ra, six.string_types):
1026 elif isinstance(ra, float):
1029 raise ValueError(
"Error... ra must be a string or a float.")
1037 ss = (
"%.2f" % float(hms[2])).split(
".")
1039 if otype.lower() ==
"html":
1040 return "%s<sup>h</sup>%s<sup>m</sup>%s<sup>s</sup>.%s" % (
1046 elif otype.lower() ==
"latex":
1047 return "$%s^{\\rm h}%s^{\\rm m}%s^{\\rm s}\\!.%s$" % (
1054 raise ValueError(
"Error... 'otype' input must be 'html' or 'latex'")
1059 if isinstance(dec, six.string_types):
1060 dms = dec.split(
":")
1061 elif isinstance(dec, float):
1064 raise ValueError(
"Error... dec must be a string or a float.")
1072 ss = (
"%.2f" % float(dms[2])).split(
".")
1074 if otype.lower() ==
"html":
1075 return "%s°%s'%s\".%s" % (
1076 (re.sub(
r"\+",
"", dms[0])).zfill(2),
1081 elif otype.lower() ==
"latex":
1082 return "$%s^{\\circ}%s'%s''\\!.%s$" % (
1083 (re.sub(
r"\+",
"", dms[0])).zfill(2),
1089 raise ValueError(
"Error... 'otype' must be 'html' or 'latex'.")
1093 CSS files for results pages
1097 result_page_css =
"""
1098 /* create body style */
1100 font-family: "Avant Garde", Avantegarde, Verdana, Geneva, "Trebuchet MS", sans-serif;
1103 /* create header name style */
1105 margin: 0px 0px 0px 0px;
1106 padding: 4px 4px 8px 4px;
1109 letter-spacing: 0px;
1110 font-family: "Avant Garde", Avantegarde, Verdana, Geneva, "Trebuchet MS", Sans-Serif;
1111 background-color: darkolivegreen;
1116 text-shadow: 2px 2px 2px #1c2310;
1117 text-decoration: none;
1122 text-shadow: 2px 2px 2px #1c2310;
1123 text-decoration: none;
1128 text-shadow: 2px 2px 2px #7fa046;
1129 text-decoration: none;
1134 padding: 4px 4px 8px 4px;
1137 font-family: "Avant Garde", Avantegarde, Verdana, Geneva, "Trebuchet MS", Sans-Serif;
1138 text-shadow: 1px 1px 1px #333300;
1139 background-color: #666600;
1143 /* create footer style */
1145 border-top: 1px solid #999;
1147 font-family: monospace;
1151 /* create a class for a posterior plot image */
1154 border: 0px solid #999;
1157 /* create a class for a full joint posterior plot image */
1160 border: 0px solid #999;
1163 /* create a class for a background distribution plot image */
1166 border: 0px solid #999;
1169 /* create a class for a Bk data plot */
1174 /* create class for an amplitude spectral density plot */
1179 /* create class for an MCMC chain plot */
1184 /* style for links list */
1186 background-color: darkolivegreen;
1187 font-family: "Avant Garde", Avantegarde, Verdana, Geneva, "Trebuchet MS", Sans-Serif;
1191 padding: 0px 0px 3px 3px;
1192 margin: 0px 0px 8px 0px;
1193 text-shadow: 2px 2px 2px #1c2310;
1196 div.pagelinks a:link {
1198 text-shadow: 2px 2px 2px #1c2310;
1199 text-decoration: none;
1202 div.pagelinks a:visited {
1204 text-shadow: 2px 2px 2px #1c2310;
1205 text-decoration: none;
1208 div.pagelinks a:hover {
1210 text-shadow: 2px 2px 2px #7fa046;
1211 text-decoration: none;
1214 /* pulsar parameter table class */
1216 background-color: floralwhite;
1219 box-shadow: 2px 2px 2px 2px #d8d8d8;
1220 -webkit-box-shadow: 2px 2px 2px 2px #d8d8d8;
1221 -moz-box-shadow: 2px 2px 2px 2px #d8d8d8;
1222 padding: 4px 4px 4px 4px;
1225 /* upper limits table class */
1227 background-color: floralwhite;
1230 box-shadow: 2px 2px 2px 2px #d8d8d8;
1231 -webkit-box-shadow: 2px 2px 2px 2px #d8d8d8;
1232 -moz-box-shadow: 2px 2px 2px 2px #d8d8d8;
1233 padding: 4px 4px 4px 4px;
1236 /* background evidence table class */
1238 background-color: floralwhite;
1241 box-shadow: 2px 2px 2px 2px #d8d8d8;
1242 -webkit-box-shadow: 2px 2px 2px 2px #d8d8d8;
1243 -moz-box-shadow: 2px 2px 2px 2px #d8d8d8;
1244 padding: 4px 4px 4px 4px;
1247 /* set defaults for table data and table headers */
1250 border-collapse: collapse;
1254 padding: 0px 8px 0px 8px;
1259 padding: 0px 8px 0px 8px;
1264 border-left: 1px solid #000;
1268 border-right: 1px solid #000;
1272 border-top: 1px solid #000;
1276 border-bottom: 1px solid #000;
1279 /* set text colour classes for detectors */
1308 results_table_css =
"""
1309 /* create body style */
1311 font-family: Verdana, Geneva, "Trebuchet MS", sans-serif;
1314 /* create footer style */
1316 border-top: 1px solid #999;
1318 font-family: monospace;
1322 /* create link style */
1325 text-decoration: none;
1330 text-decoration: none;
1335 text-decoration: none;
1336 text-shadow: 2px 2px 2px #ccc;
1339 /* set defaults for table data and table headers */
1342 border-collapse: collapse;
1346 padding: 0px 8px 0px 8px;
1351 padding: 0px 8px 0px 8px;
1356 border-left: 1px solid #000;
1360 border-right: 1px solid #000;
1364 border-top: 1px solid #000;
1368 border-bottom: 1px solid #000;
1371 /* set text colour classes for detectors */
def __init__(self, link, linktext="", linkclass="", linkid="", linkstyle="")
Input the link and the text that the link surrounds.
Class to make and return a html table.
def addrow(self, rowclass="", rowid="", rowstyle="")
Add a new empty row dictionary to the list and increment the current row index.
def __init__(self, tag="table", tableclass="", tableid="", tablestyle="")
def deleterow(self, rowidx)
Delete a row.
def adddata(self, datatext, dataclass="", dataid="", datastyle="", header=False, rowspan=0, colspan=0, rowidx=None)
Add table data (or is header is True) tags to a given row.
A class to create a html tag.
def set_tagstyle(self, tstyle)
def __init__(self, tag, tagtext="", tagclass="", tagid="", tagstyle="", newline=False)
def set_tagextra(self, textra)
def set_tagclass(self, tclass)
def set_tagtext(self, ttext)
def __iadd__(self, ttext)
Overload the += operator to append text to tagtext.
Class to make a return a LaTeX table.
def set_label(self, label)
def set_preamble(self, preamble)
def set_ncolumns(self, ncolumns)
def adddata(self, datatxt, multicolumn=0, mcalign="c", rowidx=None)
def addrow(self, underline=False)
def __init__(self, ncolumns=1, columnalign="c", caption="", label="", floatval="h", preamble="", postamble="")
Create a table environment with ncolumns columns positioned with columnpos
def set_caption(self, caption)
def set_floatval(self, floatval)
def addhrule(self, rowidx=None)
def set_postamble(self, postamble)
def set_columnalign(self, columnalign)
def dec_str(dec, otype="html")
def dec_or_exp(f, dp=2, horl="html")
def ra_str(ra, otype="html")
def exp_str(f, p=1, otype="html")
def rad_to_hms(rad)
rad_to_hms(rad): Convert radians to hours, minutes, and seconds of arc.
def rad_to_dms(rad)
rad_to_dms(rad): Convert radians to degrees, minutes, and seconds of arc.