Skip to content

Commit c7de2ed

Browse files
added type hints to gen_matrix_array
1 parent 79105d9 commit c7de2ed

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/openlifu/xdc/transducer.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,16 @@ def to_json(self, compact:bool) -> str:
254254
return json.dumps(self.to_dict(), indent=4)
255255

256256
@staticmethod
257-
def gen_matrix_array(nx=2, ny=2, pitch=1, kerf=0, units="mm", impulse_response=1, impulse_dt=1, id='array', name='Array', attrs={}):
257+
def gen_matrix_array(nx:int=2,
258+
ny:int=2,
259+
pitch:float=1.0,
260+
kerf:float=0.0,
261+
units:str="mm",
262+
impulse_response:float|np.ndarray=1.0,
263+
impulse_dt:float=1.0,
264+
id:str='array',
265+
name:str='Array',
266+
attrs:Dict|None=None):
258267
"""Generate a 2D flat matrix array
259268
260269
Args:
@@ -291,4 +300,6 @@ def gen_matrix_array(nx=2, ny=2, pitch=1, kerf=0, units="mm", impulse_response=1
291300
impulse_dt=impulse_dt,
292301
units=units
293302
))
303+
if attrs is None:
304+
attrs = {}
294305
return Transducer(elements=elements, id=id, name=name, attrs=attrs)

0 commit comments

Comments
 (0)