source: tol/tolbase/lib/toltk/statable.tcl @ 1b5b24e

devel
Last change on this file since 1b5b24e was 6d7779d, checked in by Jorge Pérez <josp.jorge@…>, 18 years ago

initial import

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@1 be4846ae-f051-483a-831f-b64e7d08527f

  • Property mode set to 100644
File size: 3.8 KB
Line 
1#/////////////////////////////////////////////////////////////////////////////
2# FILE    : statable.tcl
3# PURPOSE : This file contains a namespace called StatisticsTable with its
4#           functions. It's for managing series statistics tables.
5#           It's a child of BayesTable so inherites all its functionalities.
6#/////////////////////////////////////////////////////////////////////////////
7
8
9#/////////////////////////////////////////////////////////////////////////////
10  namespace eval ::StatisticsTable {
11#
12# PURPOSE: The purpose of this namespace is organize code and functions and
13#          provides functions to create and manage a series statistics table.
14#          A special namespace is created for each instance of statitstics
15#          table.
16#
17#/////////////////////////////////////////////////////////////////////////////
18}
19
20
21#/////////////////////////////////////////////////////////////////////////////
22  proc ::StatisticsTable::Create {path sergrp} {
23#
24# PURPOSE:
25#
26# PARAMETERS:
27#
28#/////////////////////////////////////////////////////////////////////////////
29  set this [::BayesTable::Create $path \
30    -fillproc "::StatisticsTable::Fill $sergrp" -child StatisticsTable]
31  ReadIni   $this
32  Configure $this
33}
34
35
36#/////////////////////////////////////////////////////////////////////////////
37  proc ::StatisticsTable::Fill {sergrp this} {
38#
39# PURPOSE:
40#
41# PARAMETERS:
42#
43#/////////////////////////////////////////////////////////////////////////////
44  # insert the series into the table
45  set numCols [$sergrp serie size]
46  set list  [lindex [::tol::seriestat [$sergrp serie 0 reference]] 1]
47  foreach {name value} $list {
48    lappend stat $name
49  }
50  set numRows [llength $stat]
51  #::BayesTable::SetElement $this 0 0 [mc "Statistics"]
52  for {set i 0} {$i < $numRows} {incr i} {
53    ::BayesTable::SetElement $this [expr $i+1] 0 [mc [lindex $stat $i]]
54  }
55
56  for {set j 0} {$j < $numCols} {incr j} {
57    ::BayesTable::SetElement $this 0 [expr $j+1] [$sergrp serie $j name]
58    set values [lindex [::tol::seriestat [$sergrp serie $j reference]] 1]
59    for {set i 0} {$i < $numRows} {incr i} {
60      ::BayesTable::SetElement $this [expr $i+1] [expr $j+1] \
61                [lindex $values [expr 2*$i+1]]
62    }
63  }
64  ::BayesTable::SetMatrixInfo $this \
65          [list [expr $numRows+1] [expr $numCols+1]] ""
66}
67
68
69#/////////////////////////////////////////////////////////////////////////////
70# INIFILE
71#/////////////////////////////////////////////////////////////////////////////
72
73#/////////////////////////////////////////////////////////////////////////////
74  proc ::StatisticsTable::ReadIni {this} {
75#
76# PURPOSE: Reads specific options from .ini file. First of all, reads options
77#          from BayesTable. Actually there isn't specific options.
78#
79# PARAMETERS:
80#   this  -> Instance of BayesTable
81#
82#/////////////////////////////////////////////////////////////////////////////
83  # General options (parent)
84  ::BayesTable::ReadIni $this
85  # Specific options
86}
87
88
89#/////////////////////////////////////////////////////////////////////////////
90  proc ::StatisticsTable::WriteIni {this} {
91#
92# PURPOSE: Writes specific options to .ini file. This procedure is called by
93#          parent BayesGraph. Actually doesn't do anything.
94#
95# PARAMETERS:
96#   this  -> Instance of BayesTable
97#
98#/////////////////////////////////////////////////////////////////////////////
99
100}
101
102
103#/////////////////////////////////////////////////////////////////////////////
104  proc ::StatisticsTable::Configure {this} {
105#
106# PURPOSE: Configures some options of Statistics Table. First of all,
107#          configures options from BayesTable. Actually there isn't specific
108#          options.
109#
110# PARAMETERS:
111#   this  -> Instance of BayesTable
112#
113#/////////////////////////////////////////////////////////////////////////////
114  # General options (parent)
115  ::BayesTable::Configure $this
116  # Specific options
117}
Note: See TracBrowser for help on using the repository browser.