I explored the function generate_raster in ArcGIS python API, following the tutorial creating raster information product using raster analytics | ArcGIS for Developers.
It worked perfectly when using the built-in raster functions like 'Stretch' as demoed in the tutorial. But when I replace the rasterFunction name with the one in my image service, like, 'customRasterFunction', it returned the error below.
ERROR 001641: The specified entry 'Input Raster Function' is invalid. A processing template must reference either a valid raster function template (RFT) XML file or a pre-existing template by name.\nFailed to execute (GenerateRasterFromRasterFunction).\n."}
It seems that it could not find the raster function template 'customRasterFunction'. However, when I opened the image service in map viewer, and click 'Image Display', I can change the Renderer to the 'customRasterFunction', and the image is displayed without any problem.
Any idea why?