Exemple #1
0
 def press(self, parent, bid):
     for b in range(len(parent.colors) + 1):
         if parent.colorbtns.button(b).isEnabled():
             parent.colorbtns.button(b).setStyleSheet(parent.styleUnpressed)
     self.setStyleSheet(parent.stylePressed)
     parent.ops_plot[2] = bid
     if not parent.sizebtns.button(1).isChecked():
         if bid == 0:
             for b in [1, 2]:
                 parent.topbtns.button(b).setEnabled(False)
                 parent.topbtns.button(b).setStyleSheet(
                     parent.styleInactive)
         else:
             for b in [1, 2]:
                 parent.topbtns.button(b).setEnabled(True)
                 parent.topbtns.button(b).setStyleSheet(
                     parent.styleUnpressed)
     else:
         for b in range(3):
             parent.topbtns.button(b).setEnabled(False)
             parent.topbtns.button(b).setStyleSheet(parent.styleInactive)
     if bid == 6:
         fig.corr_masks(parent)
     elif bid == 7:
         fig.beh_masks(parent)
     M = fig.draw_masks(parent)
     fig.plot_masks(parent, M)
     fig.plot_colorbar(parent, bid)
Exemple #2
0
 def mode_change(self, i):
     self.activityMode = i
     if self.loaded:
         # activity used for correlations
         self.bin = int(self.binedit.text())
         nb = int(np.floor(float(self.Fcell.shape[1]) / float(self.bin)))
         if i == 0:
             f = self.Fcell
         elif i == 1:
             f = self.Fneu
         elif i == 2:
             f = self.Fcell - 0.7 * self.Fneu
         else:
             f = self.Spks
         ncells = len(self.stat)
         self.Fbin = f[:, :nb * self.bin].reshape(
             (ncells, nb, self.bin)).mean(axis=2)
         self.Fbin = self.Fbin - self.Fbin.mean(axis=1)[:, np.newaxis]
         self.Fstd = (self.Fbin**2).sum(axis=1)
         self.trange = np.arange(0, self.Fcell.shape[1])
         # if in correlation-view, recompute
         if self.ops_plot[2] == self.ops_plot[3].shape[1]:
             fig.corr_masks(self)
         elif self.ops_plot[2] == self.ops_plot[3].shape[1] + 1:
             fig.beh_masks(self)
         fig.plot_colorbar(self, self.ops_plot[2])
         M = fig.draw_masks(self)
         fig.plot_masks(self, M)
         fig.plot_trace(self)
         self.show()
Exemple #3
0
 def load_behavior(self):
     name = QtGui.QFileDialog.getOpenFileName(self,
                                              "Open *.npy",
                                              filter="*.npy")
     name = name[0]
     bloaded = False
     try:
         beh = np.load(name)
         beh = beh.flatten()
         if beh.size == self.Fcell.shape[1]:
             self.bloaded = True
     except (ValueError, KeyError, OSError, RuntimeError, TypeError,
             NameError):
         print("ERROR: this is not a 1D array with length of data")
     if self.bloaded:
         beh -= beh.min()
         beh /= beh.max()
         self.beh = beh
         b = len(self.colors)
         self.colorbtns.button(b).setEnabled(True)
         self.colorbtns.button(b).setStyleSheet(self.styleUnpressed)
         fig.beh_masks(self)
         fig.plot_trace(self)
         self.show()
     else:
         print("ERROR: this is not a 1D array with length of data")