[Swift-user] Question about mappers

Lorenzo Pesce lpesce at uchicago.edu
Thu Mar 29 21:03:48 CDT 2012


Hi all--
Thanks a lot for your help. I have another question.

This is what my problem looks like. There is a set of input files, all with the same name (say X.mat), in a set of subdirectories of say <root_dir>:
Win1
Win2
Win3
.
.
.
WinN



The applications takes the input file as *filename* (string) and not a handle, then some other parameters and produces a couple of output files (see below for app demoreal).

For each directory, say Win1, each file X.mat is mapped to many output files result_neuron_<i>_ht_<j>.mat, where i and j are a parameter sweep (same for all windows, but the X.mat files are different).

My script pokes around, takes some input and then spews up a swift script. My mapping misfires and all the output files end up in <root_dir>, which doesn't work because many should have the same name.
If the input file were a handle, I would use a file type and map input and output and I think that I would know how to do that. Here I have no idea.

// file to run the Margic square example from the matlab web site
type file;

string MCRPath = "/soft/matlab/7.13";
string spikefilename = "$infile";

app (file outdata,file result) demoreal (string mcr, int chn, int htin, string datafile)
{
  runDemoReal mcr chn htin datafile stdout=@outdata;
}

string WinDirs[] = ${swiftWinDirs};
int htvec[] = ${htvec};
int chnvec[] = ${chnvec};


foreach win in WinDirs {
  string spikefile = @strcat("${currdir}/",win,spikefilename);
  foreach chn in chnvec {  
     foreach s, i in htvec {
       file result <single_file_mapper; file=@strcat("result_neuron_", chn, "_ht_",s,".mat")>;
       file LogDemoReal <single_file_mapper; file=@strcat("demo_real", chn, "_ht_",s,".log")>;
       (LogDemoReal,result) = demoreal (MCRPath, chn, s, spikefile);
     }
  }
}








More information about the Swift-user mailing list