LazStats: Refactor MedianPolishUnit. Note: Unit not tested. Comparing with a youtube video on this subject, it does not seem to work.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7375 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-04-12 22:16:23 +00:00
parent 55b63a817f
commit 32a5a614c8
4 changed files with 897 additions and 882 deletions

View File

@@ -1,100 +1,81 @@
object MedianPolishForm: TMedianPolishForm object MedianPolishForm: TMedianPolishForm
Left = 638 Left = 638
Height = 408 Height = 410
Top = 340 Top = 340
Width = 462 Width = 472
AutoSize = True AutoSize = True
Caption = 'Median Polishing for a Two-Way Table' Caption = 'Median Polishing for a Two-Way Table'
ClientHeight = 408 ClientHeight = 410
ClientWidth = 462 ClientWidth = 472
OnActivate = FormActivate OnActivate = FormActivate
OnCreate = FormCreate OnCreate = FormCreate
OnShow = ResetBtnClick OnShow = ResetBtnClick
Position = poMainFormCenter Position = poMainFormCenter
LCLVersion = '2.1.0.0' LCLVersion = '2.1.0.0'
object ResetBtn: TButton object ResetBtn: TButton
AnchorSideRight.Control = CancelBtn
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 161
Height = 25
Top = 375
Width = 54
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 100
BorderSpacing.Top = 8
BorderSpacing.Right = 12
BorderSpacing.Bottom = 8
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 3
end
object CancelBtn: TButton
AnchorSideRight.Control = ComputeBtn AnchorSideRight.Control = ComputeBtn
AnchorSideBottom.Control = Owner AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 227 Left = 263
Height = 25 Height = 25
Top = 375 Top = 377
Width = 62 Width = 54
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
AutoSize = True AutoSize = True
BorderSpacing.Left = 12 BorderSpacing.Left = 8
BorderSpacing.Top = 8 BorderSpacing.Top = 8
BorderSpacing.Right = 12 BorderSpacing.Right = 8
BorderSpacing.Bottom = 8 BorderSpacing.Bottom = 8
Cancel = True Caption = 'Reset'
Caption = 'Cancel' OnClick = ResetBtnClick
ModalResult = 2 TabOrder = 1
TabOrder = 4
end end
object ComputeBtn: TButton object ComputeBtn: TButton
AnchorSideRight.Control = ReturnBtn AnchorSideRight.Control = CloseBtn
AnchorSideBottom.Control = Owner AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 301 Left = 325
Height = 25 Height = 25
Top = 375 Top = 377
Width = 76 Width = 76
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
AutoSize = True AutoSize = True
BorderSpacing.Left = 12 BorderSpacing.Left = 8
BorderSpacing.Top = 8 BorderSpacing.Top = 8
BorderSpacing.Right = 12 BorderSpacing.Right = 8
BorderSpacing.Bottom = 8 BorderSpacing.Bottom = 8
Caption = 'Compute' Caption = 'Compute'
OnClick = ComputeBtnClick OnClick = ComputeBtnClick
TabOrder = 5 TabOrder = 2
end end
object ReturnBtn: TButton object CloseBtn: TButton
AnchorSideRight.Control = Owner AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 389 Left = 409
Height = 25 Height = 25
Top = 375 Top = 377
Width = 61 Width = 55
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
AutoSize = True AutoSize = True
BorderSpacing.Left = 12 BorderSpacing.Left = 8
BorderSpacing.Top = 8 BorderSpacing.Top = 8
BorderSpacing.Right = 12 BorderSpacing.Right = 8
BorderSpacing.Bottom = 8 BorderSpacing.Bottom = 8
Caption = 'Return' Caption = 'Close'
ModalResult = 1 ModalResult = 11
TabOrder = 6 TabOrder = 3
end end
object Bevel1: TBevel object Bevel1: TBevel
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
AnchorSideRight.Control = Owner AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = ReturnBtn AnchorSideBottom.Control = CloseBtn
Left = 0 Left = 0
Height = 8 Height = 8
Top = 359 Top = 361
Width = 462 Width = 472
Anchors = [akLeft, akRight, akBottom] Anchors = [akLeft, akRight, akBottom]
Shape = bsBottomLine Shape = bsBottomLine
end end
@@ -103,15 +84,16 @@ object MedianPolishForm: TMedianPolishForm
AnchorSideTop.Control = Owner AnchorSideTop.Control = Owner
AnchorSideRight.Control = Owner AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = NormChk AnchorSideBottom.Control = Bevel1
Left = 0 Left = 0
Height = 340 Height = 361
Top = 0 Top = 0
Width = 462 Width = 472
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
AutoSize = True
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 340 ClientHeight = 361
ClientWidth = 462 ClientWidth = 472
TabOrder = 0 TabOrder = 0
object Label1: TLabel object Label1: TLabel
AnchorSideLeft.Control = Panel1 AnchorSideLeft.Control = Panel1
@@ -129,58 +111,59 @@ object MedianPolishForm: TMedianPolishForm
AnchorSideLeft.Control = Panel1 AnchorSideLeft.Control = Panel1
AnchorSideTop.Control = Label1 AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = DepIn1 AnchorSideRight.Control = DepIn
AnchorSideBottom.Control = Panel1 AnchorSideBottom.Control = Panel1
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 8 Left = 8
Height = 309 Height = 338
Top = 23 Top = 23
Width = 201 Width = 206
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 8 BorderSpacing.Left = 8
BorderSpacing.Right = 8 BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
ItemHeight = 0 ItemHeight = 0
OnSelectionChange = VarListSelectionChange
TabOrder = 0 TabOrder = 0
end end
object DepVar: TEdit object DepVar: TEdit
AnchorSideLeft.Control = DepIn1 AnchorSideLeft.Control = DepIn
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideRight.Control = Panel1 AnchorSideRight.Control = Panel1
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = DepOut AnchorSideBottom.Control = DepOut
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 253 Left = 258
Height = 23 Height = 23
Top = 48 Top = 48
Width = 201 Width = 206
Anchors = [akLeft, akRight, akBottom] Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 8 BorderSpacing.Left = 8
BorderSpacing.Right = 8 BorderSpacing.Right = 8
BorderSpacing.Bottom = 12 BorderSpacing.Bottom = 12
ReadOnly = True
TabOrder = 4 TabOrder = 4
Text = 'DepVar' Text = 'DepVar'
end end
object DepIn1: TBitBtn object DepIn: TBitBtn
AnchorSideLeft.Control = Panel1 AnchorSideLeft.Control = Panel1
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = VarList AnchorSideTop.Control = VarList
Left = 217 Left = 222
Height = 28 Height = 28
Top = 23 Top = 23
Width = 28 Width = 28
Images = MainDataModule.ImageList Images = MainDataModule.ImageList
ImageIndex = 1 ImageIndex = 1
OnClick = DepIn1Click OnClick = DepInClick
Spacing = 0 Spacing = 0
TabOrder = 1 TabOrder = 1
end end
object DepOut: TBitBtn object DepOut: TBitBtn
AnchorSideLeft.Control = Panel1 AnchorSideLeft.Control = Panel1
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = DepIn1 AnchorSideTop.Control = DepIn
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 217 Left = 222
Height = 28 Height = 28
Top = 55 Top = 55
Width = 28 Width = 28
@@ -196,7 +179,7 @@ object MedianPolishForm: TMedianPolishForm
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = DepOut AnchorSideTop.Control = DepOut
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 217 Left = 222
Height = 28 Height = 28
Top = 107 Top = 107
Width = 28 Width = 28
@@ -212,7 +195,7 @@ object MedianPolishForm: TMedianPolishForm
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = Fact1In AnchorSideTop.Control = Fact1In
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 217 Left = 222
Height = 28 Height = 28
Top = 139 Top = 139
Width = 28 Width = 28
@@ -228,7 +211,7 @@ object MedianPolishForm: TMedianPolishForm
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = Fact1Out AnchorSideTop.Control = Fact1Out
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 217 Left = 222
Height = 28 Height = 28
Top = 191 Top = 191
Width = 28 Width = 28
@@ -244,7 +227,7 @@ object MedianPolishForm: TMedianPolishForm
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = Fact2In AnchorSideTop.Control = Fact2In
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 217 Left = 222
Height = 28 Height = 28
Top = 222 Top = 222
Width = 28 Width = 28
@@ -262,16 +245,17 @@ object MedianPolishForm: TMedianPolishForm
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Fact1Out AnchorSideBottom.Control = Fact1Out
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 253 Left = 258
Height = 23 Height = 23
Top = 132 Top = 132
Width = 201 Width = 206
Anchors = [akLeft, akRight, akBottom] Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 8 BorderSpacing.Left = 8
BorderSpacing.Right = 8 BorderSpacing.Right = 8
BorderSpacing.Bottom = 12 BorderSpacing.Bottom = 12
ReadOnly = True
TabOrder = 7 TabOrder = 7
Text = 'Edit1' Text = 'Factor1'
end end
object Factor2: TEdit object Factor2: TEdit
AnchorSideLeft.Control = Fact2In AnchorSideLeft.Control = Fact2In
@@ -280,22 +264,23 @@ object MedianPolishForm: TMedianPolishForm
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Fact2Out AnchorSideBottom.Control = Fact2Out
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 253 Left = 258
Height = 23 Height = 23
Top = 215 Top = 215
Width = 201 Width = 206
Anchors = [akLeft, akRight, akBottom] Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 8 BorderSpacing.Left = 8
BorderSpacing.Right = 8 BorderSpacing.Right = 8
BorderSpacing.Bottom = 12 BorderSpacing.Bottom = 12
ReadOnly = True
TabOrder = 10 TabOrder = 10
Text = 'Edit1' Text = 'Factor2'
end end
object Label4: TLabel object Label4: TLabel
AnchorSideLeft.Control = Fact2Out AnchorSideLeft.Control = Fact2Out
AnchorSideTop.Control = Fact2Out AnchorSideTop.Control = Fact2Out
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 217 Left = 222
Height = 15 Height = 15
Top = 274 Top = 274
Width = 81 Width = 81
@@ -308,10 +293,11 @@ object MedianPolishForm: TMedianPolishForm
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label4 AnchorSideTop.Control = Label4
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 306 Left = 311
Height = 23 Height = 23
Top = 270 Top = 270
Width = 35 Width = 35
Alignment = taRightJustify
BorderSpacing.Left = 8 BorderSpacing.Left = 8
TabOrder = 11 TabOrder = 11
Text = '5' Text = '5'
@@ -319,7 +305,7 @@ object MedianPolishForm: TMedianPolishForm
object StaticText1: TStaticText object StaticText1: TStaticText
AnchorSideLeft.Control = DepVar AnchorSideLeft.Control = DepVar
AnchorSideBottom.Control = DepVar AnchorSideBottom.Control = DepVar
Left = 253 Left = 258
Height = 15 Height = 15
Top = 31 Top = 31
Width = 73 Width = 73
@@ -331,7 +317,7 @@ object MedianPolishForm: TMedianPolishForm
object Label2: TLabel object Label2: TLabel
AnchorSideLeft.Control = Factor1 AnchorSideLeft.Control = Factor1
AnchorSideBottom.Control = Factor1 AnchorSideBottom.Control = Factor1
Left = 253 Left = 258
Height = 15 Height = 15
Top = 115 Top = 115
Width = 42 Width = 42
@@ -343,7 +329,7 @@ object MedianPolishForm: TMedianPolishForm
object Label3: TLabel object Label3: TLabel
AnchorSideLeft.Control = Factor2 AnchorSideLeft.Control = Factor2
AnchorSideBottom.Control = Factor2 AnchorSideBottom.Control = Factor2
Left = 253 Left = 258
Height = 15 Height = 15
Top = 198 Top = 198
Width = 42 Width = 42
@@ -352,32 +338,31 @@ object MedianPolishForm: TMedianPolishForm
Caption = 'Factor 2' Caption = 'Factor 2'
ParentColor = False ParentColor = False
end end
end object NormChk: TCheckBox
object ItersBtn: TRadioButton AnchorSideLeft.Control = DepIn
AnchorSideLeft.Control = NormChk AnchorSideTop.Control = MaxEdit
AnchorSideLeft.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideTop.Control = NormChk Left = 222
AnchorSideTop.Side = asrCenter Height = 19
Left = 258 Top = 305
Height = 19 Width = 234
Top = 340 BorderSpacing.Top = 12
Width = 182 Caption = 'Show Bill Miller''s Normalizing Procedure'
BorderSpacing.Left = 16 TabOrder = 12
BorderSpacing.Right = 8 end
Caption = 'Show Results for Each Iteration' object ItersBtn: TRadioButton
TabOrder = 2 AnchorSideLeft.Control = DepIn
Visible = False AnchorSideTop.Control = NormChk
end AnchorSideTop.Side = asrBottom
object NormChk: TCheckBox Left = 222
AnchorSideLeft.Control = Owner Height = 19
AnchorSideBottom.Control = Bevel1 Top = 328
Left = 8 Width = 182
Height = 19 BorderSpacing.Top = 4
Top = 340 BorderSpacing.Right = 8
Width = 234 Caption = 'Show Results for Each Iteration'
Anchors = [akLeft, akBottom] TabOrder = 13
BorderSpacing.Left = 8 Visible = False
Caption = 'Show Bill Miller''s Normalizing Procedure' end
TabOrder = 1
end end
end end

View File

@@ -90,6 +90,9 @@ const
DIVIDER = '==========================================================================='; DIVIDER = '===========================================================================';
GRAPH_BACK_COLOR = clCream;
GRAPH_WALL_COLOR = clGray;
GRAPH_FLOOR_COLOR = clLtGray;
implementation implementation