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

enh: added option to smooth LDOS grid with Gaussian smoothing from sisl #123

Merged
merged 1 commit into from
Mar 25, 2022

Conversation

sofiasanz
Copy link
Member

Added possibility to smooth the real space grid with Gaussian smoothing for LDOS plots.

@zerothi
Copy link
Collaborator

zerothi commented Mar 24, 2022

Just an idea, you could let smooth be a dict which contains the arguments for the function, then you don't need to think too much about additional parameters?

@sofiasanz
Copy link
Member Author

Just an idea, you could let smooth be a dict which contains the arguments for the function, then you don't need to think too much about additional parameters?

Yes I like it! You can see my implementation in commit cf3d5ec.

@sofiasanz
Copy link
Member Author

I see! Yes that is much better :-)

grid_i.grid = grid

# In Ref. [ACS Nano, Vol. 12, No. 7, p. 7048-7056] they use r=0.6 Angstroms to simulate the Gaussian-shaped tip
grid_i = grid_i.smooth(**kwargs["smooth"])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if this what you want, but this will always smooth it?

@sofiasanz
Copy link
Member Author

sofiasanz commented Mar 25, 2022

But if the user doesn't pass any arguments for smooth then it assumes r=0, no? And then it doesn't have the smoothing effect, no?

@sofiasanz
Copy link
Member Author

Otherwise it can just first check if the smooth dictionary is empty or not.

@zerothi
Copy link
Collaborator

zerothi commented Mar 25, 2022

But if the user doesn't pass any arguments for smooth then it assumes r=0, no? And then it doesn't have the smoothing effect, no?

No, it will use the default values, https://zerothi.github.io/sisl/api/generated/sisl.Grid.html?highlight=smooth#sisl.Grid.smooth

Remember that kwargs for a zero length dict is effectively passing no arguments. I think it is safest to check whether the argument exist (checking the length would not allow users to use default values).

@sofiasanz
Copy link
Member Author

I see. Forgot to check which were the default values of the method. Thanks!

Remember that kwargs for a zero length dict is effectively passing no arguments. I think it is safest to check whether the argument exist (checking the length would not allow users to use default values).

I just saw again what you wrote in #123 (comment), didn't see the first line before hehe

Copy link
Collaborator

@zerothi zerothi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm!

mnt: let smooth be a dictionary and updated test

mnt: pass smooth dict directly to the sisl function

mnt: check wether smooth argument exists before smoothing the grid
@sofiasanz sofiasanz merged commit 0c08d5d into main Mar 25, 2022
@sofiasanz sofiasanz deleted the smooth-grid branch March 25, 2022 17:25
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

Successfully merging this pull request may close these issues.

2 participants