Skip to content

Instantly share code, notes, and snippets.

@thomasaarholt
Created February 11, 2021 09:16
Show Gist options
  • Select an option

  • Save thomasaarholt/b3dcee12849fcb3452e1f2dbf0cd9f90 to your computer and use it in GitHub Desktop.

Select an option

Save thomasaarholt/b3dcee12849fcb3452e1f2dbf0cd9f90 to your computer and use it in GitHub Desktop.
1D Tophat function using radius and center
import hyperspy.api as hs
expr = "where(abs(x - center) < radius, A, 0)"
tophat = hs.model.components1D.Expression(expr, 'Top Hat', position="center", A=1, center=0, radius=1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment