def main(): seq = PwiSequence( angles=np.asarray([-5, 0, 5])*np.pi/180, pulse=Pulse(center_frequency=8e6, n_periods=3, inverse=False), rx_sample_range=(0, 4096), downsampling_factor=1, speed_of_sound=1490, pri=200e-6, sri=10e-3, tgc_start=14, tgc_slope=2e2) scheme = Scheme( tx_rx_sequence=seq, rx_buffer_size=4, output_buffer=DataBufferSpec(type="FIFO", n_elements=12), work_mode="ASYNC") # Here starts communication with the device. with arrus.Session() as sess: us4r = sess.get_device("/Us4R:0") us4r.set_hv_voltage(10) # Upload sequence on the us4r-lite device. buffer, const_metadata = sess.upload(scheme) timer = Timer() buffer.append_on_new_data_callback(timer.callback) sess.start_scheme() work_time = 10 # [s] print(f"Running for {work_time} s") time.sleep(10) # When we exit the above scope, the session and scheme is properly closed. print("Finished.")
def main(): # Here starts communication with the device. with arrus.Session() as sess: us4r = sess.get_device("/Us4R:0") us4r.set_hv_voltage(10) n_elements = us4r.get_probe_model().n_elements # Full transmit aperture, full receive aperture. seq = TxRxSequence( ops=[ TxRx( Tx( aperture=[True] * n_elements, excitation=Pulse(center_frequency=6e6, n_periods=2, inverse=False), # Custom delays 1. delays=[0] * n_elements), Rx(aperture=[True] * n_elements, sample_range=(0, 2048), downsampling_factor=1), pri=200e-6), ], # Turn off TGC. tgc_curve=[14] * 200, # [dB] # Time between consecutive acquisitions, i.e. 1/frame rate. sri=50e-3) # Declare the complete scheme to execute on the devices. scheme = Scheme( # Run the provided sequence. tx_rx_sequence=seq, # Processing pipeline to perform on the GPU device. processing=Pipeline( steps=(RemapToLogicalOrder(), SelectFrames([0]), Squeeze(), Lambda(lambda data: data - (data.mean(axis=0).astype(np.int16)))), placement="/GPU:0")) # Upload the scheme on the us4r-lite device. buffer, metadata = sess.upload(scheme) # Created 2D image display. display = Display2D(metadata=metadata, value_range=(-1000, 1000)) # Start the scheme. sess.start_scheme() # Start the 2D display. # The 2D display will consume data put the the input queue. # The below function blocks current thread until the window is closed. display.start(buffer) print("Display closed, stopping the script.") # When we exit the above scope, the session and scheme is properly closed. print("Stopping the example.")
def setUp(self) -> None: sequence = LinSequence( tx_aperture_center_element=np.arange(0, 65, 8), tx_aperture_size=32, rx_aperture_center_element=np.arange(0, 65, 8), rx_aperture_size=32, tx_focus=50e-6, pulse=Pulse(center_frequency=6e6, n_periods=2, inverse=False), rx_sample_range=(0, 2048), downsampling_factor=1, speed_of_sound=1490, pri=100e-6, sri=50e-3, tgc_start=0, tgc_slope=12, ) self.op = ScanConversion self.context = self.get_default_context(sequence=sequence)
from arrus.utils.gui import Display2D from arrus.utils.imaging import get_bmode_imaging, get_extent arrus.set_clog_level(arrus.logging.INFO) arrus.add_log_file("test.log", arrus.logging.INFO) # Here starts communication with the device. with arrus.Session() as sess: us4r = sess.get_device("/Us4R:0") us4r.set_hv_voltage(40) sequence = StaSequence( tx_aperture_center=np.linspace(-15, 15, 11)*1e-3, tx_aperture_size=32, tx_focus=-6e-3, pulse=Pulse(center_frequency=6e6, n_periods=2, inverse=False), rx_sample_range=(0, 2048), downsampling_factor=2, speed_of_sound=1450, pri=200e-6, tgc_start=14, tgc_slope=2e2) # Imaging output grid. x_grid = np.arange(-15, 15, 0.2) * 1e-3 z_grid = np.arange(5, 45, 0.2) * 1e-3 scheme = Scheme( tx_rx_sequence=sequence, processing=get_bmode_imaging(sequence=sequence, grid=(x_grid, z_grid))) # Upload sequence on the us4r-lite device.