Hi Antonio,
Yes, the second part is still connected, and the symbol "files" has a value which is the list of file names. I reused the name "files" in the argument to the analyzeImageGroup function, which was a bit confusing. But appearing as an argument it is a formal parameter, and not the same. The function accepts a list of file names, which are still available as the value of the global symbol "files." But when used, analyzeImageGroup just expects a list of file names, each being a string. In the notebook, these are given without full paths because we have already set the default directory to the notebook directory, and the files are in it.
Here is some code which was executed after the notebook was executed. Notice that files still has a value which is our full list of file names. But I can also give the function a list of file names I have typed in. And I can also Map the function onto a list of lists, where each bottom level list is a list of file names. Now I get a list of analysis results, one result for each of the bottom level list of file names. This could be used to process an entire set of data, consisting of separate lists for each group of images which should be added and analyzed.
In[63]:= files
Out[63]= {"fiber3_0.fits", "fiber3_1.fits", "fiber3_2.fits", \
"fiber3_3.fits", "fiber3_4.fits"}
In[64]:= analyzeImageGroup[files]
Out[64]= {{476.983, 500.031}, 386.469, {"fiber3_0.fits",
"fiber3_1.fits", "fiber3_2.fits", "fiber3_3.fits", "fiber3_4.fits"}}
In[65]:= (* Here we explicitly give it a list of file names *)
In[66]:= analyzeImageGroup[{"fiber3_1.fits", "fiber3_2.fits"}]
During evaluation of In[66]:= InterpolatingFunction::dmval: Input value {0.652631,498.308} lies outside the range of data in the interpolating function. Extrapolation will be used. >>
During evaluation of In[66]:= InterpolatingFunction::dmval: Input value {0.176204,498.308} lies outside the range of data in the interpolating function. Extrapolation will be used. >>
During evaluation of In[66]:= InterpolatingFunction::dmval: Input value {-0.300222,498.308} lies outside the range of data in the interpolating function. Extrapolation will be used. >>
During evaluation of In[66]:= General::stop: Further output of InterpolatingFunction::dmval will be suppressed during this calculation. >>
Out[66]= {{471.156, 498.285}, 387.422, {"fiber3_1.fits",
"fiber3_2.fits"}}
In[67]:= (* The errors are not a problem, but can be turned off if we \
want *)
In[68]:= Off[InterpolatingFunction::dmval]
In[69]:= analyzeImageGroup[{"fiber3_1.fits", "fiber3_2.fits"}]
Out[69]= {{471.156, 498.285}, 387.422, {"fiber3_1.fits",
"fiber3_2.fits"}}
(* We can Map the function onto a list of lists to get a list of \
results *)
In[70]:= listOfLists = {{"fiber3_1.fits",
"fiber3_2.fits"}, {"fiber3_3.fits", "fiber3_4.fits"}};
In[71]:= analyzeImageGroup /@ listOfLists
Out[71]= {{{471.156, 498.285},
387.422, {"fiber3_1.fits", "fiber3_2.fits"}}, {{473.682, 500.875},
386.866, {"fiber3_3.fits", "fiber3_4.fits"}}}
(* Turn the error message back on *)