Просмотр исходного кода

time domain noise plot for harmonics

tags/1.6.1
Trevor Irons 5 лет назад
Родитель
Сommit
596e5bd808
1 измененных файлов: 44 добавлений и 28 удалений
  1. 44
    28
      akvo/tressel/mrsurvey.py

+ 44
- 28
akvo/tressel/mrsurvey.py Просмотреть файл

@@ -560,17 +560,25 @@ class GMRDataProcessor(SNMRDataProcessor):
560 560
             plot = should Akvo plot the results 
561 561
             canvas = mpl plotting axis      
562 562
         """
563
+        TDPlot = True
564
+        
563 565
         if plot:
564 566
             canvas.reAx2(shy=False)
565
-            canvas.ax1.set_ylabel(r"signal [nV]", fontsize=8)
566
-            #canvas.ax2.set_xlabel(r"time [s]", fontsize=8)
567
-            canvas.ax2.set_ylabel(r"signal [nV]", fontsize=8)
568
-            canvas.ax2.set_xlabel(r"frequency [Hz]", fontsize=8)
569
-            canvas.ax1.set_yscale('log')
570
-            canvas.ax2.set_yscale('log')
567
+            canvas.ax1.set_ylabel(r"signal (nV)", fontsize=8)
568
+            canvas.ax2.set_ylabel(r"signal (nV)", fontsize=8)
569
+            if TDPlot:
570
+                canvas.ax2.set_xlabel(r"time (s)", fontsize=8)
571
+            else:
572
+                canvas.ax2.set_xlabel(r"frequency (Hz)", fontsize=8)
573
+                canvas.ax1.set_yscale('log')
574
+                canvas.ax2.set_yscale('log')
575
+
576
+
577
+
571 578
         # Data
572 579
         iFID = 0
573 580
 
581
+
574 582
         # stores previous f0 as starting point in non-linear search 
575 583
         f0p = {} 
576 584
         f1p = {} 
@@ -592,19 +600,23 @@ class GMRDataProcessor(SNMRDataProcessor):
592 600
                         mmaxd = 0
593 601
                         if procRefs: 
594 602
                             for ichan in self.DATADICT[pulse]["rchan"]:
595
-                                #canvas.ax1.plot( self.DATADICT[pulse]["TIMES"], 1e9*self.DATADICT[pulse][ichan][ipm][istack], alpha=.5) 
596
-                                #mmaxr = max( mmaxr, np.max(1e9*self.DATADICT[pulse][ichan][ipm][istack])) 
597
-                                ww = np.fft.fftfreq(len(self.DATADICT[pulse][ichan][ipm][istack]), d=self.dt)
598
-                                X = np.fft.rfft(self.DATADICT[pulse][ichan][ipm][istack])
599
-                                canvas.ax1.plot(np.abs(ww[0:len(X)]), np.abs(X), alpha=.5)
603
+                                if TDPlot:
604
+                                    canvas.ax1.plot( self.DATADICT[pulse]["TIMES"], 1e9*self.DATADICT[pulse][ichan][ipm][istack], alpha=.5) 
605
+                                    mmaxr = max( mmaxr, np.max(1e9*self.DATADICT[pulse][ichan][ipm][istack])) 
606
+                                else:
607
+                                    ww = np.fft.fftfreq(len(self.DATADICT[pulse][ichan][ipm][istack]), d=self.dt)
608
+                                    X = np.fft.rfft(self.DATADICT[pulse][ichan][ipm][istack])
609
+                                    canvas.ax1.plot(np.abs(ww[0:len(X)]), np.abs(X), alpha=.5)
600 610
                             canvas.ax1.set_prop_cycle(None)
601 611
                             #canvas.ax1.set_ylim(-mmaxr, mmaxr) 
602 612
                         for ichan in self.DATADICT[pulse]["chan"]:
603
-                            #canvas.ax2.plot( self.DATADICT[pulse]["TIMES"], 1e9*self.DATADICT[pulse][ichan][ipm][istack], alpha=.5) 
604
-                            #mmaxd = max( mmaxd, np.max(1e9*self.DATADICT[pulse][ichan][ipm][istack])) 
605
-                            ww = np.fft.fftfreq(len(self.DATADICT[pulse][ichan][ipm][istack]), d=self.dt)
606
-                            X = np.fft.rfft(self.DATADICT[pulse][ichan][ipm][istack])
607
-                            canvas.ax2.plot(np.abs(ww[0:len(X)]), np.abs(X), alpha=.5)
613
+                            if TDPlot:
614
+                                canvas.ax2.plot( self.DATADICT[pulse]["TIMES"], 1e9*self.DATADICT[pulse][ichan][ipm][istack], alpha=.5) 
615
+                                mmaxd = max( mmaxd, np.max(1e9*self.DATADICT[pulse][ichan][ipm][istack])) 
616
+                            else:
617
+                                ww = np.fft.fftfreq(len(self.DATADICT[pulse][ichan][ipm][istack]), d=self.dt)
618
+                                X = np.fft.rfft(self.DATADICT[pulse][ichan][ipm][istack])
619
+                                canvas.ax2.plot(np.abs(ww[0:len(X)]), np.abs(X), alpha=.5)
608 620
                         canvas.ax2.set_prop_cycle(None)
609 621
                         #canvas.ax2.set_ylim(-mmaxd, mmaxd)
610 622
                     if procRefs: 
@@ -637,12 +649,14 @@ class GMRDataProcessor(SNMRDataProcessor):
637 649
                                         f1p[ichan], f1K1, f1KN, f1Ks, Bounds, Nsearch ) 
638 650
                             # plot
639 651
                             if plot:
640
-                                #canvas.ax1.plot( self.DATADICT[pulse]["TIMES"], 1e9*self.DATADICT[pulse][ichan][ipm][istack], \
641
-                                #    label = pulse + " ipm=" + str(ipm) + " istack=" + str(istack) + " rchan="  + str(ichan))
642
-                                ww = np.fft.fftfreq(len(self.DATADICT[pulse][ichan][ipm][istack]), d=self.dt)
643
-                                X = np.fft.rfft(self.DATADICT[pulse][ichan][ipm][istack])
644
-                                canvas.ax1.plot(np.abs(ww[0:len(X)]), np.abs(X),\
645
-                                label = pulse + " ipm=" + str(ipm) + " istack=" + str(istack) + " rchan="  + str(ichan))
652
+                                if TDPlot:
653
+                                    canvas.ax1.plot( self.DATADICT[pulse]["TIMES"], 1e9*self.DATADICT[pulse][ichan][ipm][istack], \
654
+                                        label = pulse + " ipm=" + str(ipm) + " istack=" + str(istack) + " rchan="  + str(ichan))
655
+                                else:
656
+                                    ww = np.fft.fftfreq(len(self.DATADICT[pulse][ichan][ipm][istack]), d=self.dt)
657
+                                    X = np.fft.rfft(self.DATADICT[pulse][ichan][ipm][istack])
658
+                                    canvas.ax1.plot(np.abs(ww[0:len(X)]), np.abs(X),\
659
+                                    label = pulse + " ipm=" + str(ipm) + " istack=" + str(istack) + " rchan="  + str(ichan))
646 660
 
647 661
                     for ichan in self.DATADICT[pulse]["chan"]:
648 662
                         if nF == 1:
@@ -675,12 +689,14 @@ class GMRDataProcessor(SNMRDataProcessor):
675 689
                
676 690
                         # plot
677 691
                         if plot:
678
-                            #canvas.ax2.plot( self.DATADICT[pulse]["TIMES"], 1e9*self.DATADICT[pulse][ichan][ipm][istack], \
679
-                            #    label = pulse + " ipm=" + str(ipm) + " istack=" + str(istack) + " chan="  + str(ichan))
680
-                            ww = np.fft.fftfreq(len(self.DATADICT[pulse][ichan][ipm][istack]), d=self.dt)
681
-                            X = np.fft.rfft(self.DATADICT[pulse][ichan][ipm][istack])
682
-                            canvas.ax2.plot(np.abs(ww[0:len(X)]), np.abs(X), \
683
-                                label = pulse + " ipm=" + str(ipm) + " istack=" + str(istack) + " chan="  + str(ichan))
692
+                            if TDPlot:
693
+                                canvas.ax2.plot( self.DATADICT[pulse]["TIMES"], 1e9*self.DATADICT[pulse][ichan][ipm][istack], \
694
+                                    label = pulse + " ipm=" + str(ipm) + " istack=" + str(istack) + " chan="  + str(ichan))
695
+                            else:
696
+                                ww = np.fft.fftfreq(len(self.DATADICT[pulse][ichan][ipm][istack]), d=self.dt)
697
+                                X = np.fft.rfft(self.DATADICT[pulse][ichan][ipm][istack])
698
+                                canvas.ax2.plot(np.abs(ww[0:len(X)]), np.abs(X), \
699
+                                    label = pulse + " ipm=" + str(ipm) + " istack=" + str(istack) + " chan="  + str(ichan))
684 700
 
685 701
                     if plot:
686 702
                         if procRefs: 

Загрузка…
Отмена
Сохранить