LMTool GUI (pylorenzmie.lmtool)#

For a user-oriented guide to launching and using the application, see LMTool.

class pylorenzmie.lmtool.LMTool.LMTool(controls, filename=None, normalizer=None)[source]#

Bases: QMainWindow

Main window for the LMTool hologram-fitting application.

Parameters:
  • controls (type[LMWidget]) – LMWidget subclass (not an instance) providing parameter controls.

  • filename (str, optional) – Path to a hologram image to load on startup.

  • normalizer (Normalizer, optional) – Background normalization strategy. Defaults to median-filter normalization with a 51-pixel kernel.

uiFile = 'LMTool.ui'#
data(data)#
Return type:

None

readHologram(filename=None)#
Return type:

None

readBackground(filename=None)#
Return type:

None

saveParameters(filename=None)#
Return type:

None

crop()[source]#
Return type:

tuple[GenericAlias[float] | GenericAlias[int], QRectF, GenericAlias[float]]

estimate()#
Return type:

None

undoEstimate()#
Return type:

None

setRobust(state)#
Return type:

None

closeEvent(event)[source]#
Return type:

None

optimize()#
Return type:

None

pylorenzmie.lmtool.LMTool.lmtool()[source]#
Return type:

None

class pylorenzmie.lmtool.LMWidget.LMWidget(*args, **kwargs)[source]#

Bases: QFrame

Parameter-control panel for a LorenzMie model.

Loads its layout from uiFile and its parameter configuration from configFile (both relative to the lmtool package directory). Emits propertyChanged whenever any parameter value changes.

cls#

alias of jaxLorenzMie

uiFile = 'LMWidget.ui'#
configFile = 'LMTool.json'#
propertyChanged#

alias of str

properties(properties)#
Return type:

None

fixed(fixed)#
Return type:

None

config()[source]#
Return type:

dict[str, dict[str, bool | int | float | str]]

setConfig(config)[source]#
Return type:

None

classmethod example()[source]#
Return type:

None

class pylorenzmie.lmtool.ALMWidget.ALMWidget(*args, **kwargs)[source]#

Bases: LMWidget

Parameter-control panel for an AberratedLorenzMie model.

cls#

alias of AberratedLorenzMie

uiFile = 'ALMWidget.ui'#
class pylorenzmie.lmtool.ImageWidget.ImageWidget(*args, data=None, **kwargs)[source]#

Bases: GraphicsLayoutWidget

Image display with a circular ROI for selecting a particle region.

roiChanged#

Emitted with (x, y) centre coordinates when the ROI moves.

alias of float

radiusChanged#

Emitted with the new radius in pixels when the ROI is resized.

alias of int

data(data)#
Return type:

None

x_p(x_p)#
Return type:

None

y_p(y_p)#
Return type:

None

radius()#
Return type:

int

rect()[source]#
Return type:

QRectF

classmethod example()[source]#
Return type:

None

class pylorenzmie.lmtool.FitWidget.FitWidget(*args, **kwargs)[source]#

Bases: GraphicsLayoutWidget

Three-panel widget showing the ROI, model fit, and normalized residuals.

optimizationStarted#

Emitted when an optimization thread is launched.

optimizationFinished#

Emitted with the pd.Series result when optimization succeeds.

alias of object

optimizationError#

Emitted with an error message string when optimization fails.

alias of str

optimize(data, coordinates)[source]#

Fit the model to data and update the display.

Blocks the calling thread until the fit completes. For non-blocking use in a GUI context call optimizeAsync() instead.

Parameters:
  • data (ndarray) – Normalized hologram crop.

  • coordinates (ndarray, shape (2, npts)) – Pixel coordinates for the crop.

Return type:

Series

Returns:

result (pandas.Series) – Fitted parameters and uncertainties.

optimizeAsync(data, coordinates)[source]#

Start optimization in a background thread.

Returns immediately. Emits optimizationStarted on entry, then optimizationFinished (or optimizationError) when the thread completes. Use optimize() for synchronous (blocking) operation.

Parameters:
  • data (ndarray) – Normalized hologram crop.

  • coordinates (ndarray, shape (2, npts)) – Pixel coordinates for the crop.

Return type:

None

shutdown()[source]#

Stop any running optimization thread and wait for it to finish.

Return type:

None

setData(data, rect, coordinates)[source]#

Display data, compute and show the current model prediction.

Parameters:
  • data (ndarray) – Cropped hologram region.

  • rect (QRectF) – Screen rectangle for positioning the images.

  • coordinates (ndarray, shape (2, npts)) – Pixel coordinates for the cropped region.

Return type:

None

showEvent(event)[source]#
Return type:

None

refreshPreview(properties=None)[source]#

Recompute and redisplay the model prediction without re-optimizing.

Parameters:

properties (dict, optional) – Model properties to apply before recomputing the hologram.

Return type:

None

model(model)#
Return type:

None

properties(properties)#
Return type:

None

setSetting(name, value)#
Return type:

None

saveResult(filename=None)#
Return type:

None

saveJson(filename)[source]#
Return type:

None

saveResultAs()#
Return type:

None

class pylorenzmie.lmtool.ProfileWidget.ProfileWidget(*args, model=None, radius=100, **kwargs)[source]#

Bases: PlotWidget

Radial-profile plot showing experimental data and model prediction.

properties(properties)#
Return type:

None

model(model)#
Return type:

None

data(data)#
Return type:

None

radius(radius)#
Return type:

None

plotTheory()[source]#
Return type:

None

plotData()[source]#
Return type:

None

classmethod example()[source]#
Return type:

None

class pylorenzmie.lmtool.ParameterWidget.ParameterWidget(*args, **kwargs)[source]#

Bases: QFrame

Compound widget combining a label, spinbox, slider, and lock checkbox.

Exposes a unified interface for reading and setting a single floating-point parameter value. The slider and spinbox are kept in sync via Qt Designer connections in ParameterWidget.ui.

valueChanged#

alias of float

value()[source]#
Return type:

float

setValue(value)[source]#
Return type:

None

minimum()[source]#
Return type:

float

maximum()[source]#
Return type:

float

range()[source]#
Return type:

list[float]

setRange(range)[source]#
Return type:

None

step()[source]#
Return type:

float

setStep(value)[source]#
Return type:

None

decimals()[source]#
Return type:

int

setDecimals(decimals)[source]#
Return type:

None

prefix()[source]#
Return type:

str

setPrefix(prefix)[source]#
Return type:

None

suffix()[source]#
Return type:

str

setSuffix(suffix)[source]#
Return type:

None

text()[source]#
Return type:

str

setText(text)[source]#
Return type:

None

fixed()[source]#
Return type:

bool

setFixed(fixed)[source]#
Return type:

None

settings()[source]#
Return type:

dict

setSettings(settings)[source]#
Return type:

None

classmethod example()[source]#
Return type:

None

class pylorenzmie.lmtool.OptimizerWidget.OptimizerWidget(*args, **kwargs)[source]#

Bases: ParameterTree

Parameter-tree widget for configuring scipy least_squares settings.

Emits settingChanged (name, value) whenever any setting changes. Enforces the constraint that Levenberg-Marquardt requires loss='linear'.

settingChanged#

Emitted with (name, value) whenever a solver setting changes.

alias of str

settings(settings)#
Return type:

None

classmethod example()[source]#
Return type:

None