Skip to content

Instantly share code, notes, and snippets.

@thomasaarholt
Created February 11, 2021 09:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomasaarholt/3c7a776aa88554aa6283373d996aadd8 to your computer and use it in GitHub Desktop.
Save thomasaarholt/3c7a776aa88554aa6283373d996aadd8 to your computer and use it in GitHub Desktop.
2D TopHat Hyperspy Sympy Component
import hyperspy.api as hs
expr = "where(sqrt((x - xc)**2 + (y - yc)**2) < radius, A, 0)"
tophat = hs.model.components2D.Expression(expr, 'Top Hat', position=("xc", "yc"), A=1, xc=0, yc=0, radius=1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment