1 | function makephysdata(varargin) |
---|
2 | %MAKEPHYSDATA - Make a starting physics data file |
---|
3 | % |
---|
4 | % NOTE: MML creators are phasing out the use of physdata. |
---|
5 | % |
---|
6 | % NOTES |
---|
7 | %1. This just a rountine to be used to create the Physdata file |
---|
8 | % Then the parameter like Golden parameters should be updated |
---|
9 | % using setphydata command. For example, to set the golden H-orbit: |
---|
10 | % setphysdata('BPMx','Golden',getx('Struct')); |
---|
11 | % |
---|
12 | % See also soleilinit |
---|
13 | |
---|
14 | % |
---|
15 | % Written By Gregory J. Portmann |
---|
16 | % Modified by Laurent S. Nadolski |
---|
17 | |
---|
18 | % |
---|
19 | % TODO to be adapted for SOLEIL |
---|
20 | |
---|
21 | FamilyName = getfamilylist; |
---|
22 | N = size(FamilyName,1); |
---|
23 | |
---|
24 | for i = 1:N |
---|
25 | Family = deblank(FamilyName(i,:)); |
---|
26 | |
---|
27 | if ismemberof(Family,'BPM') |
---|
28 | PhysData.(Family).Golden = 0; |
---|
29 | PhysData.(Family).Gain = 1; |
---|
30 | PhysData.(Family).Offset = 0; |
---|
31 | PhysData.(Family).Coupling = 0; |
---|
32 | |
---|
33 | elseif ismemberof(Family,'COR') || ... |
---|
34 | ismemberof(Family,'QUAD') || ... |
---|
35 | ismemberof(Family,'SEXT') || ... |
---|
36 | ismemberof(Family,'BEND') |
---|
37 | |
---|
38 | PhysData.(Family).Gain = 1; |
---|
39 | PhysData.(Family).Offset = 0; |
---|
40 | PhysData.(Family).Coupling = 0; |
---|
41 | |
---|
42 | elseif ismemberof(Family,'TUNE')|| ... |
---|
43 | ismemberof(Family,'CHRO') |
---|
44 | PhysData.TUNE.Golden = getgolden(Family); |
---|
45 | |
---|
46 | end |
---|
47 | end |
---|
48 | |
---|
49 | |
---|
50 | % All calibation data is saved in this file |
---|
51 | FileName = getfamilydata('OpsData','PhysDataFile'); |
---|
52 | |
---|
53 | %DirectoryName = getfamilydata('Directory','DataRoot'); |
---|
54 | %Machine = lower(getfamilydata('Machine')); |
---|
55 | %[DirectoryName, FileName, ExtentionName] = fileparts(which('getsp')); |
---|
56 | %DirectoryName = fullfile(DirectoryName, Machine, filesep); |
---|
57 | %FileName = [Machine, 'physdata']; |
---|
58 | |
---|
59 | if exist([FileName, '.mat'], 'file') |
---|
60 | tmp = questdlg({... |
---|
61 | sprintf('%s.mat', FileName), ... |
---|
62 | 'is where many important parameters are saved to operate', ... |
---|
63 | 'saved to operate this machine. You are about to completely', ... |
---|
64 | 'overwrite this file with no backup!', ... |
---|
65 | 'Are you sure you want to change the Physics Data Structure?'},... |
---|
66 | 'SETPHYSDATA','YES','NO','NO'); |
---|
67 | if ~strcmpi(tmp,'YES') |
---|
68 | fprintf(' No change made to the Physics Data Structure\n'); |
---|
69 | return |
---|
70 | end |
---|
71 | end |
---|
72 | |
---|
73 | |
---|
74 | save(FileName, 'PhysData'); |
---|
75 | fprintf(' A new Physics Data Structure has been saved to %s\n', FileName); |
---|