Changeset 2808 in Sophya for trunk/SophyaLib/HiStats


Ignore:
Timestamp:
Jun 14, 2005, 1:25:05 PM (20 years ago)
Author:
ansari
Message:

MAJ documentation - Reza 14/6/2005

Location:
trunk/SophyaLib/HiStats
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/HiStats/basedtable.cc

    r2699 r2808  
    131131}
    132132
    133 
     133//! Adds a line (or row to the table) with r_8* inout data
     134/*!
     135  The data to be added is provided as an array (vector) of double (r_8).
     136  The necessary data conversion is performed, depending on each
     137  column's data typeconverted to the data type.
     138  Return the new number of table rows (lines / entries)
     139  \param data : Data for each cell of the row to be appended
     140  (data[k] k=0..NbColumns())
     141*/
    134142sa_size_t BaseDataTable::AddLine(const r_8* data)
    135143{
     
    155163}
    156164
     165//! Adds a line (or row to the table) with input data as an array of MuTyV
     166/*!
     167  The data to be added is provided as an array (vector) of MuTyV.
     168  The MuTyV class conversion operators are used to match against each
     169  cell data type.
     170  Return the new number of table rows (lines / entries)
     171  \param data : Data (MuTyV*) for each cell of the row to be appended
     172  (data[k] k=0..NbColumns())
     173*/
    157174sa_size_t BaseDataTable::AddLine(const MuTyV* data)
    158175{
     
    247264}
    248265
    249 
    250 //! Prints table definition and number of entries
     266/*! In addition to printing the number of entries and column names,
     267  this method prints also minimum/maximum value for each column.
     268  This information might be computed when the Show() method is called.
     269  This may take some time for tables with large number of entries (>~ 10^6)
     270*/
    251271void   BaseDataTable::Show(ostream& os) const
    252272{
  • trunk/SophyaLib/HiStats/basedtable.h

    r2732 r2808  
    1818
    1919namespace SOPHYA {
     20//! Interface definition for classes handling data in a table.
    2021class BaseDataTable : public AnyDataObj , public NTupleInterface {
    2122public:
     
    3334  virtual           ~BaseDataTable();
    3435 
     36  //! Adds a column holding integer, named \b cnom
    3537  inline sa_size_t  AddIntegerColumn(const char * cnom)
    3638  { return AddColumn(IntegerField, cnom); }
     39  //! Adds a column holding integer, named \b cnom
    3740  inline sa_size_t  AddIntegerColumn(string const & cnom)
    3841  { return AddColumn(IntegerField, cnom); }
     42  //! Adds a column holding long integer, named \b cnom
    3943  inline sa_size_t  AddLongColumn(const char * cnom)
    4044  { return AddColumn(LongField, cnom); }
     45  //! Adds a column holding long integer, named \b cnom
    4146  inline sa_size_t  AddLongColumn(string const & cnom)
    4247  { return AddColumn(LongField, cnom); }
     48  //! Adds a column holding floating values (r_4), named \b cnom
    4349  inline sa_size_t  AddFloatColumn(const char * cnom)
    4450  { return AddColumn(FloatField, cnom); }
     51  //! Adds a column holding floating values (r_4), named \b cnom
    4552  inline sa_size_t  AddFloatColumn(string const & cnom)
    4653  { return AddColumn(FloatField, cnom); }
     54  //! Adds a column holding double values (r_8), named \b cnom
    4755  inline sa_size_t  AddDoubleColumn(const char * cnom)
    4856  { return AddColumn(DoubleField, cnom); }
     57  //! Adds a column holding double values (r_8), named \b cnom
    4958  inline sa_size_t  AddDoubleColumn(string const & cnom)
    5059  { return AddColumn(DoubleField, cnom); }
     60  //! Adds a column holding character strings, named \b cnom
    5161  inline sa_size_t  AddStringColumn(const char * cnom)
    5262  { return AddColumn(StringField, cnom); }
     63  //! Adds a column holding character strings, named \b cnom
    5364  inline sa_size_t  AddStringColumn(string const & cnom)
    5465  { return AddColumn(StringField, cnom); }
     
    6980
    7081  // Acces to various counts and parameters
     82  //! Return the number of lines (rows) in the table)
    7183  inline sa_size_t  NEntry() const { return mNEnt ; }
     84  //! Return the number of columns in the tables (number of cells in a row) 
    7285  inline sa_size_t  NVar() const   { return mNames.size() ; }
     86  //! Return the number of columns in the tables (number of cells in a row) 
    7387  inline sa_size_t  NVars() const   { return mNames.size() ; }
     88  //! Return the segment size (SegDBInterface objects corresponding to columns) 
    7489  inline sa_size_t  SegmentSize() const   { return mSegSz ; }
     90  //! Return the number of segments (SegDBInterface objects corresponding to columns) 
    7591  inline sa_size_t  NbSegments() const   { return mNSeg ; }
    7692
     
    7894  virtual sa_size_t AddLine(const r_8* data);
    7995  virtual sa_size_t AddLine(const MuTyV * data);
    80  
     96
     97  //! Alias for AddLine()
    8198  inline sa_size_t  Fill(const r_8* data)
    8299  { return AddLine(data); }
     100  //! Alias for AddLine()
    83101  inline sa_size_t  Fill(const MuTyV * data);
    84102     
    85103  virtual sa_size_t Extend();
    86104
    87   // Getting a given line (record) information
     105  //! Return the information stored in line \b n of the table
    88106  virtual MuTyV *   GetLine(sa_size_t n) const ;
    89  
     107
     108  //! Return the index for column name \b nom 
    90109  sa_size_t         IndexNom(char const* nom) const ;
     110  //! Return the index for column name \b nom 
    91111  inline sa_size_t  IndexNom(string const & nom) const
    92112  { return IndexNom(nom.c_str()); }
     113  //! Return the column name for column index \b k
    93114  string            NomIndex(sa_size_t k) const ;
    94115
     
    107128  virtual void Clear() = 0;
    108129
    109   // ---- ASCII I/O
     130  //! Prints the table content - NOT YET IMPLEMENTED !
    110131  void              Print(int num, int nmax=1) const ;
    111132 
     133//! Prints table definition and number of entries
    112134  void              Show(ostream& os) const ;
     135  //! Prints table definition and number of entries on the standard output stream \b cout
    113136  inline void       Show() const { Show(cout) ; }
    114137 
     
    144167  mutable r_8 *  mVarD;    // Pour retourner une ligne de la table
    145168  mutable MuTyV *  mVarMTV;    // Pour retourner une ligne de la table en MuTyV
    146  
     169
     170  //! \cond   Pour pas inclure ds la documentation doxygen
    147171  typedef struct {
    148172    string nom;
     
    150174    sa_size_t ser;
    151175  } colst;
     176  //! \endcond 
    152177  std::vector<colst> mNames;
    153178
  • trunk/SophyaLib/HiStats/datatable.cc

    r2699 r2808  
    1111   This class can be used to organize data in table (row-column) form.
    1212   Each column holds homogeneous data (same data type), while different
    13    columns can be used for different data types (integer, float, string ...)
     13   columns can be used for different data types
     14   (integer, float, string ...).
     15   The whole data set is kept in memory.
    1416   \sa SOPHYA::MuTyV
    1517   \sa SOPHYA::BaseDataTable
    16    \sa SOPHYA::ObjFileIO<DataTable>
     18   \sa SOPHYA::SegDataBlock
    1719
    1820   \code
     
    4345}
    4446
    45 //! copy constructor - shares the data
     47//! copy constructor
     48/*!
     49  The copy constructur shares the data if \b share=true.
     50  Otherwise, the Clone() method is called to make a complete copy.
     51*/
    4652DataTable::DataTable(DataTable const & a, bool share)
    4753  : BaseDataTable(a.SegmentSize())
     
    5359  if (a.mInfo)  mInfo = new DVList(*(a.mInfo));
    5460}
    55 
     61//! Copy the table structure from \b a and shares the data (columns content)
    5662void DataTable::Share(DataTable const & a)
    5763{
     
    8591}
    8692
     93//! Copy the table structure from \b a and duplicate (copy) the data (columns content)
    8794void DataTable::Clone(DataTable const & a)
    8895{
     
    115122  } 
    116123}
    117 
     124//! Reset (/clear) the table content and structure
    118125void DataTable::Clear()
    119126{
     
    151158
    152159
     160/*!
     161  Implements the action defined in the BaseDataTable interface.
     162  In the current implementation, throws an exception (ParmError)
     163  if the table contains some data already.
     164*/
    153165sa_size_t DataTable::AddColumn(FieldType ft, string const & cnom)
    154166{
  • trunk/SophyaLib/HiStats/datatable.h

    r2699 r2808  
    1616class FITS_DataTable;
    1717
     18//! An implementation of BaseDataTable with data (columns) stored in memory.
    1819class DataTable : public BaseDataTable {
    1920public:
  • trunk/SophyaLib/HiStats/histinit.cc

    r2699 r2808  
    1717/*!
    1818   \defgroup HiStats HiStats module
    19    This module contains histograms
     19   This module contains histograms (1D, 2D) and
     20   classes for management of data sets as tables (NTuple, DataTable ...)
    2021*/
    2122 
     
    2526  \class SOPHYA::HiStatsInitiator
    2627  \ingroup HiStats
    27   Histograms initiator
     28  This class performs the initialisation for HiStats module.
     29  More specifically, it registers PPF handlers for the following classes :
     30  - Histo
     31  - HProf
     32  - HistoErr
     33  - Histo2D
     34  - NTuple
     35  - XNTuple
     36  - DataTable
     37  - SwPPFDataTable
     38
     39  If the system linker/loader handles correctly static object initialisation, there
     40  is no action required when writing programs. If not, an instance of the class must
     41  be present before any other operation on the libray classes.
    2842*/
     43
    2944HiStatsInitiator::HiStatsInitiator()
    3045  : NToolsInitiator()
  • trunk/SophyaLib/HiStats/ntuple.cc

    r2682 r2808  
    5353
    5454/* --Methode-- */
    55 //! Default constructor
     55//! Default constructor - To be used when reading in an NTuple.
    5656//++
    5757NTuple::NTuple()
  • trunk/SophyaLib/HiStats/ntuple.h

    r2682 r2808  
    2222class FITS_NTuple;
    2323
     24//! Class for creation and management of double or float data sets in a table
    2425class NTuple : public AnyDataObj , public NTupleInterface {
    2526
     
    2829                    NTuple(int nvar, char** noms, int blk=512, bool fgdouble=true);
    2930                    NTuple(const NTuple& NT);
    30   //A virer                 NTuple(char* flnm);
    3131  virtual           ~NTuple();
    3232
     
    3535  void              Fill(r_4* x);
    3636  void              Fill(r_8* x);
    37 
    38   inline int_4      NEntry() const  { return(mNEnt); } 
     37  //! Return the number of lines (rows) in the table)
     38  inline int_4      NEntry() const  { return(mNEnt); }
     39  //! Return the number of columns in the tables (number of cells in a row) 
    3940  inline int_4      NVar() const { return(mNVar); } 
     41  //! Return the bloc size
    4042  inline int_4      BLock() const { return(mBlk); } 
    4143// $CHECK$ Reza 21/10/99 Pourquoi faire BLock() ?
    4244
     45  //! Return the content of the cell for line (row) \b n , column \b k
    4346  float             GetVal(int n, int k)   const;
     47  //! Return the content of the cell for line (row) \b and column name \b nom
    4448  inline float      GetVal(int n, const char* nom) const
    4549                            { return(GetVal(n, IndexNom(nom)) ); }
    4650  int               IndexNom(const char* nom)  const ;
    4751  char*             NomIndex(int k) const;
    48 
     52  //! Return the content of line \b n as a vector of r_4 (float)
    4953  r_4*              GetVec(int n, r_4* ret=NULL)  const ;
     54  //! Return the content of line \b n as a vector of r_8 (double)
    5055  r_8*              GetVecD(int n, r_8* ret=NULL)  const ;
    5156
     
    5560  inline void       Show() const { Show(cout); }
    5661
     62  //! Return the associated DVList object
    5763  DVList&           Info();
    5864
  • trunk/SophyaLib/HiStats/swppfdtable.cc

    r2699 r2808  
    99   This class can be used to organize data in table (row-column) form.
    1010   Each column holds homogeneous data (same data type), while different
    11    columns can be used for different data types (integer, float, string ...)
     11   columns can be used for different data types
     12   (integer, float, string ...).
     13   A PPF stream is used as swap space. Due to limitations in the current
     14   implementation of PPF streams, read operations (acces to table data) cannot
     15   be performed when a table is being filled.
     16
     17   \warning
     18   - When creating a table, the output PPF stream (POutPersist) must not be closed
     19   (destroyed) before the call to the SwPPFDataTable object.
     20   - It is not possible to make a complete (deep) copy of a table SwPPFDataTable
     21   Copy constructor and equal operator shares the data.
     22   - Although the destructor  DOES NOT save the
     23   table object itself to the memory. You have to use the << operator on the
     24   output PPF stream being used as swap
     25
    1226   \sa SOPHYA::MuTyV
    13    \sa SOPHYA::BaseDataTable
    14    \sa SOPHYA::ObjFileIO<DataTable>
     27   \sa SOPHYA::DataTable
     28   \sa SOPHYA::SwSegDataBlock  SOPHYA::PPFDataSwapper
    1529
    1630   \code
    1731   #include "swppfdtable.h"
    1832   // ...
    19    DataTable dt(64);
     33   {
     34   // ---- Creation of the table
     35   // Create the swap stream
     36   POutPersist so("myswtable.ppf");
     37   SwPPFDataTable dt(so, 64);
     38   // define table columns
    2039   dt.AddFloatColumn("X0_f");
    2140   dt.AddFloatColumn("X1_f");
    2241   dt.AddDoubleColumn("X0X0pX1X1_d");
    23    double x[5];
     42   // Fill the table
     43   MuTyV x[5];
    2444   for(int i=0; i<63; i++) {
    2545     x[0] = (i%9)-4.;  x[1] = (i/9)-3.;  x[2] = x[0]*x[0]+x[1]*x[1];
     
    2848   // Printing table info
    2949   cout << dt ;
    30    // Saving object into a PPF file
    31    POutPersist po("dtable.ppf");
    32    po << dt ;
     50   // Swap out all data and write the table structure to the PPF stream
     51   so << dt ;
     52   // ....
     53   }
     54   {
     55   // ---- Accessing information from a previously created table
     56   SwPPFDataTable dt;
     57   PInPersist si("myswtable.ppf");
     58   si >> dt;
     59   // Printing table info
     60   cout << dt ;   
     61   }
    3362   \endcode
    3463*/
    35 /*! Default constructor with optional specification of block (or segment) size -
    36     NOT intented for general use
    37 */
     64//! Default constructor with optional specification of block (or segment) size
    3865SwPPFDataTable::SwPPFDataTable(sa_size_t segsz)
    3966  : BaseDataTable(segsz),
     
    205232
    206233
     234/*!
     235  Implements the action defined in the BaseDataTable interface.
     236  In the current implementation, throws an exception (ParmError)
     237  if the table contains some data already.
     238*/
    207239sa_size_t SwPPFDataTable::AddColumn(FieldType ft, string const & cnom)
    208240{
     
    271303}
    272304
     305//! Adds a line (or row to the table) with r_8* input data.
     306/*!
     307  The min/max values for each column is updated, in addition
     308  to the actions performed by the base class AddLine()
     309*/
    273310sa_size_t SwPPFDataTable::AddLine(const r_8* data)
    274311{
     
    284321}
    285322
     323//! Adds a line (or row to the table) with input data as an array of MuTyV
     324/*!
     325  The min/max values for each column is updated, in addition
     326  to the actions performed by the base class AddLine()
     327*/
    286328sa_size_t SwPPFDataTable::AddLine(const MuTyV * data)
    287329{
  • trunk/SophyaLib/HiStats/swppfdtable.h

    r2699 r2808  
    1515namespace SOPHYA {
    1616
     17//! An implementation of BaseDataTable with using a PPF stream as swap space.
    1718class SwPPFDataTable : public BaseDataTable {
    1819public:
     
    3637  friend class ObjFileIO<BaseDataTable> ;
    3738 
    38   //! Reset the table content and structure
     39  //! Reset(Clear) the table content and structure
    3940  virtual void Clear();
    4041  /*! This method should be called in order to empty the swapout buffer,
     
    6465  // un comptage de reference pour le detruire lorsque tous les tables
    6566  // l'utilisant sont supprimes
     67  //! \cond    Pour NE PAS inclure dans la doc
    6668  typedef struct { PInPersist* pis; uint_4 refcnt; } St_InSwap;
     69  //! \endcond
    6770  St_InSwap * mSwIn;
    6871};
  • trunk/SophyaLib/HiStats/xntuple.cc

    r2682 r2808  
    2424   columns with int, float or string type content. In addition, this class
    2525   can handle large data sets, using swap space on disk.
    26    \sa SOPHYA::ObjFileIO<XNTuple>
     26
     27   \sa SOPHYA::BaseDataTable SOPHYA::DataTable SOPHYA::SwPPFDataTable
     28
     29   \deprecated
     30   This class is being deprecated. Use classes derived from SOPHYA::BaseDataTable
     31   whenever possible
     32
    2733
    2834   \code
  • trunk/SophyaLib/HiStats/xntuple.h

    r2682 r2808  
    2727// Bloc de donnees
    2828//
     29//! \cond  Pour ne pas inclure dans la documentation
    2930struct NTBlk
    3031{
     
    4142    char*    sdata ; 
    4243} ;
    43 
     44//! \endcond
    4445//  Forward class declaration for Fits handler
    4546class FITS_XNTuple;
    4647
     48//! Class for creation and management of data sets organised as a table
    4749class XNTuple : public AnyDataObj , public NTupleInterface {
    4850public:
Note: See TracChangeset for help on using the changeset viewer.