def initFindAndFit(parameters): """ Initialize and return a PSFFFTFinderFitter object. """ # Create psf fft function object. psf_fn = psfFn.PSFFn(psf_filename=parameters.getAttr("psf")) # Check that the PSF FFT and camera pixel sizes agree. diff = abs( parameters.getAttr("pixel_size") - psf_fn.getPixelSize() * 1.0e3) assert (diff < 1.0e-6), "Wrong pixel size, incorrect PSF data?" # Create peak finder. finder = fitting.PeakFinderArbitraryPSF(parameters=parameters, psf_object=psf_fn) # Create fftFitC.CFFTFit object. mfitter = initFitter(finder, parameters, psf_fn) # Create peak fitter. fitter = fitting.PeakFitterArbitraryPSF(mfitter=mfitter, parameters=parameters) # Specify which properties we want from the analysis. properties = [ "background", "error", "height", "iterations", "significance", "sum", "x", "y", "z" ] return fitting.PeakFinderFitter(peak_finder=finder, peak_fitter=fitter, properties=properties)
def initFindAndFit(parameters): """ Initialize and return a SplinerFinderFitter object. """ # Create spline object. spline_fn = splineToPSF.loadSpline(parameters.getAttr("spline")) # Create peak finder. finder = fitting.PeakFinderArbitraryPSF(parameters=parameters, psf_object=spline_fn) # Create cubicFitC.CSplineFit object. mfitter = initFitter(finder, parameters, spline_fn) # Create peak fitter. fitter = fitting.PeakFitterArbitraryPSF(mfitter=mfitter, parameters=parameters) # Specify which properties we want from the analysis. properties = [ "background", "error", "height", "iterations", "significance", "sum", "x", "y", "z" ] return fitting.PeakFinderFitter(peak_finder=finder, peak_fitter=fitter, properties=properties)
def initFindAndFit(parameters): """ Initialize and return a fitting.PeakFinderFitter object. """ # Create pupil function object. [min_z, max_z] = parameters.getZRange() pupil_fn = pupilFn.PupilFunction(pf_filename = parameters.getAttr("pupil_function"), zmin = min_z * 1.0e+3, zmax = max_z * 1.0e+3) # PSF debugging. if False: tifffile.imsave("pupil_fn_psf.tif", pupil_fn.getPSF(0.1).astype(numpy.float32)) # Check that the PF and camera pixel sizes agree. diff = abs(parameters.getAttr("pixel_size") - pupil_fn.getPixelSize()*1.0e3) assert (diff < 1.0e-6), "Incorrect pupil function?" # Create peak finder. finder = fitting.PeakFinderArbitraryPSF(parameters = parameters, psf_object = pupil_fn) # Create cubicFitC.CSplineFit object. mfitter = initFitter(finder, parameters, pupil_fn) # Create peak fitter. fitter = fitting.PeakFitterArbitraryPSF(mfitter = mfitter, parameters = parameters) # Specify which properties we want from the analysis. properties = ["background", "error", "height", "iterations", "significance", "sum", "x", "y", "z"] return fitting.PeakFinderFitter(peak_finder = finder, peak_fitter = fitter, properties = properties)