-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add 2D Gaussian fitter to fit module #192
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.