Skip to content

Instantly share code, notes, and snippets.

@mutterer
Last active January 29, 2022 19:18
Show Gist options
  • Save mutterer/3894e2441de94465e0dda89617f7bc00 to your computer and use it in GitHub Desktop.
Save mutterer/3894e2441de94465e0dda89617f7bc00 to your computer and use it in GitHub Desktop.
compare center of mass and gaussian fit.ijm
// see https://twitter.com/Maurice_Y_Lee/status/1487093624982499330
// show center of mass
makePoint(getValue('XM'),getValue('YM'),"medium green hybrid");
Overlay.addSelection('green');
// gaussian fit
makePoint(gaussianFit(true),gaussianFit(false),"medium red hybrid");
Overlay.addSelection('red');
run("Select None");
function gaussianFit(horizontal) {
run("Select All");
if (!horizontal) setKeyDown('alt');
k=getProfile();
Fit.doFit("Gaussian",Array.getSequence(k.length), k);
return Fit.p(2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment