def __plot_signals(self, signals, output_test, output_training, channel_labels, distance): """ Args: signals: channel_labels: Returns: object: """ colors = list(CSS4_COLORS.keys()) i = 0 fig = plt.figure(figsize=(40, 40)) print(f"Distance Between Signals {distance}") ax = fig.add_subplot(4, 4, i + 1) i += 1 color_index = 0 ax.set_title("Interpreted Signal with Output Class " + str(output_test)) for channel, label in zip(signals[0], channel_labels): ax.plot(channel, color=colors[color_index + 20], label=label) color_index += 1 plt.legend() ax = fig.add_subplot(4, 4, i + 1) i += 1 color_index = 0 ax.set_title("Example Signal with Output Class " + str(output_training)) for channel, label in zip(signals[1], channel_labels): ax.plot(channel, color=colors[color_index + 20], label=label) color_index += 1 plt.legend() plt.show() return plt
def __plot_signals(self, signals, attribution, output_test, output_training, channel_labels): """ Args: signals: channel_labels: Returns: object: """ colors = list(CSS4_COLORS.keys()) i = 0 fig = plt.figure(figsize=(40, 40)) ax = fig.add_subplot(4, 4, i + 1) i += 1 color_index = 0 ax.set_title("Interpreted Signal with Output Class "+str(output_test)) # for channel, label in zip(signals[0], channel_labels): ax.plot(sum(signals[0]).detach().cpu()) ax.plot(sum(attribution[0]), color="r") # color_index += 1 # plt.legend() ax = fig.add_subplot(4, 4, i + 1) i += 1 color_index = 0 ax.set_title("Example Signal with Output Class "+str(output_training)) # for channel, label in zip(signals[1], channel_labels): # ax.plot(channel, color=colors[color_index + 20], label=label) # color_index += 1 ax.plot(sum(signals[1])) ax.plot(sum(attribution[1]), color="r") # plt.legend() plt.show() return plt
def get_xkcd_palette(): from matplotlib._color_data import XKCD_COLORS as color_dict return ColorPalette.from_mcd(color_dict.values())
def get_tableau_palette(): from matplotlib._color_data import TABLEAU_COLORS as color_dict return ColorPalette.from_mcd(color_dict.values())
def get_css4_palette(): from matplotlib._color_data import CSS4_COLORS as color_dict return ColorPalette.from_mcd(color_dict.values())
draw.line([tuple(prev), tuple(point)], fill=1, width=3) prev = point annotation_images.append(np.asarray(annotation_img)) return annotation_images def load_annotations_as_lists(csv_filename): df = pd.read_csv(csv_filename) annotations = get_annotation_points(df, 2, 2) return annotations if __name__ == '__main__': from matplotlib._color_data import CSS4_COLORS colors = list(CSS4_COLORS.keys()) BORDER_WIDTH = 0.5 WRITE_FOLDER = '../../projects/nuclear/resources/figures/' if not os.path.exists(WRITE_FOLDER): os.makedirs(WRITE_FOLDER) raw_stack_location = f"../../projects/nuclear/resources/images/backup-stacks/{roi}.tiff" csv_location = f"../../projects/nuclear/resources/csv/processed/{roi}_z{pad(str(Z_SLICE))}.csv" raw_stack = imread(raw_stack_location) # 1) raw image raw_image = raw_stack[Z_SLICE, :, :] plt.imshow(raw_image, cmap='gray')