Simple_DAQ is a Python-based, user-friendly interface tailored for data acquisition from prevalent instruments in the Henriksen lab.
This project draws inspiration from an earlier LabVIEW version of SimpleDAQ.vi that was a staple in the Henriksen lab. The decision to reimagine it stemmed from recurring challenges faced with the LabVIEW iteration: transferring it between PCs often led to failures due to broken dependencies with sub VIs. Additionally, integrating new instrument drivers became a challenge when manufacturers lacked a robustly written one.
- Visit the Simple_DAQ GitHub repository.
- Click on the green
Code
button on the right. - Choose
Download ZIP
. - Once downloaded, extract the ZIP file to a location of your choice.
Anaconda is a popular distribution of Python that simplifies package management and deployment.
- Download Anaconda for your operating system.
- Follow the installation instructions for your operating system from the Anaconda installation guide.
Anaconda Navigator is a GUI tool that comes with the Anaconda distribution.
- Open Anaconda Navigator from your applications or programs list.
- Click on
Environments
on the left sidebar. - Click on
Create
at the bottom. - Name it
simple_daq_env
and choose the Python version you want (e.g., 3.X). Click on theCreate
button. - After the environment is created, make sure it's activated (should be highlighted in green).
- Open PyCharm and choose
Open
to load theSimple_DAQ
directory you extracted from the ZIP file. - Once the project is open, navigate to
File
>Settings
(orPreferences
on macOS) >Project: Simple_DAQ
>Python Interpreter
. - Click on the gear icon and choose 'Add'.
- From the left pane, select 'Conda Environment' and then 'Existing environment'.
- Select the interpreter from the
simple_daq_env
environment you created in Anaconda Navigator. The path would typically be in the Anaconda directory underenvs/simple_daq_env/bin/python
. - To automatically install the required packages, navigate to
Tools
in the top menu and selectSync Python Requirements
. This will read therequirements.txt
file and install all necessary packages.
- Open the
Simple_DAQ
directory (that you extracted from the ZIP file) in VSCode. - Press
Ctrl + Shift + P
to open the command palette. - Type and select "Python: Select Interpreter".
- Choose the interpreter from the
simple_daq_env
environment you created in Anaconda Navigator. - Open the terminal in VSCode (View > Terminal) and type:
pip install -r requirements.txt
To get started, first clone the Simple_DAQ repository from GitHub:
git clone https://github.com/Henriksen-Lab/Simple_DAQ.git
Navigate to the cloned directory:
cd Simple_DAQ
Using Python's built-in venv:
# Using venv module for Python
python -m venv venv
# Activate the virtual environment
# For Windows
venv\Scripts\activate
# For macOS and Linux
source venv/bin/activate
Using Anaconda (if installed):
conda create --name simple_daq_env python=3.X
conda activate simple_daq_env
Replace 3.X
with your desired Python version.
To install the required packages,
pip install -r requirements.txt
While the Python version maintains the UI style of the original LabVIEW version, it introduces several enhancements to improve user convenience.
-
Configuration Management:
- Save: The Measurement Set-up window captures the current settings as a screenshot and saves it to a designated folder. The file is named
[Filename]_Simple_DAQ_config
and is saved whenever theSave config
orRun
buttons are pressed. - Load: You can revert to previous settings at any time by using the
Load config
button. This feature is especially handy for reviewing past measurement configurations or for initiating new measurements with similar settings.
- Save: The Measurement Set-up window captures the current settings as a screenshot and saves it to a designated folder. The file is named
-
Real-Time Data Visualization:
The Realtime plotting window provides live data visualization, allowing you to see measurements as they are being taken.
-
Instant Data Backup:
Within the Realtime plotting panel, a special button allows you to quickly save the visualized data. The saved data is named
temp
and stored in a designated folder. This function is beneficial for safeguarding against potential data loss, such as accidental file corruption (which might occur if files are being synced to cloud storage while concurrently being modified by the program). It also provides a method to keep a separate copy of continuous data.
-
Safety First:
- Before initiating any measurements, ensure you're knowledgeable about the equipment and the measurements you're planning. Ensure connections are correct and that the readings are sensible. Proceeding without this confirmation can lead to wasted time and inaccurate data.
-
Initial Setup:
- Begin by following the installation instructions provided.
- In your IDE, execute the
Simple_DAQ_beta.py
file. Two windows namedSpecify your measurement below
andRealtime plotting
will appear.
-
Measurement Specification Window:
- This window primarily contains three fields:
Instrument
,File
, andSweep
.
- This window primarily contains three fields:
-
File Configuration:
-
Determine a
File name
for your data. -
Specify the
Folder path
where data should be saved. -
Determine the
order
of your files. Input should be an integer. E.g., default data will save asname_me_please.001
.Note: If a file with the same name and order already exists, the program will automatically increment the order by one to prevent overwriting.
-
Set the
File size
. Input should be an integer. This represents the number of data points the program will save at once. E.g., an input of 1000 means the data file will be updated after 1000 data points are acquired. -
Specify the
Data interval
, using a positive float number. This defines the time gap between successive instrument value queries. -
Use the
My note
field to document any relevant information about the device or physical setup. This helps in future data analysis.
-
-
Instrument Configuration:
- The far-left block is reserved for VNA-type instruments. Remaining blocks are for instruments that return a single value.
-
Assign a
Variable name
which will represent this in your data set. -
Fill in the
Visa address
, verifiable via NI MAX software orVisa_troubleshooting.py
. -
Choose your
Instrument_name
andFunction_selection
for specific data recording.Note: To avoid VISA communication issues, only one instrument is communicated with at any given time.
-
Sweep Configurations:
-
This panel contains:
Main loop
,Secondary loop
, andPID control
. -
For a single parameter sweep, fill in the
Main loop
:- Instrument settings mirror those in the instrument panel.
- Sweep settings include
Start
,Stop
,Sweep step size
, andDelay time
. - Toggles include:
Log scale?
: Toggles between linear and ratio sweeps. With this enabled,Sweep step size
changes toRatio between steps
. A value greater than 1 is advised.Sweep back?
: Returns the sweep to the start point. Additional configurations likeBack step
andBack delay
are available for costumizing, or it keeps to original settings.
- Click
Time estimate
to view an estimated duration for the sweep.
-
For a double parameter sweep, use both the
Main loop
andSecondary loop
. The program completes the entire secondary loop for every main loop step. -
Use
PID control
for temperature regulation. Options here includeIceT noise setup
andNV transfer setup
.
-
-
Initiating the Measurement
Once you click the
Run
button, your IDE will display a sequence of status updates, which might include:Measurement loaded Monitor functioning # Displayed when no sweep is set up. Single Sweep Starting # Displayed for Mainloop sweep configuration. Double Sweep Started # Displayed when both Mainloop and Secondary loop configurations.
Over time, as the data files are created or updated, you'll notice additional messages like:
2023.08.16 11:16:36 name_me_please.001 Data file created. 2023.08.16 11:26:36 name_me_please.001 Data file updated. 2023.08.16 11:36:36 name_me_please.001 Data file updated.
-
Visualizing Data with the Plot Window
Select Data:
- Navigate to
data_selector
to specify the data category you'd like to visualize. Your options might be:data
: Represents data to be saved in filessweep
: Refers to internal record for you sweep parameterspid
: Indicates the temp log from the PID set up
Define Axes:
- Determine which parameters you want on the X1 and Y1 axes for your graph.
Begin Visualization:
- Click on
Start plotting
. A live-updating plot will subsequently appear on the right side of the screen.
- Navigate to
This tool is particularly useful when you need to test individual instruments or make simultaneous manual adjustments. Its primary purpose is to validate the connection and assess the functionality of a single instrument.
When you've captured data on different computers and wish to synchronize their timestamps, this tool comes to the rescue. It efficiently concatenates identically formatted data (with matching axes) found within a folder. By comparing diverse timestamps, it aligns data and then exports the newly consolidated data to the specified folder.
Instrument_dict.py
: This contains the nomenclature and functionalities associated with the drivers.
1. Start by editing or adding the desired function/driver within the Instrument_Drivers
directory.
2. If you're introducing a new driver:
- Import the new driver in
Instrument_dict.py
3. Integrating a New Driver or Function:
Whenever you add a new driver or function:
-
Update the
get_value()
andset_value()
functions inInstrument_dict.py
to accommodate the new additions. -
Make appropriate modifications to the
instrument_dict
inInstrument_dict.py
.
For Instance:
Suppose you've created a new driver, SampleInstrument.py
, housing several functions like follows, and you've placed this in the Instrument_Drivers
directory.
def SampleInstrument_get_random1(address):
...
return value
def SampleInstrument_get_random2(address):
...
return value
def SampleInstrument_set_random3(address, value):
...
def SampleInstrument_set_random4(address, value):
...
To integrate this in Instrument_dict.py
, proceed as follows:
- Incorporate the new driver by adding:
from SampleInstrument import *
- Enhance the
instrument_dict
to include the new functions:
instrument_dict['get'].update({SampleInstrument: ['random1', 'random2']})
instrument_dict['set'].update({SampleInstrument: ['random3', 'random4']})
- Embed the new functions into the
get_value
andset_value
procedures:
def get_value(address='', name='', func='', **kwargs): # Extend this function
...
elif name == 'SampleInstrument':
if func == 'random1':
value = SampleInstrument_get_random1(address)
elif func == 'random2':
value = SampleInstrument_get_random2(address)
def set_value(value, address='', name='', func='', **kwargs): # Expand this function
...
elif name == 'SampleInstrument':
if func == 'random3':
SampleInstrument_set_random3(address, value)
elif func == 'random4':
SampleInstrument_set_random4(address, value)
4. Before pushing your changes to GitHub (and please do so if you add new drivers/functions), ensure that the Visa_troubleshooting.py
correctly displays the intended readouts or causes the instrument to behave as desired.
├── Simple_DAQ_beta.py
├── Visa_troubleshooting.py
├── Datafile editor.py
├── UI_manager
│ ├── DataManager.py
│ └── _ini_.py
├── Customized
│ ├── LYW_plot_universal.py
│ ├── SD_picoVNA_py32bit.py
│ ├── SD_plot
│ │ ├── SD_FigureFormat.py
│ │ ├── SD_Func.py
│ │ ├── SD_LoadData.py
│ │ ├── SD_plot_universal.py
│ │ ├── __pycache__
│ │ └── _ini_.py
│ └── SD_pywin32error.sh
├── requirments.txt
├── README.md
├── LICENSE
├── Instrument_Drivers
│ ├── _ini_.py
│ ├── FileManager.py
│ ├── Instrument_dict.py
│ ├── Agilent_infiniVision.py
│ ├── DC205.py
│ ├── E4405B.py
│ ├── Keysight_U2741A.py
│ ├── PicoVNA108
│ │ ├── PicoVNA108.py
│ │ ├── pywin32-env
│ ├── PicoVNA Python Wrapper(folded)
│ ├── SR124.py
│ ├── SR770.py
│ ├── SR830.py
│ ├── hp34461A.py
│ ├── keithley.py
│ ├── keithley2230G_30_1.py
│ ├── keysightN6700c.py
│ ├── thermometer
│ │ ├── _ini_.py
│ │ ├── RuOx.py
│ │ └── Cernox.py
│ ├── noise_probe_PID.py
│ ├── noise_probe_arduino_control.py
│ ├── Arduino_run_noise_probe
│ │ └── Arduino_run_noise_probe.ino
│ ├── transfer_heater_PID.py
│ ├── transfer_heater_arduino_comm.py
│ ├── Arduino_run_transfer_Heater
│ │ └── Arduino_run_transfer_Heater.ino
│ └── vna_analysis.py
└── older reference(folded)
PicoVNA 108 is a peculiar instrument to query because the python warpper the instrument uses bases on pywin32
package and only function in Python 32bit ver, which means you might need to separately install a 32 bit python for the instrument. There are serveral more steps to prepare if you want to install picovna 3 and talk to it through python on a new PC
The step is required even if you don't want to use the software built by manufactor, because only after installation, the instrument would be registered in registry and thus to be accessed. You could find the installation package in ~\Instrument_Drivers\PicoVNA_InitialSetup\picovna3_exe_install.exe
. After installation, the folder in Document
should have content as a example shown in ~\Instrument_Drivers\PicoVNA_InitialSetup\picovna3_exe_install\PicoVNA3_whatItShouldLookLikeAfterInstall
. You could run the program to check if the software is correctly installed
For PicoVNA 3 usage, run
~\Instrument_Drivers\PicoVNA_InitialSetup\PICOVNA_pythonWarpper\9B7C3137-F2BB-4D8E-9FDB-450B6D527E5Ex0x1x0.py
under Python 32bit environment with pywin32
pre-installed(or use the embeded python 32 bit package at ~\Instrument_Drivers\PicoVNA108\pywin32-env
). No error should show up at this step if python installed correctly.
Bring the registry up by press win + R
on keyboard and type in regedit
in the pop-up window at bottom left.
Look for items with format Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\PicoControl3[].PicoVNA_3[]
like the following:
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\PicoControl3.PicoVNA_3
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\PicoControl3.PicoVNA_3_1
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\PicoControl3.PicoVNA_3_2
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\PicoControl3_1.PicoVNA_3_1
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\PicoControl3_2.PicoVNA_3_2
Now go to the function you call for smith data get_picoVNA_smith
(details of the function in ~\Instrument_Drivers\PicoVNA108.py
), change the arg picoVNA="PicoControl3.PicoVNA_3"
.
Change "PicoControl3.PicoVNA_3"
by testing the conbination of in your registry and see which one gave you response PicoControl3[].PicoVNA_3[]
. Usually one of them would work out.
try this one by one if previous not working:
- re-run the program
- restart the equipment
- Run this command in
WindowPowerShell
as Administrator:
Remove-Item -path $env:LOCALAPPDATA\Temp\gen_py -recurse
Problems you may encounter and possible solution:
- Q: What to do if error messages show up with
pyvisa.errors.VisaIOError
or something similar?- A: Check you GPIB/Usb connection and visa addressesa. Make sure you can see the instrument in NI MAX softerware with the same Visa address as your input.
Xinyi Du (Shilling) (2021-2024)