% Matlab program for displaying spectra % % Graphics initialization % Extract section from data file clear; cd /tmp; !zcat {data_dir_long}/{file}.data.Z|{html_dir_long}/chuck {start}|{html_dir_long}/keep {length}>{temp_file}; % Load the file's contents load -ascii {temp_file}; % Determine how many channels [m n] = size({temp_file}); if n == 1 % Single channel data [Tfile, F, T] = specgram({temp_file}, 2^ceil(log2({frame})), 1, {frame}, ceil({frame}/2)); T = T + {start}; if strcmp('{sgram_display}', 'imagesc') imagesc(T, fliplr(F')', 20*log10(abs(Tfile))); set(gca, 'TickDir', 'out'); title('Spectrogram of {data_dir_short}/{file}'); xlabel('Time Index'); ylabel('Frequency'); elseif strcmp('{sgram_display}', 'waterfall') h = mesh(F, fliplr(T')', 20*log10(fliplr(abs(Tfile))')); set(h, 'MeshStyle', 'row'); set(gca, 'YDir', 'reverse'); set(gca, 'View', [0 30]); pos = get(gca, 'Position'); pos(3) = .94*pos(3); set(gca, 'Position', pos); title('Waterfall spectrogram of {data_dir_short}/{file}'); xlabel('Frequency'); ylabel('Time Index'); zlabel('Amplitude (dB)'); end set(gcf, 'PaperType', 'a5'); orient tall; else for i=1:n subplot(n, 1, i); [Tfile, F, T] = specgram({temp_file}(:,i), 2^ceil(log2({frame})), 1, {frame}, ceil({frame}/2)); T = T + {start}; if strcmp('{sgram_display}', 'imagesc') imagesc(T, fliplr(F')', 20*log10(abs(Tfile))); ylabel('Frequency'); if i == 1 title(sprintf('Spectrogram of {data_dir_short}/{file}: Channel %d', i)); else title(sprintf('Channel %d', i)); end if i == n xlabel('Time Index'); end elseif strcmp('{sgram_display}', 'waterfall') pos = get(gca, 'Position'); pos(4) = 1.1*pos(4); pos(3) = 1.25*pos(4); pos(1) = (1-pos(3))/2; set(gca, 'Position', pos); h=mesh(F, fliplr(T')', 20*log10(fliplr(abs(Tfile))')); set(h, 'MeshStyle', 'row'); set(gca, 'YDir', 'reverse'); set(gca, 'View', [0 30]); if i == 1 title('Waterfall spectrograms of {data_dir_short}/{file}'); end if i == n xlabel('Frequency'); ylabel('Time Index'); end zlabel('Amplitude (dB)'); end end set(gcf, 'PaperType', 'a5'); orient tall; end % Create output file print -dgif8 {gif_file}; % Clear figure & reset all its properties (except Position) clf reset % Delete temporary files !rm {temp_file}; !rm /softlib1/htdocs/spib/spib{temp_file}.m;