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

Remove Duplicate OpacityState object in numba_interface.py #2765

Open
Rodot- opened this issue Jul 30, 2024 · 6 comments
Open

Remove Duplicate OpacityState object in numba_interface.py #2765

Rodot- opened this issue Jul 30, 2024 · 6 comments

Comments

@Rodot-
Copy link
Contributor

Rodot- commented Jul 30, 2024

Describe the bug
There are two copies of the OpacityState jitclass and its initializer. One is in opacity_state.py and the other in numba_interface.py. The version in numba_interface.py should be removed to complete the refactoring.

@karthik11135
Copy link

are we supposed to delete numba_interface file? because the implementations are same as opacitystatenumba in opacity_state file.

thanks for your time.

@Sonu0305
Copy link
Contributor

Hi @andrewfullard ,
I notice one difference in the implementation of the opacity_state_initialize method between the two files,

In opacity_state.py (L385-L392):

    tau_sobolev_df = calculate_sobolev_line_opacity(
        plasma.atomic_data.lines,
        plasma.level_number_density,
        plasma.time_explosion,
        plasma.stimulated_emission_factor,
    )

    tau_sobolev = np.ascontiguousarray(tau_sobolev_df, dtype=np.float64)

Here, tau_sobolev is being calculated dynamically using the calculate_sobolev_line_opacity method.

In numba_interface.py (L167-L169):

    tau_sobolev = np.ascontiguousarray(
        plasma.tau_sobolevs.values.copy(), dtype=np.float64
    )

Here, tau_sobolev is copied from precomputed values stored in the plasma object.

Concern:

When we remove the opacity_state_initialize method from numba_interface.py, references that currently use this method will start using the implementation in opacity_state.py. This means that tau_sobolev will be calculated dynamically instead of using the precomputed values from plasma.tau_sobolevs.

Is this the intended behavior? Or should we preserve the ability to use precomputed tau_sobolevs in certain contexts?
Looking forward for your review, Thank You.

@andrewfullard
Copy link
Contributor

Thanks for the extensive research. In this case, the opacity_state.py implementation is what we want to use. The critical check is to make sure that any uses of the numba_interface version of the class are replaced and tested against the relevant regression data.

@Sonu0305
Copy link
Contributor

Thanks for the extensive research. In this case, the opacity_state.py implementation is what we want to use. The critical check is to make sure that any uses of the numba_interface version of the class are replaced and tested against the relevant regression data.

Thank You for the clarification, should I open a PR for the same now?

@andrewfullard
Copy link
Contributor

No thank you, you have already produced a large number of PRs that we need to review.

@Sonu0305
Copy link
Contributor

No thank you, you have already produced a large number of PRs that we need to review.

Thank you for your update. I've added this task to my To-Do list, and once we've completed the reviews for the current open PRs, I'll prioritize and open a PR for this one as well.

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

No branches or pull requests

4 participants