Browse Source

time domain noise plot for harmonics

tags/1.6.1
Trevor Irons 5 years ago
parent
commit
596e5bd808
1 changed files with 44 additions and 28 deletions
  1. 44
    28
      akvo/tressel/mrsurvey.py

+ 44
- 28
akvo/tressel/mrsurvey.py View File

560
             plot = should Akvo plot the results 
560
             plot = should Akvo plot the results 
561
             canvas = mpl plotting axis      
561
             canvas = mpl plotting axis      
562
         """
562
         """
563
+        TDPlot = True
564
+        
563
         if plot:
565
         if plot:
564
             canvas.reAx2(shy=False)
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
         # Data
578
         # Data
572
         iFID = 0
579
         iFID = 0
573
 
580
 
581
+
574
         # stores previous f0 as starting point in non-linear search 
582
         # stores previous f0 as starting point in non-linear search 
575
         f0p = {} 
583
         f0p = {} 
576
         f1p = {} 
584
         f1p = {} 
592
                         mmaxd = 0
600
                         mmaxd = 0
593
                         if procRefs: 
601
                         if procRefs: 
594
                             for ichan in self.DATADICT[pulse]["rchan"]:
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
                             canvas.ax1.set_prop_cycle(None)
610
                             canvas.ax1.set_prop_cycle(None)
601
                             #canvas.ax1.set_ylim(-mmaxr, mmaxr) 
611
                             #canvas.ax1.set_ylim(-mmaxr, mmaxr) 
602
                         for ichan in self.DATADICT[pulse]["chan"]:
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
                         canvas.ax2.set_prop_cycle(None)
620
                         canvas.ax2.set_prop_cycle(None)
609
                         #canvas.ax2.set_ylim(-mmaxd, mmaxd)
621
                         #canvas.ax2.set_ylim(-mmaxd, mmaxd)
610
                     if procRefs: 
622
                     if procRefs: 
637
                                         f1p[ichan], f1K1, f1KN, f1Ks, Bounds, Nsearch ) 
649
                                         f1p[ichan], f1K1, f1KN, f1Ks, Bounds, Nsearch ) 
638
                             # plot
650
                             # plot
639
                             if plot:
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
                     for ichan in self.DATADICT[pulse]["chan"]:
661
                     for ichan in self.DATADICT[pulse]["chan"]:
648
                         if nF == 1:
662
                         if nF == 1:
675
                
689
                
676
                         # plot
690
                         # plot
677
                         if plot:
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
                     if plot:
701
                     if plot:
686
                         if procRefs: 
702
                         if procRefs: 

Loading…
Cancel
Save