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

voigt_profile #7

Closed
yevgenyr opened this issue Feb 27, 2022 · 3 comments
Closed

voigt_profile #7

yevgenyr opened this issue Feb 27, 2022 · 3 comments

Comments

@yevgenyr
Copy link

yevgenyr commented Feb 27, 2022

Hi Dan,
Great code - thanks!

I was wondering if you have plans to add a voigt peak shape (see here).

I remember that realistically, line profiles usually have this lineshape. Gaussians are usually rare.

it can be something like:

t = np.arange(-1000, 1000, 0.1) 
fwhmg = 2  
fwhml = 2 
v = sps.voigt_profile(t, fwhmg, fwhml) 
I = np.convolve(I, v, 'same') 

inside Scatter.generate_powder. (I is the pxrd profile with delta functions)

@DanPorter
Copy link
Owner

Hi yevgenyr,

Thanks for your message and glad to hear you like the code!

That's a great idea and something I had planned on adding at some point (when someone asked for it). Now you have asked, I'll find a way to add this feature :)

Best wishes,

Dan

@yevgenyr
Copy link
Author

Thanks Dan,
If you'de like I can also contribute in a way of Pull Requests as I go.
I am working on integrating a different CIF reader (from diffpy - it is a bit more comprehansive) and map it over to your cif reader. (of course feel free to reject/modify my PRs :))

@DanPorter
Copy link
Owner

Hi yevgenyr,
I've just committed a new version (V2.2.0) with some new features on the calculation of powder patterns:

twotheta, intensity, reflections = xtl.Scatter.powder('xray', units='twotheta', energy_kev=8, lorentz_fraction=0.5, custom_peak=None)

The are new inputs (all can also be set using xtl.Scatter.setup_scatter):

  • units: something like 'Q', 'dspacing' or 'twotheta'
  • lorentz_fraction: the ratio of Gaussian/Lorentzian widths in pseudo-Voight
  • custom_peak: if an array is given, this is convolved with the intensity delta-functions, rather than the pseudo-Voight.

And there are new outputs:

  • twotheta: array of spectrum angles
  • intensity: array of spectrum intensity
  • reflections: array of grouped reflections (h,k,l,twotheta,intensity)

I've added an example showing this functionality in the examples folder.

Please do have a go and see what you think! If you spot any problems let me know.

Out of interest - what features does the diffpy CIF reader have that aren't in my (admittedly pretty simple) one?

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

2 participants