1+ function varargout = frequency_control(func ,ring ,varargin )
2+ % FREQUENCY_CONTROL Private. Handle off-momentum for 6D lattice
3+ %
4+ % VARARGOUT=FREQUENCY_CONTROL(FUNC,RING,VARARGIN)
5+ %
6+ % FUNC Wrapped function, called as FUNC(RING,VARARGIN{:},'is6d',IS6D)
7+
8+ [warningdp6d ,varargs ]=getoption(varargin ,' WarningDp6D' );
9+ [is_6d , varargs ]= getoption(varargs , ' is_6d' , []);
10+ if isempty(is_6d ), is_6d= atGetRingProperties(ring ,' is_6d' ); end
11+ if is_6d
12+ [dpargs ,varargs ]=getoption(varargs ,{' dp' ,' dct' ,' df' });
13+ if ~isempty(dpargs )
14+ if warningdp6d
15+ warning(' AT:Dp6D' ,' \n%s\n%s\n%s ' ,...
16+ ' Specifying "dp" for a 6D lattice creates a copy with a modified RF frequency.' ,...
17+ ' For a better efficiency, handle the RF frequency beforehand,' ,...
18+ ' or to avoid this warning, use "setoption('' WarningDp6D'' ,false)"' );
19+ end
20+ [cavargs ,~ ]=getoption(varargs ,{' cavpts' });
21+ ring2= atsetcavity(ring ,' Frequency' ,' nominal' ,dpargs{: },cavargs{: });
22+ [varargout{1 : nargout }]=func(ring2 ,varargs{: },' is_6d' ,is_6d );
23+ else
24+ [varargout{1 : nargout }]=func(ring ,varargs{: },' is_6d' ,is_6d );
25+ end
26+ else
27+ [varargout{1 : nargout }]=func(ring ,varargs{: },' is_6d' ,is_6d );
28+ end
29+ end
0 commit comments