The Expression Engine in Dawn

The expression engine can be used in the 'Function Fitting' tool and the 'Mathematical Expression 1D' Operation in the Processing Perspective.

Syntax

The expression engine uses the typical computer syntax for the four basic arithmetic operations (+-*/). Special functions are accessed by namespaces (described below). The syntax for separating namespace components is the colon (:), rather than the usual dot (.). For example, the correct syntax to access the function exp() in the namespace dnp, is shown below.

dnp:exp()

If a dot is entered by mistake, the expression editor will show an error. This can be cleared by right clicking on the list of expressions to refresh the list and then deleting the erroneous expression.

Namespaces

The expression engine incorporates a set of names spaces. These are:

NamespacePurpose
datData manipulation functions, treating the array as a matrix or retrieving statistics
dnpMathematical functions operating on scalars or arrays of data
funcFunction fitting functions
im

Image processing functions

lzLazy evaluation functions


Clicking on a namespace of interest in this table will jump you to the appropriate section on this page.



dat

The 'dat' namespace exposes the functions defined in /org.dawnsci.jexl/src/org/dawnsci/jexl/internal/JexlGeneralFunctions.java. These are:

  • arange(dataset)
  • max(dataset, int)
  • mean(dataset, int)
  • median(dataset, int)
  • min(dataset, int)
  • peakToPeak(dataset, int)
  • product(dataset,int)
  • reshape(dataset, int[])
  • rootMeanSquare(dataset, int)
  • slice(dataset, int[], int[], int[])
  • slice(Dataset, start, stop, step)
  • slice(Dataset, String)
  • squeeze(dataset)
  • stdDev(dataset, int)
  • sum(dataset, int)
  • tile(dataset, int[])
  • transpose(dataset, int[])



dnp

The 'dnp' namespace exposes the functions defined in /org.dawnsci.jexl/src/org/dawnsci/jexl/internal/JexlMaths.java. These are:

  • arccos(data)
  • arccosh(data)
  • arcsin(data)
  • arcsinh(data)
  • arctan(data)
  • arctanh(data)
  • cbrt(data)
  • ceil(data)
  • cos(data)
  • cosh(data)
  • exp(data)
  • expm1(data)
  • floor(data)
  • log(data)
  • log10(data)
  • log1p(data)
  • log2(data)
  • maxium(data, data)
  • minimum(data, data)
  • pow(data, data)
  • power(data)
  • signum(data)
  • sin(data)
  • sinh(data)
  • sqrt(data)
  • square(data)
  • tan(data)
  • tanh(data)
  • toDegrees(data)
  • toRadians(data)



func

The 'func' namespace exposes fitting functions, these are:

  • Gaussian(dataset, double, double, double)
  • Lorentzian(dataset, double, double, double)
  • PearsonVII(dataset, double, double, double, double)
  • PseudoVoigt(dataset, double, double, double, double, double)



im

The 'im' namespace exposes the functions defined in /org.eclipse.dawnsci.analysis.dataset/src/org/eclipse/dawnsci/analysis/dataset/impl/Image.java. These are:

  • adaptiveGaussianThreshold(dataset, int, boolean)
  • adaptiveSauvolaThreshold(dataset, int, boolean)
  • adaptiveSquareThreshold(dataset, int, boolean)
  • align(dataset)
  • convolutionFilter(dataset, dataset)
  • derivativeSobelFilter(dataset, boolean)
  • extractBlob(dataset, int)
  • fanoFilter(dataset, int, int)
  • findTranslation2D(dataset, dataset, IRectangularROI)
  • flip(dataset, boolean)
  • gaussianBlurFilter(dataset, int)
  • globalEntropyThreshold
  • globalMeanThreshold(dataset, boolean)
  • globalOtsuThreshold(dataset, boolean)
  • globalThreshold(dataset, float, boolean, boolean)
  • globalThreshold(dataset, float, boolean)
  • maxFilter(dataset, int[])
  • maxRectangleFromEllipticalImage(dataset, double, double, int, int)
  • maxRectangleFromEllipticalImage(dataset, IROI)
  • meanFilter(dataset, int)
  • meanFilter(dataset, int[])
  • meanSummedAreaFiltermeanFilter(dataset, int)
  • medianFilter(dataset, int)
  • minFilter(dataset, int[])
  • pseudoFlatFieldFilter(dataset, int)
  • regrid_kabsch(dataset, dataset, dataset, dataset, dataset)
  • regrid(dataset, dataset, dataset, dataset, dataset)
  • rotate(dataset, double, boolean)
  • setImageFilterService(IImageFilterService)
  • setImageTransformService(IImageTransform)
  • sobelFilter(dataset)



lz

The 'lz' namespace exposes the functions defined in /org.dawnsci.jexl/src/org/dawnsci/jexl/internal/JexlLazyFunctions.java. These are:

  • rmean(dataset, int)
  • rsum(dataset, int)
  • slice (Dataset, int)
  • slice(Dataset, int[], int[], int[])
  • slice(Dataset, String)



Common methods

All of the namespaces listed above also have access to methods inherited from their Java superclasses, these are:

  • equals(data)
  • getClass()
  • hashCode()
  • notify()
  • notifyAll()
  • toString()
  • wait(long)
  • wait(long, int)