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 10 of file tablePrinter.py.

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

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

tablePrinter.delim
tablePrinter.False

Definition at line 74 of file tablePrinter.py.

tablePrinter.hasHeader

Definition at line 60 of file tablePrinter.py.

tablePrinter.headerwidth

Definition at line 73 of file tablePrinter.py.

tablePrinter.labels

Definition at line 52 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 75 of file tablePrinter.py.

tablePrinter.lumiheader

Definition at line 72 of file tablePrinter.py.

Referenced by lumi::Lumi2DB.retrieveData().

tablePrinter.postfix
tablePrinter.prefix

Definition at line 64 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(), and TauTagValidation.stripDiscriminatorLabel().

tablePrinter.rows
tablePrinter.separateRows

Definition at line 64 of file tablePrinter.py.

tablePrinter.True

Definition at line 64 of file tablePrinter.py.

tablePrinter.width

Definition at line 61 of file tablePrinter.py.

tablePrinter.wrapfunc

Definition at line 64 of file tablePrinter.py.

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