Skip to content

Commit c3e9a6b

Browse files
authored
Bug in logic for 2d Gaussian
There is a logic error in the code for quickly fitting a 2d gaussian - the wrong coordinate offset (x and y are swapped) is used in the center-finding along a row and column.
1 parent 212c1a7 commit c3e9a6b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ipython/FittingData.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,9 +368,9 @@
368368
" x = (X*data).sum()/total\n",
369369
" y = (Y*data).sum()/total\n",
370370
" col = data[:, int(y)]\n",
371-
" width_x = np.sqrt(np.abs((np.arange(col.size)-y)**2*col).sum()/col.sum())\n",
371+
" width_x = np.sqrt(np.abs((np.arange(col.size)-x)**2*col).sum()/col.sum())\n",
372372
" row = data[int(x), :]\n",
373-
" width_y = np.sqrt(np.abs((np.arange(row.size)-x)**2*row).sum()/row.sum())\n",
373+
" width_y = np.sqrt(np.abs((np.arange(row.size)-y)**2*row).sum()/row.sum())\n",
374374
" height = data.max()\n",
375375
" return height, x, y, width_x, width_y\n",
376376
"\n",

0 commit comments

Comments
 (0)