Skip to content

Commit

Permalink
adding h,k,l property to BVects
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-rakowski committed Dec 11, 2023
1 parent e0c7b82 commit cf256ec
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions py4DSTEM/braggvectors/braggvectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ class BVects:
"""
Enables
>>> v.qx,v.qy,v.I
>>> v.qx,v.qy,v.I, optionally, v.h,v.k,v.l
-like access to a collection of Bragg vector.
"""
Expand All @@ -361,11 +361,32 @@ def I(self):
def data(self):
return self._data

@property
def h(self):
try:
return self._data["h"]
except ValueError:
raise AttributeError("h indicies not set")

@property
def k(self):
try:
return self._data["k"]
except ValueError:
raise AttributeError("k indicies not set")

@property
def l(self):
try:
return self._data["l"]
except ValueError:
raise AttributeError("l indicies not set")

def __repr__(self):
space = " " * len(self.__class__.__name__) + " "
string = f"{self.__class__.__name__}( "
string += f"A set of {len(self.data)} bragg vectors."
string += " Access data with .qx, .qy, .I, or .data.)"
string += " Access data with .qx, .qy, .I, or .data. Optionally .h, .k, and.l, if indexed)"
return string


Expand Down

0 comments on commit cf256ec

Please sign in to comment.