Skip to content
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

Variance propagation in cubing.py #412

Open
MOwers opened this issue May 9, 2024 · 3 comments
Open

Variance propagation in cubing.py #412

MOwers opened this issue May 9, 2024 · 3 comments
Assignees
Labels
bug Something isn't working cubing All issues related to the production of Cubes from RSS

Comments

@MOwers
Copy link

MOwers commented May 9, 2024

Hi Pablo,

I think that there is an error in the interpolate_fibre function where you propagate variance. In the line:

    cube_var[wl_range: wl_range + spectral_window, rows_min:rows_max - 1, cols_min:cols_max - 1] += (
            fib_variance[wl_range: wl_range + spectral_window, np.newaxis, np.newaxis]
            * w)

it should be w**2

Cheers,
Matt.

@PabloCorcho PabloCorcho self-assigned this May 10, 2024
@PabloCorcho PabloCorcho added the cubing All issues related to the production of Cubes from RSS label May 10, 2024
@PabloCorcho
Copy link
Member

Hi Matt. Thanks for letting me know! I will start fixing this issue along with the refactoring of the cubing process.

@PabloCorcho PabloCorcho added the bug Something isn't working label May 10, 2024
@PabloCorcho
Copy link
Member

I have been checking this and I would swear the above expression is correct... The variance is interpolated in the cube using the a kernel-based weight (w) in the same way as the intensity, so the contribution from a single RSS to a cube is defined as:

$$ I_{cube}(\lambda, x,y) = \int\int I_{RSS}^{i}(\lambda, x', y') \cdot K(x - y', y - y')\ dx'dy' $$

$$ var_{cube}(\lambda, x,y) = \int\int var_{RSS}^{i}(\lambda, x', y') \cdot K(x - y', y - y')\ dx'dy' $$

where $K(x - y', y - y')\ dx'dy'$ corresponds to the variable w and ($x',\ y'$) is the location of a fibre in the pixel space. This preserves the integrated variance and intensity (if the domain of $x',\ y'$ is contained within $x,\ y$). Maybe I am missing something. We can discuss this in a telecon.

@MOwers
Copy link
Author

MOwers commented May 12, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cubing All issues related to the production of Cubes from RSS
Projects
None yet
Development

No branches or pull requests

2 participants