Bläddra i källkod

More performance improvements for plotting

tags/1.6.1
Trevor Irons 5 år sedan
förälder
incheckning
9297604df7
2 ändrade filer med 89 tillägg och 126 borttagningar
  1. 8
    5
      akvo/gui/mydynamicmplcanvas.py
  2. 81
    121
      akvo/tressel/mrsurvey.py

+ 8
- 5
akvo/gui/mydynamicmplcanvas.py Visa fil

@@ -235,17 +235,20 @@ class MyDynamicMplCanvas(MyMplCanvas):
235 235
         except:
236 236
             pass
237 237
 
238
-        self.ax1 = self.fig.add_subplot(211)
238
+        self.ax2 = self.fig.add_subplot(211)
239 239
         if shx and shy:
240
-            self.ax2 = self.fig.add_subplot(212, sharex=self.ax1, sharey=self.ax1)
240
+            self.ax1 = self.fig.add_subplot(212, sharex=self.ax2, sharey=self.ax2)
241 241
         elif shx:
242
-            self.ax2 = self.fig.add_subplot(212, sharex=self.ax1) 
242
+            self.ax1 = self.fig.add_subplot(212, sharex=self.ax2) 
243 243
         elif shy:
244
-            self.ax2 = self.fig.add_subplot(212, sharey=self.ax1) 
244
+            self.ax1 = self.fig.add_subplot(212, sharey=self.ax2) 
245 245
         else:
246
-            self.ax2 = self.fig.add_subplot(212) 
246
+            self.ax1 = self.fig.add_subplot(212) 
247 247
 
248 248
         self.ax3 = self.ax1.twinx()
249
+        self.ax2.yaxis.set_label_position("right")
250
+        self.ax2.yaxis.set_ticks_position("right")
251
+        #self.ax2.yaxis.tick_right()
249 252
 
250 253
         #self.ax1.set_facecolor('red')
251 254
         #self.ax2.set_facecolor('red')

+ 81
- 121
akvo/tressel/mrsurvey.py Visa fil

@@ -36,7 +36,7 @@ plt.register_cmap(name='magma', cmap=cmaps.magma)
36 36
 plt.register_cmap(name='magma_r', cmap=cmaps.magma_r)
37 37
 
38 38
 
39
-def loadGMRBinaryFID( rawfname, istack, info ):
39
+def xxloadGMRBinaryFID( rawfname, info ):
40 40
     """ Reads a single binary GMR file and fills into DATADICT
41 41
     """
42 42
 
@@ -556,19 +556,11 @@ class GMRDataProcessor(SNMRDataProcessor):
556 556
             plot = should Akvo plot the results 
557 557
             canvas = mpl plotting axis      
558 558
         """
559
-        #print("harmonic modelling...", f0)
560
-        #plot = True
561 559
         if plot:
562 560
             canvas.reAx2()
563
-            #canvas.ax1.tick_params(axis='both', which='major', labelsize=8)
564
-            #canvas.ax1.ticklabel_format(style='sci', axis='y') #, scilimits=(0,0))
565
-            #canvas.ax2.tick_params(axis='both', which='major', labelsize=8)
566
-            #canvas.ax2.ticklabel_format(style='sci', axis='y') #, scilimits=(0,0)) 
567 561
             canvas.ax1.set_ylabel(r"signal [nV]", fontsize=8)
568 562
             canvas.ax2.set_xlabel(r"time [s]", fontsize=8)
569 563
             canvas.ax2.set_ylabel(r"signal [nV]", fontsize=8)
570
-            #canvas.ax1.tick_params(axis='both', which='major', labelsize=8)
571
-            #canvas.ax2.tick_params(axis='both', which='major', labelsize=8)
572 564
 
573 565
         # Data
574 566
         iFID = 0
@@ -585,56 +577,45 @@ class GMRDataProcessor(SNMRDataProcessor):
585 577
                 f1p[chan] = f1+1e-1
586 578
 
587 579
         for pulse in self.DATADICT["PULSES"]:
588
-            self.DATADICT[pulse]["TIMES"] =  self.DATADICT[pulse]["TIMES"]
589 580
             Nseg = int( np.floor(len( self.DATADICT[pulse]["TIMES"] ) / f0ns) )
590 581
             for istack in self.DATADICT["stacks"]:
591 582
                 for ipm in range(self.DATADICT["nPulseMoments"]):
592 583
                     if plot:
593
-                        #canvas.ax1.clear()
594
-                        #canvas.ax2.clear()
595
-                        #for artist in canvas.ax1.lines + canvas.ax1.collections:
596
-                        #    artist.remove()
597
-                        #canvas.ax1.set_prop_cycle(None)
598
-                        #for artist in canvas.ax2.lines + canvas.ax2.collections:
599
-                        #    artist.remove()
600
-                        #canvas.ax2.set_prop_cycle(None)
601 584
                         canvas.softClear()
585
+                        mmax = 0
602 586
                         for ichan in self.DATADICT[pulse]["rchan"]:
603 587
                             canvas.ax1.plot( self.DATADICT[pulse]["TIMES"], 1e9*self.DATADICT[pulse][ichan][ipm][istack], alpha=.5) 
604
-                            #, label = "orig " +  pulse + " ipm=" + str(ipm) + " istack=" + str(istack) + " rchan="  + str(ichan))
605
-                            
588
+                            mmax = max( mmax, np.max(1e9*self.DATADICT[pulse][ichan][ipm][istack])) 
606 589
                         for ichan in self.DATADICT[pulse]["chan"]:
607 590
                             canvas.ax2.plot( self.DATADICT[pulse]["TIMES"], 1e9*self.DATADICT[pulse][ichan][ipm][istack], alpha=.5) 
608
-                            #, label = "orig " +  pulse + " ipm=" + str(ipm) + " istack=" + str(istack) + " chan="  + str(ichan))
591
+                            mmax = max( mmax, np.max(1e9*self.DATADICT[pulse][ichan][ipm][istack])) 
609 592
                         canvas.ax1.set_prop_cycle(None)
610 593
                         canvas.ax2.set_prop_cycle(None)
594
+                        canvas.ax1.set_ylim(-mmax, mmax) 
611 595
                     for ichan in self.DATADICT[pulse]["rchan"]:
612 596
                         if nF == 1:
613
-                            #self.DATADICT[pulse][ichan][ipm][istack] = harmonic.minHarmonic( f0, self.DATADICT[pulse][ichan][ipm][istack], self.samp, nK, self.DATADICT[pulse]["TIMES"] ) 
614 597
                             for iseg in range(f0ns):
615 598
                                 if iseg < f0ns-1:
616
-                                    self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg:(iseg+1)*Nseg], f0p[ichan] = harmonic.minHarmonic( self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg:(iseg+1)*Nseg], \
599
+                                    self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg:(iseg+1)*Nseg], f0p[ichan] = \
600
+                                        harmonic.minHarmonic( self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg:(iseg+1)*Nseg], \
617 601
                                             self.samp,  self.DATADICT[pulse]["TIMES"][iseg*Nseg:(iseg+1)*Nseg], \
618 602
                                             f0p[ichan], f0K1, f0KN, f0Ks ) 
619 603
                                 else:
620
-                                    self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg::], f0p[ichan] = harmonic.minHarmonic( self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg::], \
604
+                                    self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg::], f0p[ichan] = \
605
+                                        harmonic.minHarmonic( self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg::], \
621 606
                                             self.samp,  self.DATADICT[pulse]["TIMES"][iseg*Nseg::], \
622 607
                                             f0p[ichan], f0K1, f0KN, f0Ks ) 
623
-                            #self.DATADICT[pulse][ichan][ipm][istack] = harmonic.minHarmonic( self.DATADICT[pulse][ichan][ipm][istack], self.samp,  self.DATADICT[pulse]["TIMES"], \
624
-                            #    f0, f0K1, f0KN, f0Ks ) 
625 608
                         elif nF == 2:
626
-                            #self.DATADICT[pulse][ichan][ipm][istack] = harmonic.minHarmonic2( f0-1e-2, f1+1e-2, self.DATADICT[pulse][ichan][ipm][istack], self.samp, nK, self.DATADICT[pulse]["TIMES"] ) 
627
-                            #self.DATADICT[pulse][ichan][ipm][istack] = harmonic.minHarmonic2( self.DATADICT[pulse][ichan][ipm][istack], self.samp,  self.DATADICT[pulse]["TIMES"], \
628
-                            #    f0-1e-2, f0K1, f0KN, f0Ks,  \
629
-                            #    f1+1e-2, f1K1, f1KN, f1Ks ) 
630 609
                             for iseg in range(f0ns):
631 610
                                 if iseg < f0ns-1:
632
-                                    self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg:(iseg+1)*Nseg], f0p[ichan], f1p[ichan] = harmonic.minHarmonic2( self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg:(iseg+1)*Nseg],\
611
+                                    self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg:(iseg+1)*Nseg], f0p[ichan], f1p[ichan] = \
612
+                                        harmonic.minHarmonic2( self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg:(iseg+1)*Nseg],\
633 613
                                      self.samp,  self.DATADICT[pulse]["TIMES"][iseg*Nseg:(iseg+1)*Nseg], \
634 614
                                      f0p[ichan], f0K1, f0KN, f0Ks,  \
635 615
                                      f1p[ichan], f1K1, f1KN, f1Ks ) 
636 616
                                 else:
637
-                                    self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg::], f0p[ichan], f1p[ichan] = harmonic.minHarmonic2( self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg::],\
617
+                                    self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg::], f0p[ichan], f1p[ichan] = \
618
+                                        harmonic.minHarmonic2( self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg::],\
638 619
                                      self.samp,  self.DATADICT[pulse]["TIMES"][iseg*Nseg::], \
639 620
                                      f0p[ichan], f0K1, f0KN, f0Ks,  \
640 621
                                      f1p[ichan], f1K1, f1KN, f1Ks ) 
@@ -646,33 +627,29 @@ class GMRDataProcessor(SNMRDataProcessor):
646 627
                     for ichan in self.DATADICT[pulse]["chan"]:
647 628
                         
648 629
                         if nF == 1:
649
-                            #self.DATADICT[pulse][ichan][ipm][istack] = harmonic.minHarmonic( f0, self.DATADICT[pulse][ichan][ipm][istack], self.samp, nK, self.DATADICT[pulse]["TIMES"] ) 
650
-                            #self.DATADICT[pulse][ichan][ipm][istack] = harmonic.minHarmonic( self.DATADICT[pulse][ichan][ipm][istack], self.samp,  self.DATADICT[pulse]["TIMES"], \
651
-                            #    f0, f0K1, f0KN, f0Ks ) 
652 630
                             for iseg in range(f0ns):
653 631
                                 if iseg < f0ns-1:
654
-                                    self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg:(iseg+1)*Nseg], f0p[ichan] = harmonic.minHarmonic( self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg:(iseg+1)*Nseg], 
632
+                                    self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg:(iseg+1)*Nseg], f0p[ichan] = \
633
+                                        harmonic.minHarmonic( self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg:(iseg+1)*Nseg], 
655 634
                                             self.samp,  self.DATADICT[pulse]["TIMES"][iseg*Nseg:(iseg+1)*Nseg], \
656 635
                                             f0p[ichan], f0K1, f0KN, f0Ks ) 
657 636
                                 else:
658
-                                    self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg::], f0p[ichan] = harmonic.minHarmonic( self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg::], 
637
+                                    self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg::], f0p[ichan] = \
638
+                                        harmonic.minHarmonic( self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg::], 
659 639
                                             self.samp,  self.DATADICT[pulse]["TIMES"][iseg*Nseg::], \
660 640
                                             f0p[ichan], f0K1, f0KN, f0Ks )
661 641
 
662 642
                         elif nF == 2:
663
-                            #self.DATADICT[pulse][ichan][ipm][istack] = harmonic.minHarmonic2( f0-1e-2, f1+1e-2, self.DATADICT[pulse][ichan][ipm][istack], self.samp, nK, self.DATADICT[pulse]["TIMES"] ) 
664
-                            #self.DATADICT[pulse][ichan][ipm][istack] = harmonic.harmonicEuler( f0, self.DATADICT[pulse][ichan][ipm][istack], self.samp, 20, self.DATADICT[pulse]["TIMES"] ) 
665
-                            #self.DATADICT[pulse][ichan][ipm][istack] = harmonic.minHarmonic2( self.DATADICT[pulse][ichan][ipm][istack], self.samp,  self.DATADICT[pulse]["TIMES"], \
666
-                            #    f0-1e-2, f0K1, f0KN, f0Ks,  \
667
-                            #    f1+1e-2, f1K1, f1KN, f1Ks ) 
668 643
                             for iseg in range(f0ns):
669 644
                                 if iseg < f0ns-1:
670
-                                    self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg:(iseg+1)*Nseg], f0p[ichan], f1p[ichan] = harmonic.minHarmonic2( self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg:(iseg+1)*Nseg],\
645
+                                    self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg:(iseg+1)*Nseg], f0p[ichan], f1p[ichan] = \
646
+                                        harmonic.minHarmonic2( self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg:(iseg+1)*Nseg],\
671 647
                                      self.samp,  self.DATADICT[pulse]["TIMES"][iseg*Nseg:(iseg+1)*Nseg], \
672 648
                                      f0p[ichan], f0K1, f0KN, f0Ks,  \
673 649
                                      f1p[ichan], f1K1, f1KN, f1Ks ) 
674 650
                                 else:
675
-                                    self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg::], f0p[ichan], f1p[ichan] = harmonic.minHarmonic2( self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg::],\
651
+                                    self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg::], f0p[ichan], f1p[ichan] = \
652
+                                        harmonic.minHarmonic2( self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg::],\
676 653
                                      self.samp,  self.DATADICT[pulse]["TIMES"][iseg*Nseg::], \
677 654
                                      f0p[ichan], f0K1, f0KN, f0Ks,  \
678 655
                                      f1p[ichan], f1K1, f1KN, f1Ks ) 
@@ -686,18 +663,14 @@ class GMRDataProcessor(SNMRDataProcessor):
686 663
                         canvas.ax1.legend(prop={'size':6}, loc='upper right')
687 664
                         canvas.ax2.legend(prop={'size':6}, loc='upper right')
688 665
                         canvas.draw() 
689
-                    
690
-                #percent = (int)(1e2*((float)(iFID*self.DATADICT["nPulseMoments"]+(ipm))/(len(self.DATADICT["PULSES"])*self.nPulseMoments)))
666
+                
691 667
                 percent = (int)(1e2*((ipm+istack*self.nPulseMoments)/(self.nPulseMoments*len(self.DATADICT["stacks"])))) 
692 668
                 self.progressTrigger.emit(percent)  
693 669
             iFID += 1
694 670
 
695 671
         self.doneTrigger.emit() 
696 672
         self.updateProcTrigger.emit()  
697
-
698
-
699 673
         self.doneTrigger.emit() 
700
-        
701 674
     
702 675
     def FDSmartStack(self, outlierTest, MADcutoff, canvas):
703 676
         
@@ -1639,12 +1612,8 @@ class GMRDataProcessor(SNMRDataProcessor):
1639 1612
     def adaptiveFilter(self, M, flambda, truncate, mu, PCA, canvas):
1640 1613
 
1641 1614
         canvas.reAx2(shx=False, shy=False)
1642
-         
1643
-        canvas.ax2.tick_params(axis='both', which='major', labelsize=8)
1644
-        canvas.ax2.ticklabel_format(style='sci', scilimits=(0,0), axis='y')  
1645
-        
1646
-        canvas.ax2.tick_params(axis='both', which='major', labelsize=8)
1647
-        canvas.ax2.ticklabel_format(style='sci', scilimits=(0,0), axis='y')  
1615
+        # ax1 is top plot of filter taps 
1616
+        # ax2 is bottom plot of conditioned signal 
1648 1617
         
1649 1618
         if truncate:
1650 1619
             itrunc =(int) ( round( 1e-3*truncate*self.samp ) )
@@ -1667,12 +1636,16 @@ class GMRDataProcessor(SNMRDataProcessor):
1667 1636
         for istack in self.DATADICT["stacks"]:
1668 1637
             for ipm in range(self.DATADICT["nPulseMoments"]):
1669 1638
                 for pulse in self.DATADICT["PULSES"]:
1670
-                    canvas.ax1.clear()
1671
-                    canvas.ax2.clear()
1639
+                    canvas.softClear()
1640
+                    mmax = 0
1641
+                    for ichan in self.DATADICT[pulse]["chan"]:
1642
+                        canvas.ax2.plot( self.DATADICT[pulse]["TIMES"], 1e9* self.DATADICT[pulse][ichan][ipm][istack], alpha=.5) 
1643
+                        mmax = max(mmax, np.max(1e9*self.DATADICT[pulse][ichan][ipm][istack])) 
1644
+                    canvas.ax2.set_ylim(-mmax, mmax) 
1645
+                    canvas.ax2.set_prop_cycle(None)
1646
+
1672 1647
                     for ichan in self.DATADICT[pulse]["chan"]:
1673 1648
                         #H = np.zeros(M)
1674
-                        canvas.ax1.plot( self.DATADICT[pulse]["TIMES"], 1e9* self.DATADICT[pulse][ichan][ipm][istack],\
1675
-                            label = "noisy") 
1676 1649
                         RX = []
1677 1650
                         for irchan in self.DATADICT[pulse]["rchan"]:
1678 1651
                             RX.append(self.DATADICT[pulse][irchan][ipm][istack][::-1])
@@ -1690,23 +1663,23 @@ class GMRDataProcessor(SNMRDataProcessor):
1690 1663
                                                         M, mu, PCA, flambda, H[pulse][ichan])
1691 1664
                         # replace
1692 1665
                         if truncate:
1693
-                            canvas.ax1.plot( self.DATADICT[pulse]["TIMES"][0:itrunc], 1e9* e[::-1][0:itrunc],\
1694
-                            label = pulse + " ipm=" + str(ipm) + " istack=" + str(istack) + " ichan="  + str(ichan))
1666
+                            canvas.ax2.plot( self.DATADICT[pulse]["TIMES"][0:itrunc], 1e9* e[::-1][0:itrunc],\
1667
+                                label = pulse + " ipm=" + str(ipm) + " istack=" + str(istack) + " ichan="  + str(ichan))
1695 1668
                             self.DATADICT[pulse][ichan][ipm][istack] = e[::-1][0:itrunc]
1696 1669
                         else:
1697
-                            canvas.ax1.plot( self.DATADICT[pulse]["TIMES"], 1e9* e[::-1],\
1698
-                            label = pulse + " ipm=" + str(ipm) + " istack=" + str(istack) + " ichan="  + str(ichan))
1670
+                            canvas.ax2.plot( self.DATADICT[pulse]["TIMES"], 1e9* e[::-1],\
1671
+                                label = pulse + " ipm=" + str(ipm) + " istack=" + str(istack) + " ichan="  + str(ichan))
1699 1672
                             self.DATADICT[pulse][ichan][ipm][istack] = e[::-1]
1700 1673
                             
1701
-                        canvas.ax2.plot( H[pulse][ichan] , label="taps") 
1702
-                        canvas.ax1.legend(prop={'size':6})
1703
-                        canvas.ax2.legend(prop={'size':6})
1674
+                        canvas.ax1.plot( H[pulse][ichan] ) # , label="taps") 
1675
+                        canvas.ax2.legend(prop={'size':6}, loc='upper right')
1676
+                        #canvas.ax2.legend(prop={'size':6}, loc='upper right')
1704 1677
 
1705
-                        canvas.ax1.set_xlabel(r"time [s]", fontsize=8)
1706
-                        canvas.ax1.set_ylabel(r"signal [nV]", fontsize=8)
1678
+                        canvas.ax2.set_xlabel(r"time [s]", fontsize=8)
1679
+                        canvas.ax2.set_ylabel(r"signal [nV]", fontsize=8)
1707 1680
 
1708
-                        canvas.ax2.set_xlabel(r"filter index", fontsize=8)
1709
-                        canvas.ax2.set_ylabel(r"scale factor", fontsize=8)
1681
+                        canvas.ax1.set_xlabel(r"filter index", fontsize=8)
1682
+                        canvas.ax1.set_ylabel(r"scale factor", fontsize=8)
1710 1683
 
1711 1684
                     canvas.draw()
1712 1685
 
@@ -2169,21 +2142,30 @@ class GMRDataProcessor(SNMRDataProcessor):
2169 2142
 
2170 2143
         if plot:
2171 2144
             canvas.reAx2()
2172
-            canvas.ax1.tick_params(axis='both', which='major', labelsize=8)
2173
-            canvas.ax1.ticklabel_format(style='sci', scilimits=(0,0), axis='y')  
2174
-            canvas.ax2.tick_params(axis='both', which='major', labelsize=8)
2175
-            canvas.ax2.ticklabel_format(style='sci', scilimits=(0,0), axis='y')  
2145
+            canvas.ax1.set_ylabel(r"signal [nV]", fontsize=8)
2146
+            canvas.ax2.set_xlabel(r"time [s]", fontsize=8)
2147
+            canvas.ax2.set_ylabel(r"signal [nV]", fontsize=8)
2176 2148
 
2177 2149
         ife = (int)( max(self.fe, self.windead) * self.samp )
2178 2150
         # Data
2179 2151
         iFID = 0
2180 2152
         for pulse in self.DATADICT["PULSES"]:
2181
-            self.DATADICT[pulse]["TIMES"] =  self.DATADICT[pulse]["TIMES"][ife:-ife]
2153
+            self.DATADICT[pulse]["TIMES"] = self.DATADICT[pulse]["TIMES"][ife:-ife]
2182 2154
             for ipm in range(self.DATADICT["nPulseMoments"]):
2183 2155
                 for istack in self.DATADICT["stacks"]:
2184
-                    canvas.ax1.clear()
2185
-                    canvas.ax2.clear()
2186
-                    #for ichan in np.append(self.DATADICT[pulse]["chan"], self.DATADICT[pulse]["rchan"]):
2156
+                    if plot:
2157
+                        canvas.softClear()
2158
+                        mmax = 0
2159
+                        for ichan in self.DATADICT[pulse]["rchan"]:
2160
+                            canvas.ax1.plot( self.DATADICT[pulse]["TIMES"], 1e9*self.DATADICT[pulse][ichan][ipm][istack][ife:-ife], alpha=.5)
2161
+                            mmax = max( mmax, np.max(1e9*self.DATADICT[pulse][ichan][ipm][istack][ife:-ife])) 
2162
+                        for ichan in self.DATADICT[pulse]["chan"]:
2163
+                            canvas.ax2.plot( self.DATADICT[pulse]["TIMES"], 1e9*self.DATADICT[pulse][ichan][ipm][istack][ife:-ife], alpha=.5)
2164
+                            mmax = max( mmax, np.max(1e9*self.DATADICT[pulse][ichan][ipm][istack][ife:-ife])) 
2165
+                        canvas.ax2.set_prop_cycle(None)
2166
+                        canvas.ax1.set_prop_cycle(None)
2167
+                        canvas.ax1.set_ylim(-mmax, mmax) 
2168
+
2187 2169
                     for ichan in self.DATADICT[pulse]["rchan"]:
2188 2170
                         # reflect signal back on itself to reduce gibbs effects on early times 
2189 2171
                         #nr = len( self.DATADICT[pulse][ichan][ipm][istack] ) - 1 + ife
@@ -2217,12 +2199,8 @@ class GMRDataProcessor(SNMRDataProcessor):
2217 2199
                                 label = "data " + pulse + " ipm=" + str(ipm) + " istack=" + str(istack) + " chan="  + str(ichan))
2218 2200
 
2219 2201
                     if plot:
2220
-                        canvas.ax1.set_xlabel(r"time [s]", fontsize=8)
2221
-                        canvas.ax1.set_ylabel(r"signal [nV]", fontsize=8)
2222
-                        canvas.ax2.set_xlabel(r"time [s]", fontsize=8)
2223
-                        canvas.ax2.set_ylabel(r"signal [nV]", fontsize=8)
2224
-                        canvas.ax1.legend(prop={'size':6})
2225
-                        canvas.ax2.legend(prop={'size':6})
2202
+                        canvas.ax1.legend(prop={'size':6}, loc='upper right')
2203
+                        canvas.ax2.legend(prop={'size':6}, loc='upper right')
2226 2204
                         canvas.draw() 
2227 2205
                     
2228 2206
                 percent = (int)(1e2*((float)(iFID*self.DATADICT["nPulseMoments"]+(ipm))/(len(self.DATADICT["PULSES"])*self.nPulseMoments)))
@@ -2395,9 +2373,7 @@ class GMRDataProcessor(SNMRDataProcessor):
2395 2373
         for ch in rchanin:
2396 2374
             rchan.append(str(ch)) 
2397 2375
 
2398
-        # not in any headers but this has changed, NOT the place to do this. MOVE  
2399
-        #self.prePulseDelay  = 0.01          # delay before pulse
2400
-        self.deadTime       = deadTime       # instrument dead time before measurement
2376
+        self.deadTime = deadTime             # instrument dead time before measurement
2401 2377
         self.samp = 50000.                   # in case this is a reproc, these might have 
2402 2378
         self.dt   = 1./self.samp             # changed
2403 2379
 
@@ -2428,7 +2404,6 @@ class GMRDataProcessor(SNMRDataProcessor):
2428 2404
         ##############################################
2429 2405
         # Read in binary (.lvm) data
2430 2406
         iistack = 0
2431
-        fnames = []
2432 2407
         for istack in procStacks:
2433 2408
             if self.nDAQVersion <= 1.0:
2434 2409
                 try:
@@ -2436,32 +2411,14 @@ class GMRDataProcessor(SNMRDataProcessor):
2436 2411
                 except:
2437 2412
                     self.loadGMRASCIIFID( base + "_" + str(istack) + ".lvm", istack )
2438 2413
             elif self.nDAQVersion < 2.3:
2439
-                #rawfname = base + "_" + str(istack) 
2440 2414
                 self.loadGMRASCIIFID( base + "_" + str(istack), istack )
2441 2415
             else:
2442 2416
                 self.loadGMRBinaryFID( base + "_" + str(istack) + ".lvm", istack )
2443
-                #fnames.append( base + "_" + str(istack) + ".lvm" )
2444
-                
2445
-            percent = (int) (1e2*((float)((iistack*self.nPulseMoments+ipm+1))  / (len(procStacks)*self.nPulseMoments)))
2446
-            self.progressTrigger.emit(percent) 
2447
-            iistack += 1
2448 2417
 
2449
-        # multiprocessing load data
2450
-        #info = {}
2451
-        #info["prePulseDelay"] = self.prePulseDelay
2452
-        #with multiprocessing.Pool() as pool: 
2453
-        #    results = pool.starmap( loadGMRBinaryFID, zip(itertools.repeat(self), fnames, info ) ) # zip(np.tile(vc, (ns, 1)), np.tile(vgc, (ns,1)), itertools.repeat(sys.argv[1]), itertools.repeat(sys.argv[2]), EPS_CMR))
2454
-        # Plotting
2455
-
2456
-        if plot: 
2457
-            iistack = 0
2458
-            for istack in procStacks:
2418
+            if plot: 
2459 2419
                 for ipm in range(self.nPulseMoments):
2460
-                    canvas.ax1.clear()
2461
-                    canvas.ax2.clear()
2462
-                    canvas.ax3.clear()
2463
-                    #canvas.fig.patch.set_facecolor('blue')
2464
-                           
2420
+                    canvas.softClear()                           
2421
+
2465 2422
                     for ichan in chan:
2466 2423
                         canvas.ax1.plot(self.DATADICT["Pulse 1"]["PULSE_TIMES"], self.DATADICT["Pulse 1"]["CURRENT"][ipm][istack] , color='black')
2467 2424
                         canvas.ax3.plot(self.DATADICT["Pulse 1"]["TIMES"],       self.DATADICT["Pulse 1"][ichan][ipm][istack], label="Pulse 1 FID data ch. "+str(ichan)) #, color='blue')
@@ -2469,25 +2426,27 @@ class GMRDataProcessor(SNMRDataProcessor):
2469 2426
                     for ichan in rchan:
2470 2427
                         canvas.ax2.plot(self.DATADICT["Pulse 1"]["TIMES"], self.DATADICT["Pulse 1"][ichan][ipm][istack], label="Pulse 1 FID ref ch. "+str(ichan)) #, color='blue')
2471 2428
 
2472
-                    canvas.ax3.legend(prop={'size':6})
2473
-                    canvas.ax2.legend(prop={'size':6})
2429
+                    canvas.ax3.legend(prop={'size':6}, loc='upper right')
2430
+                    canvas.ax2.legend(prop={'size':6}, loc='upper right')
2474 2431
                     
2475 2432
                     canvas.ax1.set_title("stack "+str(istack)+" pulse index " + str(ipm), fontsize=8)
2476
-                    canvas.ax1.set_xlabel("time [s]", fontsize=8)
2477 2433
                     canvas.ax1.set_ylabel("Current [A]", fontsize=8) 
2478 2434
                     canvas.ax1.ticklabel_format(style='sci', scilimits=(0,0), axis='y') 
2479 2435
                     
2480 2436
                     canvas.ax2.set_ylabel("RAW signal [V]", fontsize=8)
2437
+                    canvas.ax3.set_ylabel("RAW signal [V]", fontsize=8)
2481 2438
                     canvas.ax2.tick_params(axis='both', which='major', labelsize=8)
2482 2439
                     canvas.ax2.tick_params(axis='both', which='minor', labelsize=6)
2483 2440
                     canvas.ax2.set_xlabel("time [s]", fontsize=8)
2484
-                    canvas.ax2.ticklabel_format(style='sci', scilimits=(0,0), axis='y') 
2485
-                    canvas.ax3.ticklabel_format(style='sci', scilimits=(0,0), axis='y') 
2486 2441
                     canvas.draw()
2487 2442
 
2488
-                percent = (int) (1e2*((float)((iistack*self.nPulseMoments+ipm+1))  / (len(procStacks)*self.nPulseMoments)))
2489
-                self.progressTrigger.emit(percent) 
2490
-                iistack += 1
2443
+            percent = (int) (1e2*((float)((iistack*self.nPulseMoments+ipm+1))  / (len(procStacks)*self.nPulseMoments)))
2444
+            self.progressTrigger.emit(percent) 
2445
+            iistack += 1
2446
+
2447
+#                percent = (int) (1e2*((float)((iistack*self.nPulseMoments+ipm+1))  / (len(procStacks)*self.nPulseMoments)))
2448
+#                self.progressTrigger.emit(percent) 
2449
+#                iistack += 1
2491 2450
 
2492 2451
         self.enableDSP()    
2493 2452
         self.doneTrigger.emit()
@@ -2556,8 +2515,9 @@ class GMRDataProcessor(SNMRDataProcessor):
2556 2515
         # multiprocessing load data
2557 2516
         #info = {}
2558 2517
         #info["prePulseDelay"] = self.prePulseDelay
2518
+        #info["samp"] = self.samp
2559 2519
         #with multiprocessing.Pool() as pool: 
2560
-        #    results = pool.starmap( loadGMRBinaryFID, zip(itertools.repeat(self), fnames, info ) ) # zip(np.tile(vc, (ns, 1)), np.tile(vgc, (ns,1)), itertools.repeat(sys.argv[1]), itertools.repeat(sys.argv[2]), EPS_CMR))
2520
+        #    results = pool.starmap( xxloadGMRBinaryFID, ( fnames, zip(itertools.repeat(info)) ) ) 
2561 2521
         # Plotting
2562 2522
 
2563 2523
         if plot: 
@@ -2576,8 +2536,8 @@ class GMRDataProcessor(SNMRDataProcessor):
2576 2536
                     for ichan in rchan:
2577 2537
                         canvas.ax2.plot(self.DATADICT["Pulse 1"]["TIMES"], self.DATADICT["Pulse 1"][ichan][ipm][istack], label="Pulse 1 FID ref ch. "+str(ichan)) #, color='blue')
2578 2538
 
2579
-                    canvas.ax3.legend(prop={'size':6})
2580
-                    canvas.ax2.legend(prop={'size':6})
2539
+                    canvas.ax3.legend(prop={'size':6}, loc='upper right')
2540
+                    canvas.ax2.legend(prop={'size':6}, loc='upper right')
2581 2541
                     
2582 2542
                     canvas.ax1.set_title("stack "+str(istack)+" pulse index " + str(ipm), fontsize=8)
2583 2543
                     canvas.ax1.set_xlabel("time [s]", fontsize=8)
@@ -2757,7 +2717,7 @@ class GMRDataProcessor(SNMRDataProcessor):
2757 2717
                             canvas.ax1.plot(self.DATADICT["Pulse 2"]["TIMES"], self.DATADICT["Pulse 2"][ichan][ipm][istack], label="Pulse 2 FID ref ch. "+str(ichan)) #, color='blue')
2758 2718
                 
2759 2719
                 if plot:
2760
-                    canvas.ax1.legend(prop={'size':6})
2720
+                    canvas.ax1.legend(prop={'size':6}, loc='upper right')
2761 2721
                     canvas.ax1.set_title("stack "+str(istack)+" pulse index " + str(ipm), fontsize=8)
2762 2722
                     canvas.ax1.set_xlabel("time [s]", fontsize=8)
2763 2723
                     canvas.ax1.set_ylabel("RAW signal [V]", fontsize=8)

Laddar…
Avbryt
Spara