File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -137,6 +137,7 @@ BaselineOfPolyMath >> packages: spec [
137137 'Math-StatisticalMoments' 'Math-Series' ) ];
138138 package: ' Math-FastFourierTransform'
139139 with: [ spec requires: #( 'Math-Complex' ) ];
140+ package: ' Math-UI' ;
140141 package: ' Math-FunctionFit' with: [
141142 spec requires:
142143 #( 'Math-Numerical' 'Math-Chromosome' 'Math-Accuracy-Core'
Original file line number Diff line number Diff line change @@ -15,3 +15,19 @@ PMDataHolder >> pointsAndErrorsDo: aBlock [
1515 self do:
1616 [ :each | aBlock value: (PMWeightedPoint point: each)]
1717]
18+
19+ { #category : ' printing' }
20+ PMDataHolder >> printOn: aStream [
21+
22+ aStream << ' Data size ' .
23+ self size printOn: aStream.
24+ aStream << ' ' .
25+
26+ self shouldBePrintedAsLiteral ifTrue: [
27+ self printAsLiteralFormOn: aStream.
28+ ^ self ].
29+ self isSelfEvaluating ifTrue: [
30+ self printAsSelfEvaluatingFormOn: aStream ].
31+ [ self printElementsOn: aStream ]
32+ on: Error do: [ aStream << ' Failing printOn: is getting printed.' ]
33+ ]
Original file line number Diff line number Diff line change 88{ #category : ' printing' }
99PMFunctionPrinter >> printFunction: aFunction [
1010
11- ^ aFunction compiledBlock sourceNode sourceCode
11+ ^ aFunction compiledBlock sourceNode body sourceCode
1212]
Original file line number Diff line number Diff line change @@ -241,23 +241,6 @@ PMGeneralFunctionFit >> precision [
241241^ geneticOptimizer precision
242242]
243243
244- { #category : ' printing' }
245- PMGeneralFunctionFit >> printOn: aStream [
246-
247- aStream
248- nextPutAll: ' a ' ;
249- nextPutAll: self class name;
250- nextPut: $(;
251- print: geneticOptimizer;
252- nextPutAll: ' with data of size: ' ;
253- print: data size.
254- dataTruncated ifTrue: [
255- aStream
256- nextPutAll: ' truncated to: ' ;
257- print: self optimizer functionBlock data size ].
258- aStream nextPut: $)
259- ]
260-
261244{ #category : ' accessing' }
262245PMGeneralFunctionFit >> quartile [
263246^ errorFunction quartile
Original file line number Diff line number Diff line change 1+ Extension { #name : ' PMErrorOfParameterFunction' }
2+
3+ { #category : ' *Math-UI' }
4+ PMErrorOfParameterFunction >> inspectorFunctionPlotTab: aBuilder [
5+
6+ < inspectorPresentationOrder: 1 title: ' Error function plot' >
7+ ^ (PMFunctionPlotter onData: data) buildPlotPresenter: aBuilder
8+ ]
9+
10+ { #category : ' *Math-UI' }
11+ PMErrorOfParameterFunction >> inspectorTable: aBuilder [
12+
13+ < inspectorPresentationOrder: 2 title: ' Error function parameters' >
14+
15+ ^ PMTablePresenterInspectorBuilder new
16+ tableItems: self inspectorTableParametersItems;
17+ buildTable: aBuilder
18+ ]
19+
20+ { #category : ' *Math-UI' }
21+ PMErrorOfParameterFunction >> inspectorTableParametersItems [
22+
23+ | items |
24+ items := {
25+ (' Function' - > (PMFunctionPrinter new printFunction: function)).
26+ (' RelativeError' - > relative).
27+ (' Error type' - > errorType) }.
28+ items := items collect: [ :e | StInspectorAssociationNode hostObject: e ].
29+ (#( #quartile #insensitive ) includes: errorType) ifTrue: [
30+ items add: (StInspectorAssociationNode hostObject: ' With quartile' - > quartile) ].
31+ ^ items
32+ ]
Original file line number Diff line number Diff line change 1+ Class {
2+ #name : ' PMFunctionPlotter' ,
3+ #superclass : ' Object' ,
4+ #instVars : [
5+ ' data'
6+ ],
7+ #category : ' Math-UI' ,
8+ #package : ' Math-UI'
9+ }
10+
11+ { #category : ' as yet unclassified' }
12+ PMFunctionPlotter class >> onData: aCollection [
13+
14+ ^ self new
15+ data: aCollection;
16+ yourself
17+ ]
18+
19+ { #category : ' as yet unclassified' }
20+ PMFunctionPlotter >> buildPlotPresenter: aBuilder [
21+
22+ | plot |
23+ plot := RSLinePlot points: data.
24+ plot build.
25+ ^ (aBuilder instantiate: SpRoassalInspectorPresenter )
26+ canvas: plot canvas;
27+ yourself
28+ ]
29+
30+ { #category : ' accessing' }
31+ PMFunctionPlotter >> data: aCollection [
32+
33+ data := aCollection
34+ ]
Original file line number Diff line number Diff line change 1+ Extension { #name : ' PMGeneralFunctionFit' }
2+
3+ { #category : ' *Math-UI' }
4+ PMGeneralFunctionFit >> inspectorFunctionPlotTab: aBuilder [
5+
6+ < inspectorPresentationOrder: 1 title: ' Function plot' >
7+ ^ (PMFunctionPlotter onData: data) buildPlotPresenter: aBuilder
8+ ]
9+
10+ { #category : ' *Math-UI' }
11+ PMGeneralFunctionFit >> inspectorTable: aBuilder [
12+
13+ < inspectorPresentationOrder: 2 title: ' Function parameters' >
14+
15+ ^ PMTablePresenterInspectorBuilder new
16+ tableItems: self inspectorTableParametersItems;
17+ buildTable: aBuilder
18+ ]
19+
20+ { #category : ' *Math-UI' }
21+ PMGeneralFunctionFit >> inspectorTableParametersItems [
22+
23+ | items |
24+ items := {
25+ (' Generic optimizer' - > geneticOptimizer).
26+ (' Data' - > data) }.
27+ items := items collect: [ :e | StInspectorAssociationNode hostObject: e ].
28+ dataTruncated ifTrue: [
29+ items add: (StInspectorAssociationNode hostObject: ' Truncated to' - > geneticOptimizer functionBlock data size) ].
30+ ^ items
31+ ]
Original file line number Diff line number Diff line change 1+ Class {
2+ #name : ' PMTablePresenterInspectorBuilder' ,
3+ #superclass : ' Object' ,
4+ #instVars : [
5+ ' tableAssociationItems'
6+ ],
7+ #category : ' Math-UI' ,
8+ #package : ' Math-UI'
9+ }
10+
11+ { #category : ' as yet unclassified' }
12+ PMTablePresenterInspectorBuilder >> buildTable: aBuilder [
13+
14+ | tablePresenter |
15+ tablePresenter := aBuilder newTable.
16+ tablePresenter
17+ addColumn: (SpStringTableColumn title: ' Name' evaluated: #key );
18+ addColumn: (SpStringTableColumn title: ' Value' evaluated: #value );
19+ items: tableAssociationItems;
20+ beResizable.
21+ ^ tablePresenter
22+ ]
23+
24+ { #category : ' as yet unclassified' }
25+ PMTablePresenterInspectorBuilder >> tableItems: aCollection [
26+
27+ tableAssociationItems := aCollection
28+ ]
Original file line number Diff line number Diff line change 1+ Package { #name : ' Math-UI' }
You can’t perform that action at this time.
0 commit comments