Changeset 1096
- Timestamp:
- Apr 2, 2021, 3:57:01 PM (4 years ago)
- Location:
- trunk/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/proj_field.m
r1095 r1096 1074 1074 end 1075 1075 1076 %% initiate Matlab structure for physical field 1076 %% initiate Matlab structure for physical fieldopen 1077 1077 [ProjData,errormsg]=proj_heading(FieldData,ObjectData); 1078 1078 if ~isempty(errormsg) … … 1204 1204 ProjData.VarAttribute{1}.Role='coord_y'; 1205 1205 ProjData.VarAttribute{2}.Role='coord_x'; 1206 YAttribute=[]; 1207 XAttribute=[]; 1206 1208 if ~isempty(icell_grid) 1207 1209 YAttribute=FieldData.VarAttribute{CellInfo{icell_grid}.CoordIndex(NbDim-1)}; -
trunk/src/series.m
r1095 r1096 627 627 empty_line(iline)= isempty(cell2mat(InputTable(iline,1:3))); 628 628 end 629 if ~isempty(find(empty_line ));629 if ~isempty(find(empty_line,1)) 630 630 InputTable(empty_line,:)=[]; % remove empty lines 631 631 set(handles.InputTable,'Data',InputTable) … … 743 743 744 744 %% 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')751 745 set(handles.RUN, 'Enable','On') 752 746 set(handles.RUN,'BackgroundColor',[1 0 0])% set RUN button to red … … 758 752 InputTable=get(handles.InputTable,'Data'); 759 753 SeriesData=get(handles.series,'UserData'); 754 760 755 if strcmp(iview,'append') % display the input data as a new line in the table 761 756 iview=size(InputTable,1)+1; % the next line in InputTable becomes the current line 762 % InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}];763 757 elseif strcmp(iview,'one') % refresh the list of input file series 764 758 iview=1; % the first line in InputTable becomes the current line 765 759 InputTable={'','','','',''}; 766 % InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}];767 760 set(handles.TimeTable,'Data',[{''},{[]},{[]},{[]},{[]}]) 768 761 set(handles.MinIndex_i,'Data',[]) … … 860 853 SeriesData.Ref_j1=j1; 861 854 SeriesData.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); 860 set(handles.Device,'String',[Device DeviceExt]) 861 set(handles.Experiment,'String',[Experiment ExperimentExt]) 862 if ~isempty(regexp(InputTable{1,1},'(^http://)|(^https://)')) 863 set(handles.OutputPathBrowse,'Value',1)% an output folder needs to be specified for OpenDAP data 864 end 865 866 %update the output path if needed 867 if ~(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; 876 end 877 862 878 set(handles.series,'UserData',SeriesData) 863 879 … … 1029 1045 end 1030 1046 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 % else1039 % NbSlice=siz(1);1040 % end1041 % end1042 % end1043 1047 end 1044 1048 if ~isempty(NbSlice) … … 1050 1054 if ~isempty(VideoObject)% case of movies 1051 1055 imainfo=get(VideoObject); 1052 if isempty(j1_series) ;% frame index along i1056 if isempty(j1_series) % frame index along i 1053 1057 Time=zeros(imainfo.NumberOfFrames+1,2); 1054 1058 Time(:,2)=(0:1/imainfo.FrameRate:(imainfo.NumberOfFrames)/imainfo.FrameRate)'; … … 1069 1073 TimeLast=Time(last_i+1,last_j+1); 1070 1074 end 1071 if size(Time)>=[MaxIndex_i+1 MaxIndex_j+1] ;1075 if size(Time)>=[MaxIndex_i+1 MaxIndex_j+1] 1072 1076 TimeMax=Time(MaxIndex_i+1,MaxIndex_j+1); 1073 1077 end … … 1134 1138 j_max{iline}=max(pair_max,[],1); % max on j index 1135 1139 if ~isempty(j_max{iline}) 1136 MaxIndex_i(iline)= max(find(j_max{iline}))-1; % max ref index i1137 MinIndex_i(iline)= min(find(j_max{iline}))-1; % min ref index i1140 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 1138 1142 end 1139 1143 end … … 1149 1153 LineData=zeros(size(file_indices)); 1150 1154 file_select=file_indices(file_indices<=numel(j_max{iline})); 1151 ind_select=fi nd(file_indices<=numel(j_max{iline}));1155 ind_select=file_indices<=numel(j_max{iline}); 1152 1156 LineData(ind_select)=j_max{iline}(file_select)~=0; 1153 1157 CData(ind_y,:)=ones(size(ind_y'))*LineData; … … 1198 1202 1199 1203 %------------------------------------------------------------------------ 1204 %fill the menu of possible pairs as input 1200 1205 function displ_pair=update_listpair(i1_series,i2_series,j1_series,j2_series,mode,time,TimeUnit,ref_i,ref_j,TimeName,InputTable,FileInfo) 1201 1206 %------------------------------------------------------------------------ … … 1212 1217 max_diff=max(diff_i(diff_i>0)); 1213 1218 for ipair=min_diff:max_diff 1214 if numel(diff_i(diff_i==ipair))>01219 if ~isempty(find(diff_i==ipair,1))% if the considered difference exists as input 1215 1220 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) 1217 1222 if ref_i<=floor(ipair/2) 1218 1223 ref_i=floor(ipair/2)+1; % shift ref_i to get the first pair … … 2137 2142 [status,result]=system(oar_command)% execute system command and show the result (ID number of the launched job) on the Matlab command window 2138 2143 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 2140 2149 fprintf(fid,oar_command); % store the command 2141 2150 fprintf(fid,result); % store the result (job ID number) … … 2723 2732 set(handles.Experiment,'Visible','on') 2724 2733 set(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 end2730 set(handles.OutputPath,'String',OutputPath)2731 end2732 2734 set(handles.Experiment_title,'Visible','on') 2733 2735 set(handles.OutputPath,'Visible','on') … … 2777 2779 set(handles.OutputDirExt,'Visible',OutputDirVisible) 2778 2780 set(handles.OutputSubDir,'Visible',OutputDirVisible) 2779 set(handles.OutputDir_title,'Visible',OutputDirVisible)2781 % set(handles.OutputDir_title,'Visible',OutputDirVisible) 2780 2782 SeriesData.ActionName=ActionName; % record ActionName for next use 2781 2783 … … 3951 3953 3952 3954 function OutputPath_Callback(hObject, eventdata, handles) 3953 % hObject handle to OutputPath (see GCBO)3954 % eventdata reserved - to be defined in a future version of MATLAB3955 % handles structure with handles and user data (see GUIDATA)3956 3957 % Hints: get(hObject,'String') returns contents of OutputPath as text3958 % str2double(get(hObject,'String')) returns contents of OutputPath as a doubl3959 3960 3955 3961 3956 3962 3957 function Experiment_Callback(hObject, eventdata, handles) 3963 % hObject handle to Experiment (see GCBO)3964 % eventdata reserved - to be defined in a future version of MATLAB3965 % handles structure with handles and user data (see GUIDATA)3966 3967 % Hints: get(hObject,'String') returns contents of Experiment as text3968 % str2double(get(hObject,'String')) returns contents of Experiment as a double3969 3958 3970 3959 3971 3960 function Device_Callback(hObject, eventdata, handles) 3972 % hObject handle to Device (see GCBO)3973 % eventdata reserved - to be defined in a future version of MATLAB3974 % handles structure with handles and user data (see GUIDATA)3975 3976 3961 3977 3962 3978 3963 % --- Executes on button press in OutputPathBrowse. 3979 3964 function OutputPathBrowse_Callback(hObject, eventdata, handles) 3965 CheckValue=get(handles.OutputPathBrowse,'Value'); 3966 if CheckValue 3980 3967 OutputPath=uigetdir(get(handles.OutputPath,'String')); 3981 3968 set(handles.OutputPath,'String',OutputPath) 3969 else 3970 InputTable=get(handles.InputTable,'Data'); 3971 set(handles.OutputPath,'String',InputTable{1,1}) 3972 end -
trunk/src/series/civ_series.m
r1095 r1096 331 331 end 332 332 if CheckInputFile 333 OutputPath=fullfile(Param.OutputPath, Param.Experiment,Param.Device);333 OutputPath=fullfile(Param.OutputPath,num2str(Param.Experiment),num2str(Param.Device)); 334 334 if iview_A==0 % no nc file has been entered 335 335 ncfile=fullfile_uvmat(OutputPath,Param.InputTable{1,2},Param.InputTable{1,3},Param.InputTable{1,5},... -
trunk/src/series/merge_proj.m
r1094 r1096 83 83 if ~exist(FirstFileName,'file') 84 84 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')87 85 end 88 86 return … … 252 250 CheckOverwrite=Param.CheckOverwrite; 253 251 end 254 OutputPath=fullfile(Param.OutputPath, Param.Experiment,Param.Device);252 OutputPath=fullfile(Param.OutputPath,num2str(Param.Experiment),num2str(Param.Device)); 255 253 256 254 for index=1:NbField -
trunk/src/series/sliding_average.m
r1095 r1096 185 185 186 186 %% initialisation 187 T=24.4; %main wave period 188 t0=3; % time for motion start (torus at its maximum x) 187 char_index=regexp(SubDir{1},'waves_L1_'); 188 switch(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 205 end 189 206 NbPeriod=2; %number of periods for the sliding average 190 207 omega=2*pi/T; 191 amplitude=2.5; %oscillation amplitude192 208 Lscale=15;%diameter of the torus, length scale for normalisation 193 209 Uscale=amplitude*omega; … … 214 230 NpTime=round(NbPeriod*T/dt+1); 215 231 216 OutputPath=fullfile(Param.OutputPath, Param.Experiment,Param.Device);232 OutputPath=fullfile(Param.OutputPath,num2str(Param.Experiment),num2str(Param.Device)); 217 233 RootFileOut=RootFile{1}; 218 234 NomTypeOut='_1'; -
trunk/src/struct2nc.m
r1093 r1096 42 42 return 43 43 end 44 FilePath=fileparts(flname); 45 if ~strcmp(FilePath,'') && ~exist(FilePath,'dir') 46 errormsg=['directory ' FilePath ' needs to be created']; 47 return 48 end 44 49 if ~exist('Data','var') 45 50 errormsg='no data input for the netcdf file'; … … 47 52 end 48 53 49 50 54 %% check the validity of the input field structure 51 55 if ~ (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 return56 end56 [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 57 61 end 58 62 ListVarName=Data.ListVarName; 59 63 60 64 %% 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 65 cmode = netcdf.getConstant('NETCDF4'); 66 cmode = bitor(cmode, netcdf.getConstant('CLASSIC_MODEL')); 67 cmode = bitor(cmode, netcdf.getConstant('CLOBBER')); 68 nc = netcdf.create(flname, cmode); 74 69 75 70 %% write global constants
Note: See TracChangeset
for help on using the changeset viewer.