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

Adding depolarizing decomposition #2

Open
Jashcraf opened this issue Sep 20, 2024 · 1 comment
Open

Adding depolarizing decomposition #2

Jashcraf opened this issue Sep 20, 2024 · 1 comment

Comments

@Jashcraf
Copy link

Hello! I was interested in learning Julia after some persistent persuasion and decided to add a little bit to this package as a first pass because I too exist in Mueller calculus.

Specifically, I’m trying to add the depolarizing decomposition of a Mueller matrix so that you can analytically separate out the Depolarizer, Retarder, and Diattenuator from a single Mueller matrix.

For the time being, here’s the Diattenuator function

using LinearAlgebra

function decompose_diattenuator(M)

    T = M[1, 1]
    diattenuation_vector = M[1, 2:4] / T

    D = sqrt(dot(diattenuation_vector, diattenuation_vector))
    mD = sqrt(1 - D^2)
    diattenuation_norm = diattenuation_vector # / mD
    DD = kron(diattenuation_vector, transpose(diattenuation_vector))

    # Create the diattenuator
    I = diagm([1., 1., 1.])
    inner_diattenuator = (I * mD) + (1 - mD) * DD

    # Put it all together
    Md = zeros(4, 4)
    Md[1, 1] = 1.
    Md[1, 2:4] = diattenuation_vector
    Md[2:4, 1] = diattenuation_vector
    Md[2:4, 2:4] = inner_diattenuator
    Md = Md * T

    return Md
end

Does this sound like it would be a useful inclusion to Mueller.jl? If so, I can get started on a PR

@Jashcraf Jashcraf changed the title Adding depolarizing decomposition - general diattenuator / retarder support? Adding depolarizing decomposition Sep 20, 2024
@Jashcraf
Copy link
Author

For reference, I have a similar set of functions implemented in Python in my Katsu package
https://github.com/Jashcraf/katsu/blob/deea56fdcba0f60a4c65ef42a9b03f26d70950bb/katsu/mueller.py#L489

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant