Skip to content

Commit

Permalink
store aap_parameters_user in ~/.aa/ and add this directory to path
Browse files Browse the repository at this point in the history
  • Loading branch information
jooh committed Aug 29, 2018
1 parent a3bf499 commit c8b099e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
5 changes: 5 additions & 0 deletions aaClass.m
Expand Up @@ -24,6 +24,11 @@
rmpath(genpath(fullfile(obj.Path,'.git'))); % remove GitHub-related path rmpath(genpath(fullfile(obj.Path,'.git'))); % remove GitHub-related path
rmpath(genpath(fullfile(obj.Path,'external','cluster'))); % remove cluster-integration path rmpath(genpath(fullfile(obj.Path,'external','cluster'))); % remove cluster-integration path
end end

% user config directory
configdir = fullfile(getenv('HOME'),'.aa');
aas_makedir([], configdir);
addpath(configdir);


obj.Name = 'automaticanalysis'; obj.Name = 'automaticanalysis';
info = loadjson(strrep(aafile,'Class.m','.json')); info = loadjson(strrep(aafile,'Class.m','.json'));
Expand Down
32 changes: 18 additions & 14 deletions aa_engine/aarecipe.m
Expand Up @@ -37,39 +37,43 @@


% First work on default parameters % First work on default parameters
if ~exist(defaultparameters,'file') if ~exist(defaultparameters,'file')
resp = userinput('questdlg',sprintf('Cannot find parameters file %s\nSeed new parameter file from existing default?',defaultparameters), ... fprintf(...
'Cannot find parameters file %s, opening user interface to generate a new file\n',...
defaultparameters);
resp = userinput('questdlg',...
sprintf('Cannot find parameters file %s\nSeed new parameter file from existing default?',defaultparameters), ...
'Parameter file', ... 'Parameter file', ...
'Yes','No (Exit)','No (Exit)','GUI',isGUI); 'Yes','No (Exit)','No (Exit)','GUI',isGUI);
assert(~strcmp(resp,'No (Exit)'), 'exiting'); assert(~strcmp(resp,'No (Exit)'), 'exiting');
% if we made it here, we are seeding a new parameters file % if we made it here, we are seeding a new parameters file
% we have default parameters % we have default parameters
defaultdir = fullfile(fileparts(fileparts(mfilename('fullpath'))),'aa_parametersets'); defaultdir = fullfile(fileparts(fileparts(mfilename('fullpath'))),'aa_parametersets');
[seedparam, rootpath] = userinput('uigetfile',{'*.xml','All Paremeters Files' },'Desired seed parameter',defaultdir,'GUI',isGUI); [seedparam, rootpath] = userinput('uigetfile',{'*.xml','All Parameter Files' },'Desired seed parameter',defaultdir,'GUI',isGUI);
assert(ischar(seedparam), 'exiting'); assert(ischar(seedparam), 'exiting');
seedparam = fullfile(rootpath, seedparam); seedparam = fullfile(rootpath, seedparam);


% initialise the save dialogue in the current aap.acq_details.root if specified % initialise the save dialogue in the current aap.acq_details.root if specified
xml=xml_read(seedparam,Pref); xml=xml_read(seedparam,Pref);
defaultdir = aas_expandpathbyvars(xml.acq_details.root); configdir = fullfile(getenv('HOME'),'.aa');
if isempty(defaultdir), defaultdir = pwd; end

% generate new parameters file N.B.: in networks with shared resources % generate new parameters file N.B.: in networks with shared resources
% average user may not be able to write into aa_paremetersets % average user may not be able to write into aa_paremetersets
[defaultparameters, rootpath] = userinput('uiputfile',{'*.xml','All Paremeters Files' },... [defaultparameters, rootpath] = userinput('uiputfile',{'*.xml','All Parameter Files' },...
'Location of the parameters file',fullfile(defaultdir,defaultparameters),'GUI',isGUI); 'Location of the parameters file',fullfile(configdir, defaultparameters),'GUI',isGUI);
assert(ischar(defaultparameters), 'exiting'); assert(ischar(defaultparameters), 'exiting');
destination = fullfile(rootpath, defaultparameters); destination = fullfile(rootpath, defaultparameters);


analysisroot = userinput('uigetdir',rootpath,'Location of analyses by default','GUI',isGUI); analysisroot = aas_expandpathbyvars(xml.acq_details.root);
aas_makedir([], analysisroot);
analysisroot = userinput('uigetdir',analysisroot,'Location of analyses by default','GUI',isGUI);


create_minimalXML(seedparam, destination,analysisroot); create_minimalXML(seedparam, destination, analysisroot);
assert(exist(destination,'file')>0,'failed to create %s',defaultparameters); assert(exist(destination,'file')>0,'failed to create %s', defaultparameters);


% N.B. we don't actually modify defaultparameters - it should now be on the path. But % N.B. we don't actually modify defaultparameters - it should now be on the path. But
% let's double check. It might not be e.g. if you haven't actually added AA to your % let's double check. It might not be e.g. if you haven't actually added AA to your
% path properly before calling this function. % path properly before calling this function.
assert(exist(defaultparameters,'file')>0, ... assert(exist(defaultparameters,'file')>0, ...
'could not find %s - Are you sure it is in your path?',... 'could not find %s - Are you sure it is on your path?',...
defaultparameters); defaultparameters);


if isGUI if isGUI
Expand Down Expand Up @@ -453,8 +457,8 @@ function create_minimalXML(seedparam,destination,analysisroot)
function varargout = userinput(varargin) function varargout = userinput(varargin)
% Examples: % Examples:
% resp = userinput('questdlg',sprintf('Cannot find parameters file %s\nSeed new parameter file from existing default?','paramfile'), 'Parameter file', 'Yes','No (Exit)','No (Exit)','GUI',true); % resp = userinput('questdlg',sprintf('Cannot find parameters file %s\nSeed new parameter file from existing default?','paramfile'), 'Parameter file', 'Yes','No (Exit)','No (Exit)','GUI',true);
% [seedparam, rootpath] = userinput('uigetfile',{'*.xml','All Paremeters Files' },'Desired seed parameter',defaultdir,'GUI',true); % [seedparam, rootpath] = userinput('uigetfile',{'*.xml','All Parameter Files' },'Desired seed parameter',defaultdir,'GUI',true);
% [defaultparameters, rootpath] = userinput('uiputfile',{'*.xml','All Paremeters Files' }, 'Location of the parameters file and analyses by default',fullfile(pwd,defaultparameters),'GUI',true); % [defaultparameters, rootpath] = userinput('uiputfile',{'*.xml','All Parameter Files' }, 'Location of the parameters file and analyses by default',fullfile(pwd,defaultparameters),'GUI',true);


isGUI = true; isGUI = true;
iParam = find(strcmpi(varargin,'gui'),1); iParam = find(strcmpi(varargin,'gui'),1);
Expand Down Expand Up @@ -528,4 +532,4 @@ function create_minimalXML(seedparam,destination,analysisroot)
otherwise otherwise
error('Function %s is not an existing function or not implemented!',varargin{1}); error('Function %s is not an existing function or not implemented!',varargin{1});
end end
end end

0 comments on commit c8b099e

Please sign in to comment.