Commit cedbdb25 authored by Simone Liuzzo's avatar Simone Liuzzo
Browse files

Merge branch 'excludeBPM' into 'master'

Exclude bpm

See merge request !9
parents 3df88751 9d689522
......@@ -10,9 +10,10 @@ fda='tango:sr/d-bpmlibera/fda_reader';
devfda=dvopen(fda);
dvtimeout(devfda,50);
pause(10); % some times 5s are not enough
XZ=dvcmd(devfda,'ReadXZPositions',n_and_date);
pause(10); % some times 5s are not enough
size(XZ);
X=XZ(1:224*n);
Z=XZ(1+(224*n):448*n);
......
No preview for this file type
......@@ -22,7 +22,7 @@ function varargout = qempanel2(varargin)
% Edit the above text to modify the response to help qempanel2
% Last Modified by GUIDE v2.5 13-Mar-2018 16:07:38
% Last Modified by GUIDE v2.5 24-Aug-2018 14:19:48
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
......@@ -87,6 +87,7 @@ qemres.datadir=dirname;
[qemres,semres,qemb]=qempanelset(dirname,get(handles.PartialRMcheckbox,'Value'));
handles.qemdata=qempaneldata(dirname,handles);
set(handles.edit1,'String',dirname);
set(handles.ExcludeBPMList,'String','');
pushbutton2_Callback(hObject, eventdata, handles); % qem check response
guidata(hObject,handles);
......@@ -126,7 +127,7 @@ set(handles.DCRMcheckbox,'Enable','off')
set(handles.FullRMcheckbox,'Enable','off')
set(handles.PartialRMcheckbox,'Enable','off')
wrongbpms=[];
wrongbpms=qemres.wrongbpms; % find(bpmm.All_Status.read~=0)
[semres.resph,semres.respv]=semloadresp(qemres,semres,wrongbpms);
[qemres.resph,qemres.respv,qemres.frespx,semres.frespz]=qemcheckresp(qemres,semres,wrongbpms);
semres.respiax=load_sriaxresp(qemres.datadir,qemres.opticsdir,'h2v',semres.hlist);
......@@ -156,6 +157,8 @@ else
end
dispfunc=@(i,itot) waitbar(i/itot,hw);
okbpm=true(length(qemres.bpmidx),1);
okbpm(qemres.wrongbpms) = false;
if get(handles.AnalyticFitCheck,'Value') == 1
qemb(2).kn=qempanelfitqAnalytic(qemb(2),qemres,semres,qemres.qpfit,okbpm,qemres.qmode,dispfunc);
else
......@@ -173,6 +176,7 @@ function pushbutton19_Callback(hObject, eventdata, handles)
% handles structure with handles and user data (see GUIDATA)
global qemb qemres semres
okbpm=true(length(qemres.bpmidx),1);
okbpm(qemres.wrongbpms) = false;
set(handles.statustext,'String','fitting dipoles');
if get(handles.AnalyticFitCheck,'Value') == 1
......@@ -637,4 +641,36 @@ if get(handles.PartialRMcheckbox,'Value') % FULL/PARTIAL
set(handles.FullRMcheckbox,'Value',1.0)
disp('Force Full for AC measurement')
end
\ No newline at end of file
function ExcludeBPMList_Callback(hObject, eventdata, handles)
% hObject handle to ExcludeBPMList (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of ExcludeBPMList as text
% str2double(get(hObject,'String')) returns contents of ExcludeBPMList as a double
global qemres
str = get(hObject,'String');
a=cellfun(@str2double,strsplit(str,','));
% append to already excluded BPMs
qemres.wrongbpms = unique([qemres.wrongbpms a]);
mess=[num2str(length(qemres.wrongbpms)) ' bpms not used: ' num2str(qemres.wrongbpms,'%d ')];
set(handles.text3,'String',mess);
pushbutton2_Callback(hObject, eventdata, handles); % qem check response
% --- Executes during object creation, after setting all properties.
function ExcludeBPMList_CreateFcn(hObject, eventdata, handles)
% hObject handle to ExcludeBPMList (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
......@@ -45,7 +45,9 @@ if (isfield(handles,'compare') && handles.compare) || ...
fprintf('residual H = %g m/rad\n', std2(diffh(:)));
fprintf('residual V = %g m/rad\n', std2(diffv(:)));
mess=[mess;' ';['orbit residual = ' num2str(residual)];...
['H disp. residual = ' num2str(hdispresidual)]];
['H disp. residual = ' num2str(hdispresidual)];...
[];...
[num2str(length(qemres.wrongbpms)) ' bpms not used: ' num2str(qemres.wrongbpms,'%d ')]];
qemplotresp(4,diffh,diffv,'deviation');
end
end
......
......@@ -119,6 +119,22 @@ if ~isfield(qemres,'bhrot'), qemres.bhrot=ones(nbpm,1); end
if ~isfield(qemres,'bvrot'), qemres.bvrot=ones(nbpm,1); end
qemres.brot=0.5*(qemres.bhrot+qemres.bvrot);
% store wrong BPMS
if ~isfield(qemres,'wrongbpms') % if this command is reached from Browse, the wrong BPMS must be those defined during the measurement and thus not changed.
try
bpms_dev = tango.Device('sr/d-bpmlibera/all');
actually_disabled_bpms = find(bpms_dev.All_Status.read~=0);
qemres.wrongbpms = actually_disabled_bpms; % index of BPMS that are not green in libera manager.
catch err
disp(err);
qemres.wrongbpms = [];
warning('tango not available');
end
else
disp('This BPMS are disabled: ');
disp(qemres.wrongbpms);
end
elist=sort(selcor(qemres.skcode));
qemres.skewidx=qemres.sextidx(elist);
qemres.skewl=qemres.sxl(elist);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment