Dionyssos commited on
Commit
fd9e569
·
1 Parent(s): 38e59a0
Files changed (1) hide show
  1. app.py +18 -31
app.py CHANGED
@@ -271,28 +271,26 @@ def plot_expression_RIGID(arousal, dominance, valence):
271
  verticalalignment="top",
272
  )
273
 
274
-
275
  def explode(data):
276
- '''replicate 16 x 16 x 16 cube to edges array 31 x 31 x 31'''
277
- size = np.array(data.shape)*2
278
- data_e = np.zeros(size - 1, dtype=data.dtype)
279
- data_e[::2, ::2, ::2] = data
280
- return data_e
281
-
 
 
 
282
 
283
  def plot_expression(arousal, dominance, valence):
284
-
285
  '''_h = cuda tensor (N_PIX, N_PIX, N_PIX)'''
286
 
287
- N_PIX=5
288
  _h = np.random.rand(N_PIX, N_PIX, N_PIX) * 1e-3
289
  adv = np.array([arousal, .994 - dominance, valence]).clip(0, .99)
290
  arousal, dominance, valence = (adv * N_PIX).astype(np.int64) # find voxel
291
  _h[arousal, dominance, valence] = .22
292
 
293
-
294
-
295
-
296
  filled = np.ones((N_PIX, N_PIX, N_PIX), dtype=bool)
297
 
298
  # upscale the above voxel image, leaving gaps
@@ -333,37 +331,26 @@ def plot_expression(arousal, dominance, valence):
333
  ax.set_ylabel('dominance', fontsize=10, labelpad=10)
334
  ax.grid(False)
335
 
336
-
337
-
338
-
339
  ax.plot([N_PIX, N_PIX], [0, N_PIX + .2], [N_PIX, N_PIX], 'g', linewidth=1)
340
  ax.plot([0, N_PIX], [N_PIX, N_PIX + .24], [N_PIX, N_PIX], 'k', linewidth=1)
341
-
342
- # Bottom face lines
343
- # ax.plot([0, N_PIX + line_extension], [0, 0], [0, 0], 'y', linewidth=1)
344
- # ax.plot([0, 0], [0, N_PIX + line_extension], [0, 0], 'r', linewidth=1)
345
- # ax.plot([N_PIX, N_PIX + line_extension], [0, N_PIX], [0, 0], 'm', linewidth=1)
346
- # ax.plot([0, N_PIX], [N_PIX, N_PIX + line_extension], [0, 0], 'c', linewidth=1)
347
-
348
- # Vertical lines
349
- # ax.plot([0, 0], [0, 0], [0, N_PIX + line_extension], 'b', linewidth=1)
350
- # ax.plot([N_PIX, N_PIX], [0, 0], [0, N_PIX + line_extension], 'w', linewidth=1)
351
- # ax.plot([N_PIX, N_PIX], [N_PIX, N_PIX], [0, N_PIX + line_extension], 'orange', linewidth=1)
352
- # ax.plot([0, 0], [N_PIX, N_PIX], [0, N_PIX + line_extension], 'lime', linewidth=1)
353
 
354
- # # Missing lines on the top face
355
  ax.plot([0, 0], [0, N_PIX], [N_PIX, N_PIX], 'darkred', linewidth=1)
356
  ax.plot([0, N_PIX], [0, 0], [N_PIX, N_PIX], 'darkblue', linewidth=1)
357
 
358
  # Set pane colors after plotting the lines
359
- ax.w_xaxis.set_pane_color((0.8, 0.8, 0.8, 0.5))
360
- ax.w_yaxis.set_pane_color((0.8, 0.8, 0.8, 0.5))
361
- ax.w_zaxis.set_pane_color((0.8, 0.8, 0.8, 0.0))
 
362
 
363
  # Restore the limits to prevent the plot from expanding
364
  ax.set_xlim(0, N_PIX)
365
  ax.set_ylim(0, N_PIX)
366
  ax.set_zlim(0, N_PIX)
 
 
 
367
  # ------
368
 
369
 
 
271
  verticalalignment="top",
272
  )
273
 
 
274
  def explode(data):
275
+ """
276
+ Expands a 3D array by creating gaps between voxels.
277
+ This function is used to create the visual separation between the voxels.
278
+ """
279
+ shape_orig = np.array(data.shape)
280
+ shape_new = shape_orig * 2 - 1
281
+ retval = np.zeros(shape_new, dtype=data.dtype)
282
+ retval[::2, ::2, ::2] = data
283
+ return retval
284
 
285
  def plot_expression(arousal, dominance, valence):
 
286
  '''_h = cuda tensor (N_PIX, N_PIX, N_PIX)'''
287
 
288
+ N_PIX = 5
289
  _h = np.random.rand(N_PIX, N_PIX, N_PIX) * 1e-3
290
  adv = np.array([arousal, .994 - dominance, valence]).clip(0, .99)
291
  arousal, dominance, valence = (adv * N_PIX).astype(np.int64) # find voxel
292
  _h[arousal, dominance, valence] = .22
293
 
 
 
 
294
  filled = np.ones((N_PIX, N_PIX, N_PIX), dtype=bool)
295
 
296
  # upscale the above voxel image, leaving gaps
 
331
  ax.set_ylabel('dominance', fontsize=10, labelpad=10)
332
  ax.grid(False)
333
 
 
 
 
334
  ax.plot([N_PIX, N_PIX], [0, N_PIX + .2], [N_PIX, N_PIX], 'g', linewidth=1)
335
  ax.plot([0, N_PIX], [N_PIX, N_PIX + .24], [N_PIX, N_PIX], 'k', linewidth=1)
 
 
 
 
 
 
 
 
 
 
 
 
336
 
337
+ # Missing lines on the top face
338
  ax.plot([0, 0], [0, N_PIX], [N_PIX, N_PIX], 'darkred', linewidth=1)
339
  ax.plot([0, N_PIX], [0, 0], [N_PIX, N_PIX], 'darkblue', linewidth=1)
340
 
341
  # Set pane colors after plotting the lines
342
+ # UPDATED: Replaced `w_xaxis` with `xaxis` and `w_yaxis` with `yaxis`.
343
+ ax.xaxis.set_pane_color((0.8, 0.8, 0.8, 0.5))
344
+ ax.yaxis.set_pane_color((0.8, 0.8, 0.8, 0.5))
345
+ ax.zaxis.set_pane_color((0.8, 0.8, 0.8, 0.0))
346
 
347
  # Restore the limits to prevent the plot from expanding
348
  ax.set_xlim(0, N_PIX)
349
  ax.set_ylim(0, N_PIX)
350
  ax.set_zlim(0, N_PIX)
351
+
352
+ #plt.show()
353
+
354
  # ------
355
 
356