% function values = read_spec_header(fname) % % Arthur Woll has modified spec so each time it takes an exposure it % generates an info file with information about the exposure. % The information of greatest interest is the value of the beamline counters. % % The function, read_spec_header(fname) opens the spec info file, fname, % and scans it for the beamline counter information. % In values it returns the mean value of each counter during the % exposure associated with the spec file "fname". % values(1) = mean(I0); % values(2) = mean(I1); % values(3) = mean(I2); % values(4) = mean(I3); % values(5) = mean(I4); % values(5) = Time of Exposure; % % In some case fname has counter information for 2 or more images. % read_spec_header averages the counter values over all images.. % function values = read_spec_header(fname) fid = fopen(fname,'r'); values = []; total_time = 0; while(~feof(fid)) line = fgetl(fid); while(~(strncmp('#L',line,2))&(~feof(fid))) line = fgetl(fid); end if ~feof(fid) line = fgetl(fid); end [temp1, temp2, I0 , I1, I2, I3, I4, ct1, ct2] = strread(line,'%f %d %f %f %f %f %f %f %f',1); if (length(values)>0) values = values + [I0 I1 I2 I3 I4]; else values = [I0 I1 I2 I3 I4]; end total_time = total_time + ct1; end values = values / total_time; values = [ values, ct1];