celldetective 1.3.4.post1__py3-none-any.whl → 1.3.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,6 +19,7 @@ from fonticon_mdi6 import MDI6
19
19
  from math import floor
20
20
 
21
21
  from matplotlib import colormaps
22
+ import matplotlib.cm
22
23
 
23
24
 
24
25
  class QueryWidget(QWidget):
@@ -473,6 +474,14 @@ class TableUI(QMainWindow, Styles):
473
474
  self.table_view.resizeColumnsToContents()
474
475
  self.setAttribute(Qt.WA_DeleteOnClose)
475
476
 
477
+ def resizeEvent(self, event):
478
+
479
+ super().resizeEvent(event)
480
+
481
+ try:
482
+ self.fig.tight_layout()
483
+ except:
484
+ pass
476
485
 
477
486
  def _createActions(self):
478
487
 
@@ -718,8 +727,11 @@ class TableUI(QMainWindow, Styles):
718
727
  def save_as_csv_inplace_per_pos(self):
719
728
 
720
729
  print("Saving each table in its respective position folder...")
721
- for pos,pos_group in self.data.groupby('position'):
722
- pos_group.to_csv(pos+os.sep.join(['output', 'tables', f'trajectories_{self.population}.csv']), index=False)
730
+ for pos,pos_group in self.data.groupby(['position']):
731
+ invalid_cols = [c for c in list(pos_group.columns) if c.startswith('Unnamed')]
732
+ if len(invalid_cols)>0:
733
+ pos_group = pos_group.drop(invalid_cols, axis=1)
734
+ pos_group.to_csv(pos[0]+os.sep.join(['output', 'tables', f'trajectories_{self.population}.csv']), index=False)
723
735
  print("Done...")
724
736
 
725
737
  def differenciate_selected_feature(self):
@@ -812,7 +824,7 @@ class TableUI(QMainWindow, Styles):
812
824
 
813
825
  num_df = self.data.select_dtypes(include=self.numerics)
814
826
 
815
- timeseries = num_df.groupby("FRAME").sum().copy()
827
+ timeseries = num_df.groupby(["FRAME"]).sum().copy()
816
828
  timeseries["timeline"] = timeseries.index
817
829
  self.subtable = TableUI(timeseries,"Group by frames", plot_mode="plot_timeseries")
818
830
  self.subtable.show()
@@ -1029,11 +1041,10 @@ class TableUI(QMainWindow, Styles):
1029
1041
  layout.addLayout(hbox)
1030
1042
 
1031
1043
  self.cmap_cb = QColormapComboBox()
1032
- for cm in list(colormaps):
1033
- try:
1034
- self.cmap_cb.addColormap(cm)
1035
- except:
1036
- pass
1044
+ all_cms = list(colormaps)
1045
+ for cm in all_cms:
1046
+ if hasattr(matplotlib.cm, str(cm).lower()):
1047
+ self.cmap_cb.addColormap(cm.lower())
1037
1048
 
1038
1049
  hbox = QHBoxLayout()
1039
1050
  hbox.addWidget(QLabel('colormap: '), 33)
@@ -1324,6 +1335,9 @@ class TableUI(QMainWindow, Styles):
1324
1335
  if file_name:
1325
1336
  if not file_name.endswith(".csv"):
1326
1337
  file_name += ".csv"
1338
+ invalid_cols = [c for c in list(self.data.columns) if c.startswith('Unnamed')]
1339
+ if len(invalid_cols)>0:
1340
+ self.data = self.data.drop(invalid_cols, axis=1)
1327
1341
  self.data.to_csv(file_name, index=False)
1328
1342
 
1329
1343
  def test_bool(self, array):
@@ -1417,8 +1431,8 @@ class TableUI(QMainWindow, Styles):
1417
1431
  row_idx_i = row_idx[np.where(col_idx == unique_cols[k])[0]]
1418
1432
  y = self.data.iloc[row_idx_i, unique_cols[k]]
1419
1433
  print(unique_cols[k])
1420
- for w,well_group in self.data.groupby('well_name'):
1421
- for pos,pos_group in well_group.groupby('pos_name'):
1434
+ for w,well_group in self.data.groupby(['well_name']):
1435
+ for pos,pos_group in well_group.groupby(['pos_name']):
1422
1436
  for tid,group_track in pos_group.groupby(self.groupby_cols[1:]):
1423
1437
  ax.plot(group_track["FRAME"], group_track[column_names[unique_cols[k]]],label=column_names[unique_cols[k]])
1424
1438
  #ax.plot(self.data["FRAME"][row_idx_i], y, label=column_names[unique_cols[k]])
@@ -1454,8 +1468,8 @@ class TableUI(QMainWindow, Styles):
1454
1468
  # else:
1455
1469
  # ref_time_col = 'FRAME'
1456
1470
 
1457
- for w,well_group in self.data.groupby('well_name'):
1458
- for pos,pos_group in well_group.groupby('pos_name'):
1471
+ for w,well_group in self.data.groupby(['well_name']):
1472
+ for pos,pos_group in well_group.groupby(['pos_name']):
1459
1473
  for tid,group_track in pos_group.groupby(self.groupby_cols[1:]):
1460
1474
  self.ax.plot(group_track["FRAME"], group_track[column_names[unique_cols[0]]],c="k", alpha = 0.1)
1461
1475
  self.ax.set_xlabel(r"$t$ [frame]")