Project Structure

This page describes how the code is laid out and also provides links to concepts as needed.

Overall Layout

  • Code is laid out in packages (the directories starting with a + denote a package in MATLAB).

  • The bulk of the code is in classes: it is object-oriented.

  • start_zapit is used to neatly start up the GUI in a user-friendly way.

  • The main gui is structured in a similar way to a model/view/controller layout:

    • The "model", zapit.pointer, handles the underlying logic and is independent of the GUI as possible. This class is sometimes referred to at the API in the documentation, is it is the interface used to integrate the photostimulation into custom behavior code.

    • The "view", zapit.gui.main.view, builds the UI elements of the GUI itself and contains no logic. It was built using AppDesigner and must never be edited by hand.

    • The "controller", zapit.gui.main.controller, is a class that inherits zapit.gui.main.view and so when it is instantiated (i.e. created at the command line or in start_zapit) the GUI appears. The controller class is what provides the logic to make the GUI run: it defines callback functions, listeners, etc. The controller is a composite class, since it has a model property that contains an instance of zapit.pointer this enables the controller to interact with the model. For example, to initiate the galvo calibration routine or to present stimuli.

  • The class zapit.pointer implements the bulk of the logic and does the heavy lifting.

Concepts

  • In most classes contain some observable properties, meaning that changes to the values of those properties will drive a callback function to run via a listener. For example, the experimentPath property in zapit.pointer is observable. The buildListeners method in zapit.gui.main.controller creates a listener that watches for changes the experiment path property. These can be made via the GUI or at the command line (hZP.experimentPath='\some\path'). When changes are made, the updateExperimentPathTextArea method of zapit.gui.main.controller is run to update the text of the path in a text area box found in the GUI Calibrate Scanners tab.

Last updated