Changeset 81 for trunk/src/uvmat.m


Ignore:
Timestamp:
Apr 13, 2010, 10:37:08 AM (14 years ago)
Author:
sommeria
Message:

several bug repairs:
option movie backward introduced for uvmat

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r77 r81  
    628628update_rootinfo(hObject,eventdata,handles)
    629629
    630 
    631 
    632 
    633 
     630%-------------------------------------------------------------------
     631%-- called by action in FileIndex edit box
     632%-------------------------------------------------------------------
     633function FileIndex_Callback(hObject, eventdata, handles)
     634FileIndices=get(handles.FileIndex,'String');
     635if isempty(str2num(FileIndices))
     636    [pp,ff,str1,str2,str_a,str_b]=name2display(FileIndices);
     637else
     638    str1=FileIndices;
     639    str2='';
     640    str_a='';
     641    str_b='';
     642end
     643set(handles.i1,'String',str1);
     644set(handles.i2,'String',str2);
     645set(handles.j1,'String',str_a);
     646set(handles.j2,'String',str_b);
     647run0_Callback(hObject, eventdata, handles)
     648
     649%-------------------------------------------------------------------
     650%-- called by action in FileIndex_1 edit box
     651%-------------------------------------------------------------------
     652function FileIndex_1_Callback(hObject, eventdata, handles)
     653% FileIndices=get(handles.FileIndex_1,'String');
     654% if isempty(str2num(FileIndices))
     655%     [pp,ff,str1,str2,str_a,str_b]=name2display(FileIndices)
     656% else
     657%     str1=FileIndices;
     658%     str2='';
     659%     str_a='';
     660%     str_b='';
     661% end
     662% set(handles.i1,'String',str1);
     663% set(handles.i2,'String',str2);
     664% set(handles.j1,'String',str_a);
     665% set(handles.j2,'String',str_b);
     666run0_Callback(hObject, eventdata, handles)
    634667
    635668%-------------------------------------------------------------------
     
    644677UvData.NewSeries=1; %flag for run0: begin a new series
    645678UvData.TestInputFile=1;
    646 set(handles.fix_pair,'Value',0) % desactivate by default the comp_input '-'input window
     679set(handles.fix_pair,'Value',1) % activate by default the comp_input '-'input window
    647680%FileIndex_Callback(hObject, eventdata, handles)% update field counters
    648681
     
    860893function set_scan_options(hObject, eventdata, handles)
    861894
    862 %  set the corresponding index navigation options (TO CHECK WITH THE SECOND FIELD)
    863 NomType=get(handles.FileIndex,'UserData');
     895%  set the corresponding index navigation options
     896NomType=get(handles.FileIndex,'UserData');       
    864897NomType_1=get(handles.FileIndex_1,'UserData');
     898last_i_str=get(handles.last_i,'String');
     899nbfield=str2num(last_i_str{1});
     900if numel(last_i_str)==2
     901    nbfield=min(nbfield,str2num(last_i_str{2}));
     902end 
    865903state_j='off'; %default
    866 scan_option='i';
     904scan_option='i';%default
    867905switch NomType
    868906    case {'_i_j','_i_j1-j2','_i1-i2_j','#_ab'},% two navigation indices
    869907        state_j='on';
    870         if exist('nbfield','var') && isequal(nbfield,1)
    871             scan_option='j';
    872         else
    873             scan_option='i';               
     908        if isequal(nbfield,1)
     909            scan_option='j';                 
    874910        end
    875911end
     
    878914        case {'_i_j','_i_j1-j2','_i1-i2_j','#_ab'},% two navigation indices
    879915            state_j='on';
    880             if exist('nbfield','var') && isequal(nbfield,1)
    881                 scan_option='j';
    882             else
    883                 scan_option='i';               
    884             end
     916            if isequal(nbfield,1)
     917                scan_option='j';                 
     918            end           
    885919    end
    886920end
     
    10731107    end
    10741108end
    1075 set(handles.FileIndex,'UserData',NomType_1);
     1109set(handles.FileIndex_1,'UserData',NomType_1);
    10761110
    10771111% make visible and fill the second raw of edit boxes
     
    12901324    set(handles.scan_i,'BackgroundColor',[1 1 0])
    12911325    set(handles.scan_j,'Value',0)
    1292     set(handles.scan_j,'BackgroundColor',[0.831 0.816 0.784])
     1326%     set(handles.scan_j,'BackgroundColor',[0.831 0.816 0.784])
    12931327else
    12941328    set(handles.scan_i,'BackgroundColor',[0.831 0.816 0.784])
    12951329    set(handles.scan_j,'Value',1)
    1296     set(handles.scan_j,'BackgroundColor',[1 1 0])
    1297 end
     1330%     set(handles.scan_j,'BackgroundColor',[1 1 0])
     1331end
     1332scan_j_Callback(hObject, eventdata, handles)
    12981333
    12991334%-------------------------------------------------------------------
     
    13051340    set(handles.scan_i,'Value',0)
    13061341    set(handles.scan_i,'BackgroundColor',[0.831 0.816 0.784])
     1342    NomType=get(handles.FileIndex,'UserData');
     1343    switch NomType
     1344    case {'_i_j1-j2','#_ab','%3dab'},% pair with j index
     1345        set(handles.fix_pair,'Visible','on')% option fixed pair on/off made visible (choice of avaible pair with buttons + and - if ='off')
     1346    otherwise
     1347        set(handles.fix_pair,'Visible','off')
     1348    end
    13071349else
    13081350    set(handles.scan_j,'BackgroundColor',[0.831 0.816 0.784])
    13091351    set(handles.scan_i,'Value',1)
    13101352    set(handles.scan_i,'BackgroundColor',[1 1 0])
     1353    set(handles.fix_pair,'Visible','off')
    13111354end
    13121355
     
    15881631
    15891632%-------------------------------------------------------------------
    1590 %Executes on button press in runmin: make one step backward and call
    1591 %run0. The step backward is along the fields series 1 or 2 depending on
    1592 %the scan_i and scan_j check box (exclusive each other)
    1593 %-------------------------------------------------------------------
    1594 function RunMovie_Callback(hObject, eventdata, handles)
     1633% -- Executes on button press in Movie: make a series of +> steps
     1634function Movie_Callback(hObject, eventdata, handles)
    15951635%------------------------------------------------------------------
    1596 set(handles.RunMovie,'BackgroundColor',[1 1 0])%paint the command button in yellow
     1636set(handles.Movie,'BackgroundColor',[1 1 0])%paint the command button in yellow
    15971637drawnow
    15981638increment=str2num(get(handles.increment_scan,'String')); %get the field increment d
     
    16001640set(handles.speed,'Visible','on')
    16011641set(handles.speed_txt,'Visible','on')
    1602 set(handles.RunMovie,'BusyAction','queue')
     1642set(handles.Movie,'BusyAction','queue')
    16031643testavi=0;
    16041644UvData=get(handles.uvmat,'UserData');
    16051645
    1606 while get(handles.speed,'Value')~=0 & isequal(get(handles.RunMovie,'BusyAction'),'queue') % enable STOP command
     1646while get(handles.speed,'Value')~=0 & isequal(get(handles.Movie,'BusyAction'),'queue') % enable STOP command
    16071647        errormsg=runpm(hObject,eventdata,handles,increment);
    16081648        if ~isempty(errormsg)
     
    16151655   set(handles.uvmat,'UserData',UvData);
    16161656end
    1617 set(handles.RunMovie,'BackgroundColor',[1 0 0])%paint the command buttonback to red
     1657set(handles.Movie,'BackgroundColor',[1 0 0])%paint the command buttonback to red
     1658
     1659%-------------------------------------------------------------------
     1660% -- Executes on button press in Movie: make a series of <- steps
     1661function MovieBackward_Callback(hObject, eventdata, handles)
     1662%------------------------------------------------------------------
     1663set(handles.MovieBackward,'BackgroundColor',[1 1 0])%paint the command button in yellow
     1664drawnow
     1665increment=-str2num(get(handles.increment_scan,'String')); %get the field increment d
     1666set(handles.STOP,'Visible','on')
     1667set(handles.speed,'Visible','on')
     1668set(handles.speed_txt,'Visible','on')
     1669set(handles.MovieBackward,'BusyAction','queue')
     1670testavi=0;
     1671UvData=get(handles.uvmat,'UserData');
     1672
     1673while get(handles.speed,'Value')~=0 & isequal(get(handles.MovieBackward,'BusyAction'),'queue') % enable STOP command
     1674        errormsg=runpm(hObject,eventdata,handles,increment);
     1675        if ~isempty(errormsg)
     1676            return
     1677        end
     1678        pause(1.02-get(handles.speed,'Value'))% wait for next image
     1679end
     1680if isfield(UvData,'aviobj') && ~isempty( UvData.aviobj),
     1681    UvData.aviobj=close(UvData.aviobj);
     1682   set(handles.uvmat,'UserData',UvData);
     1683end
     1684set(handles.MovieBackward,'BackgroundColor',[1 0 0])%paint the command buttonback to red
    16181685
    16191686%-------------------------------------------------------------------
     
    16221689set(handles.movie_pair,'BusyAction','Cancel')
    16231690set(handles.movie_pair,'value',0)
    1624 set(handles.RunMovie,'BusyAction','Cancel')
     1691set(handles.Movie,'BusyAction','Cancel')
     1692set(handles.MovieBackward,'BusyAction','Cancel')
    16251693set(handles.MenuExportMovie,'BusyAction','Cancel')
    16261694
     
    16581726
    16591727comp_input=get(handles.fix_pair,'Value');
    1660 if isequal(NomType,'_i1-i2')||isequal(NomType,'_i1-i2_j')
    1661     comp_input=1; %impose a fixed pair
    1662     set(handles.fix_pair,'Value',1)
    1663 end
     1728% if isequal(NomType,'_i1-i2')||isequal(NomType,'_i1-i2_j')
     1729%     comp_input=1; %impose a fixed pair
     1730%     set(handles.fix_pair,'Value',1)
     1731% end
    16641732
    16651733%case of scanning along the first direction (rootfile numbers)
     
    17091777    [indices]=name_generator('',num1,num_a,'',NomType,1,num2,num_b,'');
    17101778    set(handles.FileIndex,'String',indices);
    1711     if sub_value
     1779    if ~isempty(filename_1)
    17121780         indices_1=name_generator('',num1_1,num_a_1,'',NomType_1,1,num2_1,num_b_1,'');
    17131781         set(handles.FileIndex_1,'String',indices_1);
     
    18971965function errormsg=refresh_field(handles,filename,filename_1,num_i1,num_i2,num_j1,num_j2,Field)
    18981966%------------------------------------------------------------------------
     1967
    18991968%initialisation
    19001969set(handles.run0,'BackgroundColor',[1 1 0])%paint the command button in yellow
     
    19261995FileType=[];%default
    19271996if ~isempty(filename)
    1928 %     [filename,RootPath,filebase,xx,Ext]=read_file_boxes(handles);
    19291997    if ~exist(filename,'file')
    19301998        errormsg=['input file ' filename ' does not exist'];
     
    24212489    if NbDim==3
    24222490        nbpoints=UvData.Field.DimValue(DimIndex(1));
    2423         %Zvar=DimVarIndex(DimIndex(1));
    2424          %Zvar=DimVarIndex(1);
    2425 %          Zvar=VarType{imax}.coord_3;
    24262491        if isfield(VarType{imax},'coord_3')&& ~isequal(VarType{imax}.coord_3,0) % z is a dimension variable
    2427             ZName=UvData.Field.ListVarName{VarType{imax}.coord_3}
     2492            ZName=UvData.Field.ListVarName{VarType{imax}.coord_3};
    24282493            eval(['UvData.ZMax=max(UvData.Field.' ZName ');'])
    24292494            eval(['UvData.ZMin=min(UvData.Field.' ZName ');'])
     
    30753140    set(handles.npx,'Visible','on')
    30763141    set(handles.npy,'Visible','on')
    3077     set(handles.fix_pair,'Value',0)
     3142%     set(handles.fix_pair,'Value',0)
    30783143else
    30793144    set(handles.npx_title,'Visible','off')% visible npx,pxcm... buttons
     
    30813146    set(handles.npx,'Visible','off')
    30823147    set(handles.npy,'Visible','off')
    3083     set(handles.fix_pair,'Value',1)
     3148%     set(handles.fix_pair,'Value',1)
    30843149end
    30853150setfield(handles);% update the field structure ('civ1'....)
     
    32463311    set(handles.npx,'Visible','on')
    32473312    set(handles.npy,'Visible','on')
    3248     set(handles.fix_pair,'Value',0)
     3313%     set(handles.fix_pair,'Value',0)
    32493314else
    32503315    set(handles.npx_title,'Visible','off')% visible npx,pxcm... buttons
     
    32523317    set(handles.npx,'Visible','off')
    32533318    set(handles.npy,'Visible','off')
    3254     set(handles.fix_pair,'Value',1)
     3319%     set(handles.fix_pair,'Value',1)
    32553320end
    32563321if isequal(field,'velocity')|isequal(field_1,'velocity');
     
    44154480set(handles.speed,'Visible','on')
    44164481set(handles.speed_txt,'Visible','on')
    4417 set(handles.RunMovie,'BusyAction','queue')
     4482set(handles.Movie,'BusyAction','queue')
    44184483
    44194484imin=str2num(get(handles.i1,'String'));
     
    47594824end
    47604825UvData=get(handles.uvmat,'UserData');
    4761 % [hset_object,UvData.sethandles]=set_object(data);% call the set_object interface
     4826[hset_object,UvData.sethandles]=set_object(data);% call the set_object interface
    47624827% %position the set_object GUI with respect to uvmat
    47634828% pos_uvmat=get(handles.uvmat,'Position');
     
    48664931   
    48674932
     4933
     4934
     4935
     4936
Note: See TracChangeset for help on using the changeset viewer.