Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
6d1a140
Added to .gitignore folders Calibration Files, Data, and Protocols
tsgouvea Jun 29, 2016
fb4c4eb
Added file .gitmodules to .gitignore.
tsgouvea Jun 29, 2016
b7e7992
Added uicontrol styles 'togglebutton' and 'pushbutton' to GUI
tsgouvea Jun 30, 2016
bffd743
Work in progress
tsgouvea Jul 1, 2016
d138406
Tabs working. Now adding uitable.
tsgouvea Jul 5, 2016
53f8426
Accepts meta.style uitables. Stores handles in Matlab 2016.
tsgouvea Jul 5, 2016
a1a82ca
Added purpose of Kepecs Bpod fork
lclclclclclclc Jul 15, 2016
3b1bd29
Merge branch 'featTabs'
tsgouvea Jul 20, 2016
0186480
Bpod Settings, Calibration Files, and Protocols are saved in the user…
fitzsturgill Aug 4, 2016
c416059
checks for calibration and settings folders in BpodUserPath first and…
Aug 5, 2016
62246ee
In progress, still need to finish updating instances of BpodPath
fitzsturgill Aug 8, 2016
eda2128
Removes reference to undefined variable S. Moves redundant bits of co…
tsgouvea Aug 9, 2016
a988ae5
Fixes bug with unspecified tabs
tsgouvea Aug 9, 2016
ce7b9ac
Updated LaunchManager, RunProtocol, BpodLiquidCalibration, and Pipeli…
fitzsturgill Sep 6, 2016
4e11c56
Merge remote-tracking branch 'origin/master' into BpodUserPath
Sep 6, 2016
8da7443
Merge pull request #6 from KepecsLab/BpodUserPath
torbenott Sep 6, 2016
9b45e63
adds mat file containing string to BpodUserPath in Bpod home director…
Sep 6, 2016
0b27cf3
changed mat file to txt file
Sep 7, 2016
a847ac6
Added menu bar to Parameter GUI allowing to save current TaskParamete…
Sep 16, 2016
284ca61
prevents protocol from crashing when you hit "cancel" while saving.
Sep 16, 2016
55a9709
Solves sync-issue by adding a 'get' option to BpodParameterGUI. Shows…
Sep 16, 2016
5c29a52
more consistent appearance of menus
Sep 19, 2016
fb79a58
corrected save menu callback function.
Sep 21, 2016
7a93191
corrects error in 'get'.
Sep 22, 2016
4671f5c
Replaced with latest port breakout board design from Sanworks (LED ad…
Sep 23, 2016
5e1a304
When stopping a Bpod protocol the custom user script UserKillScript.m…
Sep 28, 2016
076d02a
Custom location for BpodUser (#8)
torbenott Oct 24, 2016
ffd003b
Very minor: 1) ignore BpodUserPath.txt 2) fix SaveBpodProtocolSetting…
fitzsturgill Nov 3, 2016
ecae5d8
Merge pull request #9 from KepecsLab/SaveMenu
torbenott Dec 16, 2016
81d5862
Merge pull request #10 from KepecsLab/UserKillScript
torbenott Dec 16, 2016
bc1ae7f
added edit text/string option to parameter GUI
fitzsturgill Mar 30, 2017
2a7b51f
testing changes to deal with TrialTypes intialized as vector of NaNs
fitzsturgill Apr 8, 2017
54beae0
As the olfactometer IP address is often a string, turning it into a s…
May 16, 2017
ef92eed
As the olfactometer IP address is often a string, turning it into a s…
May 18, 2017
1d7fa8e
As the olfactometer IP address is often a string, turning it into a s…
May 18, 2017
94e217f
Merge commit '2a7b51fc2251e9ebb66b080a82c7a738ffc56894' into Olfactom…
Jun 23, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Calibration Files/**
Data/**
Protocols/**
.gitmodules
*BpodUserPath.txt
Binary file not shown.
603 changes: 0 additions & 603 deletions CAD/PCB/MouseBoxPortBreakout/MouseBox_PortBreakout_r1.brd

This file was deleted.

2,443 changes: 0 additions & 2,443 deletions CAD/PCB/MouseBoxPortBreakout/MouseBox_PortBreakout_r1.sch

This file was deleted.

Binary file not shown.
77 changes: 53 additions & 24 deletions Functions/Internal Functions/BpodObject.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
ProtocolSettings
Data
BpodPath
BpodUserPath % FS MOD
SettingsPath
DataPath
ProtocolPath
Expand Down Expand Up @@ -117,31 +118,54 @@

obj.HostOS = system_dependent('getos');
obj.BpodPath = BpodPath;
dir_calfiles = dir( fullfile(obj.BpodPath,'Calibration Files') );
if length(dir_calfiles) == 0, %then Cal Folder didn't exist.
mkdir(fullfile(obj.BpodPath,'Calibration Files'));
obj.CalibrationTables.LiquidCal = [];
obj.CalibrationTables.SoundCal = [];
%% FS MOD
if exist(fullfile(obj.BpodPath,'BpodUserPath.txt'),'file') == 2
UserFile = fopen(fullfile(obj.BpodPath,'BpodUserPath.txt'),'r');
BpodUserPath = fscanf(UserFile,'%s');
fclose(UserFile);
else
% Liquid
try
LiquidCalibrationFilePath = fullfile(obj.BpodPath, 'Calibration Files', 'LiquidCalibration.mat');
load(LiquidCalibrationFilePath);
obj.CalibrationTables.LiquidCal = LiquidCal;
catch
obj.CalibrationTables.LiquidCal = [];
end
% Sound
try
SoundCalibrationFilePath = fullfile(obj.BpodPath, 'Calibration Files', 'SoundCalibration.mat');
load(SoundCalibrationFilePath);
obj.CalibrationTables.SoundCal = SoundCal;
catch
obj.CalibrationTables.SoundCal = [];
if ispc
import java.lang.*;
BpodUserPath = fullfile(char(System.getProperty('user.home')), 'BpodUser');
else
BpodUserPath = fullfile('~', 'BpodUser');
end
UserFile = fopen(fullfile(obj.BpodPath,'BpodUserPath.txt'),'w');
fprintf(UserFile,'%s',BpodUserPath);
fclose(UserFile);
end
obj.BpodUserPath = BpodUserPath;
if ~isdir(obj.BpodUserPath)
mkdir(obj.BpodUserPath);
warning(['Bpod user directory not found. Directory created at ' obj.BpodUserPath]);
end
%setting up costum folders
if ~isdir(fullfile(obj.BpodUserPath,'Calibration Files')) %then Cal Folder didn't exist.
copyfile(fullfile(obj.BpodPath, 'Calibration Files'),fullfile(obj.BpodUserPath,'Calibration Files')); % FS MOD
end
if ~isdir(fullfile(obj.BpodUserPath,'Settings Files'))
copyfile(fullfile(obj.BpodPath, 'Settings Files'), fullfile(obj.BpodUserPath, 'Settings Files'));
end

% Liquid
try
LiquidCalibrationFilePath = fullfile(obj.BpodUserPath, 'Calibration Files', 'LiquidCalibration.mat'); % FS MOD
load(LiquidCalibrationFilePath);
obj.CalibrationTables.LiquidCal = LiquidCal;
catch
obj.CalibrationTables.LiquidCal = [];
end
% Sound
try
SoundCalibrationFilePath = fullfile(obj.BpodUserPath, 'Calibration Files', 'SoundCalibration.mat'); % FS MOD
load(SoundCalibrationFilePath);
obj.CalibrationTables.SoundCal = SoundCal;
catch
obj.CalibrationTables.SoundCal = [];
end

% Load input channel settings
obj.InputConfigPath = fullfile(obj.BpodPath, 'Settings Files', 'BpodInputConfig.mat');
obj.InputConfigPath = fullfile(obj.BpodUserPath, 'Settings Files', 'BpodInputConfig.mat'); % FS MOD
load(obj.InputConfigPath);
obj.InputsEnabled = BpodInputConfig;

Expand All @@ -155,9 +179,9 @@
obj.UsesPsychToolbox = 0;
end
%Check for Data folder
dir_data = dir(fullfile(obj.BpodPath,'Data'));
dir_data = dir(fullfile(obj.BpodUserPath,'Data')); % FS MOD
if length(dir_data) == 0, %then Data didn't exist.
mkdir(fullfile(obj.BpodPath, 'Data'));
mkdir(fullfile(obj.BpodUserPath, 'Data'));
end
end
function obj = InitializeHardware(obj, portString)
Expand Down Expand Up @@ -425,7 +449,12 @@
set(obj.GUIHandles.MainFig,'handlevisibility','off');

% Load protocols into selector
ProtocolPath = fullfile(obj.BpodPath,'Protocols');
%% FS MOD
ProtocolPath = fullfile(obj.BpodUserPath,'Protocols');
if ~isdir(ProtocolPath)
mkdir(ProtocolPath)
end
%%
Candidates = dir(ProtocolPath);
ProtocolNames = cell(1);
nCandidates = length(Candidates)-2;
Expand Down
2 changes: 1 addition & 1 deletion Functions/Internal Functions/SaveBpodSystemSettings.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function SaveBpodSystemSettings
global BpodSystem
BpodSystemSettings = BpodSystem.SystemSettings;
save(fullfile(BpodSystem.BpodPath, 'Settings Files', 'BpodSystemSettings.mat'), 'BpodSystemSettings');
save(fullfile(BpodSystem.BpodUserPath, 'Settings Files', 'BpodSystemSettings.mat'), 'BpodSystemSettings'); % FS MOD
38 changes: 19 additions & 19 deletions Functions/Launch manager/LaunchManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ function LaunchManager_OpeningFcn(hObject, eventdata, handles, varargin)
% Check to see if a folder for this protocol's name exists, and if not, make one
% along with default files for the default test subject named "Test Session"

DataPath = fullfile(BpodSystem.BpodPath,'Data',DummySubjectString);
DataPath = fullfile(BpodSystem.BpodUserPath,'Data',DummySubjectString);
ProtocolName = BpodSystem.CurrentProtocolName;
ProtocolPath = fullfile(BpodSystem.BpodPath,'Protocols',ProtocolName);
ProtocolPath = fullfile(BpodSystem.BpodUserPath,'Protocols',ProtocolName);
SettingsPath = fullfile(DataPath,ProtocolName,'Session Settings');
DefaultSettingsPath = fullfile(ProtocolPath,'SessionSettings.mat');

Expand All @@ -113,7 +113,7 @@ function LaunchManager_OpeningFcn(hObject, eventdata, handles, varargin)
% Make a list of the names of all subjects who already have a folder for this
% protocol.

DataPath = fullfile(BpodSystem.BpodPath,'Data');
DataPath = fullfile(BpodSystem.BpodUserPath,'Data');
CandidateSubjects = dir(DataPath);
SubjectNames = cell(1);
nSubjects = 1;
Expand All @@ -133,7 +133,7 @@ function LaunchManager_OpeningFcn(hObject, eventdata, handles, varargin)
end
set(handles.listbox1,'String',SubjectNames);

SettingsPath = fullfile(BpodSystem.BpodPath,'Data',DummySubjectString, ProtocolName,'Session Settings');
SettingsPath = fullfile(BpodSystem.BpodUserPath,'Data',DummySubjectString, ProtocolName,'Session Settings');
Candidates = dir(SettingsPath);
nSettingsFiles = 0;
SettingsFileNames = cell(1);
Expand Down Expand Up @@ -211,7 +211,7 @@ function listbox1_Callback(hObject, eventdata, handles)
else
SelectedName = NameList;
end
SettingsPath = fullfile(BpodSystem.BpodPath,'Data',SelectedName,ProtocolName,'Session Settings');
SettingsPath = fullfile(BpodSystem.BpodUserPath,'Data',SelectedName,ProtocolName,'Session Settings');
Candidates = dir(SettingsPath);
nSettingsFiles = 0;
SettingsFileNames = cell(1);
Expand Down Expand Up @@ -268,7 +268,7 @@ function pushbutton1_Callback(hObject, eventdata, handles)
if ~isempty(SettingsFileName) && ~isempty(NameList)
ProtocolName = BpodSystem.CurrentProtocolName;
FormattedDate = [datestr(now, 3) datestr(now, 7) '_' datestr(now, 10)];
DataFolder = fullfile(BpodSystem.BpodPath,'Data',SubjectName,ProtocolName, 'Session Data');
DataFolder = fullfile(BpodSystem.BpodUserPath,'Data',SubjectName,ProtocolName, 'Session Data');
Candidates = dir(DataFolder);
nSessionsToday = 0;
for x = 1:length(Candidates)
Expand All @@ -278,11 +278,11 @@ function pushbutton1_Callback(hObject, eventdata, handles)
end
end
end
DataPath = fullfile(BpodSystem.BpodPath,'Data',SubjectName,ProtocolName,'Session Data',[SubjectName '_' ProtocolName '_' FormattedDate '_Session' num2str(nSessionsToday+1) '.mat']);
SettingsPath = fullfile(BpodSystem.BpodPath,'Data',SubjectName,ProtocolName, 'Session Settings',[SettingsFileName '.mat']);
DataPath = fullfile(BpodSystem.BpodUserPath,'Data',SubjectName,ProtocolName,'Session Data',[SubjectName '_' ProtocolName '_' FormattedDate '_Session' num2str(nSessionsToday+1) '.mat']);
SettingsPath = fullfile(BpodSystem.BpodUserPath,'Data',SubjectName,ProtocolName, 'Session Settings',[SettingsFileName '.mat']);
BpodSystem.DataPath = DataPath;
BpodSystem.SettingsPath = SettingsPath;
ProtocolPath = fullfile(BpodSystem.BpodPath,'Protocols',ProtocolName,[ProtocolName '.m']);
ProtocolPath = fullfile(BpodSystem.BpodUserPath,'Protocols',ProtocolName,[ProtocolName '.m']);
close(LaunchManager)
BpodSystem.Live = 1;
BpodSystem.GUIData.ProtocolName = ProtocolName;
Expand Down Expand Up @@ -331,9 +331,9 @@ function pushbutton2_Callback(hObject, eventdata, handles) % ------------------
NewName = Spaces2Underscores(NewName);
% Check to see if subject already exists
ProtocolName = BpodSystem.CurrentProtocolName;
Testpath = fullfile(BpodSystem.BpodPath,'Data',NewName);
Testpath = fullfile(BpodSystem.BpodUserPath,'Data',NewName);
Testpath2 = fullfile(Testpath,ProtocolName);
ProtocolPath = fullfile(BpodSystem.BpodPath,'Protocols',ProtocolName);
ProtocolPath = fullfile(BpodSystem.BpodUserPath,'Protocols',ProtocolName);
NewAnimal = 0;
if exist(Testpath) ~= 7
mkdir(Testpath);
Expand Down Expand Up @@ -397,7 +397,7 @@ function pushbutton3_Callback(hObject, eventdata, handles)
catch
end
if ((OkToDelete == 1) && (~isempty(SelectedName)))
DeletePath = fullfile(BpodSystem.BpodPath,'Data',SelectedName);
DeletePath = fullfile(BpodSystem.BpodUserPath,'Data',SelectedName);
rmdir(DeletePath,'s')
BpodErrorSound;
msgbox([' Entry for ' SelectedName ' deleted!'], 'Modal');
Expand Down Expand Up @@ -459,7 +459,7 @@ function pushbutton4_Callback(hObject, eventdata, handles)
SubjectName = SubjectNameList{SubjectNameValue};
% Check to see if subject already exists
ProtocolName = BpodSystem.CurrentProtocolName;
Testpath = fullfile(BpodSystem.BpodPath,'Data',SubjectName,ProtocolName,'Session Settings',[NewSettingsName '.mat' ]);
Testpath = fullfile(BpodSystem.BpodUserPath,'Data',SubjectName,ProtocolName,'Session Settings',[NewSettingsName '.mat' ]);
if exist(Testpath) == 0
SettingsPath = Testpath;
ProtocolSettings = struct;
Expand Down Expand Up @@ -502,13 +502,13 @@ function pushbutton5_Callback(hObject, eventdata, handles)
Selected = get(handles.listbox2, 'Value');
SettingsFileName = NameList{Selected};
ProtocolName = BpodSystem.CurrentProtocolName;
SettingsPath = fullfile(BpodSystem.BpodPath,'Data',SubjectName,ProtocolName,'Session Settings',[ SettingsFileName '.mat']);
SettingsPath = fullfile(BpodSystem.BpodUserPath,'Data',SubjectName,ProtocolName,'Session Settings',[ SettingsFileName '.mat']);
delete(SettingsPath);
BpodErrorSound;
msgbox(['Settings file ' SettingsFileName ' deleted!'], 'Modal');
set(handles.listbox2, 'Value', 1);
% Update UI with new settings
SettingsPath = fullfile(BpodSystem.BpodPath,'Data',SubjectName, ProtocolName,'Session Settings');
SettingsPath = fullfile(BpodSystem.BpodUserPath,'Data',SubjectName, ProtocolName,'Session Settings');
Candidates = dir(SettingsPath);
nSettingsFiles = 0;
SettingsFileNames = cell(1);
Expand Down Expand Up @@ -549,7 +549,7 @@ function pushbutton6_Callback(hObject, eventdata, handles)
Selected = get(handles.listbox2, 'Value');
SettingsFileName = NameList{Selected};
ProtocolName = BpodSystem.CurrentProtocolName;
SettingsPath = fullfile(BpodSystem.BpodPath,'Data',SubjectName,ProtocolName,'Session Settings',[ SettingsFileName '.mat']);
SettingsPath = fullfile(BpodSystem.BpodUserPath,'Data',SubjectName,ProtocolName,'Session Settings',[ SettingsFileName '.mat']);
BpodSystem.SettingsPath = SettingsPath;
evalin('base', ['load(''' SettingsPath ''')'])
clc
Expand All @@ -567,7 +567,7 @@ function pushbutton7_Callback(hObject, eventdata, handles)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global BpodSystem;
SearchStartPath = fullfile(BpodSystem.BpodPath, 'Data');
SearchStartPath = fullfile(BpodSystem.BpodUserPath, 'Data');
[Filename Pathname Junk] = uigetfile('*.mat', 'Select settings to import', SearchStartPath);
SettingsName = Filename(1:(length(Filename)-4));
TargetSettingsPath = [Pathname Filename];
Expand All @@ -582,7 +582,7 @@ function pushbutton7_Callback(hObject, eventdata, handles)
Selected = get(handles.listbox1, 'Value');
SubjectName = NameList{Selected};
ProtocolName = BpodSystem.CurrentProtocolName;
DestinationSettingsPath = fullfile(BpodSystem.BpodPath,'Data',SubjectName,ProtocolName,'Session Settings',[ SettingsName '.mat']);
DestinationSettingsPath = fullfile(BpodSystem.BpodUserPath,'Data',SubjectName,ProtocolName,'Session Settings',[ SettingsName '.mat']);

if (exist(DestinationSettingsPath) == 2)
msgbox(['"' SettingsName '"' ' already exists in the target folder. Import aborted.'])
Expand All @@ -593,7 +593,7 @@ function pushbutton7_Callback(hObject, eventdata, handles)
copyfile(TargetSettingsPath, DestinationSettingsPath);

% Update UI with new settings
SettingsPath = fullfile(BpodSystem.BpodPath,'Data',SubjectName, ProtocolName,'Session Settings');
SettingsPath = fullfile(BpodSystem.BpodUserPath,'Data',SubjectName, ProtocolName,'Session Settings');
Candidates = dir(SettingsPath);
nSettingsFiles = 0;
SettingsFileNames = cell(1);
Expand Down
10 changes: 8 additions & 2 deletions Functions/Launch manager/RunProtocol.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function RunProtocol(Opstring)
SelectedProtocol = get(BpodSystem.GUIHandles.ProtocolSelector, 'Value');
SelectedProtocolName = ProtocolNames{SelectedProtocol};
BpodSystem.CurrentProtocolName = SelectedProtocolName;
addpath(fullfile(BpodSystem.BpodPath, 'Protocols', SelectedProtocolName));
addpath(fullfile(BpodSystem.BpodUserPath, 'Protocols', SelectedProtocolName));
LaunchManager;
else
if BpodSystem.Pause == 0
Expand All @@ -41,11 +41,17 @@ function RunProtocol(Opstring)
end
end
case 'Stop'
%execute user kill script
try
[~,Protocol]=fileparts(fileparts(fileparts(BpodSystem.DataPath)));
run(fullfile(BpodSystem.BpodUserPath,'Protocols',Protocol,'UserKillScript.m'));
catch
end
if ~isempty(BpodSystem.CurrentProtocolName)
disp(' ')
disp([BpodSystem.CurrentProtocolName ' ended.'])
end
rmpath(fullfile(BpodSystem.BpodPath, 'Protocols', BpodSystem.CurrentProtocolName));
rmpath(fullfile(BpodSystem.BpodUserPath, 'Protocols', BpodSystem.CurrentProtocolName));
BpodSystem.BeingUsed = 0;
BpodSystem.CurrentProtocolName = '';
BpodSystem.SettingsPath = '';
Expand Down
6 changes: 5 additions & 1 deletion Functions/Launch manager/SaveBpodProtocolSettings.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@
%}
function SaveBpodProtocolSettings
global BpodSystem
save(BpodSystem.SettingsPath, 'BpodSystem.ProtocolSettings');

% now compatible with recent matlab versions in which you can't save a
% structure field directly (FS MOD)
ProtocolSettings = BpodSystem.ProtocolSettings;
save(BpodSystem.SettingsPath, 'ProtocolSettings');
10 changes: 5 additions & 5 deletions Functions/LiquidCalibrator/BpodLiquidCalibration.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

% Setup calibration
BpodSystem.PluginObjects.LiquidCal.PendingMeasurements = cell(1,8);
CalibrationFilePath = fullfile(BpodSystem.BpodPath, 'Calibration Files', 'LiquidCalibration.mat');
CalibrationFilePath = fullfile(BpodSystem.BpodUserPath, 'Calibration Files', 'LiquidCalibration.mat');
if exist(CalibrationFilePath) == 2
load(CalibrationFilePath);
else
Expand Down Expand Up @@ -329,11 +329,11 @@ function RemoveMeasurement(varargin)
BpodSystem.PluginObjects.LiquidCal.CalData(CurrentValve).Coeffs = [];
end
% Save file
TestSavePath = fullfile(BpodSystem.BpodPath, 'Calibration Files');
TestSavePath = fullfile(BpodSystem.BpodUserPath, 'Calibration Files');
if exist(TestSavePath) ~= 7
mkdir(TestSavePath);
end
SavePath = fullfile(BpodSystem.BpodPath, 'Calibration Files', 'LiquidCalibration.mat');
SavePath = fullfile(BpodSystem.BpodUserPath, 'Calibration Files', 'LiquidCalibration.mat');
LiquidCal = BpodSystem.PluginObjects.LiquidCal.CalData;
LiquidCal(1).LastDateModified = now;
save(SavePath, 'LiquidCal');
Expand Down Expand Up @@ -696,11 +696,11 @@ function AddCalMeasurements(varargin)
% LiquidCalibrationManager to reflect the new pending measurements vector

% Save file
TestSavePath = fullfile(BpodSystem.BpodPath, 'Calibration Files');
TestSavePath = fullfile(BpodSystem.BpodUserPath, 'Calibration Files');
if exist(TestSavePath) ~= 7
mkdir(TestSavePath);
end
SavePath = fullfile(BpodSystem.BpodPath, 'Calibration Files', 'LiquidCalibration.mat');
SavePath = fullfile(BpodSystem.BpodUserPath, 'Calibration Files', 'LiquidCalibration.mat');
LiquidCal = BpodSystem.PluginObjects.LiquidCal.CalData;
LiquidCal(1).LastDateModified = now;
save(SavePath, 'LiquidCal');
Expand Down
Loading