Skip to content

Commit 5bc7475

Browse files
committed
Adding new models to cpufit, python, java and matlab bindings. Extending documentation
1 parent 1b398c8 commit 5bc7475

File tree

8 files changed

+34
-6
lines changed

8 files changed

+34
-6
lines changed

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ __pycache__
66

77
# Gradle/IntelliJ
88
Gpufit/java/gpufit/.gradle
9-
Gpufit/java/gpufit/build
109
Gpufit/java/gpufit/out
1110

1211
# build folders
13-
build/
14-
/docs/_build
12+
**/build/*
1513

Cpufit/interface.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,12 @@ void FitInterface::set_number_of_parameters(ModelID const model_id)
117117
case SPLINE_3D_PHASE_MULTICHANNEL:
118118
n_parameters_ = 6;
119119
break;
120+
case SPLINE_4D:
121+
n_parameters_ = 6;
122+
break;
123+
case SPLINE_5D:
124+
n_parameters_ = 7;
125+
break;
120126
default:
121127
throw std::runtime_error("unknown model ID");
122128
}

Cpufit/python/pycpufit/cpufit.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ class ModelID:
7171
SPLINE_3D = 10
7272
SPLINE_3D_MULTICHANNEL = 11
7373
SPLINE_3D_PHASE_MULTICHANNEL = 12
74+
SPLINE_4D = 13
75+
SPLINE_5D = 14
7476

7577
class EstimatorID:
7678
LSE = 0

Gpufit/java/gpufit/src/main/java/com/github/gpufit/Model.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
public enum Model {
88

9-
GAUSS_1D(0, 4), GAUSS_2D(1, 5), GAUSS_2D_ELLIPTIC(2, 6), GAUSS_2D_ROTATED(3, 7), CAUCHY_2D_ELLIPTIC(4, 6), LINEAR_1D(5, 2);
9+
GAUSS_1D(0, 4), GAUSS_2D(1, 5), GAUSS_2D_ELLIPTIC(2, 6), GAUSS_2D_ROTATED(3, 7), CAUCHY_2D_ELLIPTIC(4, 6), LINEAR_1D(5, 2), FLETCHER_POWELL_HELIX(6, 3), BROWN_DENNIS(7, 4), SPLINE_1D(8, 3), SPLINE_2D(9, 4), SPLINE_3D(10, 5), SPLINE_3D_MULTICHANNEL(11, 5), SPLINE_3D_PHASE_MULTICHANNEL(12, 6), SPLINE_4D(13, 6), SPLINE_5D(15, 7);
1010

1111
public final int id, numberParameters;
1212

Gpufit/matlab/ModelID.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
SPLINE_3D = 10
1414
SPLINE_3D_MULTICHANNEL = 11
1515
SPLINE_3D_PHASE_MULTICHANNEL = 12
16+
SPLINE_4D = 13
17+
SPLINE_5D = 14
1618
end
1719
methods (Static)
1820
function v = validID(id)

Gpufit/python/pygpufit/gpufit.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ class ModelID:
6060
SPLINE_3D = 10
6161
SPLINE_3D_MULTICHANNEL = 11
6262
SPLINE_3D_PHASE_MULTICHANNEL = 12
63+
SPLINE_4D = 13
64+
SPLINE_5D = 14
6365

6466

6567
class EstimatorID:

docs/customization.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,15 @@ of model parameters and dimensions must be specified as well.
2727

2828
Detailed step by step instructions for adding a model function are given below.
2929

30-
1. Define an additional model ID in file constants.h_. When using the language bindings, the model ID must also be added for Python (in gpufit.py), Matlab (in ModelID.m), Java (in Model.java).
30+
1. Define an additional model ID in file `<Gpufit/constants.h>`_. To use wih Cpufit also add the model ID in `<Cpufit/interface.cpp>`_. When using the language bindings, the model ID must also be added
31+
32+
- for Python
33+
- in `<Gpufit/python/gpufit.py>`_ for pygpufit
34+
- in `<Cpufit/python/cpufit.py>`_ for pycpufit
35+
- for Matlab in `<Gpufitmatlab/ModelID.m>`_
36+
- for Java in `<Gpufit/java/gpufit/src/main/java/com/github/gpufit/Model.java>`_.
37+
38+
3139
2. Implement a CUDA device function within a newly created .cuh file in folder Gpufit/Gpufit/models according to the following template. (The REAL type is defined in Gpufit/definitions.h to switch between single and double precision.)
3240

3341
.. code-block:: cuda

docs/fit_model_functions.rst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,4 +395,14 @@ spline coefficients. The model function :code:`g` exists for each x,y,z coordina
395395

396396
:`p_4`: offset
397397

398-
:`p_5`: phase
398+
:`p_5`: phase
399+
400+
4D Spline function
401+
++++++++++++++++++
402+
403+
**Documentation missing**
404+
405+
5D Spline function
406+
++++++++++++++++++
407+
408+
**Documentation missing**

0 commit comments

Comments
 (0)