Skip to content

Conversation

@ShinjiFujita
Copy link
Contributor

@ShinjiFujita ShinjiFujita commented Aug 2, 2024

Closes #109.

@astropenguin astropenguin changed the title Update qlook.py (issue109) Add 2D Gaussian fitter to qlook commands Aug 3, 2024
@astropenguin astropenguin changed the title Add 2D Gaussian fitter to qlook commands Add 2D Gaussian fitter to fit module Aug 3, 2024
Copy link
Member

@astropenguin astropenguin left a 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.

@astropenguin astropenguin added the feature New feature or request label Aug 5, 2024
@astropenguin astropenguin added this to the v2024.8 milestone Aug 5, 2024
@astropenguin astropenguin self-requested a review August 6, 2024 11:20
@astropenguin astropenguin modified the milestones: v2024.8, v2024.9 Aug 7, 2024
@astropenguin astropenguin removed this from the v2024.9 milestone Apr 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Add 2D Gaussian fitter to fit module

3 participants