Explorar el Código

display_2 center cut time evolution

vogdb hace 5 años
padre
commit
b85f93f7df
Se han modificado 1 ficheros con 20 adiciones y 0 borrados
  1. 20 0
      epileptor/display_2d.py

+ 20 - 0
epileptor/display_2d.py

@@ -190,6 +190,26 @@ def display_state_at_points(dt, state, data_filename, point_index_list, line_lis
     plt.savefig(os.path.join(media_fpath, fig_fname))
 
 
+def center_cut_t_evolution(dt, state, data_filename):
+    values = state.values
+    # Those values should be set manually. Now they are set for 2019-04-04_19.16
+    # 32800 - 33100, 51380 - 52000
+    dt_begin = int(51400 / dt)
+    dt_end = int(51700 / dt)
+    _, y_nh, x_nh = values.shape
+    x = x_nh // 2
+    center_cut = values[dt_begin:dt_end, :, x:(x + 2)]
+    center_cut = center_cut.transpose(0, 2, 1).reshape(-1, y_nh)
+    ax = plt.gca()
+    img = ax.imshow(center_cut.T, cmap='jet')
+    plt.colorbar(mappable=img, ax=ax)
+
+    title = 'cut_{}_at{}s_{}'.format(state.name, int(dt_begin / 1000), data_filename)
+    fig_fname = '{}.{}'.format(title, img_ext)
+    plt.savefig(os.path.join(media_fpath, fig_fname))
+    ax.clear()
+
+
 media_fpath = 'media'
 filepath, img_ext = parse_cmd_args()
 data_filename = os.path.basename(filepath)