(self, *args)
| 105 | self.update_data(None) |
| 106 | |
| 107 | def update_bands(self, *args): |
| 108 | band_data = np.linspace( |
| 109 | self.data_range[0], self.data_range[1], self.num_bands + 1 |
| 110 | ) |
| 111 | self.scaled_band_data = ( |
| 112 | (band_data - self.data_range[0]) |
| 113 | / (self.data_range[1] - self.data_range[0]) |
| 114 | )[:, np.newaxis] |
| 115 | |
| 116 | n = len(self.data.index) |
| 117 | |
| 118 | if self.band_type == "circle": |
| 119 | t = np.linspace(0, 2 * np.pi, 1000) |
| 120 | band_data_x, band_data_y = ( |
| 121 | self.scaled_band_data * np.cos(t), |
| 122 | self.scaled_band_data * np.sin(t), |
| 123 | ) |
| 124 | elif self.band_type == "polygon": |
| 125 | t = np.linspace(0, 2 * np.pi, n + 1) |
| 126 | band_data_x, band_data_y = ( |
| 127 | self.scaled_band_data * np.sin(t), |
| 128 | self.scaled_band_data * np.cos(t), |
| 129 | ) |
| 130 | |
| 131 | with self.bands.hold_sync(): |
| 132 | self.bands.x = band_data_x |
| 133 | self.bands.y = band_data_y |
| 134 | |
| 135 | with self.band_labels.hold_sync(): |
| 136 | self.band_labels.x = self.scaled_band_data[:, 0] |
| 137 | self.band_labels.y = [0.0] * (self.num_bands + 1) |
| 138 | self.band_labels.text = ["{:.0%}".format(b) for b in band_data] |
| 139 | |
| 140 | def update_data(self, *args): |
| 141 | self.update_bands(None) |
no outgoing calls
no test coverage detected