added help for different backends

This commit is contained in:
Matthias@Dell 2023-06-24 12:28:12 +02:00
parent 0494881232
commit 0eed4d402b

View File

@ -17,6 +17,7 @@ from time import sleep
from os import path, makedirs from os import path, makedirs
import pickle as pkl import pickle as pkl
import json import json
import atexit
import argparse import argparse
@ -99,7 +100,7 @@ def monitor_predict(model_dir: str, count=5000, interval=settings["interval"], m
print(f"Starting measurement with:\n\tinterval = {interval}s\nSave the data using 'save_csv()' afterwards.") print(f"Starting measurement with:\n\tinterval = {interval}s\nSave the data using 'save_csv()' afterwards.")
try: try:
_measure.measure_count(dev, V=True, I=True, count=count, interval=interval, beep_done=False, verbose=False, update_func=update, update_interval=0.1) _measure.measure_count(dev, count=count, interval=interval, beep_done=False, verbose=False, update_func=update, update_interval=0.1)
except KeyboardInterrupt: except KeyboardInterrupt:
if args["keithley"]: if args["keithley"]:
dev.write(f"smua.source.output = smua.OUTPUT_OFF") dev.write(f"smua.source.output = smua.OUTPUT_OFF")
@ -125,7 +126,7 @@ def monitor_count(count=5000, interval=settings["interval"], max_points_shown=16
print(f"Starting measurement with:\n\tinterval = {interval}s\nSave the data using 'save_csv()' afterwards.") print(f"Starting measurement with:\n\tinterval = {interval}s\nSave the data using 'save_csv()' afterwards.")
try: try:
_measure.measure_count(dev, V=True, I=True, count=count, interval=interval, beep_done=False, verbose=False, update_func=update_func, update_interval=0.05) _measure.measure_count(dev, count=count, interval=interval, beep_done=False, verbose=False, update_func=update_func, update_interval=0.05)
except KeyboardInterrupt: except KeyboardInterrupt:
if args["keithley"]: if args["keithley"]:
dev.write(f"smua.source.output = smua.OUTPUT_OFF") dev.write(f"smua.source.output = smua.OUTPUT_OFF")
@ -301,16 +302,16 @@ def help(topic=None):
if topic == None: if topic == None:
print(""" print("""
Functions: Functions:
measure - take measurements measure [kat] - take measurements
monitor - take measurements with live monitoring in a matplotlib window monitor [kat] - take measurements with live monitoring in a matplotlib window
measure_count - take a fixed number of measurements measure_count [kat] - take a fixed number of measurements
monitor_count - take a fixed number of measurements with live monitoring in a matplotlib window monitor_count [kat] - take a fixed number of measurements with live monitoring in a matplotlib window
repeat - measure and save to csv multiple times repeat [kat] - measure and save to csv multiple times
get_dataframe - return smua.nvbuffer 1 and 2 as pandas dataframe get_dataframe [kat] - return device internal buffer as pandas dataframe
save_csv - save the last measurement as csv file save_csv [kat] - save the last measurement as csv file
save_pickle - save the last measurement as pickled pandas dataframe save_pickle [kat] - save the last measurement as pickled pandas dataframe
load_dataframe - load a pandas dataframe from csv or pickle load_dataframe [kat] - load a pandas dataframe from csv or pickle
run_script - run a lua script on the Keithely device run_script [k ] - run a lua script on the Keithely device
Run 'help(function)' to see more information on a function Run 'help(function)' to see more information on a function
Available topics: Available topics:
@ -345,9 +346,12 @@ Functions:
os.path """) os.path """)
elif topic == "device": elif topic == "device":
print("""Device: print("""Device:
The opened pyvisa resource (deveithley device) is the global variable 'k'. keithley backend:
You can interact using pyvisa functions, such as The opened pyvisa resource (deveithley device) is the global variable 'dev'.
k.write("command"), k.query("command") etc. to interact with the device.""") You can interact using pyvisa functions, such as
k.write("command"), k.query("command") etc. to interact with the device.
arduino backend:
The Arduino will be avaiable as BleakClient using the global variable 'dev'. """)
else: else:
print(topic.__doc__) print(topic.__doc__)
@ -389,6 +393,7 @@ Enter 'help()' for a list of commands""")
except Exception as e: except Exception as e:
print(e) print(e)
exit(1) exit(1)
atexit.register(_backend.exit, dev)
if __name__ == "__main__": if __name__ == "__main__":