6
6
7
7
import numpy as np
8
8
import pyqtgraph as pg
9
- from PyQt5 import QtGui , QtCore
10
- from PyQt5 .QtWidgets import QStyle
11
- from PyQt5 .QtWidgets import QWidget , QSlider , QMainWindow , QGridLayout , QStyleOptionSlider , QApplication , QLabel , QLineEdit , QPushButton , QComboBox , QCheckBox
9
+ from qtpy import QtGui , QtCore
10
+ from qtpy .QtWidgets import QStyle
11
+ from qtpy .QtWidgets import QWidget , QSlider , QMainWindow , QGridLayout , QStyleOptionSlider , QApplication , QLabel , QLineEdit , QPushButton , QComboBox , QCheckBox
12
12
from matplotlib import cm
13
13
from rastermap .rastermap import Rastermap
14
14
from scipy .ndimage import gaussian_filter1d
@@ -634,8 +634,8 @@ def activate(self):
634
634
#model = np.load(os.path.join(parent.ops["save_path0"], "embedding.npy"))
635
635
#model = np.load("embedding.npy", allow_pickle=True).item()
636
636
self .isort1 = np .argsort (self .model .embedding [:, 0 ])
637
- self .u = self .model .u
638
- self .v = self .model .v
637
+ self .Usv = self .model .Usv
638
+ self .Vsv = self .model .Vsv
639
639
self .comboBox .addItem ("rastermap" )
640
640
#self.isort1, self.isort2 = mapping.main(self.sp,None,self.u,self.sv,self.v)
641
641
@@ -678,19 +678,16 @@ def compute_map(self):
678
678
self .mapOn .setEnabled (False )
679
679
self .tic = time .time ()
680
680
try :
681
- self .model = Rastermap (n_components = ops ["n_components" ], n_X = ops ["n_X" ],
682
- nPC = ops ["nPC" ], init = ops ["init" ], alpha = ops ["alpha" ],
683
- K = ops ["K" ], constraints = ops ["constraints" ],
684
- annealing = ops ["annealing" ])
681
+ self .model = Rastermap ()
685
682
self .model .fit (self .sp )
686
683
#proc = {"embedding": model.embedding, "uv": [model.u, model.v],
687
684
# "ops": ops, "filename": args.S, "train_time": train_time}
688
685
#basename, fname = os.path.split(args.S)
689
686
#np.save(os.path.join(basename, "embedding.npy"), proc)
690
- print ("raster map computed in %3.2f s" % (time .time () - self .tic ))
691
687
self .activate ()
692
- except :
688
+ except Exception as e :
693
689
print ("Rastermap issue: Interrupted by error (not finished)\n " )
690
+ print (e )
694
691
#self.process.start("python -u -W ignore -m rastermap --S %s --ops %s"%
695
692
# (spath, opspath))
696
693
@@ -740,13 +737,9 @@ def sort_time(self):
740
737
"end_time" : - 1
741
738
}
742
739
if not hasattr (self , "isort2" ):
743
- self .model = Rastermap (n_components = ops ["n_components" ],
744
- n_X = ops ["n_X" ], nPC = ops ["nPC" ],
745
- init = ops ["init" ], alpha = ops ["alpha" ],
746
- K = ops ["K" ], constraints = ops ["constraints" ],
747
- annealing = ops ["annealing" ])
748
- unorm = (self .u ** 2 ).sum (axis = 0 )** 0.5
749
- self .model .fit (self .sp .T , u = self .v * unorm , v = self .u / unorm )
740
+ self .model = Rastermap ()
741
+ #unorm = (self.u**2).sum(axis=0)**0.5
742
+ self .model .fit (self .sp .T , Usv = self .Vsv , Vsv = self .Usv )
750
743
self .isort2 = np .argsort (self .model .embedding [:, 0 ])
751
744
self .tsort = self .isort2 .astype (np .int32 )
752
745
else :
@@ -755,7 +748,7 @@ def sort_time(self):
755
748
756
749
def neural_sorting (self , i ):
757
750
if i == 0 :
758
- self .isort = np .argsort (self .u [:, int (self .PCedit .text ()) - 1 ])
751
+ self .isort = np .argsort (self .Usv [:, int (self .PCedit .text ()) - 1 ])
759
752
elif i == 1 :
760
753
self .isort = self .isort1
761
754
if i < 2 :
0 commit comments