Error in bounding_box
The bounding_box return an image offset by 1 pixel, this translate to an error in mask_ellipse or similar masking routine Here is the code to reproduce the error
import mpdaf
from mpdaf.obj import moffat_image
from mpdaf.obj.objs import bounding_box
ima = moffat_image(fwhm=(5,5), n=2.5, shape=(13,13), flux=1.0, unit_fwhm=None)
radii = (5,5)
posangle=0
peak = ima.peak()
center = (peak['p'],peak['q'])
step = 1
[sy, sx], _, center = bounding_box(
form="ellipse", center=center, radii=radii,
shape=ima.shape, posangle=posangle, step=step)
cima = ima[sy, sx]
tima = ima.copy()
peak = tima.peak()
center = (peak['p']+0.5,peak['q']+0.5)
tima.mask_ellipse(center, radii, posangle, unit_radius=None, unit_center=None, inside=False)
fig,ax = plt.subplots(1,3,figsize=(12,5))
ima.plot(ax=ax[0])
cima.plot(ax=ax[1])
tima.plot(ax=ax[2])