Recorder module

Main module

Software made for recording velocity form a Femto-Gramophone in a triggered manner. Can be used in conjunction with two-photon microscoppes by Femtonics Inc.

class Recorder.Recorder.Reader(gram, frequency)[source]

A worker that can continnously send commands to the Gramophone with a given frequency.

Parameters:
  • name (str) – The name of this reader. Can be used for identification to stop a specific reader.
  • read_func (function) – The read function that should be called.
  • frequency (float) – The frequency at which the function should be called in Hz.
read()[source]

Start calling the read function repeatedly. Slot for a QThread.

class Recorder.Recorder.VelLogModel(log, parent=None)[source]

QT modell for velocity logs. Used to make an interface between the GUI’s table view and the Velocity log object

add_record(record)[source]

Adds the given Record object the the current velocity log.

columnCount(parent)[source]

Return the number of columns to be displayed. One column for each header.

data(index, role)[source]

Called to receive information about a cell of the table.

flags(index)[source]

Returns flag to decide which cells are editable.

headerData(section, orientation, role)[source]

Returns the haeder data the GUI is asking for.

plot_record(selection)[source]

Plots the selected record(s) using Matplotlib.

removeRows(row, count, parent=<PyQt5.QtCore.QModelIndex object>)[source]

Removes ‘count’ number of rows starting at ‘row’

rowCount(parent)[source]

Return the number of rows to be displayed. one row for each recording.

setData(index, value, role=2)[source]

Called to set the data in a cell of the table.

class Recorder.Recorder.aboutWindow(*args, **kwargs)[source]

The window shown if the user clicks the About option in the Help menu. Displays basic info about the software.

class Recorder.Recorder.deviceInfoWindow(gram, *args, **kwargs)[source]
class Recorder.Recorder.licenseWindow(*args, **kwargs)[source]

The window shown if the user clicks the License option in the Help menu. Displays the open source license the software is distributed under.

class Recorder.Recorder.pyGramWindow(devmode, log_file, *args, **kwargs)[source]

The main window of the Gramophone reader.

closeEvent(event)[source]

The built in close event of QMainWindow. User is trying to close the program. Ignore the passed event if you want to stop the user from doing so.

connect()[source]

Connects to the currently selected Gramophone.

connect_btn_cb()[source]

Callback for the connect button.

delete_btn_cb()[source]

Callback for the Delete button.

delete_warning(count)[source]

Displays a message box to ask for confirmation. Call it if the user is trying to delete velocity records.

disconnect()[source]

Disconnects the currently connected Gramophone.

gramophone_error(error_message)[source]

Slot for the errorOccurred signal of the Gramophone. Displays a message box with the warning, disconnects if necessary.

log_changed()[source]

Calll this function when the velocity log is modified and it should be saved.

make_dummy()[source]

Function only available for developers. Creates a dummy record in the current velocity log with randomized data.

new_file()[source]

Creates a new blank velocity log file and sets it as the current working file.

new_window()[source]

Opens a new instance of the Gramophone recorder. New windows can be used for simultanious recording of an other Gramophone device.

open()[source]

Opens a velocity log from file and sets it as the current working file.

plot_btn_cb()[source]

Callback for the Plot button.

quit()[source]

Close all windows and disconnrect form the Gramohone. Call this right before exiting.

record_warning()[source]

Displays a warning if the recording is in progress. Call it if the user tries to exit.

refresh_gram_list()[source]

Refreshes the list of available Gramophones.

reset_gram_timer()[source]

Function only available for developers. Sends a Reset internal clock command to the Gramophone.

reset_graph()[source]

Resets the live velocity plot to its starting state ie. erases the plot if there is already something on it.

save()[source]

Saves the currently used log file. Returns True if the file is saved or False if saving was cancelled

save_as()[source]

Same as save, but shows a file selection dialog to save to an other file.

save_warning()[source]

Displays a warning if there are unsaved changes to the log file. Call it if the user tries to exit.

select_file(mode='save', filename=None)[source]

Displays a file selection dialog for velocity log files. Mode can be ‘save’ or ‘open’.

selected_rows

A property that holds a list of the selected rows of the current velocity log.

set_autosave(val)[source]

Turns automatic saving on (True) or off (False)

Parameters:val (bool) – The sate to set
show_about()[source]

Displays the About window.

show_license()[source]

Displays the License window.

show_manual()[source]

Opens the Gramophone User Guide in the default pdf reader.

show_settings()[source]

Opens a settings window.

update_conn_state()[source]

Updates the GUI depending on wheter the software is currently connected to a Gramophone.

update_graph(velocity)[source]

Slot for the vel_signal of the Gramophone. Shifts the graph to the right and appends with the value received.

update_rec_state(in_state_1, in_state_2)[source]

Slot for the rec_signal of the Grmaophone. Updates the state of recording and the GUI.

update_table_size()[source]

Update all except last the row’s width to fit content in the list of velocity recordings.

update_timer(millis)[source]

Slot for the time_signal of the Gramophone. Updates the timer on the GUI.

update_title()[source]

Updates the tile of the window with the name of the current file and a * character if there are unsaved changes made to said file. Called after the current file is changed or saved.

class Recorder.Recorder.settingsWindow(main_win, *args, **kwargs)[source]

Logging module

Module for logging Velocity data form the Gramophone into HDF5 files.

class logger.DummyRecord[source]

A record with random data insted of recorded velocity. Can be used for testing purposes.

class logger.FileRecord(file_group)[source]

A velocity record that is saved in a HDF5 file.

comment

Returns the record’s comment form file

device_serial

Returns the record’s device id form file

finish_time

Returns the finish time form file

mean_vel

Returns the record’s mean velocity form file

rec_id

Returns the record’s ID form file

sampling_freq

Returns the record’s mean velocity form file

save(log_file)[source]

Saves the modified fields and returns itself.

software_version

Returns the record’s device id form file

start_time

Returns the start time form file

times

Returns the time data form file

velocities

Returns the velocity data form file

class logger.MemoryRecord(rec_id, sampling_freq, device_serial)[source]

A velocity record that is in memory ie. not saved yet.

append(gtime, vel, rec)[source]

Appends this record with the given time and velocity if the recording state is 1.

finish()[source]

Called then the recording to this record is finished. Saves the current time as the finish time.

start()[source]

Called when recording to this record is started. Saves the current time as the start time.

class logger.Record[source]

Abstract class for velocity records.

date_hr

A property that holds the starting date in a human readable format defined by the data_format class variable.

finish_time_hr

A property that holds the finishing time in a human readable format defined by the time_format class variable.

length

A property that holds the length of this recording in seconds.

length_hr

A property that holds the length of the recording in a human readable format defined by the length_format class variable.

mean_vel

A property that holds the mean of the recorded velocities.

save(log_file)[source]

Saves this record into a file and returns a FileRecord that can replace it.

Parameters:log_file (h5py.File) – An opened HDF5 file
start_time_hr

A property that holds the starting time in a human readable format defined by the time_format class variable.

unique_id

A property that stores a unique id based on the start time of this record. Used for naming folders in the HDF5 file.

class logger.VelocityLog[source]

A container object for velocity recordins. Handles saving records to HDF5 files.

save()[source]

Saves all records from this log to file.