|
13 | 13 | # --- |
14 | 14 | from __future__ import annotations |
15 | 15 |
|
| 16 | +import numpy as np |
| 17 | + |
16 | 18 | from openlifu.bf import Pulse, Sequence, apod_methods, focal_patterns |
17 | 19 | from openlifu.geo import Point |
18 | 20 | from openlifu.plan import Protocol |
|
27 | 29 | focal_pattern = focal_patterns.SinglePoint(target_pressure=1.2e6) |
28 | 30 | focal_pattern = focal_patterns.Wheel(center=False, spoke_radius=5, num_spokes=3, target_pressure=1.2e6) |
29 | 31 | apod_method = apod_methods.MaxAngle(30) |
30 | | -sim_setup = SimSetup(x_extent=[-30,30], y_extent=[-30,30], z_extent=[-4,70]) |
| 32 | +sim_setup = SimSetup(x_extent=(-30,30), y_extent=(-30,30), z_extent=(-4,70)) |
31 | 33 | protocol = Protocol( |
32 | 34 | id='test_protocol', |
33 | 35 | name='Test Protocol', |
|
37 | 39 | apod_method=apod_method, |
38 | 40 | sim_setup=sim_setup) |
39 | 41 |
|
40 | | -target = Point(position=(0,0,50), units="mm", radius=2) |
| 42 | +target = Point(position=np.array([0, 0, 50]), units="mm", radius=2) |
41 | 43 | trans = Transducer.gen_matrix_array(nx=8, ny=8, pitch=4, kerf=0.5, id="m3", name="openlifu", impulse_response=1e6/10) |
42 | 44 | # - |
43 | 45 |
|
|
48 | 50 | scale=True) |
49 | 51 |
|
50 | 52 | pc = {"MI":ParameterConstraint('<', 1.8, 1.85), "TIC":ParameterConstraint('<', 2.0), 'global_isppa_Wcm2':ParameterConstraint('within', error_value=(49, 190))} |
51 | | -scaled_analysis.to_table(constraints=pc).set_index('Param')[['Value', 'Units', 'Status']] |
| 53 | +if scaled_analysis is not None: |
| 54 | + scaled_analysis.to_table(constraints=pc).set_index('Param')[['Value', 'Units', 'Status']] |
52 | 55 |
|
53 | 56 | protocol = Protocol.from_file('../tests/resources/example_db/protocols/example_protocol/example_protocol.json') |
54 | 57 | solution, sim_res, analysis = protocol.calc_solution( |
55 | 58 | target=target, |
56 | 59 | transducer=trans, |
57 | 60 | simulate=True, |
58 | 61 | scale=True) |
59 | | -analysis.to_table().set_index('Param')[['Value', 'Units', 'Status']] |
| 62 | +if analysis is not None: |
| 63 | + analysis.to_table().set_index('Param')[['Value', 'Units', 'Status']] |
0 commit comments