makemovie_pinedobj.pro 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. pro makemovie_pinedobj
  2. default, filename, "$HOME/prog/objsim/data/movies/pinedobjmovie.idlmov"
  3. retw=50
  4. reth=1
  5. modw=50
  6. modh=1
  7. a = obj_new('movieinput', /create, filename=filename)
  8. a->generatefile, owarray=[retw,modw], oharray=[reth,modh], nfilters=2
  9. pic = fltarr(retw,reth)
  10. pic2 = fltarr(modw,modh)
  11. nretneurons=retw*reth
  12. nmodneurons=modw*modh
  13. nkombi=nretneurons*nmodneurons
  14. g=indgen(5)-2
  15. b=fltarr(5)
  16. for i=0,4 do begin
  17. b(i)=exp(-g(i)*g(i)/5.)
  18. endfor
  19. h=indgen(5)-2
  20. c=fltarr(5)
  21. for i=0,4 do begin
  22. c(i)=exp(-h(i)*h(i)/5.)
  23. endfor
  24. objposition=intarr(3)
  25. objposition(0)=-15
  26. objposition(1)=0
  27. objposition(2)=15
  28. modposition=intarr(9)
  29. retposition=intarr(9)
  30. ;for i=0,8 do begin
  31. ; modposition(i)=5*(i+1)-25
  32. ; retposition(i)=5*(i+1)-25
  33. ;endfor
  34. counter=0
  35. for objpos=0,2 do begin
  36. for modpos=0,45 do begin
  37. for retpos=0,45 do begin
  38. pic(*)=0
  39. pic2(*)=0
  40. if (modpos-retpos eq objposition(objpos)) then begin
  41. for j=0,4 do begin
  42. pic(retpos+j)=1*b(j)
  43. endfor
  44. for j=0,4 do begin
  45. pic2(objposition(objpos)+retpos+j)=1*b(j)
  46. endfor
  47. a->WriteFrame, pic
  48. a->WriteFrame, pic2
  49. counter=counter+1
  50. endif else begin
  51. pic(retpos)=0
  52. pic2(modpos)=0
  53. endelse
  54. tvscl, rebin(pic, 10*retw, reth*10, /sample)
  55. endfor
  56. endfor
  57. endfor
  58. infos=intarr(counter,2)
  59. counter=0
  60. for objpos=0,2 do begin
  61. for modpos=0,45 do begin
  62. for retpos=0,45 do begin
  63. pic(*)=0
  64. pic2(*)=0
  65. if (modpos-retpos eq objposition(objpos)) then begin
  66. for j=0,4 do begin
  67. pic(retpos+j)=1*b(j)
  68. endfor
  69. for j=0,4 do begin
  70. pic2(objposition(objpos)+retpos+j)=1*b(j)
  71. endfor
  72. infos(counter,0)=retpos
  73. infos(counter,1)=modpos
  74. counter=counter+1
  75. endif else begin
  76. pic(retpos)=0
  77. pic2(modpos)=0
  78. endelse
  79. tvscl, rebin(pic, 10*retw, reth*10, /sample)
  80. endfor
  81. endfor
  82. endfor
  83. uwriteu, filename+'.info',infos
  84. print, counter
  85. ;for u=0,nmodneurons-5 do begin
  86. ; for i=0, nretneurons-5 do begin
  87. ; frame = pic
  88. ; frame2 = pic2
  89. ; for j=0,4 do begin
  90. ; frame(i+j)=1*b(j)
  91. ; frame2(u+j)=1*b(j)
  92. ; ;;frame2(i+j)=1+b(j)
  93. ; endfor
  94. ; ;frame2(u)=1
  95. ; ;wait, 0.15
  96. ; tvscl, rebin(frame, 10*retw, reth*10, /sample)
  97. ; ;tvscl, 0, 0.3, /norm, rebin(frame2, 10*modw, modh*10, /sample)
  98. ; a->WriteFrame, frame
  99. ; a->WriteFrame, frame2
  100. ; endfor
  101. ;endfor
  102. ;endfor
  103. obj_destroy, a
  104. end