An EPICS areaDetector Plugin to perform 2D Gaussian fit using the optimization problem solver from Ceres Solver.
Primary Author: Luca Porzio - luca.porzio@helmholtz-berlin.de
The ADPluginGaussianFit works with the support of Ceres Solver library. It can be build from sources and installed in a selected folder. Please follow the instructions from the official website.
Clone ADPluginGaussianFit repository into your areaDetector installation folder, on the same level where ADCore is located.
Setup the areaDetector installation by adding support to Ceres Solver.
In configure/CONFIG_SITE.local add the following lines:
WITH_CERES = YES
CERES_EXTERNAL = YES
In configure/CONFIG_SITE.local.<architecture> add the following lines:
WITH_CERES = YES
CERES = /usr/local
#CERES_LIB = $(CERES)/lib
#CERES_INCLUDE = $(CERES)/include
In configure/RELEASE_PRODS.local add the following lines:
# ADPLUGINGAUSSIANFIT is optional plugin
ADPLUGINGAUSSIANFIT=$(AREA_DETECTOR)/ADPluginGaussianFit
In Makefile add the following lines after the ADCore definition:
ifdef ADPLUGINGAUSSIANFIT
DIRS := $(DIRS) $(ADPLUGINGAUSSIANFIT)
$(ADPLUGINGAUSSIANFIT)_DEPEND_DIRS += $(ADCORE)
endif
Setup ADCore to work with ADPluginGaussianFit.
In ADCore/ADApp/commonLibraryMakefile add the followings lines:
ifeq ($(WITH_CERES),YES)
ifeq ($(CERES_EXTERNAL),NO)
LIB_LIBS += ceres
else
ifdef CERES_LIB
ceres_DIR = $(CERES_LIB)
LIB_LIBS += ceres
LIB_LIBS += glog
LIB_LIBS += cholmod
LIB_LIBS += openblas
else
LIB_SYS_LIBS += ceres
LIB_SYS_LIBS += glog
LIB_SYS_LIBS += cholmod
LIB_SYS_LIBS += openblas
endif
endif
endif
In ADCore/ADApp/commonDriverMakefile add the following lines:
# ADPLUGINGAUSSIANFIT
ifdef ADPLUGINGAUSSIANFIT
$(DBD_NAME)_DBD += NDPluginGaussianFit.dbd
PROD_LIBS += NDPluginGaussianFit
ifdef CERES_LIB
ceres_DIR +=$(CERES_LIB)
PROD_LIBS += ceres glog cholmod openblas
else
PROD_SYS_LIBS += ceres glog cholmod openblas
endif
endif
In commonPlugins.cmd add the following lines:
NDGaussianFitConfigure("GAUSSIAN_FIT", $(QSIZE), 0, "$(PORT)", 0, 0, 0, 0, 0)
dbLoadRecords("$(ADPLUGINGAUSSIANFIT)/db/NDPluginGaussianFit.template", "P=$(PREFIX),R=GaussianFit1:, PORT=GAUSSIAN_FIT,ADDR=0,TIMEOUT=1,NDARRAY_PORT=$(PORT)")
set_requestfile_path("$(ADPLUGINGAUSSIANFIT)/db")
Clean and compile in the following order ADCore, ADSupport and ADPluginGaussianFit by running the following command in each directory:
make clean uninstall && make -j16In your application, make sure to setup the ADPLUGINGAUSSIANFIT variable in the corresponding envPaths.