function eta, t0, i, n s = n * (SYSTIME(/SECONDS) - t0) / i h = STRING(FORMAT='(I02)', LONG(s / 3600)) m = STRING(FORMAT='(I02)', LONG((s / 60) mod 60)) s = STRING(FORMAT='(I02)', LONG(s mod 60)) return, 'ETA: ' + h + ':' + m + ':' + s end pro rotation_movie, n, SAVE_FILE=save_file, RESUME=resume @common_blocks.inc loadct, 0 slice_ori = [1.,0.,-.72] slice_size = [-.5, -.5, 1.5, 1.5] if KEYWORD_SET(save_file) and KEYWORD_SET(resume) then begin RESTORE, save_file endif else begin xy_size = 128 n2 = 32 < n proj = build_projection(INTERP=1, IMAGE_SIZE=xy_size) images = DBLARR(xy_size, xy_size, 4, 32) t0 = SYSTIME(/SECONDS) levels_sum = DBLARR(4) for i = 0L,n2-1 do begin theta = (i/DOUBLE(n2)) * 3.14159265 * 2. change_slice_ori, PROJ=proj, NEW_ORI=[cos(theta), sin(theta), slice_ori[2]] images[0,0,0,i] = make_HII_picture(PROJ=proj, /NO_NORMALIZE, CACHE=cache) ;tvscl, images[*,*,0,i] ; time remaining = (t-t0)/(i-i0) * (n-1-i) print, i, slice_ori, ' ', eta(t0, i, n2-i-1) dummy = composite_HII_picture(images[*,*,*,i], LEVELS=levels, /DRY_RUN) levels_sum += levels endfor levels_sum /= n2 i = 0L endelse proj = build_projection(INTERP=1) cache = 0 i0 = i t0 = SYSTIME(/SECONDS) while i lt n do begin if KEYWORD_SET(save_file) and (i mod 8 eq 0) then $ SAVE, slice_ori, xy_sl_size, n, i, levels_sum, FILENAME=save_file theta = (i/DOUBLE(n)) * 3.14159265 * 2. change_slice_ori, PROJ=proj, NEW_ORI=[cos(theta), sin(theta), slice_ori[2]] data = make_HII_picture(PROJ=proj, /NO_NORMALIZE, CACHE=cache) box = box_image(PROJ=proj) img = composite_HII_picture(data, LEVELS=levels_sum) img = 255B - BYTE((255 - img) * (255B - 255B*TRANSPOSE(CMREPLICATE(box,3), [2,0,1])) / 255) tvscl, img, /TRUE ; time remaining = (t-t0)/(i-i0) * (n-1-i) fn = 'img' + string(FORMAT='(I03)',i) + '.png' write_png, fn, img print, i, slice_ori, ' ', eta(t0, i-i0+1, n-i-1) i += 1 endwhile print, string([7B,7B,7B,7B,7B]) ; bell character x 5 lets you know when the process is complete end