def sub_to_image_grid(func):
@wraps(func)<EOL>def wrapper(grid, galaxies, *args, **kwargs):<EOL><INDENT>"""<STR_LIT>"""<EOL>result = func(grid, galaxies, *args, *kwargs)<EOL>if isinstance(grid, SubGrid):<EOL><INDENT>return grid.regular_data_1d_from_sub_data_1d(result)<EOL><DEDENT>else:<EOL><INDENT>return result<EOL><DEDENT><DEDENT>return wrapper<EOL>
Wrap the function in a function that, if the grid is a sub-grid (grids.SubGrid), rebins the computed \
values to the sub-grids corresponding regular-grid by taking the mean of each set of sub-gridded values.

Parameters
----------
func : (profiles, *args, **kwargs) -> Object
    A function that requires the sub-grid and galaxies.