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

You want this? Do this! #14

Open
CandleHouse opened this issue Nov 29, 2023 · 2 comments
Open

You want this? Do this! #14

CandleHouse opened this issue Nov 29, 2023 · 2 comments

Comments

@CandleHouse
Copy link
Collaborator

Get decomposition coefficient with physical experiment without spectrum! Please integrate this!

def deDecompGetCoeff(lowProj: TwoOrThreeD, highProj: TwoOrThreeD, 
                     len1: TwoOrThreeD, len2: TwoOrThreeD) -> Tuple[NDArray, NDArray]:
    '''
        Calculate the decomposing coefficient (Order 2 with bias term) of dual-energy onto two material length.
    '''
    
    def deCalcBetaGamma(A1, A2, LComb):
        A1Square = A1.T**2
        A2Square = A2.T**2
        A1A2 = (A1 * A2).T
        A1 = A1.T
        A2 = A2.T
        Ones = np.ones((A1.T.shape[0]))
        A = np.array([A1Square, A2Square, A1A2, A1, A2, Ones]).T

        return np.linalg.pinv(A) @ LComb

    beta, gamma = deCalcBetaGamma(lowProj.flatten(), highProj.flatten(), 
                                  np.array([len1.flatten(), len2.flatten()]).T).T

    return beta, gamma
@z0gSh1u
Copy link
Collaborator

z0gSh1u commented Nov 29, 2023

6

1 similar comment
@Ruachmaninov
Copy link

6

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

3 participants