PREGENLIST - alternate listing function for pre-generated waveform list = pregenlist(inputFileName, startSamp, external); Generate list; external cannot be 'OPTIMAL' list = pregenlist(inputFileName, startSamp, external, detId); Generate list; external can be 'OPTIMAL' nSim number of simulations to generate inputFileName 1x1 or 1x2 cell containing a string with name of input file (must include file extention) and an optional field path for *.ilwd files startSamp 1x2 vector defining range of allowed start times in samples wrt the beginning of data set external struct or vector with sky location & polarization angle or string 'RANDOM' or 'OPTIMAL'; if struct, must have fields x, phi and psi detId (optional) detector identifier string; only needed for 'OPTIMAL' external angles list Cell array containing simulations list. Each row is a simulation. Each component of the row represent: [simId ampl startSamp int1 int2 ext1 ext2 ext3], in this order. N.B. startSamp is now a scalar - start time has been determined SEE ALSO: MAKELIST, GRAVEN
0001 function list = pregenlist(varargin) 0002 0003 % PREGENLIST - alternate listing function for pre-generated waveform 0004 % 0005 % list = pregenlist(inputFileName, startSamp, external); 0006 % Generate list; external cannot be 'OPTIMAL' 0007 % list = pregenlist(inputFileName, startSamp, external, detId); 0008 % Generate list; external can be 'OPTIMAL' 0009 % 0010 % nSim number of simulations to generate 0011 % inputFileName 1x1 or 1x2 cell containing a string with name of input 0012 % file (must include file extention) and an optional 0013 % field path for *.ilwd files 0014 % startSamp 1x2 vector defining range of allowed start times in 0015 % samples wrt the beginning of data set 0016 % external struct or vector with sky location & polarization angle 0017 % or string 'RANDOM' or 'OPTIMAL'; if struct, must have 0018 % fields x, phi and psi 0019 % detId (optional) detector identifier string; only needed for 0020 % 'OPTIMAL' external angles 0021 % 0022 % list Cell array containing simulations list. Each row is a 0023 % simulation. Each component of the row represent: 0024 % [simId ampl startSamp int1 int2 ext1 ext2 ext3], in this 0025 % order. N.B. startSamp is now a scalar - start time has 0026 % been determined 0027 % 0028 % SEE ALSO: MAKELIST, GRAVEN 0029 0030 % $Id: pregenlist.m,v 1.9 2004/05/17 21:16:49 stuver Exp $ 0031 0032 % INITIALIZE output variable 0033 % CHECK varargin for error 0034 % SET simId to inputFileName (parse if needed) 0035 % SET ampl to -1 to mark log file as using pre-generated waveform 0036 % SET start time 0037 % SET int1 and int2 (internal angles) to optimal orientation 0038 % SET external angles 0039 % ASSEMBLE list 0040 % RETURN list 0041 0042 % Initialize list 0043 list = {}; 0044 0045 % Check varargin for error 0046 if length(varargin) ~= 4 & length(varargin) ~= 5 0047 error(['pregenlist: varargin can only be [inputFileName, ' ... 0048 'startSamp, external, detId] or [nSim, inputFileName, ' ... 0049 'startSamp, external, detId]']) 0050 elseif length(varargin) == 4 0051 [inputFileName, startSamp, external, detId] = deal(varargin{:}); 0052 % Determine number of simulations in the list 0053 nSim = size(inputFileName, 1); 0054 elseif length(varargin) == 5 0055 [nSim, inputFileName, startSamp, external, detId] = deal(varargin{:}); 0056 inputFileName = repmat(inputFileName, nSim, 1); 0057 startSamp = repmat(startSamp, nSim, 1); 0058 external = repmat(external, nSim, 1); 0059 end 0060 0061 for iSim = 1:nSim 0062 % Set simId to be the inputFileName 0063 if strcmp(class(inputFileName(iSim,:)), 'cell') & ... 0064 length(inputFileName(iSim,:)) == 2 0065 simId{iSim}= [inputFileName{iSim,1} ',' inputFileName{iSim,2}]; 0066 if ~strcmp(class(simId{iSim}), 'char') 0067 simId{iSim} 0068 error('pregenlist: simId must be a string') 0069 end 0070 elseif strcmp(class(inputFileName(iSim,:)), 'cell') & ... 0071 length(inputFileName(iSim,:)) == 1 0072 simId{iSim} = [inputFileName{iSim,1}]; 0073 if ~strcmp(class(simId{iSim}), 'char') 0074 simId{iSim} 0075 error('pregenlist: simId must be a string') 0076 end 0077 elseif strcmp(class(inputFileName(iSim,:)), 'char') 0078 simId{iSim} = [inputFileName(iSim,:)]; 0079 else 0080 simId{iSim} 0081 error('pregenlist: simId must be either cell or char class') 0082 end 0083 0084 % Set ampl 0085 ampl(iSim) = -1; 0086 % This -1 in the ampl holder of the list is the flag that will mark the 0087 % log file as being produced for a pre-generated waveform. 0088 0089 % Pick start time 0090 [startSamp1(iSim), startSamp2(iSim)] = deal(startSamp(iSim,1), ... 0091 startSamp(iSim,2)); 0092 nuStartSamp(iSim) = pickstime(startSamp1(iSim), startSamp2(iSim)); 0093 if isempty(startSamp(iSim)) 0094 error('pregenlist: pickstime returned empty startSamp') 0095 end 0096 0097 % Assume optimal orientation angles for the source (this would leave the 0098 % time series unchanged if run through makett) 0099 int1(iSim) = 1; 0100 int2(iSim) = 0; 0101 0102 % Set external angles 0103 if ~strcmp(class(external), 'cell') 0104 nuExternal(iSim,:) = setexternal(-2, external(iSim,:), 1, detId); 0105 elseif strcmp(class(external), 'cell') 0106 nuExternal(iSim,:) = setexternal(-1, external{iSim}, 1, detId); 0107 end 0108 0109 if isempty(external) 0110 error('pregenlist: setexternal returned empty external') 0111 end 0112 0113 end 0114 0115 % Assemble list 0116 for k=1:size(simId,2) 0117 list(k,:) = {simId{:,k}, ampl(k), nuStartSamp(k), int1(k), int2(k),... 0118 nuExternal(k,1), nuExternal(k,2), nuExternal(k,3)}; 0119 end 0120 0121 return