def report(self): """ Returns a detailed report on the packing of this structure. """ report = Report() report.add_html_body(self.html_report()) if self.options["reportmode"] == "html": return [report.get_html(), ""] elif self.options["reportmode"] == "text": return [report.get_text(), ""] elif self.options["reportmode"] == "both": return [report.get_text(), report.get_html()] else: raise "unknown report mode option '%s'" % options["reportmode"]
def report(self,options): """ Returns a detailed report on the packing of this structure. """ report = Report() report.add_html_body(self.html_report(options)) if options['reportmode'] == 'html': return [report.get_html(),None] elif options['reportmode'] == 'text': return [report.get_text(),None] elif options['reportmode'] == 'both': return [report.get_text(),report.get_html()] else: raise "unknown report mode option '%s'"%options['reportmode']
def get_surfdist_report(self,surfdist,options): bins = options['surfdist_bins'] maxdepth = options['surfdist_maxdepth'] step = maxdepth/bins count = [0] * bins bigger = 0 total_count = 0 for s in surfdist: if s == -1 or s == 9999: continue for i in range(bins): if s<=(i+1)*step: total_count += 1 count[i] += 1 break if s>maxdepth: bigger += 1 # write table report = """<h2>Distances to next surface atom</h2> <table> <tr><th>bin</th><th>dist</th><th>#atoms</th></tr> """ for i in range(bins): report += "<tr><td>%i</td><td>%5.2f</td><td>%i</td></tr>\n"%(i+1,step*(i+1),count[i]) report += "</table><p>total atoms counted: %i<br>"%total_count report += "\natoms out of range: %i</p>\n"%bigger hreport = Report() hreport.add_html_body(report) if options['reportmode'] == 'html': return [hreport.get_html(),None] elif options['reportmode'] == 'text': return [hreport.get_text(),None] elif options['reportmode'] == 'both': return [hreport.get_text(),hreport.get_html()] else: raise "unknown report mode option '%s'"%options['reportmode'] return hreport