Skip to content

Commit

Permalink
changes to rename ratrix as BCore
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertRecatto committed Apr 4, 2016
1 parent 6ffedc5 commit 929c4bb
Show file tree
Hide file tree
Showing 145 changed files with 612 additions and 628 deletions.
6 changes: 3 additions & 3 deletions bootstrap/bootstrap.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
setupEnvironment;
addJavaComponents(); %might conflict with dbconn

dataPath=fullfile(fileparts(fileparts(getRatrixPath)),'ratrixData',filesep);
dataPath=fullfile(fileparts(fileparts(getBCorePath)),'BCoreData',filesep);

diary off
warning('off','MATLAB:MKDIR:DirectoryExists')
Expand All @@ -30,7 +30,7 @@

tries=0;
while true
initRatrixPorts;
initBCorePorts;
try
clearJavaComponents();
checkForUpdate;
Expand Down Expand Up @@ -80,7 +80,7 @@
else
com=getNextCommand(r);
if ~isempty(com)
quit=clientHandleCommand(r,com,constants.statuses.NO_RATRIX);
quit=clientHandleCommand(r,com,constants.statuses.NO_BCORE);
else
pause(0.1);
end
Expand Down
2 changes: 1 addition & 1 deletion bootstrap/setupEnvironment.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
lastwarn('')

warning('off','MATLAB:dispatcher:nameConflict')
addpath((genpath(getRatrixPath)));
addpath((genpath(getBCorePath)));
warning('on','MATLAB:dispatcher:nameConflict')

% intwarning('on');
Expand Down
56 changes: 20 additions & 36 deletions bootstrap/standAloneRun.m
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
function standAloneRun(subjectID,ratrixPath,setupFile)
%standAloneRun([ratrixPath],[setupFile],[subjectID],[recordInOracle],[backupToServer])
function standAloneRun(subjectID,BCorePath,setupFile)
%standAloneRun([BCorePath],[setupFile],[subjectID],[recordInOracle],[backupToServer])
%
% ratrixPath (optional, string path to preexisting ratrix 'db.mat' file)
% defaults to checking for db.mat in ...\<ratrix install directory>\..\ratrixData\ServerData\
% if none present, makes new ratrix located there, with a dummy subject
% BCorePath (optional, string path to preexisting BCore 'db.mat' file)
% defaults to checking for db.mat in ...\<BCore install directory>\..\BCoreData\ServerData\
% if none present, makes new BCore located there, with a dummy subject
%
% setupFile (optional, name of a setProtocol file on the path, typically in the setup directory)
% defaults to 'setProtocolDEMO'
% if subject already exists in ratrix and has a protocol, default is no action
% if subject already exists in BCore and has a protocol, default is no action
%
% subjectID (optional, must be string id of subject -- will add to ratrix if not already present)
% default is some unspecified subject in ratrix (you can't depend on which
% subjectID (optional, must be string id of subject -- will add to BCore if not already present)
% default is some unspecified subject in BCore (you can't depend on which
% one unless there is only one)
%
%
setupEnvironment;

if exist('ratrixPath','var') && ~isempty(ratrixPath)
if isdir(ratrixPath)
rx=ratrix(ratrixPath,0);
if exist('BCorePath','var') && ~isempty(BCorePath)
if isdir(BCorePath)
rx=BCore(BCorePath,0);
else
ratrixPath
error('if ratrixPath supplied, it must be a path to a preexisting ratrix ''db.mat'' file')
BCorePath
error('if BCorePath supplied, it must be a path to a preexisting BCore ''db.mat'' file')
end
else
dataPath=fullfile(fileparts(fileparts(getRatrixPath)),'ratrixData',filesep);
dataPath=fullfile(fileparts(fileparts(getBCorePath)),'BCoreData',filesep);
defaultLoc=fullfile(dataPath, 'ServerData');
d=dir(fullfile(defaultLoc, 'db.mat'));

if length(d)==1
rx=ratrix(defaultLoc,0);
fprintf('loaded ratrix from default location\n')
rx=BCore(defaultLoc,0);
fprintf('loaded BCore from default location\n')
else
try
[success mac]=getMACaddress();
Expand All @@ -42,11 +42,11 @@ function standAloneRun(subjectID,ratrixPath,setupFile)
end

machines={{'1U',mac,[1 1 1]}};
rx=createRatrixWithDefaultStations(machines,dataPath,'localTimed');
rx=createBCoreWithDefaultStations(machines,dataPath,'localTimed');
permStorePath=fullfile(dataPath,'PermanentTrialRecordStore');
mkdir(permStorePath);
rx.standAlonePath=permStorePath;
fprintf('created new ratrix\n')
fprintf('created new BCore\n')
end
end

Expand All @@ -64,9 +64,9 @@ function standAloneRun(subjectID,ratrixPath,setupFile)
else
subjectID=lower(subjectID);
try
isSubjectInRatrix=getSubjectFromID(rx,subjectID);
isSubjectInBCore=getSubjectFromID(rx,subjectID);
catch ex
if ~isempty(strfind(ex.message,'request for subject id not contained in ratrix'))
if ~isempty(strfind(ex.message,'request for subject id not contained in BCore'))

needToCreateSubject=true;
needToAddSubject=true;
Expand Down Expand Up @@ -140,22 +140,6 @@ function standAloneRun(subjectID,ratrixPath,setupFile)
replicateTrialRecords(replicationPaths,deleteOnSuccess, recordInOracle);
end
[rx ids] = emptyAllBoxes(rx,'done running trials in standAloneRun',auth);
if ~testMode
compilePath=fullfile(fileparts(getStandAlonePath(rx)),'CompiledTrialRecords');
mkdir(compilePath);
dailyAnalysisPath = fullfile(fileparts(getStandAlonePath(rx)),'DailyAnalysis');
mkdir(dailyAnalysisPath);
compileDetailedRecords([],{subjectID},[],getStandAlonePath(rx),compilePath);

selection.type = 'animal status';
selection.filter = 'all';
selection.filterVal = [];
selection.filterParam = [];
selection.titles = {sprintf('subject %s',subjectID)};
selection.subjects = {subjectID};
fs=analysisPlotter(selection,compilePath,true);
% subjectAnalysis(compilePath);
end
cleanup;
% testing
clear all
Expand Down
2 changes: 1 addition & 1 deletion bootstrap/startDataListener.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function startDataListener()
%this opens up the datanet listener so that a ratrix datanet can connect to it;
%this opens up the datanet listener so that a BCore datanet can connect to it;

setupEnvironment;
try
Expand Down
2 changes: 1 addition & 1 deletion classes/analysis/@neuronDB/process.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
%start building a parameters of the calls to runAnalysis
p.channels={db.data{neurons(i)}.channels}; % all singleUnits have only a single set of channels
p.analysisMode=mode;
p.standardParams = fullfile(getRatrixPath,'analysis','bsriram','analysisParameters','getBasicParams.m'); % warning... this is just a record and has no effect
p.standardParams = fullfile(getBCorePath,'analysis','bsriram','analysisParameters','getBasicParams.m'); % warning... this is just a record and has no effect
p.cellBoundary={'trialRange',minmax(trials),'trialMask',mask};

%default parameters are faster and no inspect for pre-processing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
channels = {getChannels(s)};
thrV = [NaN NaN NaN];
cellBoundary = {'trialRange',trialRange,'trialMask',trialMask};
standardParams = fullfile(getRatrixPath,'analysis','bsriram','analysisParameters','params_01_06_2011.m');
standardParams = fullfile(getBCorePath,'analysis','bsriram','analysisParameters','params_01_06_2011.m');
analysisMode = 'onlyAnalyze'; % most important
forceNoInspect = true;
intelligentUpdate = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
channels = {getChannels(s)};
thrV = [NaN NaN NaN];
cellBoundary = {'trialRange',trialRange,'trialMask',trialMask};
standardParams = fullfile(getRatrixPath,'analysis','bsriram','analysisParameters','params_01_06_2011.m');
standardParams = fullfile(getBCorePath,'analysis','bsriram','analysisParameters','params_01_06_2011.m');
analysisMode = 'onlyAnalyze'; % most important
forceNoInspect = true;
intelligentUpdate = false;
Expand Down
2 changes: 1 addition & 1 deletion classes/analysis/glmTool.m
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ function tutorial(g) %basic demo
load('physAnalysis_485-20100604T200707')
%how to get or make this data:
% source: datanetOutput\231\analysis\475-485\485-20100604T200707\
% make: spikeSortFiddler in RatrixTrunk@svnRev.2954
% make: spikeSortFiddler in BCoreTrunk@svnRev.2954
% subjectID = '231';
% path='\\132.239.158.179\datanetOutput' %on the G drive remote
% channels={1};
Expand Down
12 changes: 6 additions & 6 deletions classes/core/boxes/box.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ function clearSubjectDataDir(b)
end

function subPath=getBoxPathForSubjectID(b,sID,r)
if isa(r,'ratrix')
if isa(r,'BCore')
if getBoxIDForSubjectID(r,sID)==b.id
subPath=fullfile(getSubjectDataDir(b),sID); %[b.path 'subjectData' filesep sID filesep];
else
error('subject not in this box')
end
else
error('ratrix does not contain subject')
error('BCore does not contain subject')
end
end

Expand All @@ -66,11 +66,11 @@ function clearSubjectDataDir(b)
function trialRecords=getTrialRecordsForSubjectID(b,sID,r)
disp(sprintf('loading records for %s (from box)',sID))
startTime=GetSecs();
if isa(r,'ratrix')
if isa(r,'BCore')
subPath=getBoxPathForSubjectID(b,sID,r);
trialRecords=loadMakeOrSaveTrialRecords(subPath);
else
error('need ratrix object')
error('need BCore object')
end
disp(sprintf('done loading records for %s: %g s elapsed',sID,GetSecs()-startTime))
end
Expand All @@ -97,11 +97,11 @@ function clearSubjectDataDir(b)
function updateTrialRecordsForSubjectID(b,sID,trialRecords,r)
disp(sprintf('saving records for %s (from box)',sID))
startTime=GetSecs();
if isa(r,'ratrix')
if isa(r,'BCore')
subPath=getBoxPathForSubjectID(b,sID,r);
loadMakeOrSaveTrialRecords(subPath,trialRecords);
else
error('need ratrix object')
error('need BCore object')
end
disp(sprintf('done saving records for %s: %g s elapsed',sID,GetSecs()-startTime))
end
Expand Down
12 changes: 6 additions & 6 deletions classes/core/datanets/datanet.m
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,13 @@

function [datanet, quit, retval] = handleCommands(datanet,params)
% This function gets called by the client's bootstrap function, and also at the doTrial/runRealTimeLoop level to handle any available
% server commands. also gets called during physiologyServer's doServerIteration (to handle any commands sent from ratrix side)
% server commands. also gets called during physiologyServer's doServerIteration (to handle any commands sent from BCore side)
% INPUTS:
% datanet - a datanet object (either stim or data)
% params - a struct containing additional information that may be needed to process commands
% for now, this is a timestamp that was taken during 'trial start' and passed to 'trial end' for serverHandleCommand
% OUTPUTS:
% quit - a quit flag (not sure if this will be doTrial's stopEarly or realtimeloop's quit), but something to tell ratrix to stop running trials!
% quit - a quit flag (not sure if this will be doTrial's stopEarly or realtimeloop's quit), but something to tell BCore to stop running trials!
% retval - some return value (in the case of doServerIteration, should be an event to add to events_data), may be other stuff....

quit = false;
Expand Down Expand Up @@ -250,7 +250,7 @@
% (this may be useful for waiting for the omni-message END_OF_DOTRIALS)


% 4/3 to do - remove trialData? - for now, just handle simple acks. this function should work from both the ratrix and data sides...
% 4/3 to do - remove trialData? - for now, just handle simple acks. this function should work from both the BCore and data sides...
MAXSIZE = 1024*1024;
CMDSIZE = 1;
trialData = [];
Expand Down Expand Up @@ -434,7 +434,7 @@
retval(end).stimManagerClass=cparams.stimManagerClass;
retval(end).stepName=cparams.stepName;
retval(end).stepNumber=cparams.stepNumber;
fprintf('got trial start command from ratrix\n')
fprintf('got trial start command from BCore\n')
case constants.stimToDataCommands.S_TRIAL_END_EVENT_CMD
% mark end of trial - how do we add an event to events_data, which is all the way out in physiologyServer?
response=constants.dataToStimResponses.D_TRIAL_END_EVENT_ACK;
Expand Down Expand Up @@ -468,7 +468,7 @@
retval(end).datablock = params.datablock;
retval(end).ai = params.ai;

fprintf('got trial end command from ratrix\n')
fprintf('got trial end command from BCore\n')
case constants.stimToDataCommands.S_ERROR_RECOVERY_METHOD
% whether client pressed 'Restart' or 'Quit'
response=constants.dataToStimResponses.D_ERROR_METHOD_RECEIVED;
Expand Down Expand Up @@ -566,7 +566,7 @@
% INPUTS:
% datanet - the server-side datanet object; should have a valid pnet connection with parameters (timeout) already set
% subjectID - the ID string of the subject to start
% (pass to station.doTrials or whoever sets quit on ratrix side - just to make sure this is the correct subject to stop)
% (pass to station.doTrials or whoever sets quit on BCore side - just to make sure this is the correct subject to stop)
% params - the struct of params that includes the ai object so we can get the last trial's data
% OUTPUTS:
% gotAck - true if we get an ack from the client
Expand Down
Loading

0 comments on commit 929c4bb

Please sign in to comment.