Codebase¶
Main¶
cyckei.
file_structure
(path)¶Checks for existing folder structure and sets up if missing
cyckei.
handler
(type, value, tb)¶Handler which writes exceptions to log and terminal
cyckei.
main
(record_dir='Cyckei')¶Begins execution of Cyckei.
Parameters: record_dir – Optional path to recording directory. Returns: Result of app.exec_(), Qt’s main event loop.
Functions¶
functions.
not_none
(value)¶Sets a None value to “None” string
Creates a button with given information
functions.gui.
combo_box
(items, status, key, connect)¶Creates a combo box with given information
functions.gui.
line_edit
(label, status, key, connect)¶Creates text edit field with given information
functions.gui.
message
(text=None, info=None, icon=PySide2.QtWidgets.QMessageBox.Icon.Information, detail=None, confirm=False)¶Show a Qt Message with given information.
Client¶
Widget that controls a single channnel. Listed in the channel tab of the main window.
- class
client.channel_tab.
ChannelTab
(config, resource)¶
paintEvent
(self, event: PySide2.QtGui.QPaintEvent)¶
- class
client.channel_tab.
ChannelWidget
(channel, config, resource)¶Controls and stores information for a given channel
get_settings
()¶Creates all UI elements and adds them to elements list
paintEvent
(self, event: PySide2.QtGui.QPaintEvent)¶
set
(key, text)¶Sets object’s script to one selected in dropdown
Main window for the cyckei client.
- class
client.client.
MainWindow
(config)¶Main Window class which is and sets up itself
Setup menu bar
fill_batch
()¶Executes autofill for each channel
increment_batch
()¶Increments last letter of batch by char number
load_batch
()¶Loads id and log information from file
save_batch
()¶Saves id and log information to file
client.client.
about
(version)¶Display basic information about cyckei
client.client.
help
()¶Direct to help
Controls log tab, which displays logs as they are being recorded
- class
client.log_tab.
Folder
(path, name)¶Object of log, stores title and content of file for quick access
- class
client.log_tab.
Log
(path, name)¶Object of log, stores title and content of file for quick access
- class
client.log_tab.
LogViewer
(config, resource)¶Object of log tab
log_clicked
(item)¶Display text of clicked file in text box
open_explorer
(text=None)¶Open logging folder in explorer
Tab to view and edit scripts, also has access to checking procedure
- class
client.script_tab.
ScriptEditor
(config, resource)¶Main object of script tab
add
(file)¶Add new script to list to make available
check
(text)¶Run check protocol to verify validity
list_clicked
()¶Display contents of script when clicked
new
(text)¶Create new file and add to list as script
open
(text)¶Open new file and add as script
save
(text)¶Save script
setup_file_list
()¶Create list of script files
text_modified
()¶Update content of script and update status to show if edited
Methods and object to handle scripts
- class
client.scripts.
Script
(title, path)¶Object to store and manipulate scripts
save
()¶Saves script to file
update_status
()¶Updates title with ‘*’ if script has been edited
- class
client.socket.
Socket
(config)¶Handles connection, communication, and control of server over ZMQ
info_all_channels
()¶Send “info_all_channel” to server
info_channel
(channel)¶Send “info_channel” to server
ping
()¶Send “ping” to server
send
(to_send)¶Sends packet to server
send_file
(file)¶Sends packet loaded from JSON file
- class
client.workers.
AutoFill
(channel)¶Fill log text with value derived from cell identification
run
(self)¶
- class
client.workers.
Check
(config, protocol)¶
legal_test
(protocol)¶Checks if script only contains valid commands
prepare_json
(protocol)¶create json to send to server
run
()¶Initiates checking tests
run_test
(protocol)¶Checks if server can load script successfully
- class
client.workers.
Control
(config, channel, command, scripts=None, script=None, temp=False)¶Update json and send “start” function to server
run
(self)¶
- class
client.workers.
Read
(config, channel)¶Tell channel to Rest() long enough to get voltage reading on cell
run
(self)¶
- class
client.workers.
Signals
¶
- class
client.workers.
UpdateStatus
(channels, config)¶Update status shown below controls by contacting server
run
(self)¶
client.workers.
prepare_json
(channel, function, protocol, temp)¶Sets the channel’s json script to current values
Server¶
Classes to handle interfacing with Keithleys and their channels
- class
server.models.
Keithley2602
(gpib_addr, load_scripts=True)¶Represents a single keithley Interface
get_source
(kch, channel=None)¶Get source object of Keithley
- class
server.models.
Source
(source_meter, kch, channel=None)¶Represents an individual source
set_text
(text1: str = '', text2: str = '')¶Unfortunately the Keithley does not treat the two channels independently for display purposes. So setting the text for one channels removes all the info for the other channel rendering this functionality nearly useless.
Parameters:
- text1 (str) – top line of text, 10 max chars
- text2 (str) – bottom line of text, 16 max chars
server.models.
source_from_gpib
(gpib_address, channel)¶Opens GPIB resource and returns as Source object
- class
server.protocols.
AdvanceCycle
(wait_time: float = 10.0, cellrunner_parent: server.protocols.CellRunner = None)¶
run
(force_report=False)¶
Parameters: force_report (bool) – defaults to False. The run function evaluates the report_conditions to decide if a data point should be reported, setting force_report to True will report the latest data point regardless of conditions. Returns: data_to_report – (time, current, voltage, capacity) tuple to report (write to file) returns non if no data to report Return type: tuple of 4
- class
server.protocols.
CCCharge
(current, reports=(('voltage', 0.01), ('time', ':5:')), ends=(('voltage', '>', 4.2), ('time', '>', '24::')), wait_time=10.0)¶
- class
server.protocols.
CCDischarge
(current, reports=(('voltage', 0.01), ('time', ':5:')), ends=(('voltage', '<', 3), ('time', '>', '24::')), wait_time=10.0)¶
- class
server.protocols.
CVCharge
(voltage, reports=(('current', 0.01), ('time', ':5:')), ends=(('current', '<', 0.001), ('time', '>', '24::')), wait_time=10.0)¶
- class
server.protocols.
CVDischarge
(voltage, reports=(('current', 0.01), ('time', ':5:')), ends=(('current', '<', 0.001), ('time', '>', '24::')), wait_time=10.0)¶
- class
server.protocols.
Condition
¶A Condition is an object which given a ProtocolStep object to its “check” method will return a boolean indicating whether that condition has been met
A condition object may modify the .next_time attribute of the ProtocolStep object to suggest time the next time as an absolute timestamp that the condition should be checked
- class
server.protocols.
ConditionAbsolute
(value_str: str, operator_str: str, value: float, min_time: float = 1.0)¶
- class
server.protocols.
ConditionDelta
(value_str: str, delta: float)¶
- class
server.protocols.
ConditionTotalDelta
(value_str: str, delta: float)¶
- class
server.protocols.
ConditionTotalTime
(delta)¶
- class
server.protocols.
CurrentStep
(current, reports=(('voltage', 0.01), ('time', ':5:')), ends=(('voltage', '>', 4.2), ('time', '>', '24::')), wait_time=10.0)¶
- class
server.protocols.
Pause
¶
run
()¶
Parameters: force_report (bool) – defaults to False. The run function evaluates the report_conditions to decide if a data point should be reported, setting force_report to True will report the latest data point regardless of conditions. Returns: data_to_report – (time, current, voltage, capacity) tuple to report (write to file) returns non if no data to report Return type: tuple of 4
- class
server.protocols.
ProtocolStep
(wait_time: float = 10.0, cellrunner_parent: server.protocols.CellRunner = None)¶Base class for a protocol step, needs to be subclassed with implementation of a start function
A protocol step stores stores its own data and the reported points Keeps track of time, current, voltage, capacity
Because the protocol files are simply pure python the parent, which is a CellRunner instance needs to be present in the global variables as “parent”
check_end_conditions
()¶
Returns: bool Return type: whether one of the end conditions was satisfied
check_report_conditions
()¶
Returns: bool Return type: whether one of the report conditions was satisfied
run
(force_report=False)¶
Parameters: force_report (bool) – defaults to False. The run function evaluates the report_conditions to decide if a data point should be reported, setting force_report to True will report the latest data point regardless of conditions. Returns: data_to_report – (time, current, voltage, capacity) tuple to report (write to file) returns non if no data to report Return type: tuple of 4
- class
server.protocols.
Rest
(reports=(('time', ':5:'), ), ends=(('time', '>', '24::'), ), wait_time=10.0)¶
- class
server.protocols.
Sleep
(reports=(('time', ':5:'), ), ends=(('time', '>', '24::'), ), wait_time=10.0)¶
run
(force_report=False)¶The run method needs to be redefined because the logic of the Sleep protocol is unique in that a measurement is only desired if a report condition is met as opposed to the other steps which measure and then decide whether to report
Parameters: force_report (bool) – defaults to False. The run function evaluates the report_conditions to decide if a data point should be reported, setting force_report to True will report the latest data point regardless of conditions. Returns: data_to_report – (time, current, voltage, capacity) tuple to report (write to file) returns none if no data to report Return type: tuple of 4
- class
server.protocols.
VoltageStep
(voltage, reports=(('current', 0.01), ('time', ':5:')), ends=(('current', '<', 0.001), ('time', '>', '24::')), wait_time=10.0)¶
server.protocols.
process_ends
(ends)¶
Parameters: ends – desired ends conditions as a tuple of triples such as ((“voltage”,”>”, 4.2), (“time”,”>”,”24::”)) Returns: end_conditions – List of condition objects for ending a protocol step Return type: list
server.protocols.
process_reports
(reports)¶
Parameters: reports – desired reports as a tuple of pairs such as ((“voltage”,0.01), (“time”,300)) Returns: report_conditions – List of condition objects for reporting a data point Return type: list
server.protocols.
time_conversion
(t)¶
Parameters: t (str or float) – time in the “hh:mm:ss” format, where values can be ommitted e.g. “::5” would be five seconds or time in seconds Returns: Return type: time (float) in seconds Main script run by server application
server.server.
get_runner_by_channel
(channel, runners, status=None)¶Get runner currently on given channel
server.server.
info_all_channels
(runners, sources)¶Return info on all channels
server.server.
info_channel
(channel, runners, sources)¶Return info on specified channels
server.server.
main
(config, socket)¶Main start method and loop for server application
server.server.
pause
(channel, runners)¶Pause channel
server.server.
process_socket
(socket, runners, sources, server_time)¶
Parameters: socket (zmq.REP socket) – Receives messages in a non-blocking way If a message is received it processes it and sends a response Returns: Return type: None
server.server.
resume
(channel, runners)¶Resume channel from pause
server.server.
start
(channel, meta, protocol, runners, sources)¶Start channel with given protocol
server.server.
stop
(channel, runners)¶Stop channel
server.server.
test
(protocol)¶Test script load on server