File wellmet/qt_gui/qt_plot.py changed (mode: 100644) (index f70b948..fb217a5) |
... |
... |
class CandidatesWidget(pg.LayoutWidget): |
2259 |
2259 |
|
|
2260 |
2260 |
# 2 |
# 2 |
2261 |
2261 |
# |
# |
2262 |
|
#č predpokladam pandas verzi CandyBox'u |
|
2263 |
|
#items = list(self.sb_item.sample_box.candidates_index[-1].df.columns) |
|
2264 |
|
try: |
|
2265 |
|
#č načíst sloupce prostě z libovolného vzorku |
|
2266 |
|
df = self.sb_item.sample_box.candidates_index.values().__iter__().__next__() |
|
2267 |
|
items = df.columns |
|
2268 |
|
except: |
|
2269 |
|
#♥ мыным дунне |
|
2270 |
|
items = [] |
|
2271 |
|
|
|
2272 |
|
self.attr = pg.ComboBox(items=items) |
|
|
2262 |
|
|
|
2263 |
|
self.attr = pg.ComboBox(items=self.get_items()) |
2273 |
2264 |
#self.attr.activated.connect(self.redraw) |
#self.attr.activated.connect(self.redraw) |
2274 |
2265 |
self.addWidget(self.attr, row=1, col=0, colspan=2) |
self.addWidget(self.attr, row=1, col=0, colspan=2) |
2275 |
2266 |
|
|
|
... |
... |
class CandidatesWidget(pg.LayoutWidget): |
2286 |
2277 |
self.pens = [] |
self.pens = [] |
2287 |
2278 |
|
|
2288 |
2279 |
|
|
|
2280 |
|
def get_items(self): |
|
2281 |
|
try: #č výbrat libovolný vzorek |
|
2282 |
|
nodes = next(iter(self.sb_item.sample_box.candidates_index.values())) |
|
2283 |
|
return self.get_items_from_nodes(nodes) |
|
2284 |
|
except: |
|
2285 |
|
return [] |
|
2286 |
|
|
|
2287 |
|
@staticmethod |
|
2288 |
|
def get_items_from_nodes(nodes): |
|
2289 |
|
try: |
|
2290 |
|
#č predpokladam pandas verzi CandyBox'u |
|
2291 |
|
return list(nodes.columns) |
|
2292 |
|
except: |
|
2293 |
|
#č CandyNodes? |
|
2294 |
|
return list(nodes.kwargs.keys()) + list(nodes.attrs.keys()) |
|
2295 |
|
|
2289 |
2296 |
def run_stm(self): |
def run_stm(self): |
2290 |
2297 |
#č indikace |
#č indikace |
2291 |
2298 |
#self.setDisabled(True) |
#self.setDisabled(True) |
|
... |
... |
class CandidatesWidget(pg.LayoutWidget): |
2295 |
2302 |
color_map = self.gradient.colorMap() |
color_map = self.gradient.colorMap() |
2296 |
2303 |
|
|
2297 |
2304 |
try:#č může se tu stat cokoliv |
try:#č může se tu stat cokoliv |
2298 |
|
#č načíst sloupce prostě z libovolného vzorku |
|
2299 |
|
cb = self.sb_item.sample_box.candidates_index.values().__iter__().__next__() |
|
2300 |
2305 |
#č je třeba mít seznam aktualní |
#č je třeba mít seznam aktualní |
2301 |
|
self.attr.setItems(list(cb.df.columns)) |
|
|
2306 |
|
self.attr.setItems(self.get_items()) |
2302 |
2307 |
|
|
2303 |
2308 |
#č neplest s self.attr! |
#č neplest s self.attr! |
2304 |
2309 |
attr = self.attr.currentText() |
attr = self.attr.currentText() |
|
... |
... |
class CandidatesWidget(pg.LayoutWidget): |
2307 |
2312 |
maxvalue = -np.inf |
maxvalue = -np.inf |
2308 |
2313 |
minvalue = np.inf |
minvalue = np.inf |
2309 |
2314 |
for id, cb in self.sb_item.sample_box.candidates_index.items(): |
for id, cb in self.sb_item.sample_box.candidates_index.items(): |
2310 |
|
array = getattr(cb, attr) |
|
|
2315 |
|
array = np.atleast_1d(getattr(cb, attr)) |
2311 |
2316 |
if len(array): |
if len(array): |
2312 |
2317 |
maxcb = np.nanmax(array) |
maxcb = np.nanmax(array) |
2313 |
2318 |
mincb = np.nanmin(array) |
mincb = np.nanmin(array) |
|
... |
... |
class CandidatesWidget(pg.LayoutWidget): |
2326 |
2331 |
|
|
2327 |
2332 |
#č a teď jdeme! |
#č a teď jdeme! |
2328 |
2333 |
for id, cb in self.sb_item.sample_box.candidates_index.items(): |
for id, cb in self.sb_item.sample_box.candidates_index.items(): |
2329 |
|
array = getattr(cb, attr) |
|
|
2334 |
|
array = np.atleast_1d(getattr(cb, attr)) |
2330 |
2335 |
if np.isnan(array).any(): |
if np.isnan(array).any(): |
2331 |
2336 |
msg = "%s candidates has nans in %s attribute"%(id, attr) |
msg = "%s candidates has nans in %s attribute"%(id, attr) |
2332 |
2337 |
error_msg = self.__class__.__name__ + ": " + msg |
error_msg = self.__class__.__name__ + ": " + msg |