Skip to content

add analysis metadata parameter to set initial sigma value used in LatGaussFitFR fitting#1683

Open
barentine wants to merge 4 commits into
python-microscopy:masterfrom
barentine:sigmaguess
Open

add analysis metadata parameter to set initial sigma value used in LatGaussFitFR fitting#1683
barentine wants to merge 4 commits into
python-microscopy:masterfrom
barentine:sigmaguess

Conversation

@barentine

Copy link
Copy Markdown
Member

Addresses issue: if you are using LatGaussFitFR.py to fit e.g. large beads imaged on low NA setup, rather than single molecules on high NA oil immersion, you'd like to change the initial sigma value.

Is this a bugfix or an enhancement?
enhancement
Proposed changes:

  • introduce Analysis.SigmaGuess metadata parameter to LatGaussFitFR.py

Checklist:
The below is a list of things what will be considered when reviewing PRs. It is not prescriptive, and does not
imply that PRs which touch any of these will be rejected but gives a rough indication of where there is a potential
for hangups (i.e. factors which could turn a 5 min review into a half hour or longer and shunt it to the bottom
of the TODO list).

  • Does the PR avoid variable renaming in existing code, whitespace changes, and other forms of tidying? [There is a place for code tidying, but it makes reviewing
    much simpler if this is kept separate from functional changes. The auto-formatting performed by some editors is particulaly egregious and can lead to files with thousands
    of non-functional changes with a few functional changes scattered amoungst them]

If an enhancement (or non-trivial bugfix):

  • Has this been discussed in advance (feature request, PR proposal, email, or direct conversation)?
  • Does this change how users interact with the software? How will these changes be communicated?
  • Does this maintain backwards compatibility with old data?
  • Does this change the required dependencies?
  • Are there any other side effects of the change?


if fitBackground:
startParameters = [A, x0, y0, 250/2.35, dataMean.min(), .001, .001]
startParameters = [A, x0, y0, self.metadata['Analysis.SigmaGuess'], dataMean.min(), .001, .001]

@David-Baddeley David-Baddeley Jul 2, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
startParameters = [A, x0, y0, self.metadata['Analysis.SigmaGuess'], dataMean.min(), .001, .001]
startParameters = [A, x0, y0, self.metadata.get('Analysis.PSFSigmaGuess', 250/2.35), dataMean.min(), .001, .001]
  • keep backwards compatibility for re-analysis with old metadata (PARAMETERS is mostly a GUI niceity)
  • make naming line up with, e.g. GaussMultifit

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obviously needs corresponding changes to other usages

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'll want to do metadata.getOrDefault, but otherwise appreciate the suggestion to switch style, stick with the naming convention, etc.

@David-Baddeley

Copy link
Copy Markdown
Contributor

I wonder if we should add this to other Gaussian fits at the same time (ie AstigGaussFit, SplitterFitFNR)

@barentine

Copy link
Copy Markdown
Member Author

Good to go for the 3 mentioned FitFactories.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants