%% License Info
%A Model of Feedforward, Global, and Lateral Inhibition in the Locust Visual System.

%This model examines the architecture and function of inhibitory mechanisms in the 
%visual system of locusts, namely those involved in the processing of inputs to a
%key looming-sensitive neuron, the lobula giant movement detector (LGMD).

%Copyright (c) 2026, Erik Olson, Travis Wiens, and Jack Gray

%CITATION:
%When using the model code for scientific publications, cite the following work:
%Olson EGN, Wiens TK, Gray JR. A model of feedforward, global, and lateral inhibition 
%in the locust visual system predicts responses to looming stimuli. Biol Cybern. 2021 
%Jun;115(3):245-265. doi: 10.1007/s00422-021-00876-8. Epub 2021 May 16. PMID: 33997912.

%This program is free software: you can redistribute it and/or modify
%it under the terms of the GNU General Public License as published by
%the Free Software Foundation, either version 3 of the License, or
%(at your option) any later version.

%This program is distributed in the hope that it will be useful,
%but WITHOUT ANY WARRANTY; without even the implied warranty of
%MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%GNU General Public License for more details.

%You should have received a copy of the GNU General Public License
%along with this program.  If not, see <https://www.gnu.org/licenses/>.

%Contact: erik.olson@usask.ca

%% Code
% This code runs a simulated voltage clamp on the LGMD, subjected to 
% single-facet stimuli with luminance change durations of 0 ms, 83 ms,
% 183 ms and 350 ms. Results are averaged across 10 trials.  Generates and
% saves the necessary data to create Figure 4.

parFile = 'FFIModelParams_16_02_2021.mat'; % Access the parameters for the model
V_clamp = -0.065; % Set the clamp voltage

% Run the trials - see function comments for description of outputs.
[I_out,t_out,max_f,f_base,delay] = VoltageClampTrialFunction(V_clamp,parFile,10);

% Save the results
save('VoltageClampFigureData.mat','I_out','t_out','max_f','f_base','delay');