source: MML/trunk/mml/hcm2zero.m @ 4

Last change on this file since 4 was 4, checked in by zhangj, 11 years ago

Initial import--MML version from SOLEIL@2013

File size: 1.3 KB
Line 
1function hcm2zero(varargin)
2%HCM2ZERO - Set horizontal corrector strengths to zero
3%
4% hcm2zero(fraction, nstep)
5%
6%  INPUTS
7%  1. fract - fraction of corrector strength to put to zero
8%            {1} means correctors set to zero
9%             0.5 means half of the corrector strength set to zero
10%  2. nstep - number of step for zeroing correctors {Default: 5}
11%  3. Optional - 'Interactive' Wait for user for each step {Default}
12%                'NoInteractive' pause 0.2 s for each step     
13%
14%  See Also vcm2zero, vcm2golden, hcm2golden
15
16%
17%  Written by Gregory J. Portmann
18%  Adapted by Laurent S. Nadolski
19
20InteractiveFlag = 1;
21
22% Input Parser
23for i = length(varargin):-1:1
24    if strcmpi(varargin{i},'Interactive')
25        InteractiveFlag = 1;
26        varargin(i) = [];
27    elseif strcmpi(varargin{i},'NoInteractive')
28        InteractiveFlag = 0;
29        varargin(i) = [];
30    end
31end
32       
33HCORFamily = gethcmfamily;
34
35if length(varargin) < 1
36    fract = 1;
37else
38    fract = varargin{1};
39end
40
41if length(varargin) < 2
42    nstep = 5;
43else
44    nstep = varargin{2};
45end
46
47
48setpt = fract * getsp(HCORFamily);
49
50for k = 1:nstep,
51    setsp(HCORFamily, (1-k/nstep)*setpt, [], -1);   
52    if InteractiveFlag
53        disp(['   Step ' num2str(k) ' of ' num2str(nstep) ' Hit Return key to continue (Ctrl-C to stop)']);
54        pause;
55    else
56        pause(0.2)
57    end
58end
Note: See TracBrowser for help on using the repository browser.