CMS 3D CMS Logo

Functions | Variables
tablePrinter Namespace Reference

Functions

def indent (rows, hasHeader=False, headerChar='-', delim='| ', justify='center', separateRows=False, prefix='', postfix='', wrapfunc=lambda x:x)
 

Variables

 data
 
 delim
 
 False
 
 hasHeader
 
 headerwidth
 
 labels
 
 lumidata
 
 lumifooter
 
 lumiheader
 
 postfix
 
 prefix
 
 rows
 
 separateRows
 
 True
 
 width
 
 wrapfunc
 

Function Documentation

def tablePrinter.indent (   rows,
  hasHeader = False,
  headerChar = '-',
  delim = ' | ',
  justify = 'center',
  separateRows = False,
  prefix = '',
  postfix = '',
  wrapfunc = lambda x:x 
)
Indents a table by column.
- rows: A sequence of sequences of items, one sequence per row.
- hadHeader: True if the first row consists of the column's names.
- headerChar: Character to be used for the row separator line
(if hasHeader==True or separateRows==True).
- delim: The column delimiter.
- justify: Determines how are data justified in their column.
Valid values are 'left','right','center'.
- separateRows: True if rows are to be separated by a line of 'headerChar's.
- prefix: A string prepended to each printed row.
- postfix: A string appended to each printed row.
- wrapfunc: A function f(text) for wrapping text; each element in the table is first wrapped by this function.

Definition at line 9 of file tablePrinter.py.

References genParticles_cff.map, SiStripPI.max, split, str, wrapfunc, and ComparisonHelper.zip().

9  separateRows=False,prefix='',postfix='',wrapfunc=lambda x:x):
10  """
11  Indents a table by column.
12  - rows: A sequence of sequences of items, one sequence per row.
13  - hadHeader: True if the first row consists of the column's names.
14  - headerChar: Character to be used for the row separator line
15  (if hasHeader==True or separateRows==True).
16  - delim: The column delimiter.
17  - justify: Determines how are data justified in their column.
18  Valid values are 'left','right','center'.
19  - separateRows: True if rows are to be separated by a line of 'headerChar's.
20  - prefix: A string prepended to each printed row.
21  - postfix: A string appended to each printed row.
22  - wrapfunc: A function f(text) for wrapping text; each element in the table is first wrapped by this function.
23  """
24  #nested function
25  #closure for breaking logical rows to physical, using wrapfunc
26  def rowWrapper(row):
27  newRows=[wrapfunc(item).split('\n') for item in row]
28  #print 'newRows: ',newRows
29  #print 'map result: ',map(None,*newRows)
30  #print 'rowwrapped: ',[[substr or '' for substr in item] for item in map(None,*newRows)]
31  return [[substr or '' for substr in item] for item in map(None,*newRows)]
32  # break each logical row into one or more physical ones
33  logicalRows = [rowWrapper(row) for row in rows]
34  # columns of physical rows
35  columns = map(None,*reduce(operator.add,logicalRows))
36  # get the maximum of each column by the string length of its items
37  maxWidths = [max([len(str(item)) for item in column]) for column in columns]
38  rowSeparator = headerChar * (len(prefix) + len(postfix) + sum(maxWidths) + len(delim)*(len(maxWidths)-1))
39  # select the appropriate justify method
40  justify = {'center':str.center,'right':str.rjust,'left':str.ljust}[justify.lower()]
41  output=cStringIO.StringIO()
42  if separateRows: print >> output,rowSeparator
43  for physicalRows in logicalRows:
44  for row in physicalRows:
45  print >> output, prefix+delim.join([justify(str(item),width) for (item,width) in zip(row,maxWidths)])+postfix
46  if separateRows or hasHeader: print >> output, rowSeparator; hasHeader=False
47  return output.getvalue()
48 
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
#define str(s)
double split
Definition: MVATrainer.cc:139

Variable Documentation

tablePrinter.data

Definition at line 52 of file tablePrinter.py.

tablePrinter.delim
tablePrinter.False

Definition at line 73 of file tablePrinter.py.

tablePrinter.hasHeader

Definition at line 59 of file tablePrinter.py.

tablePrinter.headerwidth

Definition at line 72 of file tablePrinter.py.

tablePrinter.labels

Definition at line 51 of file tablePrinter.py.

Referenced by BTagPerformanceAnalyzerOnData.analyze(), BTagPerformanceAnalyzerMC.analyze(), AlCaElectronsTest.analyze(), SiPixelHitEfficiencySource.analyze(), SiPixelTrackResidualSource.analyze(), HLTPrescaleRecorder.beginRun(), DigiInvestigatorHistogramMaker.book(), ecaldqm::MESetEcal.book(), DigiVtxPosCorrHistogramMaker.book(), DigiVertexCorrHistogramMaker.book(), DigiPileupCorrHistogramMaker.book(), DigiLumiCorrHistogramMaker.book(), DigiBXCorrHistogramMaker< T >.book(), cscdqm::Collection.book(), pat::TauJetCorrFactors.correctionLabels(), pat::JetCorrFactors.correctionLabels(), pat::TauJetCorrFactors.correctionLabelString(), pat::JetCorrFactors.correctionLabelString(), HLTMuonValidator.dqmBeginRun(), HLTMuonOfflineAnalyzer.dqmBeginRun(), TriggerBxMonitor.dqmBeginRun(), TriggerRatesMonitor.dqmBeginRun(), HLTConfigData.dump(), HLTPrescaleRecorder.endRun(), TauDQMHistPlotter.endRun(), GenericTriggerEventFlag.expressionsFromDB(), HLTConfigData.extract(), TrackingNtuple.fillSeeds(), TrackingNtuple.fillTracks(), EcalSimpleUncalibRecHitFilter.filter(), EcalMIPRecHitFilter.filter(), ecaldqm::binning.formAxis(), hcaldqm::quantity::FEDQuantity.getLabels(), hcaldqm::quantity::CrateQuantity.getLabels(), hcaldqm::quantity::RunNumber.getLabels(), hcaldqm::quantity::EventType.getLabels(), hcaldqm::quantity.getLabels_Crate(), hcaldqm::quantity.getLabels_CrateuTCA(), hcaldqm::quantity.getLabels_CrateVME(), hcaldqm::quantity.getLabels_FED(), hcaldqm::quantity.getLabels_FEDuTCA(), hcaldqm::quantity.getLabels_FEDuTCASlot(), hcaldqm::quantity.getLabels_FEDVME(), hcaldqm::quantity.getLabels_FEDVMESpigot(), hcaldqm::quantity.getLabels_FiberCh(), hcaldqm::quantity.getLabels_FiberChuTCATP(), hcaldqm::quantity.getLabels_FiberuTCA(), hcaldqm::quantity.getLabels_FiberuTCAFiberCh(), hcaldqm::quantity.getLabels_FiberuTCATP(), hcaldqm::quantity.getLabels_FiberuTCATPFiberChuTCATP(), hcaldqm::quantity.getLabels_FiberVME(), hcaldqm::quantity.getLabels_FiberVMEFiberCh(), hcaldqm::quantity.getLabels_ieta(), hcaldqm::quantity.getLabels_SLB(), hcaldqm::quantity.getLabels_SLBCh(), hcaldqm::quantity.getLabels_SLBSLBCh(), hcaldqm::quantity.getLabels_SlotuTCA(), hcaldqm::quantity.getLabels_Subdet(), hcaldqm::quantity.getLabels_SubdetPM(), hcaldqm::quantity.getLabels_TTieta(), hcaldqm::quantity.getLabels_TTieta2x3(), hcaldqm::quantity.getLabels_TTSubdet(), hcaldqm::quantity.getLabels_TTSubdetPM(), edm::service::PrescaleService.getPrescaleTable(), HCalSD.HCalSD(), edm::EDConsumerBase.labelsForToken(), rpcdqm::utils.labelYAxisRing(), hitfit.make_constraint_intermed(), edm::PrincipalGetAdapter.makeFailToGetException(), TrackerHitAssociator.makeMaps(), PlotCombiner.makePlot(), B2GSingleLeptonHLTValidation.monitorPath(), B2GDoubleLeptonHLTValidation.monitorPath(), TopSingleLeptonHLTValidation.monitorPath(), B2GHadronicHLTValidation.monitorPath(), TopDiLeptonHLTValidation.monitorPath(), MultiplicityTimeCorrelations.MultiplicityTimeCorrelations(), MultiTrackValidator.MultiTrackValidator(), ecaldqm::binning::AxisSpecs.operator=(), PlotPixelMultVtxPos(), FastTimerService.postBeginJob(), TrackListCombiner.produce(), TrackRefitter.produce(), HIPixelTrackFilterProducer.produce(), ReducedESRecHitCollectionProducer.produce(), GenTrackMatcher.produce(), HIProtoTrackFilterProducer.produce(), EcalEBTrigPrimProducer.produce(), ReducedRecHitCollectionProducer.produce(), EcalTrigPrimProducer.produce(), HITrackClusterRemover.produce(), pat::TriggerObjectStandAlone.psetID(), TopSingleLepton_miniAOD::MonitorEnsemble.selectionPath(), SingleTopTChannelLepton_miniAOD::MonitorEnsemble.selectionPath(), HLTOfflineDQMTopSingleLepton::MonitorSingleLepton.selectionPath(), HLTOfflineDQMTopDiLepton::MonitorDiLepton.selectionPath(), SingleTopTChannelLepton::MonitorEnsemble.selectionPath(), TopSingleLepton::MonitorEnsemble.selectionPath(), TopDiLeptonOffline::MonitorEnsemble.selectionPath(), DTLocalTriggerTask.setQLabels(), DTLocalTriggerBaseTask.setQLabels(), DTLocalTriggerTask.setQLabelsTheta(), DTLocalTriggerBaseTask.setQLabelsTheta(), MVAJetTagPlotter.tagInfoRequirements(), TauDQMHistPlotter.TauDQMHistPlotter(), edm::PrincipalGetAdapter.throwAmbiguousException(), edm::EDConsumerBase.updateLookup(), MeasurementTrackerEventProducer.updatePhase2OT(), MeasurementTrackerEventProducer.updatePixels(), MeasurementTrackerEventProducer.updateStrips(), ecaldqm::binning::AxisSpecs.~AxisSpecs(), and DigiBXCorrHistogramMaker< EventWithHistory >.~DigiBXCorrHistogramMaker().

tablePrinter.lumidata
tablePrinter.lumifooter

Definition at line 74 of file tablePrinter.py.

tablePrinter.lumiheader

Definition at line 71 of file tablePrinter.py.

Referenced by lumi::Lumi2DB.retrieveData().

tablePrinter.postfix
tablePrinter.prefix

Definition at line 63 of file tablePrinter.py.

Referenced by MuonGeometrySanityCheck.analyze(), PrimaryVertexAnalyzer4PUSlimmed.bookHistograms(), DQMGenericTnPClient.calculateEfficiency(), PrimaryVertexAnalyzer4PUSlimmed.calculatePurityAndFillHistograms(), ChamberLocationSpec.chamberLocationName(), tensorflow::TBBSession.CreateGraphs(), tensorflow::NTSession.CreateGraphs(), GeneralHLTOffline.dqmBeginRun(), SusyPostProcessor.dqmEndJob(), MonitorElement.Fill(), SiPixelActionExecutor.fillFEDErrorSummary(), PrimaryVertexAnalyzer4PUSlimmed.fillGenAssociatedRecoVertexHistograms(), SiPixelActionExecutor.fillGrandBarrelSummaryHistos(), SiPixelActionExecutor.fillGrandEndcapSummaryHistos(), FastTimerServiceClient.fillPathSummaryPlots(), PrimaryVertexAnalyzer4PUSlimmed.fillResolutionAndPullHistograms(), SiPixelActionExecutor.fillSummary(), CondDBESSource.fillTagCollectionFromDB(), HcalLaserEventFilter.GetCMSSWVersion(), PhysicsTools::Calibration::VarProcessor.getInstanceName(), L1GtPsbSetupConfigOnlineProd.getRequiredValue(), FWTGeoRecoGeometryESProducer.GetTopHolder(), HcalRecHitsDQMClient.HcalRecHitsEndjob(), FillInfo.is25nsBunchSpacing(), LHCInfo.is25nsBunchSpacing(), cscdqm::Collection.load(), main(), dqm::DQMFileSaverOnline.makeSnapshot(), MuonGeometrySanityCheck.MuonGeometrySanityCheck(), RawFile.open(), FRDStreamSource.openFile(), MonitorElement.packScalarData(), HcalLedAnalysis.ProcessCalibEvent(), CmsShowSearchFiles.sendToWebBrowser(), ElectronDqmAnalyzerBase.setBookPrefix(), ElectronDqmHarvesterBase.setBookPrefix(), PFBlockAlgo.setLinkers(), CommonAnalyzer.setPrefix(), CmsShowSearchFiles.showPrefixes(), TauTagValidation.stripDiscriminatorLabel(), and deep_tau::TauWPThreshold.TauWPThreshold().

tablePrinter.rows
tablePrinter.separateRows

Definition at line 63 of file tablePrinter.py.

tablePrinter.True

Definition at line 63 of file tablePrinter.py.

tablePrinter.width

Definition at line 60 of file tablePrinter.py.

tablePrinter.wrapfunc

Definition at line 63 of file tablePrinter.py.

Referenced by dataformats.indent(), and indent().