0001 function createDir(d,src, parm)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 if(nargin<3)
0015 subdir={'intro', 'pointing', 'intent', 'deglitch', 'positional', 'rfi', ...
0016 'rfio', 'mains', 'alpha', 'stokes', 'load', ...
0017 'tau', 'tsys', 'noise', 'gain', 'astro', 'power', 'overf', 'rms', ...
0018 'map', 'summary', 'fits', 'noiseInterp', 'tauInterp'};
0019 else
0020 subdir={'intro', 'intent'};
0021 index = length(subdir);
0022 for m=1:length(parm.routines.order)
0023 switch parm.routines.order{m}
0024 case 'rfio'
0025 subdir{index+1} = 'rfi';
0026 subdir{index+2} = 'positional';
0027
0028 case 'rfi'
0029 subdir{index+1} = 'rfi';
0030 subdir{index+2} = 'positional';
0031
0032 case 'astro'
0033 subdir{index+1} = 'astro';
0034 subdir{index+2} = 'noiseInterp';
0035 subdir{index+3} = 'tauInterp';
0036
0037 case 'alpha'
0038
0039
0040 otherwise
0041 subdir{index+1} = parm.routines.order{m};
0042 end
0043 index = length(subdir);
0044 end
0045 end
0046
0047 month=getmonth;
0048
0049 ind=d.array.frame.features>0 & d.array.frame.features<2^31;
0050 d=framecut(d,ind);
0051 start=mjd2date_v2(d.array.frame.utc(1));
0052
0053 the_date_string=datestr([start.year,start.month,start.day,start.hour,start.minute,round(start.second)]);
0054 date_string_parts=regexp(the_date_string,' ','split');
0055 time=sprintf('%s:%s',char(date_string_parts(1)),char(date_string_parts(2)));
0056
0057 if strcmp(src(1),'/') || strcmp(src(1),'~')
0058 maindir=src;
0059 else
0060 [home,installeddir]=where_am_i();
0061 maindir=strcat(home,'/',installeddir,'/reduc/',src);
0062 end
0063
0064 if (exist(maindir)~=7)
0065 unix(sprintf('mkdir %s',maindir));
0066 end
0067
0068
0069
0070 maindir=strcat(maindir,'/',time);
0071
0072 if (exist(maindir)~=7)
0073 unix(sprintf('mkdir %s',maindir));
0074 end
0075
0076 for i=1:length(subdir)
0077 str=strcat(maindir,'/',subdir{i});
0078 if (exist(str)~=7)
0079 unix(sprintf('mkdir %s',str));
0080 end
0081 end
0082
0083 pause(0.1);
0084 if strcmp(src(1),'/') || strcmp(src(1),'~')
0085 slashlist = find(src == '/');
0086 if slashlist(end) < length(src)
0087 parent_dir = src(1:slashlist(end)-1);
0088 src_dir = src(slashlist(end)+1:end);
0089 else
0090 parent_dir = src(1:slashlist(end-1)-1);
0091 src_dir = src(slashlist(end-1)+1:slashlist(end)-1);
0092 end
0093
0094 eval(sprintf('save %s/maindir_%s.mat maindir subdir',parent_dir,src_dir));
0095 else
0096 eval(sprintf('save %s/%s/reduc/maindir_%s.mat maindir subdir',home,installeddir,src));
0097 end
0098
0099
0100
0101
0102 return;