annotate aim-mat/gui/createparameterfile.m @ 4:537f939baef0 tip

various bug fixes and changed copyright message
author Stefan Bleeck <bleeck@gmail.com>
date Tue, 16 Aug 2011 14:37:17 +0100
parents 20ada0af3d7d
children
rev   line source
tomwalters@0 1 % procedure for 'aim-mat'
tomwalters@0 2 %
tomwalters@0 3 % INPUT VALUES:
tomwalters@0 4 %
tomwalters@0 5 % RETURN VALUE:
tomwalters@0 6 %
tomwalters@0 7 %
tomwalters@0 8 % (c) 2011, University of Southampton
bleeck@3 9 % Maintained by Stefan Bleeck (bleeck@gmail.com)
bleeck@3 10 % download of current version is on the soundsoftware site:
bleeck@3 11 % http://code.soundsoftware.ac.uk/projects/aimmat
bleeck@3 12 % documentation and everything is on http://www.acousticscale.org
bleeck@3 13
tomwalters@0 14
tomwalters@0 15
tomwalters@0 16 function handles=createparameterfile(handles,paramname)
tomwalters@0 17 % create parameters from that file
tomwalters@0 18 % when no second parameter is given, then load it using the standart way:
tomwalters@0 19 % go through all directories and call the single module-parameterfiles
tomwalters@0 20
tomwalters@0 21
tomwalters@0 22 if nargin==1 % if no parameter file is given, then take the standart one
tomwalters@0 23 % first load the default values from the default parameter file:
tomwalters@0 24 handles=loadallparameterfiles(handles);
tomwalters@0 25 if handles.error==1
tomwalters@0 26 return
tomwalters@0 27 end
tomwalters@0 28
tomwalters@0 29 if isfield(handles,'initial_options') % aim was called with initial parameters
tomwalters@0 30 % overwrite the parameters accordingly:
tomwalters@0 31 handles=aim_loadpersonal_defaults(handles); % take these anyhow
tomwalters@0 32
tomwalters@0 33 % the signal in any case:
tomwalters@0 34 handles.all_options.signal=handles.initial_options.signal;
tomwalters@0 35
tomwalters@0 36 if isfield(handles.initial_options,'pcp')
tomwalters@0 37 handles.info.calculate_pcp=1;
tomwalters@0 38 module_names=fieldnames(handles.initial_options.pcp); % find out, which module name
tomwalters@0 39 module_name=module_names{1}; % only the first one is relevant!
tomwalters@0 40 handles.info.current_pcp_module=module_name; % this one is the current one
tomwalters@0 41 str=sprintf('handles.all_options.pcp%s=handles.initial_options.pcp.%s;',module_name,module_name);
tomwalters@0 42 eval(str);
tomwalters@0 43 end
tomwalters@0 44 if isfield(handles.initial_options,'bmm')
tomwalters@0 45 handles.info.calculate_bmm=1;
tomwalters@0 46 module_names=fieldnames(handles.initial_options.bmm); % find out, which module name
tomwalters@0 47 module_name=module_names{1}; % only the first one is relevant!
tomwalters@0 48 handles.info.current_bmm_module=module_name; % this one is the current one
tomwalters@0 49 str=sprintf('handles.all_options.bmm.%s=handles.initial_options.bmm.%s;',module_name,module_name);
tomwalters@0 50 eval(str);
tomwalters@0 51 end
tomwalters@0 52 if isfield(handles.initial_options,'nap')
tomwalters@0 53 handles.info.calculate_nap=1;
tomwalters@0 54 module_names=fieldnames(handles.initial_options.nap); % find out, which module name
tomwalters@0 55 module_name=module_names{1}; % only the first one is relevant!
tomwalters@0 56 handles.info.current_nap_module=module_name; % this one is the current one
tomwalters@0 57 str=sprintf('handles.all_options.nap.%s=handles.initial_options.nap.%s;',module_name,module_name);
tomwalters@0 58 eval(str);
tomwalters@0 59 end
tomwalters@0 60 if isfield(handles.initial_options,'strobes')
tomwalters@0 61 handles.info.calculate_strobes=1;
tomwalters@0 62 module_names=fieldnames(handles.initial_options.strobes); % find out, which module name
tomwalters@0 63 module_name=module_names{1}; % only the first one is relevant!
tomwalters@0 64 handles.info.current_strobes_module=module_name; % this one is the current one
tomwalters@0 65 str=sprintf('handles.all_options.strobes.%s=handles.initial_options.strobes.%s;',module_name,module_name);
tomwalters@0 66 eval(str);
tomwalters@0 67 end
tomwalters@0 68 if isfield(handles.initial_options,'sai')
tomwalters@0 69 handles.info.calculate_sai=1;
tomwalters@0 70 module_names=fieldnames(handles.initial_options.sai); % find out, which module name
tomwalters@0 71 module_name=module_names{1}; % only the first one is relevant!
tomwalters@0 72 handles.info.current_sai_module=module_name; % this one is the current one
tomwalters@0 73 str=sprintf('handles.all_options.sai.%s=handles.initial_options.sai.%s;',module_name,module_name);
tomwalters@0 74 eval(str);
tomwalters@0 75 end
tomwalters@0 76 if isfield(handles.initial_options,'usermodule')
tomwalters@0 77 handles.info.calculate_usermodule=1;
tomwalters@0 78 module_names=fieldnames(handles.initial_options.usermodule); % find out, which module name
tomwalters@0 79 module_name=module_names{1}; % only the first one is relevant!
tomwalters@0 80 handles.info.current_usermodule_module=module_name; % this one is the current one
tomwalters@0 81 str=sprintf('handles.all_options.usermodule.%s=handles.initial_options.usermodule.%s;',module_name,module_name);
tomwalters@0 82 eval(str);
tomwalters@0 83 end
tomwalters@0 84 if isfield(handles.initial_options,'movie')
tomwalters@0 85 handles.info.calculate_movie=1;
tomwalters@0 86 module_names=fieldnames(handles.initial_options.movie); % find out, which module name
tomwalters@0 87 module_name=module_names{1}; % only the first one is relevant!
tomwalters@0 88 handles.info.current_movie_module=module_name; % this one is the current one
tomwalters@0 89 str=sprintf('handles.all_options.movie.%s=handles.initial_options.movie.%s;',module_name,module_name);
tomwalters@0 90 eval(str);
tomwalters@0 91 end
tomwalters@0 92
tomwalters@0 93 else
tomwalters@0 94 % fill in some parameters for the signal:
tomwalters@0 95 handles.all_options.signal.signal_filename='';
tomwalters@0 96 handles.all_options.signal.start_time=0;
tomwalters@0 97 handles.all_options.signal.duration=1;
tomwalters@0 98 handles.all_options.signal.samplerate=16000;
tomwalters@0 99 handles=aim_loadpersonal_defaults(handles);
tomwalters@0 100 handles=aim_loadpersonal_defaults(handles);
tomwalters@0 101 return
tomwalters@0 102 end
tomwalters@0 103 else % the parameter file is given as a paramter. So load it!
tomwalters@0 104
tomwalters@0 105 olddir=pwd;
tomwalters@0 106 [pathstr,name,ext] = fileparts(paramname)
tomwalters@0 107 cd(pathstr);
tomwalters@0 108 eval(name); % here it is evaluated
tomwalters@0 109 cd olddir;
tomwalters@0 110
tomwalters@0 111
tomwalters@0 112 handles.all_options=all_options;
tomwalters@0 113 handles=aim_saveparameters(handles,handles.info.parameterfilename);
tomwalters@0 114 end
tomwalters@0 115
tomwalters@0 116
tomwalters@0 117