column_to_dtype={ 'file_path_raw_signals': str, 'sampling_frequency_in_hz': (int, float, np.int, np.float, np.int64, np.float64), }) signal_labels = [ dataset[column_name] for column_name in state_annotation_signals ] raw_signals = load_raw_signals(dataset['file_path_raw_signals'], signal_labels) plot_raw_signals( raw_signals, sampling_frequency=dataset['sampling_frequency_in_hz'], ax=axes[0], ) axes[0].set_ylabel("Raw signals") # LDA tranformed signals transformed_signals = annotator.transform(signal_arrays[ii]) plot_signals(transformed_signals, ax=axes[1]) axes[1].set_ylabel("Transformed signals") predicted_state_vector = annotator.predict(signal_arrays[ii]) predicted_states, predicted_intervals = convert_state_vector_to_state_intervals( predicted_state_vector, mapping=int_to_state) plot_states(predicted_states, predicted_intervals, ax=axes[2]) axes[2].set_ylabel("Automated\nannotation")
psd_max = np.max(psd) ax.set_ylim(0, psd_max) psd_figure.canvas.draw_idle() # initialise state annotation figure fig = plt.figure() gs = GridSpec(5, 1) data_axis = fig.add_subplot(gs[:3, 0]) state_axis = fig.add_subplot(gs[3, 0], sharex=data_axis) manual_state_axis = fig.add_subplot(gs[4, 0], sharex=data_axis) fig.tight_layout(**{'rect': [0.05, 0, 1, 1], 'pad': 2., 'h_pad': 0.}) # plot signals plot_raw_signals( raw_signals, sampling_frequency=dataset['sampling_frequency_in_hz'], ax=data_axis, linewidth=1., ) # plot manual annotations plot_states( manual_states, manual_intervals, ax=manual_state_axis, linewidth=5., ) manual_state_axis.set_ylabel("Manual annotation") # initialise annotator annotator = TimeSeriesStateViewer( data_axis,