Changeset 935 for trunk/src


Ignore:
Timestamp:
Mar 28, 2016, 9:15:18 PM (8 years ago)
Author:
sommeria
Message:

various improvments

Location:
trunk/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/find_file_series.m

    r924 r935  
    6868    i1_series=[];i2_series=[];j1_series=[];j2_series=[];
    6969    i1_input=1;i2_input=[];j1_input=[];j2_input=[];
    70     if ~exist(fullfileinput,'file')
     70    if exist(fullfileinput,'file')~=2
    7171        RootFile='';
    7272        return
  • trunk/src/get_file_info.m

    r924 r935  
    3737function [FileInfo,VideoObject]=get_file_info(fileinput)
    3838VideoObject=[];
    39 if exist(fileinput,'file')
     39if exist(fileinput,'file')==2
    4040    FileInfo.FileName=fileinput;
    4141    FileInfo.FileType='txt'; %default
  • trunk/src/proj_field.m

    r933 r935  
    951951PlaneAngle=[0 0 0];
    952952norm_plane=[0 0 1];
    953 cos_om=1;
    954 sin_om=0;
     953%cos_om=1;
     954%sin_om=0;
    955955test90x=0;%=1 for 90 degree rotation alround x axis
    956956test90y=0;%=1 for 90 degree rotation alround y axis
     
    10521052    ProjData.CoordMesh=FieldData.CoordMesh;
    10531053end
    1054 error=0;%default
    1055 flux=0;
    1056 testfalse=0;
    1057 ListIndex={};
     1054%error=0;%default
     1055%flux=0;
     1056%testfalse=0;
     1057%ListIndex={};
    10581058
    10591059%% group the variables (fields of 'FieldData') in cells of variables with the same dimensions
     
    13401340            if strcmp(ProjMode{icell},'interp_tps')
    13411341                Coord=FieldData.(FieldData.ListVarName{CellInfo{icell}.CoordIndex});
     1342               
     1343               
     1344                coord_x=Coord(:,1,:);% initial x coordinates
     1345            coord_y=Coord(:,2,:);% initial y coordinates
     1346            check3D=(numel(CellInfo{icell}.CoordIndex)==3);
     1347            if check3D
     1348                coord_z=Coord(:,3,:);
     1349            end
     1350           
     1351            % translate  initial coordinates to account for the new origin
     1352            coord_x=coord_x-ObjectData.Coord(1,1);
     1353            coord_y=coord_y-ObjectData.Coord(1,2);
     1354            if check3D
     1355                coord_z=coord_z-ObjectData.Coord(1,3);
     1356            end
     1357           
     1358            % selection of the vectors in the projection range (3D case)
     1359            if check3D &&  width > 0
     1360                %components of the unitiy vector normal to the projection plane
     1361                fieldZ=norm_plane(1)*coord_x + norm_plane(2)*coord_y+ norm_plane(3)*coord_z;% distance to the plane
     1362                indcut=find(abs(fieldZ) <= width);
     1363                for ivar=VarIndex
     1364                    VarName=FieldData.ListVarName{ivar};
     1365                    FieldData.(VarName)=FieldData.(VarName)(indcut);
     1366                end
     1367                coord_x=coord_x(indcut);
     1368                coord_y=coord_y(indcut);
     1369                coord_z=coord_z(indcut);
     1370            end
     1371           
     1372            %rotate coordinates if needed: coord_X,coord_Y= = coordinates in the new plane
     1373            Psi=PlaneAngle(1);
     1374            Theta=PlaneAngle(2);
     1375            Phi=PlaneAngle(3);
     1376            if testangle && ~test90y && ~test90x;%=1 for slanted plane
     1377                coord_X=(coord_x *cos(Phi) + coord_y* sin(Phi));
     1378                coord_Y=(-coord_x *sin(Phi) + coord_y *cos(Phi))*cos(Theta);
     1379                coord_Y=coord_Y+coord_z *sin(Theta);
     1380                coord_X=(coord_X *cos(Psi) - coord_Y* sin(Psi));%A VERIFIER
     1381                coord_Y=(coord_X *sin(Psi) + coord_Y* cos(Psi));
     1382            else
     1383                coord_X=coord_x;
     1384                coord_Y=coord_y;
     1385            end
     1386           
     1387            %restriction to the range of X and Y if imposed by the projection object
     1388
     1389               
     1390                Coord(:,1,:)=coord_X;% initial x coordinates
     1391            Coord(:,2,:)=coord_Y;% initial y coordinates
     1392               
     1393               
    13421394                NbCentres=FieldData.(FieldData.ListVarName{CellInfo{icell}.NbCentres_tps});
    13431395                SubRange=FieldData.(FieldData.ListVarName{CellInfo{icell}.SubRange_tps});
  • trunk/src/series.m

    r934 r935  
    518518set(handles.InputTable,'Data',InputTable)
    519519REFRESH_Callback(hObject, eventdata, handles)
    520 % DataSeries=fullfile(OutPut.Campaign,OutPut.Experiment{1},OutPut.DataSeries{1});
    521 % fileinput=uigetfile_uvmat('pick an input file',DataSeries);
    522 % hh=dir(fileinput);
    523 % if numel(hh)>1
    524 %     msgbox_uvmat('ERROR','invalid input, probably a broken link');
     520
     521
     522% %------------------------------------------------------------------------
     523% % --- fct activated by the browser under 'Open campaign/Browse...'
     524% %------------------------------------------------------------------------
     525% function MenuBrowseCampaignAppend_Callback(hObject, eventdata, handles)
     526% append='append';
     527% browse_campaign(handles,append);
     528
     529% %------------------------------------------------------------------------
     530% function browse_campaign(handles,append);
     531%
     532% %% look for the previously opened file 'oldfile'
     533%
     534% %
     535% %
     536% % InputTable=get(handles.InputTable,'Data');
     537% % RootPath=InputTable{1,1};
     538% % CampaignPath=fileparts(fileparts(RootPath));
     539% % DirFull=uigetfile_uvmat('define this path as the Campaign folder:',CampaignPath,'uigetdir');
     540% % if ~ischar(DirFull)|| ~exist(DirFull,'dir')
     541% %     return
     542% % end
     543% OutPut=browse_data(oldfile);% open the GUI browse_data to get select a campaign dir, experiment and device
     544% if ~isfield(OutPut,'Campaign')
     545%     return
     546% end
     547% DirName=fullfile(OutPut.Campaign,OutPut.Experiment{1},OutPut.DataSeries{1});
     548% ListStruct=dir(DirName); %list files and the dir DataSeries
     549% % select the first appropriate file in the dir
     550% FileName='';
     551% for ilist=1:numel(ListStruct)
     552%     if ~isequal(ListStruct(ilist).isdir,1)%look for files, not dir
     553%         FileName=ListStruct(ilist).name;
     554%         FileInfo=get_file_info(fullfile(DirName,FileName));
     555%         switch FileInfo.FileType
     556%             case {'image','multimage','civx','civdata','netcdf'}
     557%                 break
     558%         end
     559%     end
     560% end
     561% if isempty(FileName)
     562%     msgbox_uvmat('ERROR',['no appropriate input file in the DataSeries folder ' fullfile(DirName)])
    525563%     return
    526564% end
    527565%
    528 %
    529 %
    530 % %% launch the browser
    531 % fileinput=uigetfile_uvmat('pick an input file in the series',oldfile);
    532 % hh=dir(fileinput);
    533 % if numel(hh)>1
    534 %     msgbox_uvmat('ERROR','invalid input, probably a broken link');
    535 % else
    536 %     if ~isempty(fileinput)
    537 %         display_file_name(handles,fileinput,'one')
     566% %% update the list of campaigns in the menubar
     567% MenuCampaign=[{get(handles.MenuCampaign_1,'Label')};{get(handles.MenuCampaign_2,'Label')};...
     568%     {get(handles.MenuCampaign_3,'Label')};{get(handles.MenuCampaign_4,'Label')};{get(handles.MenuCampaign_5,'Label')}];
     569% check_dir=isempty(find(strcmp(DirName,MenuCampaign)));
     570% if check_dir %insert the new campaign in the list if it is not found
     571%     MenuCampaign(end)=[]; %suppress the last item
     572%     MenuCampaign=[{DirName};MenuCampaign];%insert the new campaign
     573%     for ilist=1:numel(MenuCampaign)
     574%         set(handles.(['MenuCampaign_' num2str(ilist)]),'Label',MenuCampaign{ilist})
     575%     end
     576%     % save the list for future opening:
     577%     dir_perso=prefdir;
     578%     profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
     579%     if exist(profil_perso,'file')
     580%         save (profil_perso,'MenuCampaign','-append'); %store the file names for future opening of uvmat
     581%     else
     582%         save (profil_perso,'MenuCampaign','-V6'); %store the file names for future opening of uvmat
    538583%     end
    539584% end
    540 % append='one';
    541 % set(handles.MenuOpenCampaign,'ForegroundColor',[1 1 0])
    542 % drawnow
    543 % browse_campaign(handles,append);
    544 
    545 %------------------------------------------------------------------------
    546 % --- fct activated by the browser under 'Open campaign/Browse...'
    547 %------------------------------------------------------------------------
    548 function MenuBrowseCampaignAppend_Callback(hObject, eventdata, handles)
    549 append='append';
    550 browse_campaign(handles,append);
    551 
    552 %------------------------------------------------------------------------
    553 function browse_campaign(handles,append);
    554 
    555 %% look for the previously opened file 'oldfile'
    556 
    557585%
    558 %
    559 % InputTable=get(handles.InputTable,'Data');
    560 % RootPath=InputTable{1,1};
    561 % CampaignPath=fileparts(fileparts(RootPath));
    562 % DirFull=uigetfile_uvmat('define this path as the Campaign folder:',CampaignPath,'uigetdir');
    563 % if ~ischar(DirFull)|| ~exist(DirFull,'dir')
    564 %     return
     586% %% display the selected field and related information
     587% if get(handles.CheckAppend,'Value')
     588%     display_file_name(handles,fullfile(DirName,FileName),'append')
     589% else
     590%     display_file_name(handles,fullfile(DirName,FileName),'one')
    565591% end
    566 OutPut=browse_data(oldfile);% open the GUI browse_data to get select a campaign dir, experiment and device
    567 if ~isfield(OutPut,'Campaign')
    568     return
    569 end
    570 DirName=fullfile(OutPut.Campaign,OutPut.Experiment{1},OutPut.DataSeries{1});
    571 ListStruct=dir(DirName); %list files and the dir DataSeries
    572 % select the first appropriate file in the dir
    573 FileName='';
    574 for ilist=1:numel(ListStruct)
    575     if ~isequal(ListStruct(ilist).isdir,1)%look for files, not dir
    576         FileName=ListStruct(ilist).name;
    577         FileInfo=get_file_info(fullfile(DirName,FileName));
    578         switch FileInfo.FileType
    579             case {'image','multimage','civx','civdata','netcdf'}
    580                 break
    581         end
    582     end
    583 end
    584 if isempty(FileName)
    585     msgbox_uvmat('ERROR',['no appropriate input file in the DataSeries folder ' fullfile(DirName)])
    586     return
    587 end
    588 
    589 %% update the list of campaigns in the menubar
    590 MenuCampaign=[{get(handles.MenuCampaign_1,'Label')};{get(handles.MenuCampaign_2,'Label')};...
    591     {get(handles.MenuCampaign_3,'Label')};{get(handles.MenuCampaign_4,'Label')};{get(handles.MenuCampaign_5,'Label')}];
    592 check_dir=isempty(find(strcmp(DirName,MenuCampaign)));
    593 if check_dir %insert the new campaign in the list if it is not found
    594     MenuCampaign(end)=[]; %suppress the last item
    595     MenuCampaign=[{DirName};MenuCampaign];%insert the new campaign
    596     for ilist=1:numel(MenuCampaign)
    597         set(handles.(['MenuCampaign_' num2str(ilist)]),'Label',MenuCampaign{ilist})
    598     end
    599     % save the list for future opening:
    600     dir_perso=prefdir;
    601     profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
    602     if exist(profil_perso,'file')
    603         save (profil_perso,'MenuCampaign','-append'); %store the file names for future opening of uvmat
    604     else
    605         save (profil_perso,'MenuCampaign','-V6'); %store the file names for future opening of uvmat
    606     end
    607 end
    608 
    609 %% display the selected field and related information
    610 if get(handles.CheckAppend,'Value')
    611     display_file_name(handles,fullfile(DirName,FileName),'append')
    612 else
    613     display_file_name(handles,fullfile(DirName,FileName),'one')
    614 end
    615 set(handles.MenuOpenCampaign,'ForegroundColor',[0 0 0])
     592% set(handles.MenuOpenCampaign,'ForegroundColor',[0 0 0])
    616593
    617594% --------------------------------------------------------------------
     
    619596% --------------------------------------------------------------------
    620597set(handles.MenuOpenCampaign,'ForegroundColor',[1 1 0])
    621 OutPut=browse_data(get(hObject,'Label'));% open the GUI browse_data to get select a campaign dir, experiment and device
     598OutPut=browse_data(get(hObject,'Label'),'on','on');% open the GUI browse_data to get select a campaign dir, experiment and device
    622599if ~isfield(OutPut,'Campaign')
    623600    return
    624601end
    625 DirName=fullfile(OutPut.Campaign,OutPut.Experiment{1},OutPut.DataSeries{1});
    626 hdir=dir(DirName); %list files and dirs
    627 for ilist=1:numel(hdir)
    628     if ~isequal(hdir(ilist).isdir,1)%look for files, not dir
    629         FileName=hdir(ilist).name;
    630         FileInfo=get_file_info(fullfile(DirName,FileName));
    631         switch FileInfo.FileType
    632             case {'image','multimage','civx','civdata','netcdf'}
    633             break
    634         end
    635     end
    636 end
    637 if get(handles.CheckAppend,'Value')
    638     display_file_name(handles,fullfile(DirName,FileName),'append')
    639 else
    640     display_file_name(handles,fullfile(DirName,FileName),'one')
    641 end
    642 set(handles.MenuOpenCampaign,'ForegroundColor',[0 0 0])
     602NbLines=numel(OutPut.Experiment)*numel(OutPut.DataSeries);
     603icount=0;
     604InputTable=get(handles.InputTable,'Data');
     605for iexp=1:numel(OutPut.Experiment)
     606    for idevice=1:numel(OutPut.DataSeries)
     607        icount=icount+1;
     608        InputTable{icount,1}=fullfile(OutPut.Campaign,OutPut.Experiment{iexp});
     609        InputTable{icount,2}=OutPut.DataSeries{idevice};
     610        if isempty(InputTable{icount,3})
     611            if icount>1
     612                InputTable{icount,3}=InputTable{icount-1,3};
     613            else
     614                InputTable{icount,3}='';
     615            end
     616        end
     617        if isempty(InputTable{icount,4})
     618            if icount>1
     619                InputTable{icount,4}=InputTable{icount-1,4};
     620            else
     621                InputTable{icount,4}='';
     622            end
     623        end
     624        if isempty(InputTable{icount,5})
     625            if icount>1
     626                InputTable{icount,5}=InputTable{icount-1,5};
     627            else
     628                InputTable{icount,5}='';
     629            end
     630        end
     631    end
     632end
     633if size(InputTable,1)>icount
     634    InputTable(icount+1:size(InputTable,1),:)=[];
     635end
     636set(handles.InputTable,'Data',InputTable)
     637REFRESH_Callback(hObject, eventdata, handles)
     638
     639
     640% DirName=fullfile(OutPut.Campaign,OutPut.Experiment{1},OutPut.DataSeries{1});
     641% hdir=dir(DirName); %list files and dirs
     642% for ilist=1:numel(hdir)
     643%     if ~isequal(hdir(ilist).isdir,1)%look for files, not dir
     644%         FileName=hdir(ilist).name;
     645%         FileInfo=get_file_info(fullfile(DirName,FileName));
     646%         switch FileInfo.FileType
     647%             case {'image','multimage','civx','civdata','netcdf'}
     648%             break
     649%         end
     650%     end
     651% end
     652% if get(handles.CheckAppend,'Value')
     653%     display_file_name(handles,fullfile(DirName,FileName),'append')
     654% else
     655%     display_file_name(handles,fullfile(DirName,FileName),'one')
     656% end
     657% set(handles.MenuOpenCampaign,'ForegroundColor',[0 0 0])
    643658
    644659
     
    16101625        NbCore=1;% no need to split the calculation
    16111626    case 'cluster_oar'
    1612         if strcmp(ActionExt,'.m')% case of Matlab function (uncompiled)
    1613             NbCore=1;% one core used only (limitation of Matlab licences)
    1614             answer=msgbox_uvmat('INPUT_Y-N','Number of cores =1: select the compiled version .sh for multi-core processing. Proceed with the .m version?');
    1615             if ~strcmp(answer,'Yes')
    1616                 errormsg='Action launch interrupted by user';
    1617                 return
    1618             end
    1619             extra_oar='';
    1620         else
     1627        %%%%% TEST A REMETTRE%%%%%
     1628 %       if strcmp(ActionExt,'.m')% case of Matlab function (uncompiled)
     1629%             NbCore=1;% one core used only (limitation of Matlab licences)
     1630%             answer=msgbox_uvmat('INPUT_Y-N','Number of cores =1: select the compiled version .sh for multi-core processing. Proceed with the .m version?');
     1631%             if ~strcmp(answer,'Yes')
     1632%                 errormsg='Action launch interrupted by user';
     1633%                 return
     1634%             end
     1635%             extra_oar='';
     1636 %       else
    16211637            answer=inputdlg({'Number of cores (max 36)','extra oar options'},'oarsub parameter',1,{'12',''});
    16221638            if isempty(answer)
     
    16261642            NbCore=str2double(answer{1});
    16271643            extra_oar=answer{2};
    1628         end
     1644 %       end
    16291645    case 'cluster_pbs'
    16301646        if strcmp(ActionExt,'.m')% case of Matlab function (uncompiled)
     
    16981714DirXml=fullfile(OutputDir,'0_XML');
    16991715if ~exist(DirXml,'dir')
    1700     [tild,msg1]=mkdir(DirXml);
     1716    [~,msg1]=mkdir(DirXml);
    17011717    if ~strcmp(msg1,'')
    17021718        errormsg=['cannot create ' DirXml ': ' msg1];%error message for directory creation
     
    21132129end
    21142130if exist(OutputDir,'dir')
     2131    [SUCCESS,MESSAGE,MESSAGEID] = fileattrib (OutputDir)
     2132    if MESSAGE.GroupWrite~=1
    21152133    [success,msg] = fileattrib(OutputDir,'+w','g','s');% allow writing access for the group of users, recursively in the folder
    21162134    if success==0
    2117         msgbox_uvmat('WARNING',{['unable to set group write access to ' OutputDir ':']; msg1});%error message for directory creation
     2135        msgbox_uvmat('WARNING',{['unable to set group write access to ' OutputDir ':']; msg});%error message for directory creation
     2136    end
    21182137    end
    21192138end
  • trunk/src/series/extract_rdvision.m

    r932 r935  
    469469NbDti=size(timestamp,1); %default for series or burst
    470470uid_motor_nbslice=find(t,'ImaDoc/TranslationMotor/Nbslice');
    471 if ~isempty(uid_motor_nbslice)
     471uid_nbDtk=find(t,'ImaDoc/TranslationMotor/NbDtk');
     472if ~isempty(uid_motor_nbslice)&& ~isempty(uid_nbDtk)
    472473    uid_content=get(t,uid_motor_nbslice,'contents');
    473474    NbSlice=str2num(get(t,uid_content,'value'));
    474475    NbDti=NbSlice-1;
    475 uid_NbDti=find(t,'ImaDoc/Camera/BurstTiming/NbDti');
    476 uid_content=get(t,uid_NbDti,'contents');
    477 t=set(t,uid_content,'value',num2str(NbDti));
     476    uid_NbDti=find(t,'ImaDoc/Camera/BurstTiming/NbDti');
     477    uid_content=get(t,uid_NbDti,'contents');
     478    t=set(t,uid_content,'value',num2str(NbDti));
    478479end
    479480
     
    510511       [success,msg] = fileattrib(newxml,'+w','g');% allow writing access for the group of users 
    511512        if success==0
    512             msgbox_uvmat('WARNING',{['unable to set group write access to ' newxml ':']; msg1});%error message for directory creation
     513            msgbox_uvmat('WARNING',{['unable to set group write access to ' newxml ':']; msg});%error message for directory creation
    513514        end
    514515
  • trunk/src/transform_field/phys_polar.m

    r933 r935  
    6767    DataOut.TransformInput.PolarReferenceRadius=str2num(answer{2});
    6868    DataOut.TransformInput.PolarReferenceAngle=str2num(answer{3});
     69    if isfield(XmlData,'GeometryCalib')&& isfield(XmlData.GeometryCalib,'CoordUnit')
     70        DataOut.CoordUnit=XmlData.GeometryCalib.CoordUnit;% states that the output is in unit defined by GeometryCalib, then erased all projection objects with different units
     71    end
    6972    return
    7073end
  • trunk/src/uvmat.m

    r934 r935  
    35853585    if isfield(UvData,'XmlData')%use geometry calib recorded from the ImaDoc xml file as first priority
    35863586        XmlData=UvData.XmlData{1};
     3587        if isfield(UvData,'TransformInput')
     3588            XmlData.TransformInput=UvData.TransformInput;
     3589        end
    35873590        if numel(UvData.XmlData)==2
    35883591            XmlData_1=UvData.XmlData{2};
     
    49494952            XmlData=UvData.XmlData{1};
    49504953        end
     4954        if isfield(UvData,'TransformInput')
     4955            XmlData.TransformInput=UvData.TransformInput;
     4956        end
    49514957        UvData.Field.Action.RUN=0;% indicate that the transform fct is called only to get input param
    49524958        DataOut=feval(transform_handle,UvData.Field,XmlData);% execute the transform fct to get the required conditions
     
    49584964        end
    49594965        if isfield(DataOut,'TransformInput')%  used to add transform parameters at selection of the transform fct
    4960             UvData.XmlData{1}.TransformInput=DataOut.TransformInput;
     4966            UvData.TransformInput=DataOut.TransformInput;
    49614967        end
    49624968    end
Note: See TracChangeset for help on using the changeset viewer.