Compare commits
No commits in common. "849730be09cda436b3fcdc240df8242459d50c9b" and "8b8880a6e97150b84a5f614c6f3043eee94ca942" have entirely different histories.
849730be09
...
8b8880a6e9
@ -1,8 +0,0 @@
|
|||||||
# Rule for Keithley 2611B
|
|
||||||
|
|
||||||
# take vendor and product id from lsusb
|
|
||||||
SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="05e6", ATTRS{idProduct}=="2614", GROUP="usbtmc", MODE="0660" RUN+="/bin/touch /tmp/05e6-2611-connected"
|
|
||||||
|
|
||||||
# Devices
|
|
||||||
KERNEL=="usbtmc/*", MODE="0660", GROUP="usbtmc"
|
|
||||||
KERNEL=="usbtmc[0-9]*", MODE="0660", GROUP="usbtmc"
|
|
@ -30,8 +30,6 @@ def init(beep_success=True):
|
|||||||
if beep_success: keithley.write("beeper.beep(0.5, 1000)")
|
if beep_success: keithley.write("beeper.beep(0.5, 1000)")
|
||||||
return keithley
|
return keithley
|
||||||
|
|
||||||
def beep(instr, length=0.5, pitch=1000):
|
|
||||||
instr.write(f"beeper.beep({length}, {pitch})")
|
|
||||||
|
|
||||||
def exit(instr):
|
def exit(instr):
|
||||||
instr.close()
|
instr.close()
|
||||||
|
@ -3,7 +3,7 @@ import numpy as np
|
|||||||
from matplotlib import pyplot as plt
|
from matplotlib import pyplot as plt
|
||||||
import pyvisa
|
import pyvisa
|
||||||
|
|
||||||
from m_teng.backends.keithley.keithley import reset
|
from m_teng.backends.keithley import reset
|
||||||
from m_teng.utility import testing as _testing
|
from m_teng.utility import testing as _testing
|
||||||
|
|
||||||
def measure_count(instr, count=100, interval=0.05, update_func=None, update_interval=0.5, beep_done=True, verbose=True):
|
def measure_count(instr, count=100, interval=0.05, update_func=None, update_interval=0.5, beep_done=True, verbose=True):
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
smua.reset()
|
smua.reset()
|
||||||
smua.measure.autorangev = smua.AUTORANGE_ON
|
smua.measure.autorangev = smua.AUTORANGE_ON
|
||||||
smua.measure.autorangei = smua.AUTORANGE_ON
|
smua.measure.autorangei = smua.AUTORANGE_ON
|
||||||
-- smua.measure.autozero = smua.AUTOZERO_AUTO
|
|
||||||
smua.measure.autozero = smua.AUTOZERO_AUTO
|
smua.measure.autozero = smua.AUTOZERO_AUTO
|
||||||
-- smua.measure.autozero = smua.AUTOZERO_ONCE
|
-- smua.measure.autozero = smua.AUTOZERO_ONCE
|
||||||
-- set output to 0A DC
|
-- set output to 0A DC
|
||||||
|
@ -66,9 +66,7 @@ from m_teng.utility.data import load_dataframe
|
|||||||
from m_teng.utility import file_io
|
from m_teng.utility import file_io
|
||||||
from m_teng.update_funcs import _Monitor, _ModelPredict, _update_print
|
from m_teng.update_funcs import _Monitor, _ModelPredict, _update_print
|
||||||
|
|
||||||
from m_teng.backends import keithley as _keithley
|
config_path = path.expanduser("~/.config/k-teng.json")
|
||||||
|
|
||||||
config_path = path.expanduser("~/.config/m-teng.json")
|
|
||||||
|
|
||||||
_runtime_vars = {
|
_runtime_vars = {
|
||||||
"last-measurement": ""
|
"last-measurement": ""
|
||||||
@ -77,7 +75,7 @@ _runtime_vars = {
|
|||||||
settings = {
|
settings = {
|
||||||
"datadir": path.expanduser("~/data"),
|
"datadir": path.expanduser("~/data"),
|
||||||
"name": "measurement",
|
"name": "measurement",
|
||||||
"interval": 0.02,
|
"interval": 0.05,
|
||||||
"beep": True,
|
"beep": True,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,7 +230,7 @@ def repeat(measure_func: callable, count: int, repeat_delay=0):
|
|||||||
sleep(repeat_delay)
|
sleep(repeat_delay)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
pass
|
pass
|
||||||
if settings["beep"]: _backend.beep(dev)
|
if settings["beep"]: _backend.beep()
|
||||||
|
|
||||||
|
|
||||||
def get_dataframe():
|
def get_dataframe():
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from os import path
|
from os import path
|
||||||
import matplotlib.pyplot as plt
|
|
||||||
|
|
||||||
# deprecated
|
def buffer2dataframe(buffer):
|
||||||
# def buffer2dataframe(buffer):
|
df = pd.DataFrame(buffer)
|
||||||
# df = pd.DataFrame(buffer)
|
df.colums = ["Time [s]", "Voltage [V]"]
|
||||||
# df.colums = ["Time [s]", "Voltage [V]"]
|
return df
|
||||||
# return df
|
|
||||||
|
|
||||||
def buffers2dataframe(ibuffer, vbuffer):
|
def buffers2dataframe(ibuffer, vbuffer):
|
||||||
"""
|
"""
|
||||||
@ -32,38 +30,3 @@ def load_dataframe(p:str):
|
|||||||
else:
|
else:
|
||||||
df = pd.read_pickle(p)
|
df = pd.read_pickle(p)
|
||||||
return df
|
return df
|
||||||
|
|
||||||
def plot(data: str or pd.DataFrame or np.ndarray, title="", U=True, I=False):
|
|
||||||
"""
|
|
||||||
Plot recorded data
|
|
||||||
@param data: filepath, dataframe or numpy array
|
|
||||||
"""
|
|
||||||
if type(data) == str:
|
|
||||||
_data = load_dataframe(data).to_numpy()
|
|
||||||
elif type(data) == pd.DataFrame:
|
|
||||||
_data = data.to_numpy()
|
|
||||||
else:
|
|
||||||
_data = data
|
|
||||||
print(_data[0])
|
|
||||||
plt.ion()
|
|
||||||
fig, ax = plt.subplots()
|
|
||||||
ax.set_xlabel("t [s]")
|
|
||||||
vax = ax
|
|
||||||
iax = ax
|
|
||||||
if U and I:
|
|
||||||
iax = ax.twinx()
|
|
||||||
if U:
|
|
||||||
vax = ax
|
|
||||||
vax.set_ylabel("U [V]")
|
|
||||||
vax.plot(_data[:,0], _data[:,2], color="blue", label="voltage")
|
|
||||||
if I:
|
|
||||||
iax.set_ylabel("I [A]")
|
|
||||||
iax.plot(_data[:,0], _data[:,1], color="orange", label="current")
|
|
||||||
if U and I:
|
|
||||||
plt.legend()
|
|
||||||
return fig
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
12
readme.md
12
readme.md
@ -1,5 +1,5 @@
|
|||||||
# m-TENG
|
# m-TENG
|
||||||
Helper scripts and shell for measuring **T**ribo**e**lectric **N**ano**g**enerator-based sensor output with a Keithley 2600B SMU or an Arduino
|
Helper scripts and shell for measuring **T**ribo**e**lectric **N**ano**g**enerator-based sensor output with a Keithley 2611B SMU or an Arduino
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
@ -17,10 +17,9 @@ Helper scripts and shell for measuring **T**ribo**e**lectric **N**ano**g**enerat
|
|||||||
- Run lua script on Keithley SMU
|
- Run lua script on Keithley SMU
|
||||||
- Auto-filenames
|
- Auto-filenames
|
||||||
|
|
||||||
|
|
||||||
## Available backends
|
## Available backends
|
||||||
### keithley
|
### keithley
|
||||||
Use a Keithley 2600B Source-Measure-Unit via *pyvisa*. This backend allows measuring both voltage and current simultaneously. *Tested with 2611B and 2614B*
|
Use a Keithley 2611B Source-Measure-Unit via *pyvisa*. This backend allows measuring both voltage and current simultaneously.
|
||||||
|
|
||||||
### arduino
|
### arduino
|
||||||
Use a Bluetooth capable Arduino with [https://git.quintern.xyz/MatthiasQuintern/teng-arduino](this software on the arduino).
|
Use a Bluetooth capable Arduino with [https://git.quintern.xyz/MatthiasQuintern/teng-arduino](this software on the arduino).
|
||||||
@ -38,10 +37,3 @@ ipython -i k_teng_interactive.py -- -*X*
|
|||||||
Substitute *X* for `-k` for keithley backend, `-a` for arduino backend or `-t` for testing backend.
|
Substitute *X* for `-k` for keithley backend, `-a` for arduino backend or `-t` for testing backend.
|
||||||
|
|
||||||
In the shell, run `help()` to get a list of available commands
|
In the shell, run `help()` to get a list of available commands
|
||||||
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
### Keithley
|
|
||||||
On linux:
|
|
||||||
Install the udev rule in `/etc/udev/rules.d/` and run `sudo udevadm control --reload` to force the usbtmc driver to be used with the Keithley SMU.
|
|
||||||
The `ATTRS{product_id} ` needs to match the id shown by `lsusb`.
|
|
||||||
|
Loading…
Reference in New Issue
Block a user