source: tol/tolbase/lib/toltk/cortable.tcl @ e933fd6

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