Changeset 1096 for trunk


Ignore:
Timestamp:
Apr 2, 2021, 3:57:01 PM (4 years ago)
Author:
sommeria
Message:

bugs fixed

Location:
trunk/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/proj_field.m

    r1095 r1096  
    10741074end
    10751075
    1076 %% initiate Matlab  structure for physical field
     1076%% initiate Matlab  structure for physical fieldopen
    10771077[ProjData,errormsg]=proj_heading(FieldData,ObjectData);
    10781078if ~isempty(errormsg)
     
    12041204    ProjData.VarAttribute{1}.Role='coord_y';
    12051205    ProjData.VarAttribute{2}.Role='coord_x';
     1206    YAttribute=[];
     1207    XAttribute=[];
    12061208    if ~isempty(icell_grid)
    12071209            YAttribute=FieldData.VarAttribute{CellInfo{icell_grid}.CoordIndex(NbDim-1)};
  • trunk/src/series.m

    r1095 r1096  
    627627    empty_line(iline)= isempty(cell2mat(InputTable(iline,1:3)));
    628628end
    629 if ~isempty(find(empty_line));
     629if ~isempty(find(empty_line,1))
    630630    InputTable(empty_line,:)=[]; % remove empty lines
    631631    set(handles.InputTable,'Data',InputTable)
     
    743743
    744744%% enable other menus and uicontrols
    745 % set(handles.MenuOpenCampaign,'Enable','on')
    746 % set(handles.MenuCampaign_1,'Enable','on')
    747 % set(handles.MenuCampaign_2,'Enable','on')
    748 % set(handles.MenuCampaign_3,'Enable','on')
    749 % set(handles.MenuCampaign_4,'Enable','on')
    750 % set(handles.MenuCampaign_5,'Enable','on')
    751745set(handles.RUN, 'Enable','On')
    752746set(handles.RUN,'BackgroundColor',[1 0 0])% set RUN button to red
     
    758752InputTable=get(handles.InputTable,'Data');
    759753SeriesData=get(handles.series,'UserData');
     754
    760755if strcmp(iview,'append') % display the input data as a new line in the table
    761756    iview=size(InputTable,1)+1; % the next line in InputTable becomes the current line
    762 %     InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}];
    763757elseif strcmp(iview,'one') % refresh the list of  input  file series
    764758    iview=1; % the first line in InputTable becomes the current line
    765759    InputTable={'','','','',''};
    766 %     InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}];
    767760    set(handles.TimeTable,'Data',[{''},{[]},{[]},{[]},{[]}])
    768761    set(handles.MinIndex_i,'Data',[])
     
    860853SeriesData.Ref_j1=j1;
    861854SeriesData.Ref_j2=j2;
     855
     856%% define the path for the output files
     857[InputPath,Device,DeviceExt]=fileparts(InputTable{1,1});
     858[InputPath,Experiment,ExperimentExt]=fileparts(InputPath);
     859[~,InputPath,InputPathExt]=fileparts(InputPath);
     860set(handles.Device,'String',[Device DeviceExt])
     861set(handles.Experiment,'String',[Experiment ExperimentExt])
     862if ~isempty(regexp(InputTable{1,1},'(^http://)|(^https://)'))
     863    set(handles.OutputPathBrowse,'Value',1)% an output folder needs to be specified for OpenDAP data
     864end
     865
     866%update the output path if needed
     867if ~(isfield(SeriesData,'InputPath') && strcmp(SeriesData.InputPath,InputPath))
     868    if get(handles.OutputPathBrowse,'Value')==1  % fix the output path in manual mode
     869        OutputPathOld=get(handles.OutputPath,'String');
     870        OutputPath=uigetdir(OutputPathOld,'pick a root folder for output data');
     871        set(handles.OutputPath,'String',OutputPath)
     872    else %reproduce the input path for output
     873        set(handles.OutputPath,'String',InputPath)
     874    end
     875    SeriesData.InputPath=InputPath;
     876end
     877
    862878set(handles.series,'UserData',SeriesData)
    863879
     
    10291045        end
    10301046    end
    1031    
    1032 %     if isfield(XmlData,'GeometryCalib')
    1033 %         check_calib=1;
    1034 %         if isfield(XmlData.GeometryCalib,'SliceCoord')
    1035 %             siz=size(XmlData.GeometryCalib.SliceCoord);
    1036 %             if ~isempty(NbSlice)&& ~isequal(size(1),NbSlice)
    1037 %                 msgbox_uvmat('WARNING','inconsistent numbers of Z indices between motor and calibration');
    1038 %             else
    1039 %                 NbSlice=siz(1);
    1040 %             end
    1041 %         end
    1042 %     end
    10431047end
    10441048if ~isempty(NbSlice)
     
    10501054if ~isempty(VideoObject)% case of movies
    10511055    imainfo=get(VideoObject);
    1052     if isempty(j1_series); % frame index along i
     1056    if isempty(j1_series) % frame index along i
    10531057        Time=zeros(imainfo.NumberOfFrames+1,2);
    10541058        Time(:,2)=(0:1/imainfo.FrameRate:(imainfo.NumberOfFrames)/imainfo.FrameRate)';
     
    10691073        TimeLast=Time(last_i+1,last_j+1);
    10701074    end
    1071     if size(Time)>=[MaxIndex_i+1 MaxIndex_j+1];
     1075    if size(Time)>=[MaxIndex_i+1 MaxIndex_j+1]
    10721076        TimeMax=Time(MaxIndex_i+1,MaxIndex_j+1);
    10731077    end
     
    11341138    j_max{iline}=max(pair_max,[],1); % max on j index
    11351139    if ~isempty(j_max{iline})
    1136     MaxIndex_i(iline)=max(find(j_max{iline}))-1; % max ref index i
    1137     MinIndex_i(iline)=min(find(j_max{iline}))-1; % min ref index i
     1140    MaxIndex_i(iline)=find(j_max{iline}, 1, 'last' )-1; % max ref index i
     1141    MinIndex_i(iline)=find(j_max{iline}, 1 )-1; % min ref index i
    11381142    end
    11391143end
     
    11491153    LineData=zeros(size(file_indices));
    11501154    file_select=file_indices(file_indices<=numel(j_max{iline}));
    1151     ind_select=find(file_indices<=numel(j_max{iline}));
     1155    ind_select=file_indices<=numel(j_max{iline});
    11521156    LineData(ind_select)=j_max{iline}(file_select)~=0;
    11531157    CData(ind_y,:)=ones(size(ind_y'))*LineData;
     
    11981202
    11991203%------------------------------------------------------------------------
     1204%fill the menu of possible pairs as input
    12001205function displ_pair=update_listpair(i1_series,i2_series,j1_series,j2_series,mode,time,TimeUnit,ref_i,ref_j,TimeName,InputTable,FileInfo)
    12011206%------------------------------------------------------------------------
     
    12121217        max_diff=max(diff_i(diff_i>0));
    12131218        for ipair=min_diff:max_diff
    1214             if numel(diff_i(diff_i==ipair))>0
     1219            if ~isempty(find(diff_i==ipair,1))% if the considered difference exists as input
    12151220                pair_string=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ];
    1216                 if ~isempty(time)
     1221                if size(time,1)>=ref_i+ceil(ipair/2)
    12171222                    if ref_i<=floor(ipair/2)
    12181223                        ref_i=floor(ipair/2)+1; % shift ref_i to get the first pair
     
    21372142            [status,result]=system(oar_command)% execute system command and show the result (ID number of the launched job) on the Matlab command window
    21382143            filename_oarcommand=fullfile(DIR_CLUSTER,'0_cluster_command'); % keep track of the command in file '0-OAR/0_cluster_command'
    2139             fid=fopen(filename_oarcommand,'w');
     2144            [fid,errormsg]=fopen(filename_oarcommand,'w');
     2145            if ~isempty(errormsg)
     2146                msgbox_uvmat('ERROR',['cannot create ' filename_oarcommand ': ' errormsg])
     2147                return
     2148            end
    21402149            fprintf(fid,oar_command); % store the command
    21412150            fprintf(fid,result); % store the result (job ID number)
     
    27232732set(handles.Experiment,'Visible','on')
    27242733set(handles.Experiment_title,'Visible','on')
    2725 OutputPathOld=get(handles.OutputPath,'String')
    2726 if isempty(OutputPathOld)
    2727     if ~isempty(regexp(InputTable{1,1},'(^http://)|(^https://)'))
    2728         OutputPath=uigetdir(pwd,'pick a root folder for output data');
    2729     end
    2730     set(handles.OutputPath,'String',OutputPath)
    2731 end
    27322734set(handles.Experiment_title,'Visible','on')
    27332735set(handles.OutputPath,'Visible','on')
     
    27772779set(handles.OutputDirExt,'Visible',OutputDirVisible)
    27782780set(handles.OutputSubDir,'Visible',OutputDirVisible)
    2779 set(handles.OutputDir_title,'Visible',OutputDirVisible)
     2781% set(handles.OutputDir_title,'Visible',OutputDirVisible)
    27802782SeriesData.ActionName=ActionName; % record ActionName for next use
    27812783
     
    39513953
    39523954function OutputPath_Callback(hObject, eventdata, handles)
    3953 % hObject    handle to OutputPath (see GCBO)
    3954 % eventdata  reserved - to be defined in a future version of MATLAB
    3955 % handles    structure with handles and user data (see GUIDATA)
    3956 
    3957 % Hints: get(hObject,'String') returns contents of OutputPath as text
    3958 %        str2double(get(hObject,'String')) returns contents of OutputPath as a doubl
    3959 
    39603955
    39613956
    39623957function Experiment_Callback(hObject, eventdata, handles)
    3963 % hObject    handle to Experiment (see GCBO)
    3964 % eventdata  reserved - to be defined in a future version of MATLAB
    3965 % handles    structure with handles and user data (see GUIDATA)
    3966 
    3967 % Hints: get(hObject,'String') returns contents of Experiment as text
    3968 %        str2double(get(hObject,'String')) returns contents of Experiment as a double
    39693958
    39703959
    39713960function Device_Callback(hObject, eventdata, handles)
    3972 % hObject    handle to Device (see GCBO)
    3973 % eventdata  reserved - to be defined in a future version of MATLAB
    3974 % handles    structure with handles and user data (see GUIDATA)
    3975 
    39763961
    39773962
    39783963% --- Executes on button press in OutputPathBrowse.
    39793964function OutputPathBrowse_Callback(hObject, eventdata, handles)
     3965CheckValue=get(handles.OutputPathBrowse,'Value');
     3966if CheckValue
    39803967OutputPath=uigetdir(get(handles.OutputPath,'String'));
    39813968set(handles.OutputPath,'String',OutputPath)
     3969else
     3970    InputTable=get(handles.InputTable,'Data');
     3971    set(handles.OutputPath,'String',InputTable{1,1})
     3972end
  • trunk/src/series/civ_series.m

    r1095 r1096  
    331331    end
    332332    if CheckInputFile
    333         OutputPath=fullfile(Param.OutputPath,Param.Experiment,Param.Device);
     333        OutputPath=fullfile(Param.OutputPath,num2str(Param.Experiment),num2str(Param.Device));
    334334        if iview_A==0 % no nc file has been entered
    335335            ncfile=fullfile_uvmat(OutputPath,Param.InputTable{1,2},Param.InputTable{1,3},Param.InputTable{1,5},...
  • trunk/src/series/merge_proj.m

    r1094 r1096  
    8383    if ~exist(FirstFileName,'file')
    8484        msgbox_uvmat('WARNING',['the first input file ' FirstFileName ' does not exist'])
    85     elseif isequal(size(Param.InputTable,1),1) && ~isfield(Param,'ProjObject')
    86         msgbox_uvmat('WARNING','You may need a projection object of type plane for merge_proj')
    8785    end
    8886    return
     
    252250    CheckOverwrite=Param.CheckOverwrite;
    253251end
    254 OutputPath=fullfile(Param.OutputPath,Param.Experiment,Param.Device);
     252OutputPath=fullfile(Param.OutputPath,num2str(Param.Experiment),num2str(Param.Device));
    255253
    256254for index=1:NbField
  • trunk/src/series/sliding_average.m

    r1095 r1096  
    185185
    186186%% initialisation
    187 T=24.4; %main wave period
    188 t0=3; % time for motion start (torus at its maximum x)
     187char_index=regexp(SubDir{1},'waves_L1_');
     188switch(SubDir{1}(char_index+9))
     189    case '1'
     190        amplitude=2.5 %oscillation amplitude
     191        T=24.46;
     192        t0=3 ;% dt=0.5 s, torus at its max x at the beginning of motion, i0=7
     193    case '2'
     194        amplitude=5 %oscillation amplitude
     195        T=24.47;
     196        t0=8.5; % dt=1/3 s -> image index of starting motion = 26, % torus at its max x at the beginning of motion
     197    case '3'
     198        amplitude=10 %oscillation amplitude
     199        T=24.45;
     200        t0=6.5-T/2;% dt=0.25, torus at its minimum x at the beginning of motion
     201    case '4' 
     202        amplitude=15 %oscillation amplitude
     203        T=24.48;
     204        t0=3.4;     %dt=0.2 -> i0=18 image index of starting motion, % torus at its max x at the beginning of motion
     205end
    189206NbPeriod=2; %number of periods for the sliding average
    190207omega=2*pi/T;
    191 amplitude=2.5; %oscillation amplitude
    192208Lscale=15;%diameter of the torus, length scale for normalisation
    193209Uscale=amplitude*omega;
     
    214230NpTime=round(NbPeriod*T/dt+1);
    215231
    216 OutputPath=fullfile(Param.OutputPath,Param.Experiment,Param.Device);
     232OutputPath=fullfile(Param.OutputPath,num2str(Param.Experiment),num2str(Param.Device));
    217233RootFileOut=RootFile{1};
    218234NomTypeOut='_1';
  • trunk/src/struct2nc.m

    r1093 r1096  
    4242    return
    4343end
     44FilePath=fileparts(flname);
     45if ~strcmp(FilePath,'') && ~exist(FilePath,'dir')
     46    errormsg=['directory ' FilePath ' needs to be created'];
     47    return
     48end
    4449if ~exist('Data','var')
    4550     errormsg='no data  input for the netcdf file';
     
    4752end
    4853
    49 
    5054%% check the validity of the input field structure
    5155if ~ (exist('action','var') && strcmp(action,'keep_open'))
    52 [errormsg,ListDimName,DimValue,VarDimIndex]=check_field_structure(Data);
    53 if ~isempty(errormsg)
    54     errormsg=['error in struct2nc:invalid input structure_' errormsg];
    55     return
    56 end
     56    [errormsg,ListDimName,DimValue,VarDimIndex]=check_field_structure(Data);
     57    if ~isempty(errormsg)
     58        errormsg=['error in struct2nc:invalid input structure_' errormsg];
     59        return
     60    end
    5761end
    5862ListVarName=Data.ListVarName;
    5963
    6064%% create the netcdf file with name flname in format NETCDF4
    61 % if ischar(flname)
    62     FilePath=fileparts(flname);
    63     if ~strcmp(FilePath,'') && ~exist(FilePath,'dir')
    64         errormsg=['directory ' FilePath ' needs to be created'];
    65         return
    66     end
    67     cmode = netcdf.getConstant('NETCDF4');
    68     cmode = bitor(cmode, netcdf.getConstant('CLASSIC_MODEL'));
    69     cmode = bitor(cmode, netcdf.getConstant('CLOBBER'));
    70     nc = netcdf.create(flname, cmode);
    71 % else
    72 %     nc=flname;
    73 % end
     65cmode = netcdf.getConstant('NETCDF4');
     66cmode = bitor(cmode, netcdf.getConstant('CLASSIC_MODEL'));
     67cmode = bitor(cmode, netcdf.getConstant('CLOBBER'));
     68nc = netcdf.create(flname, cmode);
    7469
    7570%% write global constants
Note: See TracChangeset for help on using the changeset viewer.