1 | function Result=idGetFFWDTableDirectory(idName) |
---|
2 | %% Written by F. Briquez |
---|
3 | % 1) Input : idName. Such as 'HU36_SIRIUS' |
---|
4 | % 2) Output : the name of the directory where FFWD tables are stored. It should be something like: |
---|
5 | % '/usr/Local/configFiles/InsertionFFTables/ANS-C08-HU44' |
---|
6 | % 3) If idName is unknown, returned Result is empty string. |
---|
7 | %% |
---|
8 | DeviceServer=idGetUndDServer(idName); |
---|
9 | if (isempty(DeviceServer)) |
---|
10 | fprintf ('Error in ''idGetFFWDTableDirectory'': idName ''%s'' is unknown''\n', idName); |
---|
11 | Result=''; |
---|
12 | return |
---|
13 | end |
---|
14 | % DeviceServer is something like 'ANS-C08/EI/M-HU44.1' |
---|
15 | SeparatorPositions=strfind(DeviceServer, '/'); |
---|
16 | if size(SeparatorPositions, 2)~=2 |
---|
17 | fprintf('Error in ''idGetFFWDTableDirectory'' : Wrong format of DeviceServer\n'); |
---|
18 | end |
---|
19 | FirstSeparatorPosition=SeparatorPositions(1); |
---|
20 | SecondSeparatorPosition=SeparatorPositions(2); |
---|
21 | Cell=DeviceServer(1:FirstSeparatorPosition-1); |
---|
22 | UndulatorNameWithStraightSectiontype=DeviceServer(SecondSeparatorPosition+1:size(DeviceServer, 2)); |
---|
23 | SeparatorPositions=strfind(idName, '_'); |
---|
24 | if size(SeparatorPositions, 2)~=1 |
---|
25 | fprintf('Error in ''idGetFFWDTableDirectory'' : Wrong format of idName\n'); |
---|
26 | end |
---|
27 | UndulatorName=idName(1:SeparatorPositions(1)-1); |
---|
28 | Result=['/usr/Local/configFiles/InsertionFFTables/', Cell, '-', UndulatorName]; |
---|
29 | return |
---|
30 | end |
---|