diff --git a/zUtil_Cryst/gtLoadReflections.m b/zUtil_Cryst/gtLoadReflections.m index 89ab241ff21544990ed0c5ef86bffa3d567cbb21..9dafacc1550a639935c1f55f762fa12f3a7fbe1b 100644 --- a/zUtil_Cryst/gtLoadReflections.m +++ b/zUtil_Cryst/gtLoadReflections.m @@ -93,8 +93,8 @@ end % end if file=[xop_dir '/' file]; - -if isreflections + +if isreflections fprintf('Opening file %s...\n',char(file)) fid=fopen(file,'r'); if fid==-1 @@ -109,7 +109,7 @@ if isreflections C = textscan(fid,pattern,'delimiter',delim); end fclose(fid); - + testo=char(testo{1}); for i=1:columns title = testo(i,:); @@ -118,7 +118,7 @@ if isreflections title = strrep(title,'.',''); title = regexprep(title,'[^a-zA-Z]',''); title = regexprep(title,'theta','tt'); - if length(title)==1 + if length(title)==1 title = regexprep(title,'m','mult'); title = regexprep(title,'^f','F'); end @@ -129,19 +129,17 @@ if isreflections reflections.(title)=C{i}; end end - + reflections.hkl=[reflections.h reflections.k reflections.l]; reflections=rmfield(reflections,'h'); reflections=rmfield(reflections,'k'); reflections=rmfield(reflections,'l'); - + xop = reflections; ind=strfind(file,'/'); xop.name = file(ind(end)+1:end); xop.xop_dir = xop_dir; - end - - end % end of function + diff --git a/zUtil_Cryst/gtReadCif.m b/zUtil_Cryst/gtReadCif.m index d187c3d4f0b521024622a6a0bf64b6110efe87be..c8fdb04fe09d2b2a58398db16771e1e006002556 100644 --- a/zUtil_Cryst/gtReadCif.m +++ b/zUtil_Cryst/gtReadCif.m @@ -1,6 +1,6 @@ -function cif=gtReadCif(name) +function cif = gtReadCif(name) % GTREADCIF Reads info from .dif files -% cif=gtReadCif(name) +% cif = gtReadCif(name) % ------------------- % Version 001 by LNervo % @@ -15,7 +15,6 @@ function cif=gtReadCif(name) % FUNCTIONS CALLED: % --none-- - latticepar = sfReadCifLattice(name); op = sfReadCifSymmetry(name); %op=textscan(op,'%s','delimiter',char(10)); @@ -36,51 +35,41 @@ cif.crystal_system = cellname; % Sub-functions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function latticepar=sfReadCifLattice(name) - - a = grep('_cell_length_a',name,' ',2); a = str2num(strtrim(a)); - b = grep('_cell_length_b',name,' ',2); b = str2num(strtrim(b)); - c = grep('_cell_length_c',name,' ',2); c = str2num(strtrim(c)); - alpha = grep('_cell_angle_alpha',name,' ',2); alpha = str2num(strtrim(alpha)); - beta = grep('_cell_angle_beta',name,' ',2); beta = str2num(strtrim(beta)); - gamma = grep('_cell_angle_gamma',name,' ',2); gamma = str2num(strtrim(gamma)); - - latticepar=[a b c alpha beta gamma]; - + a = grep('_cell_length_a',name,' ',2); a = str2num(strtrim(a)); + b = grep('_cell_length_b',name,' ',2); b = str2num(strtrim(b)); + c = grep('_cell_length_c',name,' ',2); c = str2num(strtrim(c)); + alpha = grep('_cell_angle_alpha',name,' ',2); alpha = str2num(strtrim(alpha)); + beta = grep('_cell_angle_beta',name,' ',2); beta = str2num(strtrim(beta)); + gamma = grep('_cell_angle_gamma',name,' ',2); gamma = str2num(strtrim(gamma)); + + latticepar = [a b c alpha beta gamma]; end function HM=sfReadCifHM(name) - - HM=grep('_symmetry_space_group_name_H-M',name,' ',2); - HM=strtrim(HM); - HM=strrep(HM,'''',''); - HM(2:end)=lower(HM(2:end)); - + HM = grep('_symmetry_space_group_name_H-M',name,' ',2); + HM = strtrim(HM); + HM = strrep(HM,'''',''); + HM(2:end) = lower(HM(2:end)); end - function cellname=sfReadCifCell(name) - - cellname=grep('_symmetry_cell_setting',name,' ',2); - cellname=strtrim(cellname); - + function cellname = sfReadCifCell(name) + cellname = grep('_symmetry_cell_setting',name,' ',2); + cellname = strtrim(cellname); end - function sg=sfReadCifSpacegroup(name) - - sg=grep('_symmetry_Int_Tables_number',name,' ',2); - sg=str2num(strtrim(sg)); - + function sg = sfReadCifSpacegroup(name) + sg = grep('_symmetry_Int_Tables_number',name,' ',2); + sg = str2num(strtrim(sg)); end - function op=sfReadCifSymmetry(name) - - op=grep('x',name); - op=strtrim(op); - op=op(strfind(op,'_xyz')+4:end); - op=strtrim(op); - op=strrep(op,char(32),''); - op=textscan(op,'%s','delimiter',char(10)); - op=op{1}; - + function op = sfReadCifSymmetry(name) + op = grep('x',name); + op = strtrim(op); + op = op(strfind(op,'_xyz')+4:end); + op = strtrim(op); + op = strrep(op,char(32),''); + op = textscan(op,'%s','delimiter',char(10)); + op = op{1}; end +end % end of function -end % end of function \ No newline at end of file diff --git a/zUtil_Imaging/flipimages.m b/zUtil_Imaging/flipimages.m index dfd550a9a4fbb470ab9898362e33af550224d4c1..e3e96d1db26270f8a41f849ad7ba174b6e0153d0 100644 --- a/zUtil_Imaging/flipimages.m +++ b/zUtil_Imaging/flipimages.m @@ -1,52 +1,21 @@ -function flipimages(prefix,from0) +function flipimages(prefix) % FUNCTION FLIPIMAGES Flip up-down images -% FLIPIMAGES(PREFIX,FROM0) +% FLIPIMAGES(PREFIX) % prefix = image prefix (can contain also the directory path) -% from0 = logical to start from number 0 or not % Overwrite the images in the same folder with the same name % -if ~strcmpi(prefix,'ref') - - a=dir([prefix '*.edf']); - nimages=length(a); - - if from0 - starti=0; - endi=nimages-1; - else - starti=1; - endi=nimages; - end - - for i=starti:endi - im=edf_read(sprintf('%s%04d.edf',prefix,i)); - im2=flipud(im); - edf_write(im2,sprintf('%s%04d.edf',prefix,i)); - end - - -else +if strcmpi(prefix,'ref') disp('treating reference images...') - - a=dir([prefix '*.edf']); - nimages=length(a); - for i=1:nimages - listFile(i)=a(i).name; - end - starti=1; - endi=nimages; - +end - for i=starti:endi - im=edf_read(sprintf('%s',listFile(i))); - im2=flipud(im); - edf_write(im2,sprintf('%s',listFile(i))); - disp(listFile(i)) - end +listFile = dir([prefix '*.edf']) +for k = 1:length(listFile) + im = edf_read( listFile(k).name ); + im2 = flipud(im); + edf_write( im2, listFile(k).name ); + disp(listFile(k).name) end - - end % end function