Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/BaselineOfPolyMath/BaselineOfPolyMath.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ BaselineOfPolyMath >> packages: spec [
'Math-StatisticalMoments' 'Math-Series' ) ];
package: 'Math-FastFourierTransform'
with: [ spec requires: #( 'Math-Complex' ) ];
package: 'Math-UI';
package: 'Math-FunctionFit' with: [
spec requires:
#( 'Math-Numerical' 'Math-Chromosome' 'Math-Accuracy-Core'
Expand Down
16 changes: 16 additions & 0 deletions src/Math-FunctionFit/PMDataHolder.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,19 @@ PMDataHolder >> pointsAndErrorsDo: aBlock [
self do:
[ :each | aBlock value: (PMWeightedPoint point: each)]
]

{ #category : 'printing' }
PMDataHolder >> printOn: aStream [

aStream << 'Data size '.
self size printOn: aStream.
aStream << ' '.

self shouldBePrintedAsLiteral ifTrue: [
self printAsLiteralFormOn: aStream.
^ self ].
self isSelfEvaluating ifTrue: [
self printAsSelfEvaluatingFormOn: aStream ].
[ self printElementsOn: aStream ]
on: Error do: [ aStream << 'Failing printOn: is getting printed.' ]
]
2 changes: 1 addition & 1 deletion src/Math-FunctionFit/PMFunctionPrinter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ Class {
{ #category : 'printing' }
PMFunctionPrinter >> printFunction: aFunction [

^ aFunction compiledBlock sourceNode sourceCode
^ aFunction compiledBlock sourceNode body sourceCode
]
17 changes: 0 additions & 17 deletions src/Math-FunctionFit/PMGeneralFunctionFit.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -241,23 +241,6 @@ PMGeneralFunctionFit >> precision [
^geneticOptimizer precision
]

{ #category : 'printing' }
PMGeneralFunctionFit >> printOn: aStream [

aStream
nextPutAll: 'a ';
nextPutAll: self class name;
nextPut: $(;
print: geneticOptimizer;
nextPutAll: ' with data of size: ';
print: data size.
dataTruncated ifTrue: [
aStream
nextPutAll: ' truncated to: ';
print: self optimizer functionBlock data size ].
aStream nextPut: $)
]

{ #category : 'accessing' }
PMGeneralFunctionFit >> quartile [
^errorFunction quartile
Expand Down
32 changes: 32 additions & 0 deletions src/Math-UI/PMErrorOfParameterFunction.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Extension { #name : 'PMErrorOfParameterFunction' }

{ #category : '*Math-UI' }
PMErrorOfParameterFunction >> inspectorFunctionPlotTab: aBuilder [

<inspectorPresentationOrder: 1 title: 'Error function plot'>
^ (PMFunctionPlotter onData: data) buildPlotPresenter: aBuilder
]

{ #category : '*Math-UI' }
PMErrorOfParameterFunction >> inspectorTable: aBuilder [

<inspectorPresentationOrder: 2 title: 'Error function parameters'>

^ PMTablePresenterInspectorBuilder new
tableItems: self inspectorTableParametersItems;
buildTable: aBuilder
]

{ #category : '*Math-UI' }
PMErrorOfParameterFunction >> inspectorTableParametersItems [

| items |
items := {
('Function' -> (PMFunctionPrinter new printFunction: function)).
('RelativeError' -> relative).
('Error type' -> errorType) }.
items := items collect: [ :e | StInspectorAssociationNode hostObject: e ].
(#( #quartile #insensitive ) includes: errorType) ifTrue: [
items add: (StInspectorAssociationNode hostObject: 'With quartile' -> quartile) ].
^ items
]
34 changes: 34 additions & 0 deletions src/Math-UI/PMFunctionPlotter.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Class {
#name : 'PMFunctionPlotter',
#superclass : 'Object',
#instVars : [
'data'
],
#category : 'Math-UI',
#package : 'Math-UI'
}

{ #category : 'as yet unclassified' }
PMFunctionPlotter class >> onData: aCollection [

^ self new
data: aCollection;
yourself
]

{ #category : 'as yet unclassified' }
PMFunctionPlotter >> buildPlotPresenter: aBuilder [

| plot |
plot := RSLinePlot points: data.
plot build.
^ (aBuilder instantiate: SpRoassalInspectorPresenter)
canvas: plot canvas;
yourself
]

{ #category : 'accessing' }
PMFunctionPlotter >> data: aCollection [

data := aCollection
]
31 changes: 31 additions & 0 deletions src/Math-UI/PMGeneralFunctionFit.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Extension { #name : 'PMGeneralFunctionFit' }

{ #category : '*Math-UI' }
PMGeneralFunctionFit >> inspectorFunctionPlotTab: aBuilder [

<inspectorPresentationOrder: 1 title: 'Function plot'>
^ (PMFunctionPlotter onData: data) buildPlotPresenter: aBuilder
]

{ #category : '*Math-UI' }
PMGeneralFunctionFit >> inspectorTable: aBuilder [

<inspectorPresentationOrder: 2 title: 'Function parameters'>

^ PMTablePresenterInspectorBuilder new
tableItems: self inspectorTableParametersItems;
buildTable: aBuilder
]

{ #category : '*Math-UI' }
PMGeneralFunctionFit >> inspectorTableParametersItems [

| items |
items := {
('Generic optimizer' -> geneticOptimizer).
('Data' -> data) }.
items := items collect: [ :e | StInspectorAssociationNode hostObject: e ].
dataTruncated ifTrue: [
items add: (StInspectorAssociationNode hostObject: 'Truncated to' -> geneticOptimizer functionBlock data size) ].
^ items
]
28 changes: 28 additions & 0 deletions src/Math-UI/PMTablePresenterInspectorBuilder.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Class {
#name : 'PMTablePresenterInspectorBuilder',
#superclass : 'Object',
#instVars : [
'tableAssociationItems'
],
#category : 'Math-UI',
#package : 'Math-UI'
}

{ #category : 'as yet unclassified' }
PMTablePresenterInspectorBuilder >> buildTable: aBuilder [

| tablePresenter |
tablePresenter := aBuilder newTable.
tablePresenter
addColumn: (SpStringTableColumn title: 'Name' evaluated: #key);
addColumn: (SpStringTableColumn title: 'Value' evaluated: #value);
items: tableAssociationItems;
beResizable.
^ tablePresenter
]

{ #category : 'as yet unclassified' }
PMTablePresenterInspectorBuilder >> tableItems: aCollection [

tableAssociationItems := aCollection
]
1 change: 1 addition & 0 deletions src/Math-UI/package.st
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Package { #name : 'Math-UI' }
Loading