Conversation
There was a problem hiding this comment.
Thank you for splitting the updates. It seems that this PR is still in progress, but I would like to put our decision according to the previous DESHIMA meetings anyway. The goal of the issue #109 is to create a function decode.fit.cube that takes a cube DataArray (dimensions of (lon, lat, chan)) as an input, and return a DataArray of 2D Gaussian models as an output (with the same shape and dimensions as the input). We also discussed that we could use DataArray.curvefit so that a simple 2D Gaussian function can be applied to each channel simultaneously. So the possible design of the function would be:
def cube(
cube: xr.DataArray,
/,
*,
init_amp: float = 1.0,
init_x0: float = 0.0,
init_y0: float = 0.0,
...
) -> xr.DataArray:
"""Apply 2D Gaussian fit to each channel of a 3D spectral cube."""
return cube.curvefit(
coords=("lon", "lat"),
func=gaussian_2d,
p0=(init_amp, init_x0, init_y0, ...),
)I am not fully sure whether we could implement like this, but it would be appreciated if you could consider such function-oriented implementation for readability and reproducibility.
Closes #109.