Compare commits
No commits in common. "main" and "dev" have entirely different histories.
2
MANIFEST.in
Normal file
2
MANIFEST.in
Normal file
@ -0,0 +1,2 @@
|
||||
include regina/package-data/*
|
||||
include regina/sql/*.sql
|
@ -66,7 +66,7 @@ from m_teng.utility.data import load_dataframe
|
||||
from m_teng.utility import file_io
|
||||
from m_teng.update_funcs import _Monitor, _ModelPredict, _update_print
|
||||
|
||||
config_path = path.expanduser("~/.config/m-teng.json")
|
||||
config_path = path.expanduser("~/.config/k-teng.json")
|
||||
|
||||
_runtime_vars = {
|
||||
"last-measurement": ""
|
||||
@ -75,7 +75,7 @@ _runtime_vars = {
|
||||
settings = {
|
||||
"datadir": path.expanduser("~/data"),
|
||||
"name": "measurement",
|
||||
"interval": 0.02,
|
||||
"interval": 0.05,
|
||||
"beep": True,
|
||||
}
|
||||
|
||||
|
@ -1,13 +1,12 @@
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
from os import path
|
||||
import matplotlib.pyplot as plt
|
||||
import matplotlib.pyplot
|
||||
|
||||
# deprecated
|
||||
# def buffer2dataframe(buffer):
|
||||
# df = pd.DataFrame(buffer)
|
||||
# df.colums = ["Time [s]", "Voltage [V]"]
|
||||
# return df
|
||||
def buffer2dataframe(buffer):
|
||||
df = pd.DataFrame(buffer)
|
||||
df.colums = ["Time [s]", "Voltage [V]"]
|
||||
return df
|
||||
|
||||
def buffers2dataframe(ibuffer, vbuffer):
|
||||
"""
|
||||
@ -33,37 +32,22 @@ def load_dataframe(p:str):
|
||||
df = pd.read_pickle(p)
|
||||
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
|
||||
"""
|
||||
|
||||
def plot(data):
|
||||
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
|
||||
|
||||
data = load_dataframe(data)
|
||||
if type(data) == pd.Dataframe:
|
||||
data = data.to_numpy()
|
||||
fig1, (vax, iax) = plt.subplots(2, 1, figsize=(8, 5))
|
||||
# todo
|
||||
|
||||
|
||||
vline, = vax.plot(index, vdata, color="m")
|
||||
vax.set_ylabel("Voltage [V]")
|
||||
vax.grid(True)
|
||||
|
||||
vax.plot()
|
||||
|
||||
iline, = iax.plot(index, idata, color="m")
|
||||
iax.set_ylabel("Current [A]")
|
||||
iax.grid(True)
|
||||
|
@ -20,7 +20,6 @@ classifiers = [
|
||||
dependencies = [
|
||||
"matplotlib>=3.6",
|
||||
"numpy",
|
||||
"pandas",
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
|
12
readme.md
12
readme.md
@ -1,8 +1,6 @@
|
||||
# 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
|
||||
|
||||
This project was written for my bachelor's thesis.
|
||||
|
||||
## Features
|
||||
|
||||
### Interactive (shell) mode
|
||||
@ -22,20 +20,20 @@ This project was written for my bachelor's thesis.
|
||||
|
||||
## Available backends
|
||||
### 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 2600B Source-Measure-Unit via *pyvisa*. This backend allows measuring both voltage and current simultaneously. *Tested with 2611B and 2614B*
|
||||
|
||||
### arduino
|
||||
Use a Bluetooth capable Arduino with [https://git.quintern.xyz/MatthiasQuintern/teng-arduino](this software on the arduino).
|
||||
This backend only allows measuring voltage using an Arduinos analog input pin (0 - 3.3 V, 12 bit resolution).
|
||||
Use a Bluetooth capable Arduino with [https://git.quintern.xyz/MatthiasQuintern/teng-arduino](this software on the arduino).
|
||||
This backend only allows measuring voltage using an Arduinos analog input pin (0 - 3.3 V, 12 bit resolution).
|
||||
|
||||
### testing
|
||||
Use the shell without measuring TENG output. When starting a measurement, sample data will be generated.
|
||||
Use the shell without measuring TENG output. When starting a measurement, sample data will be generated.
|
||||
|
||||
|
||||
## Shell mode
|
||||
It is recommended to run the shell with ipython:
|
||||
```shell
|
||||
ipython -i m_teng_interactive.py -- -*X*
|
||||
ipython -i k_teng_interactive.py -- -*X*
|
||||
```
|
||||
Substitute *X* for `-k` for keithley backend, `-a` for arduino backend or `-t` for testing backend.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user