(self)
| 498 | self.show_image() |
| 499 | |
| 500 | def show_image(self): |
| 501 | # Don't plot the image if dictionary is empty (causes a lot of issues) |
| 502 | if not self.io_model.img_dict: |
| 503 | return |
| 504 | |
| 505 | self.fig.clf() |
| 506 | |
| 507 | # The sequence of keys of 'img_dict' selected for plotting and ordered as 'map_keys' |
| 508 | selected_keys = self.get_selected_items_for_plot() |
| 509 | |
| 510 | # Check if positions data is available. Positions data may be unavailable |
| 511 | # (not recorded in HDF5 file) if experiment is has not been completed. |
| 512 | # While the data from the completed part of experiment may still be used, |
| 513 | # plotting vs. x-y or scatter plot may not be displayed. |
| 514 | positions_data_available = False |
| 515 | if "positions" in self.io_model.img_dict.keys(): |
| 516 | positions_data_available = True |
| 517 | |
| 518 | # Create local copies of self.pixel_or_pos, self.scatter_show and self.grid_interpolate |
| 519 | pixel_or_pos_local = self.pixel_or_pos |
| 520 | scatter_show_local = self.scatter_show |
| 521 | grid_interpolate_local = self.grid_interpolate |
| 522 | |
| 523 | # Disable plotting vs x-y coordinates if 'positions' data is not available |
| 524 | if not positions_data_available: |
| 525 | if pixel_or_pos_local: |
| 526 | pixel_or_pos_local = 0 # Switch to plotting vs. pixel number |
| 527 | logger.error("'Positions' data is not available. Plotting vs. x-y coordinates is disabled") |
| 528 | if scatter_show_local: |
| 529 | scatter_show_local = False # Switch to plotting vs. pixel number |
| 530 | logger.error("'Positions' data is not available. Scatter plot is disabled.") |
| 531 | if grid_interpolate_local: |
| 532 | grid_interpolate_local = False # Switch to plotting vs. pixel number |
| 533 | logger.error("'Positions' data is not available. Interpolation is disabled.") |
| 534 | |
| 535 | rel_low_lim = 1e-6 # define the relative low limit for log image |
| 536 | plot_interp = "Nearest" |
| 537 | |
| 538 | if self.scaler_data is not None: |
| 539 | if np.count_nonzero(self.scaler_data) == 0: |
| 540 | logger.warning("scaler is zero - scaling was not applied") |
| 541 | elif len(self.scaler_data[self.scaler_data == 0]) > 0: |
| 542 | logger.warning("scaler data has zero values") |
| 543 | |
| 544 | grey_use = self.color_opt |
| 545 | |
| 546 | ncol = int(np.ceil(np.sqrt(len(selected_keys)))) |
| 547 | try: |
| 548 | nrow = int(np.ceil(len(selected_keys) / float(ncol))) |
| 549 | except ZeroDivisionError: |
| 550 | ncol = 1 |
| 551 | nrow = 1 |
| 552 | |
| 553 | a_pad_v = 0.8 |
| 554 | a_pad_h = 0.5 |
| 555 | |
| 556 | grid = ImageGrid( |
| 557 | self.fig, |
no test coverage detected