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

Refactor plotting code #17

Open
nury12n opened this issue Dec 13, 2024 · 0 comments
Open

Refactor plotting code #17

nury12n opened this issue Dec 13, 2024 · 0 comments

Comments

@nury12n
Copy link
Collaborator

nury12n commented Dec 13, 2024

Plotting, particularly for the precipitation models, is quite messy in kawin. I would eventually like the plotting code to be the following:

  • Decoupled from the model
  • Single function for each plotting term. Currently the precipitation module has a single plotting function to handle all terms

Currently, plotting in the precipitation modules works like the following:

model = PrecipitateModel(...)
fig, ax = plt.subplots(1,2)
model.plot(ax[0], 'radius', *args, **kwargs)
model.plot(ax[1], 'volume fraction', *args, **kwargs)

But it would be better to have plotting work like:

model = PrecipitateModel(...)
fig, ax = plt.subplots(1,2)
plotRadius(model, ax=ax[0], *args, **kwargs)
plotVolumeFraction(model, ax=ax[1], *args, **kwargs)

If we want to retain the idea of a single plot function, we could have something like:

plot(model, 'radius', ax=ax[0], *args, **kwargs)
plot(model, 'volume fraction', ax=ax[1], *args, **kwargs)

Where the plot function here will just call the respective plotRadius and plotVolumeFraction functions.

Ideally, this should also involve opening up the API more so that the stored variables in the models are easily accessible and understood by the user. #11 has something like this for the precipitation module with the PrecipitationData in kawin.precipitation.PrecipitationParameters but currently doesn't store the PBM models (which are internal to the Eulerian KWN model). Something similar would be desired for the diffusion models where the user can retrieve the composition profile/flux/etc at a given time.

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