147 lines
5.9 KiB
Matlab

classdef pricklypear < handle
%PRICKYLPEAR Interface to the MSO neuron model from matlab
% PP = pricklypear() creates a new MSO neuron model interface.
% PP = pricklypear(expName) specifies the experiment name.
% PP = pricklypear(expName, irec) specifies an irec.
%
% See also pricklypear/run
properties
seed = 1 % RNG seed
iter = 99 % Used by model (do not touch!)
tstop = 2000 % Length of run
dt = 0.025 % Temporal resolution
v_init = -65 % Initial membrane potential
celsius = 38 % Temperature (celsius)
axon_soma_distance = 45 % Axon soma distance (on ipsi dendrite)
dend_n = 2 % Number of dendrites
dend_n_syn = 10 % Number of synapses per dendrite
dend_n_seg = 20 % Number of segments per dendrite
dend_length = 200 % Length of dendrites (um)
dend_syn_spread = 0.5 % Spread of synapses (index)
dend_syn_offset = 0.45 % Offset of synapses (index)
dend_0_exc_G = 11 % Excitatory conductance contra dendrite
dend_1_exc_G = 11 % Excitatory conductance ipsi dendrite
dend_0_inh_G = 0 % Inhibitory conductance contra dendrite
dend_1_inh_G = 0 % Inhibitory conductance ipsi dendrite
dend_0_exc_gain = 0.0008 % Excitatory gain contra dendrite
dend_1_exc_gain = 0.0008 % Excitatory gain ipsi dendrite
dend_0_inh_gain = 0.001 % Inhibitory gain contra dendrite
dend_1_inh_gain = 0.001 % Inhibitory gain ipsi dendrite
spk_thres_exc_contra = 0 % Excitatory spike threshold contra
spk_thres_exc_ipsi = 0 % Excitatory spike threshold ipsi
spk_thres_inh_contra = 1 % Inhibitory spike threshold contra
spk_thres_inh_ipsi = 1 % Inhibitory spike threshold ipsi
eventtimes_contra = 200+(0:75:1500) % Input spiketimes contra (ms)
eventtimes_ipsi = 200+(0:100:1500) % Input spiketimes ipsi (ms)
eventtimes_inh_contra = [] % Inh input spiketimes contra (ms)
eventtimes_inh_ipsi = [] % Inh input spiketimes ipsi (ms)
model_name = 'default' % Model name
user_data = [] % Arbitrary user data
% Private
sim_channels = {'c' 'd0p' 'd0m' 'd0d' 'd1p' 'd1m' 'd1d' 'ap' 'ad'}
sim_metrics = {'vm'}
sim_experiment = ''
sim_irec = []
template_exclude = {'eventtimes_contra' 'eventtimes_ipsi'...
'eventtimes_inh_contra' 'eventtimes_inh_ipsi'...
'template_exclude' 'model_name', 'user_data'...
'sim_irec' 'sim_experiment' 'sim_channels' 'sim_metrics'}
end
methods
% Class constructor
function obj = pricklypear(varargin)
% Handle input
p = inputParser();
p.addOptional('expname', '', @ischar);
p.addOptional('irec', []);
p.parse(varargin{:});
p = p.Results;
% Check expname
assert(~strcmp(p.expname, '_direct'), '_direct is a protected experiment name, pick any other.');
% Handle expname
if ~isempty(p.expname)
obj.sim_experiment = p.expname;
end
% Handle irec
if ~isempty(p.expname) && ~isempty(p.irec)
obj.sim_irec = p.irec;
% Check if this run exists
if exist(obj)
% Get properties from old runs
% Compatibility issues will likely arise here...
props = properties(obj);
if p.irec == 0
storedProps = load(fullfile(obj.datadir(), sprintf('run_unsaved__properties.ppbin')), '-mat');
else
storedProps = load(fullfile(obj.datadir(), sprintf('run_%05i__properties.ppbin', p.irec)), '-mat');
end
for ii = 1:numel(props)
prop = props{ii};
prop_ext = prop;
% Skip irec as it has already been dealt with
if isequal(prop_ext, 'sim_irec')
continue;
end
%%% Backwards compatibility
% Skip a property if not stored
if ~isfield(storedProps, prop)
continue;
end
% Renamed spiketimes to eventtimes
if ~isempty(strfind(prop_ext, 'spiketimes'))
prop_ext = strrep(prop_ext, 'spiketimes', 'eventtimes');
end
% Overwrite the field
obj.(prop) = storedProps.(prop_ext);
end
else
%error('Run %i does not exist', p.irec);
end
end
end
disp(obj)
plot(obj, varargin)
obj = save(obj)
obj = run(obj)
obj = irec(obj)
obj = experiment(obj)
output = struct(obj)
output = exist(obj, varargin)
output = delete(obj, varargin)
output = anadata(obj, varargin)
output = spiketimes(obj, varargin)
output = notes(obj, varargin)
output = strpad(obj, varargin)
output = basedir(obj)
output = datadir(obj)
output = directdir(obj)
output = x(obj)
output = subsref(obj, irec)
output = parent(obj)
output = child(obj, irec)
output = runSubthresholdModel(obj, varargin)
end
end