cibrrig.gui =========== .. py:module:: cibrrig.gui Attributes ---------- .. autoapisummary:: cibrrig.gui.brain_xyz_path cibrrig.gui.ba cibrrig.gui.DEFAULT_SUBJECTS_PATH cibrrig.gui.DEFAULT_ARCHIVE_PATH cibrrig.gui.DEFAULT_WORKING_PATH cibrrig.gui.OCCIPITAL_APEX cibrrig.gui.OCCIPITAL_NADIR cibrrig.gui.LAMBDA_IBL cibrrig.gui.PITCH_CORRECTION cibrrig.gui.COLORS cibrrig.gui.INSERTION_TYPES cibrrig.gui.DEFAULT_WIRING cibrrig.gui.POSSIBLE_WIRINGS Classes ------- .. autoapisummary:: cibrrig.gui.DirectorySelector cibrrig.gui.OptoFileFinder cibrrig.gui.WiringEditor cibrrig.gui.InsertionTableAppBase cibrrig.gui.NpxInsertionTableApp cibrrig.gui.OptoInsertionTableApp cibrrig.gui.NotesDialog Functions --------- .. autoapisummary:: cibrrig.gui.get_tip cibrrig.gui.insertion2IBL cibrrig.gui.convert2ccf cibrrig.gui.plot_probe_insertion cibrrig.gui.plot_probe_insertion_urchin cibrrig.gui.plot_probe_insertion_ibl cibrrig.gui.plot_insertion_layout Module Contents --------------- .. py:data:: brain_xyz_path .. py:data:: ba .. py:data:: DEFAULT_SUBJECTS_PATH .. py:data:: DEFAULT_ARCHIVE_PATH .. py:data:: DEFAULT_WORKING_PATH .. py:data:: OCCIPITAL_APEX .. py:data:: OCCIPITAL_NADIR .. py:data:: LAMBDA_IBL .. py:data:: PITCH_CORRECTION :value: 0 .. py:data:: COLORS :value: ['#ff0000', '#00ff00', '#0000ff', '#ffff00', '#ff00ff', '#00ffff', '#ff8000', '#ff0080',... .. py:data:: INSERTION_TYPES :value: ['npx1.0', 'npx2.0', 'opto_200um', 'opto_400um', 'opto_600um'] .. py:data:: DEFAULT_WIRING .. py:data:: POSSIBLE_WIRINGS .. py:function:: get_tip(x, y, z, d, phi, theta) Ripped from iblatlas because we don't want to use the the atlas nor assume that the probe insertion point should be at the brain .. py:function:: insertion2IBL(df) Convert insertion coordinates to IBL coordinates dataframe must have the following columns: - Insertion ML (microns) - Insertion AP (microns) - Insertion DV (microns) - Reference ("occipital apex", "occipital nadir", "lambda", "bregma") :param df: DataFrame with insertion coordinates :type df: pd.DataFrame :returns: DataFrame with IBL coordinates :rtype: pd.DataFrame .. py:function:: convert2ccf(df) Convert IBL coordinates to CCF coordinates In IBL frame, bregma is at (0,0,0) and right is positive x, rostral is positive y, dorsal is positive z x,y,z -> ML, AP, DV In CCF frame, bregma is at (5400, 5739, 332) (AP,ML,DV) and right is positive x, caudal is positive y, ventral is positive z dataframe must have the following columns: - x - y - z - phi (azimuth/yaw) - theta (pitch/elevation) - Depth (microns) :param df: DataFrame with IBL coordinates :type df: pd.DataFrame :returns: DataFrame with CCF coordinates :rtype: pd.DataFrame .. py:function:: plot_probe_insertion(df, save_fn) .. py:function:: plot_probe_insertion_urchin(df, save_fn) :async: .. py:function:: plot_probe_insertion_ibl(df, save_fn) .. py:function:: plot_insertion_layout(df, save_fn) .. py:class:: DirectorySelector Bases: :py:obj:`PyQt5.QtWidgets.QWidget` GUI to select paths for backup. Expands QWidget. This class provides a graphical user interface (GUI) for selecting local and remote paths for backup, as well as options for removing optogenetic artifacts and running ephys quality control. .. attribute:: local_run_path Path to the local run directory. :type: Path .. attribute:: remote_archive_path Path to the remote archive directory. :type: Path .. attribute:: remote_working_path Path to the remote working directory. :type: Path .. attribute:: remove_opto_artifact Option to remove optogenetic artifacts. :type: bool .. attribute:: run_ephys_qc Option to run ephys quality :type: bool :param QWidget: Base class QWidget. :type QWidget: QWidget .. py:attribute:: local_run_path .. py:attribute:: remote_archive_path .. py:attribute:: remote_working_path .. py:attribute:: remove_opto_artifact :value: False .. py:attribute:: run_ephys_qc :value: True .. py:method:: init_ui() Initialize the UI layout. .. py:method:: select_local_run_path() Select the local run path with UI .. py:method:: select_remote_archive_path() Select the remote archive path with UI .. py:method:: select_remote_working_path() Select the remote working path with UI .. py:method:: toggle_remove_opto_artifact(state) Toggle the remove_opto_artifact checkbox .. py:method:: get_gates() .. py:method:: infer_num_probes() .. py:method:: get_session_info() .. py:method:: submit() .. py:method:: get_paths() Return the selected paths and options .. py:class:: OptoFileFinder(title='') Bases: :py:obj:`PyQt5.QtWidgets.QDialog` Dialog box to select the opto_calibration.json file if it is not found .. attribute:: opto_file Path to the opto_calibration.json file :type: Path .. py:attribute:: opto_file_selected .. py:attribute:: select_button .. py:attribute:: opto_file :value: None .. py:method:: select_file() Select the opto_calibration.json file with UI .. py:method:: skip_file() Skip the opto_calibration.json file .. py:method:: get_opto_file() .. py:class:: WiringEditor(title='') Bases: :py:obj:`PyQt5.QtWidgets.QDialog` Dialog box to select the wiring file .. attribute:: output_wiring Dictionary of the selected wiring :type: dict .. attribute:: digital_entries Dictionary of the digital mapping (channels: signals) :type: dict .. attribute:: analog_entries Dictionary of the analog mapping (channels: signals) :type: dict .. py:attribute:: title :value: '' .. py:method:: initUI() Initialize the UI layout .. py:method:: on_digital_value_changed(combo_box, key) Update the digital value .. py:method:: on_analog_value_changed(combo_box, key) Update the analog value .. py:method:: save_values() Save the output wiring attributes .. py:method:: get_output_wiring() .. py:class:: InsertionTableAppBase(n_rows=1, n_gates=20, name='', save_fn=None) Bases: :py:obj:`PyQt5.QtWidgets.QDialog` .. py:attribute:: n_gates :value: 20 .. py:attribute:: save_fn :value: None .. py:attribute:: name :value: '' .. py:attribute:: df :value: None .. py:attribute:: table .. py:method:: get_headers() .. py:method:: add_row(row) .. py:method:: get_insertion_types() .. py:method:: update_angles(row) .. py:method:: add_new_row() .. py:method:: delete_last_row() .. py:method:: copy_previous_row(current_row_count) .. py:method:: add_new_column() .. py:method:: export_to_dataframe() .. py:method:: convert_and_export() .. py:method:: create_dataframe() .. py:method:: get_insertions() .. py:method:: to_csv() .. py:method:: load_csv() Load a csv and populate the table if it exists .. py:method:: populate_table() Populate the table with data from a dataframe .. py:class:: NpxInsertionTableApp(n_rows=1, n_gates=10, name='', save_fn=None) Bases: :py:obj:`InsertionTableAppBase` .. py:method:: get_insertion_types() .. py:method:: add_row(row) .. py:method:: convert_and_export() .. py:class:: OptoInsertionTableApp(n_rows=1, n_gates=10, name='', save_fn=None) Bases: :py:obj:`InsertionTableAppBase` .. py:method:: get_headers() .. py:method:: get_insertion_types() .. py:method:: add_row(row) .. py:method:: convert_and_export() .. py:class:: NotesDialog(n_gates, notes_fn) Bases: :py:obj:`PyQt5.QtWidgets.QDialog` .. py:attribute:: notes_fn .. py:attribute:: overall_notes_text .. py:attribute:: text_fields :value: [] .. py:method:: submit() .. py:method:: save_notes() .. py:method:: load_notes()