All experiments (on this hardware and other) are on this repo.
How to manage an experiment.
All acquisitions on this page are based on:
Setup
All calibration / basic experiments were using a piezo with a reflector a few cm away, with water in between.
I used in this case a film case, just right for the size of the transducer, filed with water and connected to the board.
Acquisition
From shell
The code below is equivalent to
python pyUn0.py single
Doing the acquisition
import pyUn0 as us
UN0RICK = us.us_spi()
UN0RICK.init()
UN0RICK.test_spi(3)
TGCC = UN0RICK.create_tgc_curve(10, 980, True)[0] # Gain: linear, 10mV to 980mV
UN0RICK.set_tgc_curve(TGCC) # We then apply the curve
UN0RICK.set_period_between_acqs(int(2500000)) # Setting 2.5ms between shots
UN0RICK.JSON["N"] = 1 # Experiment ID of the day
UN0RICK.set_multi_lines(False) # Single acquisition
UN0RICK.set_acquisition_number_lines(1) # Setting the number of lines (1)
UN0RICK.set_msps(0) # Sampling speed setting
A = UN0RICK.set_timings(200, 100, 2000, 5000, 200000)# Settings the series of pulses
UN0RICK.JSON["data"] = UN0RICK.do_acquisition() # Doing the acquisition and saves
We have setup the pulse train with us.set_timings
:
- A pulse of 200ns
- A deadtime of 100ns
- Damping for 2us
- Start of the acquisition 4us after the pulses
- Acquisition for 200us
Moreover, the TGC profile over the 200us is setup from 1% to 98% gain lineraly from 0 to 200us as:
TGCC = UN0RICK.create_tgc_curve(10, 980, True)[0] # Gain: linear, 10mV to 980mV
UN0RICK.set_tgc_curve(TGCC) # We then apply the curve
The acquisition and its parameters are saved in a json file saved close to the lib folder.
name_json = self.JSON["experiment"]["id"]+"-"+str(self.JSON["N"])+".json"
Processing
Let’s create the actual signals and images
make_clean("./") # creates a data folder if needed and moves files there
for MyDataFile in os.listdir("./data/"):
if MyDataFile.endswith(".json"):
y = us.us_json()
y.show_images = False
y.JSONprocessing("./data/"+MyDataFile) # creating the signal and time values
y.mkImg()
if y.Nacq > 1:
y.mk2DArray()
which yields
Other utilities
There are some other utilities.. to be enhanced ?
y.create_fft()
y.save_npz()