Skip to content

Commit 9f852e8

Browse files
committed
Version 3.2.4
1 parent ad36140 commit 9f852e8

File tree

163 files changed

+2678
-1931
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+2678
-1931
lines changed

BayesicFitting/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
from .source.PadeModel import PadeModel
108108
from .source.PhantomCollection import PhantomCollection
109109
from .source.PhantomSampler import PhantomSampler
110+
#from .source.PixelModel import PixelModel
110111
from .source.PoissonErrorDistribution import PoissonErrorDistribution
111112
from .source.PolySineAmpModel import PolySineAmpModel
112113
from .source.PolySurfaceModel import PolySurfaceModel

BayesicFitting/source/AmoebaFitter.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
from .AnnealingAmoeba import AnnealingAmoeba
77

88
__author__ = "Do Kester"
9-
__year__ = 2023
9+
__year__ = 2025
1010
__license__ = "GPL3"
11-
__version__ = "3.1.0"
11+
__version__ = "3.2.4"
1212
__url__ = "https://www.bayesicfitting.nl"
1313
__status__ = "Perpetual Beta"
1414

@@ -31,7 +31,7 @@
3131
# * Science System (HCSS), also under GPL3.
3232
# *
3333
# * 2003 - 2014 Do Kester, SRON (Java code)
34-
# * 2017 - 2023 Do Kester
34+
# * 2017 - 2025 Do Kester
3535

3636
class AmoebaFitter( MaxLikelihoodFitter ):
3737
"""
@@ -43,7 +43,7 @@ class AmoebaFitter( MaxLikelihoodFitter ):
4343
4444
Examples
4545
--------
46-
# assume x and y are Double1d data arrays.
46+
>>> # assume x and y are Double1d data arrays.
4747
>>> x = numpy.arange( 100, dtype=float ) / 10
4848
>>> y = 3.5 * SIN( x + 0.4 ) # make sine
4949
>>> numpy.random.seed( 12345L ) # Gaussian random number generator
@@ -60,7 +60,7 @@ class AmoebaFitter( MaxLikelihoodFitter ):
6060
>>> yfit = amfit.getResult( ) # fitted values
6161
>>> yfit = sine( x ) # fitted values ( same as previous )
6262
>>> yband = amfit.monteCarloError( ) # 1 sigma confidence region
63-
# for diagnostics ( or just for fun )
63+
>>> # for diagnostics ( or just for fun )
6464
>>> amfit = AmoebaFitter( x, sine )
6565
>>> amfit.setTemperature( 10 ) # set a temperature to escape local minima
6666
>>> amfit.setVerbose( 10 ) # report every 10th iteration

BayesicFitting/source/AnnealingAmoeba.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
from .ConvergenceError import ConvergenceError
77

88
__author__ = "Do Kester"
9-
__year__ = 2020
9+
__year__ = 2025
1010
__license__ = "GPL3"
11-
__version__ = "2.5.3"
11+
__version__ = "3.2.4"
1212
__url__ = "https://www.bayesicfitting.nl"
1313
__status__ = "Perpetual Beta"
1414

@@ -31,7 +31,7 @@
3131
# * Science System (HCSS), also under GPL3.
3232
# *
3333
# * 2003 - 2014 Do Kester, SRON (Java code)
34-
# * 2017 - 2020 Do Kester
34+
# * 2017 - 2025 Do Kester
3535

3636
class AnnealingAmoeba( object ):
3737
"""
@@ -66,7 +66,7 @@ class AnnealingAmoeba( object ):
6666
Iteration continues until the relative difference between the low and high
6767
points within the simplex is less than reltol
6868
|yhi - ylo| / ( |yhi| + |ylo| ) < reltol
69-
and/or the absolute difference is less than abstol
69+
and/or the absolute difference is less than abstol
7070
|yhi - ylo| < abstol.
7171
7272
AnnealingAmoeba can be used with limits set to one or more of the input values.
@@ -87,12 +87,10 @@ class AnnealingAmoeba( object ):
8787
the best of the above values
8888
xopt : ndarray
8989
copy of the simplex point that has the best value (nx)
90-
9190
rng : RandomState
9291
random number generator
9392
seed : int
9493
seed of rng
95-
9694
reltol : float
9795
Relative tolerance. Program stops when ( |yhi-ylo| / (|yhi|+|ylo|) ) < reltol
9896
abstol : float
@@ -103,14 +101,12 @@ class AnnealingAmoeba( object ):
103101
iteration counter
104102
ncalls : int (read only)
105103
numbers of calls to func
106-
107104
temp : float
108105
annealing temperature (default: 0)
109106
cooling : float (non existent when temp=0)
110107
cooling factor (default: 0.95)
111108
steps : int (non existent when temp=0)
112109
number of steps per cooling cycle (default: 10)
113-
114110
verbose : int
115111
0 : silent
116112
1 : print results to output
@@ -119,7 +115,6 @@ class AnnealingAmoeba( object ):
119115
callback : callable
120116
function to be called every iteration of form :
121117
xopt = callback( xopt )
122-
123118
simplex : ndarray
124119
the simplex has shape = (nx+1, nx); nx is the size of x
125120
values : ndarray

BayesicFitting/source/ArctanModel.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
from .NonLinearModel import NonLinearModel
55

66
__author__ = "Do Kester"
7-
__year__ = 2020
7+
__year__ = 2025
88
__license__ = "GPL3"
9-
__version__ = "2.5.3"
9+
__version__ = "3.2.4"
1010
__url__ = "https://www.bayesicfitting.nl"
1111
__status__ = "Perpetual Beta"
1212

@@ -28,18 +28,20 @@
2828
# * Science System (HCSS), also under GPL3.
2929
# *
3030
# * 2007 - 2014 Do Kester, SRON (JAVA code)
31-
# * 2016 - 2020 Do Kester
31+
# * 2016 - 2025 Do Kester
3232

3333
class ArctanModel( NonLinearModel ):
3434
"""
3535
Arctangus Model.
3636
3737
f( x:p ) = p_0 * arctan( p_2 * ( x - p_1 ) )
38-
p_0 = amplitude; p_1 = center; p_2 = slope.
38+
p_0 = amplitude
39+
p_1 = center
40+
p_2 = slope.
3941
4042
As always x = input.
4143
42-
The parameters are initialized at {2/pi, 0.0, 1.0}. It is a non-linear model.
44+
The parameters are initialized at [2/pi, 0.0, 1.0]. It is a non-linear model.
4345
4446
Attributes from Model
4547
--------------------------
@@ -57,7 +59,7 @@ class ArctanModel( NonLinearModel ):
5759
-------
5860
>>> arct = ArctanModel( )
5961
>>> print( arct.getNumberOfParameters( ) )
60-
3
62+
>>> 3
6163
6264
6365
Author: Do Kester

BayesicFitting/source/AstropyModel.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
from .Model import Model
1111

1212
__author__ = "Do Kester"
13-
__year__ = 2024
13+
__year__ = 2025
1414
__license__ = "GPL3"
15-
__version__ = "3.2.1"
15+
__version__ = "3.2.4"
1616
__url__ = "https://www.bayesicfitting.nl"
1717
__status__ = "Perpetual Beta"
1818

@@ -45,13 +45,13 @@ class AstropyModel( Model ):
4545
>>>
4646
>>> gauss = AstropyModel( gm )
4747
>>> print( gauss )
48-
AstropyModel( Gauss1D )
48+
>>> AstropyModel( Gauss1D )
4949
>>> print( gauss.getNumberOfParameters( ) )
50-
3
50+
>>> 3
5151
>>> print( gauss( numpy.linspace( -5, 5, 11 ) ) )
52-
[ 3.72665317e-06 3.35462628e-04 1.11089965e-02 1.35335283e-01
53-
6.06530660e-01 1.00000000e+00 6.06530660e-01 1.35335283e-01
54-
1.11089965e-02 3.35462628e-04 3.72665317e-06]
52+
>>> [ 3.72665317e-06 3.35462628e-04 1.11089965e-02 1.35335283e-01
53+
>>> 6.06530660e-01 1.00000000e+00 6.06530660e-01 1.35335283e-01
54+
>>> 1.11089965e-02 3.35462628e-04 3.72665317e-06]
5555
5656
Attributes
5757
----------

BayesicFitting/source/BSplinesModel.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
from .LinearModel import LinearModel
1010

1111
__author__ = "Do Kester"
12-
__year__ = 2022
12+
__year__ = 2025
1313
__license__ = "GPL3"
14-
__version__ = "3.0.0"
14+
__version__ = "3.2.4"
1515
__url__ = "https://www.bayesicfitting.nl"
1616
__status__ = "Perpetual Beta"
1717

@@ -29,7 +29,7 @@
2929
# *
3030
# * The GPL3 license can be found at <http://www.gnu.org/licenses/>.
3131
# *
32-
# * 2017 - 2022 Do Kester
32+
# * 2017 - 2025 Do Kester
3333

3434
class BSplinesModel( LinearModel ):
3535
"""
@@ -46,12 +46,13 @@ class BSplinesModel( LinearModel ):
4646
4747
It is a linear model.
4848
49-
order behaviour between knots continuity at knots
50-
0 piecewise constant not continuous at all
51-
1 piecewise linear lines are continuous
52-
2 parabolic pieces 1st derivatives are also continuous
53-
3 cubic pieces 2nd derivatives are also continuous
54-
n>3 n-th order polynomials (n-1)-th derivatives are also continuous
49+
| order |behaviour between knots | continuity at knots |
50+
|:-----:|:-----------------------|:-----------------------------------|
51+
| 0 | piecewise constant | not continuous at all |
52+
| 1 | piecewise linear | lines are continuous |
53+
| 2 | parabolic pieces | 1st derivatives are also continuous|
54+
| 3 | cubic pieces | 2nd derivatives are also continuous|
55+
| n>3 | n-th order polynomials | (n-1)th derivatives are continuous |
5556
5657
The user lays out a number ( << datapoints ) of knots on the x-axis at
5758
arbitrary position, generally more knots where the curvature is higher.
@@ -72,17 +73,17 @@ class BSplinesModel( LinearModel ):
7273
>>> knots = numpy.arange( 17, dtype=float ) * 10 # make equidistant knots from 0 to 160
7374
>>> csm = BSplinesModel( knots=knots, order=2 )
7475
>>> print csm.getNumberOfParameters( )
75-
18
76-
# or alternatively:
76+
>>> 18
77+
>>> # or alternatively:
7778
>>> csm = BSplinesModel( nrknots=17, order=2, min=0, max=160 ) # automatic layout of knots
7879
>>> print csm.getNumberOfParameters( )
79-
18
80-
# or alternatively:
80+
>>> 18
81+
>>> # or alternatively:
8182
>>> npt = 161 # to include both 0 and 160.
8283
>>> x = numpy.arange( npt, dtype=float ) # x-values
8384
>>> csm = BSplinesModel( nrknots=17, order=2, xrange=x ) # automatic layout of knots
8485
>>> print csm.getNumberOfParameters( )
85-
18
86+
>>> 18
8687
8788
Attributes
8889
----------

BayesicFitting/source/BaseFitter.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
from .Formatter import formatter as fmt
1313

1414
__author__ = "Do Kester"
15-
__year__ = 2023
15+
__year__ = 2025
1616
__license__ = "GPL3"
17-
__version__ = "3.2.2"
17+
__version__ = "3.2.4"
1818
__url__ = "https://www.bayesicfitting.nl"
1919
__status__ = "Perpetual Beta"
2020

@@ -36,7 +36,7 @@
3636
# * Science System (HCSS), also under GPL3.
3737
# *
3838
# * 2003 - 2014 Do Kester, SRON (JAVA code)
39-
# * 2016 - 2023 Do Kester
39+
# * 2016 - 2025 Do Kester
4040

4141
class BaseFitter( object ):
4242
"""
@@ -56,7 +56,7 @@ class BaseFitter( object ):
5656
5757
Examples
5858
--------
59-
# It is not possible to use this class. User Fitter, CurveFitter etc. in stead
59+
It is not possible to use this class. Use Fitter, CurveFitter etc. in stead
6060
6161
Note Also
6262
---------
@@ -90,7 +90,6 @@ class BaseFitter( object ):
9090
the fixed noise scale.
9191
The presence of `fixedScale` has consequences for the definitions of `chisq`,
9292
`(co)variance`, `stdevs` and `evidence`
93-
9493
minimumScale : float
9594
introduce a minimum value for the noise scale
9695
design : matrix (read only)

BayesicFitting/source/BaseModel.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
from .UniformPrior import UniformPrior
1010

1111
__author__ = "Do Kester"
12-
__year__ = 2024
12+
__year__ = 2025
1313
__license__ = "GPL3"
14-
__version__ = "3.2.1"
14+
__version__ = "3.2.4"
1515
__url__ = "https://www.bayesicfitting.nl"
1616
__status__ = "Perpetual Beta"
1717

@@ -33,7 +33,7 @@
3333
# * Science System (HCSS), also under GPL3.
3434
# *
3535
# * 2011 - 2014 Do Kester, SRON (Java code)
36-
# * 2016 - 202024 Do Kester
36+
# * 2016 - 202025 Do Kester
3737

3838
class BaseModel( object ):
3939
"""
@@ -83,12 +83,12 @@ class BaseModel( object ):
8383
parNames : list of str
8484
list of parameter names. (default : "parameter_k")
8585
86-
Author : Do Kester
86+
Author Do Kester
8787
8888
"""
8989

9090
# *************************************************************************
91-
def __init__( self, nparams=0, ndim=1, copy=None, posIndex=[], nonZero=[], **kwargs ):
91+
def __init__( self, nparams=0, ndim=1, ndout=None, copy=None, posIndex=[], nonZero=[], **kwargs ):
9292
"""
9393
BaseModel Constructor.
9494
<br>
@@ -113,6 +113,8 @@ def __init__( self, nparams=0, ndim=1, copy=None, posIndex=[], nonZero=[], **kwa
113113
if copy is None :
114114
setatt( self, "npbase", nparams )
115115
setatt( self, "ndim", ndim )
116+
if ndout is not None :
117+
setatt( self, "ndout", ndout, type=int )
116118
setatt( self, "priors", None )
117119
setatt( self, "posIndex", numpy.asarray( posIndex, dtype=int ) )
118120
setatt( self, "nonZero", numpy.asarray( nonZero, dtype=int ) )
@@ -123,6 +125,8 @@ def __init__( self, nparams=0, ndim=1, copy=None, posIndex=[], nonZero=[], **kwa
123125
else :
124126
setatt( self, "npbase", copy.npbase )
125127
setatt( self, "ndim", copy.ndim )
128+
if "ndout" in vars( copy ) :
129+
setatt( self, "ndout", copy.ndout, type=int )
126130
setatt( self, "priors", None if copy.priors is None else copy.priors.copy() )
127131
setatt( self, "posIndex", copy.posIndex )
128132
setatt( self, "nonZero", copy.nonZero )

0 commit comments

Comments
 (0)