Locked History Actions


Adding New Models to IMENGINE

Adding a 2D Flux Density Model

Refer to src/imextend.cc for a working example. The basic idea is to extend the GenericPixelFunction class and implement your own calculation of the flux density as a function of scaled pixel coordinates (x,y). For example:

class MyGaussian : public img::GenericPixelFunction {
    // Creates a new model with the specified sigma in pixels.
        MyGaussian(double sigma)
        : _twosigmasq(2*sigma*sigma), _norm(8*std::atan(1.0)*sigma*sigma)
        { }
        // Returns the normalized function value at (x,y) in pixel space.
    double operator()(double x, double y) const {
        return std::exp(-(x*x+y*y)/_twosigmasq)/_norm;
    double _twosigmasq,_norm;
}; // MyGaussian

You can now use this class like any of the built-in classes. For example, to add the flux from instances of this new model:

img::AbsPixelFunctionPtr core(new MyGaussian(sigma1)),tail(new MyGaussian(sigma2));
img::AbsPixelFunctionPtr source(new img::PixelFunctionSum(core,tail,frac,dx,dy));

Adding a 1D Radial Profile Model

Under construction...

Adding a new Transform Type

Under construction...