Skip to content

Commit

Permalink
adding plotting to BraggVectors
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-rakowski committed Dec 11, 2023
1 parent 31fb037 commit 2684583
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions py4DSTEM/braggvectors/braggvector_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,51 @@ def to_strainmap(self, name: str = None):

return StrainMap(self, name) if name else StrainMap(self)

def plot(
self,
index: tuple[int,int] | list[int],
cal: str = 'cal',
returnfig: bool = False,
**kwargs
):
"""
Plot Bragg vector, from a specified index.
Calls py4DSTEM.process.diffraction.plot_diffraction_pattern(braggvectors.<cal/raw>[index], **kwargs).
Optionally can return the figure.
Parameters
----------
index : tuple[int,int] | list[int]
index for which Bragg vectors to plot
cal : str, optional
Choice to plot calibrated or raw Bragg vectors must be 'raw' or 'cal', by default 'cal'
returnfig : bool, optional
Boolean to return figure or not, by default False
Returns
-------
tuple (figure, axes)
matplotlib figure, axes returned if `returnfig` is True
"""
assert cal.lower() in ('cal', 'raw'), f"'cal' must be in ('cal', 'raw') {cal = } passed"
from py4DSTEM.process.diffraction import plot_diffraction_pattern

if cal == 'cal':
pl = self.cal[index]
else:
pl = self.raw[index]

if returnfig:
return plot_diffraction_pattern(
pl,
returnfig=returnfig,
**kwargs,
)
else:
plot_diffraction_pattern(
pl,
**kwargs,
)

######### END BraggVectorMethods CLASS ########

Expand Down

0 comments on commit 2684583

Please sign in to comment.