|
@@ -194,7 +194,7 @@ class GMRDataProcessor(SNMRDataProcessor):
|
194
|
194
|
self.RotatedAmplitude = False
|
195
|
195
|
# self.DATA = np.zeros(1) # Numpy array to hold all data, dimensions resized based on experiment
|
196
|
196
|
# self.PULSES = np.zeros(1) # Numpy array to hold all data, dimensions resized based on experiment
|
197
|
|
-
|
|
197
|
+
|
198
|
198
|
def Print(self):
|
199
|
199
|
print ("pulse type", self.pulseType)
|
200
|
200
|
print ("maxBusV", self.maxBusV)
|
|
@@ -560,39 +560,66 @@ class GMRDataProcessor(SNMRDataProcessor):
|
560
|
560
|
#plot = True
|
561
|
561
|
if plot:
|
562
|
562
|
canvas.reAx2()
|
563
|
|
- canvas.ax1.tick_params(axis='both', which='major', labelsize=8)
|
564
|
|
- canvas.ax1.ticklabel_format(style='sci', scilimits=(0,0), axis='y')
|
565
|
|
- canvas.ax2.tick_params(axis='both', which='major', labelsize=8)
|
566
|
|
- canvas.ax2.ticklabel_format(style='sci', scilimits=(0,0), axis='y')
|
|
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
|
+ canvas.ax1.set_ylabel(r"signal [nV]", fontsize=8)
|
|
568
|
+ canvas.ax2.set_xlabel(r"time [s]", fontsize=8)
|
|
569
|
+ 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)
|
567
|
572
|
|
568
|
573
|
# Data
|
569
|
574
|
iFID = 0
|
570
|
575
|
|
|
576
|
+ # stores previous f0 as starting point in non-linear search
|
|
577
|
+ f0p = {}
|
|
578
|
+ f1p = {}
|
|
579
|
+ for pulse in self.DATADICT["PULSES"]:
|
|
580
|
+ for rchan in self.DATADICT[pulse]["rchan"]:
|
|
581
|
+ f0p[rchan] = f0
|
|
582
|
+ f1p[rchan] = f1+1e-1
|
|
583
|
+ for chan in self.DATADICT[pulse]["chan"]:
|
|
584
|
+ f0p[chan] = f0
|
|
585
|
+ f1p[chan] = f1+1e-1
|
|
586
|
+
|
571
|
587
|
for pulse in self.DATADICT["PULSES"]:
|
572
|
588
|
self.DATADICT[pulse]["TIMES"] = self.DATADICT[pulse]["TIMES"]
|
573
|
589
|
Nseg = int( np.floor(len( self.DATADICT[pulse]["TIMES"] ) / f0ns) )
|
574
|
|
- for ipm in range(self.DATADICT["nPulseMoments"]):
|
575
|
|
- for istack in self.DATADICT["stacks"]:
|
576
|
|
- canvas.ax1.clear()
|
577
|
|
- canvas.ax2.clear()
|
578
|
|
- #for ichan in np.append(self.DATADICT[pulse]["chan"], self.DATADICT[pulse]["rchan"]):
|
|
590
|
+ for istack in self.DATADICT["stacks"]:
|
|
591
|
+ for ipm in range(self.DATADICT["nPulseMoments"]):
|
|
592
|
+ 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
|
+ canvas.softClear()
|
|
602
|
+ for ichan in self.DATADICT[pulse]["rchan"]:
|
|
603
|
+ 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
|
+
|
|
606
|
+ for ichan in self.DATADICT[pulse]["chan"]:
|
|
607
|
+ 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))
|
|
609
|
+ canvas.ax1.set_prop_cycle(None)
|
|
610
|
+ canvas.ax2.set_prop_cycle(None)
|
579
|
611
|
for ichan in self.DATADICT[pulse]["rchan"]:
|
580
|
|
- if plot:
|
581
|
|
- canvas.ax1.plot( self.DATADICT[pulse]["TIMES"], 1e9*self.DATADICT[pulse][ichan][ipm][istack], \
|
582
|
|
- label = "orig " + pulse + " ipm=" + str(ipm) + " istack=" + str(istack) + " rchan=" + str(ichan))
|
583
|
|
-
|
584
|
612
|
if nF == 1:
|
585
|
613
|
#self.DATADICT[pulse][ichan][ipm][istack] = harmonic.minHarmonic( f0, self.DATADICT[pulse][ichan][ipm][istack], self.samp, nK, self.DATADICT[pulse]["TIMES"] )
|
586
|
614
|
for iseg in range(f0ns):
|
587
|
615
|
if iseg < f0ns-1:
|
588
|
|
- self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg:(iseg+1)*Nseg] = harmonic.minHarmonic( self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg:(iseg+1)*Nseg], \
|
|
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], \
|
589
|
617
|
self.samp, self.DATADICT[pulse]["TIMES"][iseg*Nseg:(iseg+1)*Nseg], \
|
590
|
|
- f0, f0K1, f0KN, f0Ks )
|
|
618
|
+ f0p[ichan], f0K1, f0KN, f0Ks )
|
591
|
619
|
else:
|
592
|
|
- self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg::] = harmonic.minHarmonic( self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg::], \
|
|
620
|
+ self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg::], f0p[ichan] = harmonic.minHarmonic( self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg::], \
|
593
|
621
|
self.samp, self.DATADICT[pulse]["TIMES"][iseg*Nseg::], \
|
594
|
|
- f0, f0K1, f0KN, f0Ks )
|
595
|
|
-
|
|
622
|
+ f0p[ichan], f0K1, f0KN, f0Ks )
|
596
|
623
|
#self.DATADICT[pulse][ichan][ipm][istack] = harmonic.minHarmonic( self.DATADICT[pulse][ichan][ipm][istack], self.samp, self.DATADICT[pulse]["TIMES"], \
|
597
|
624
|
# f0, f0K1, f0KN, f0Ks )
|
598
|
625
|
elif nF == 2:
|
|
@@ -602,15 +629,15 @@ class GMRDataProcessor(SNMRDataProcessor):
|
602
|
629
|
# f1+1e-2, f1K1, f1KN, f1Ks )
|
603
|
630
|
for iseg in range(f0ns):
|
604
|
631
|
if iseg < f0ns-1:
|
605
|
|
- self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg:(iseg+1)*Nseg] = harmonic.minHarmonic2( 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], f1p[ichan] = harmonic.minHarmonic2( self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg:(iseg+1)*Nseg],\
|
606
|
633
|
self.samp, self.DATADICT[pulse]["TIMES"][iseg*Nseg:(iseg+1)*Nseg], \
|
607
|
|
- f0-1e-2, f0K1, f0KN, f0Ks, \
|
608
|
|
- f1+1e-2, f1K1, f1KN, f1Ks )
|
|
634
|
+ f0p[ichan], f0K1, f0KN, f0Ks, \
|
|
635
|
+ f1p[ichan], f1K1, f1KN, f1Ks )
|
609
|
636
|
else:
|
610
|
|
- self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg::] = harmonic.minHarmonic2( self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg::],\
|
|
637
|
+ self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg::], f0p[ichan], f1p[ichan] = harmonic.minHarmonic2( self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg::],\
|
611
|
638
|
self.samp, self.DATADICT[pulse]["TIMES"][iseg*Nseg::], \
|
612
|
|
- f0-1e-2, f0K1, f0KN, f0Ks, \
|
613
|
|
- f1+1e-2, f1K1, f1KN, f1Ks )
|
|
639
|
+ f0p[ichan], f0K1, f0KN, f0Ks, \
|
|
640
|
+ f1p[ichan], f1K1, f1KN, f1Ks )
|
614
|
641
|
# plot
|
615
|
642
|
if plot:
|
616
|
643
|
canvas.ax1.plot( self.DATADICT[pulse]["TIMES"], 1e9*self.DATADICT[pulse][ichan][ipm][istack], \
|
|
@@ -618,23 +645,19 @@ class GMRDataProcessor(SNMRDataProcessor):
|
618
|
645
|
|
619
|
646
|
for ichan in self.DATADICT[pulse]["chan"]:
|
620
|
647
|
|
621
|
|
- if plot:
|
622
|
|
- canvas.ax2.plot( self.DATADICT[pulse]["TIMES"], 1e9*self.DATADICT[pulse][ichan][ipm][istack], \
|
623
|
|
- label = "orig " + pulse + " ipm=" + str(ipm) + " istack=" + str(istack) + " chan=" + str(ichan))
|
624
|
|
-
|
625
|
648
|
if nF == 1:
|
626
|
649
|
#self.DATADICT[pulse][ichan][ipm][istack] = harmonic.minHarmonic( f0, self.DATADICT[pulse][ichan][ipm][istack], self.samp, nK, self.DATADICT[pulse]["TIMES"] )
|
627
|
650
|
#self.DATADICT[pulse][ichan][ipm][istack] = harmonic.minHarmonic( self.DATADICT[pulse][ichan][ipm][istack], self.samp, self.DATADICT[pulse]["TIMES"], \
|
628
|
651
|
# f0, f0K1, f0KN, f0Ks )
|
629
|
652
|
for iseg in range(f0ns):
|
630
|
653
|
if iseg < f0ns-1:
|
631
|
|
- self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg:(iseg+1)*Nseg] = harmonic.minHarmonic( self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg:(iseg+1)*Nseg],
|
|
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
|
655
|
self.samp, self.DATADICT[pulse]["TIMES"][iseg*Nseg:(iseg+1)*Nseg], \
|
633
|
|
- f0, f0K1, f0KN, f0Ks )
|
|
656
|
+ f0p[ichan], f0K1, f0KN, f0Ks )
|
634
|
657
|
else:
|
635
|
|
- self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg::] = harmonic.minHarmonic( self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg::],
|
|
658
|
+ self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg::], f0p[ichan] = harmonic.minHarmonic( self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg::],
|
636
|
659
|
self.samp, self.DATADICT[pulse]["TIMES"][iseg*Nseg::], \
|
637
|
|
- f0, f0K1, f0KN, f0Ks )
|
|
660
|
+ f0p[ichan], f0K1, f0KN, f0Ks )
|
638
|
661
|
|
639
|
662
|
elif nF == 2:
|
640
|
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"] )
|
|
@@ -644,33 +667,31 @@ class GMRDataProcessor(SNMRDataProcessor):
|
644
|
667
|
# f1+1e-2, f1K1, f1KN, f1Ks )
|
645
|
668
|
for iseg in range(f0ns):
|
646
|
669
|
if iseg < f0ns-1:
|
647
|
|
- self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg:(iseg+1)*Nseg] = harmonic.minHarmonic2( self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg:(iseg+1)*Nseg],\
|
|
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],\
|
648
|
671
|
self.samp, self.DATADICT[pulse]["TIMES"][iseg*Nseg:(iseg+1)*Nseg], \
|
649
|
|
- f0-1e-2, f0K1, f0KN, f0Ks, \
|
650
|
|
- f1+1e-2, f1K1, f1KN, f1Ks )
|
|
672
|
+ f0p[ichan], f0K1, f0KN, f0Ks, \
|
|
673
|
+ f1p[ichan], f1K1, f1KN, f1Ks )
|
651
|
674
|
else:
|
652
|
|
- self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg::] = harmonic.minHarmonic2( self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg::],\
|
|
675
|
+ self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg::], f0p[ichan], f1p[ichan] = harmonic.minHarmonic2( self.DATADICT[pulse][ichan][ipm][istack][iseg*Nseg::],\
|
653
|
676
|
self.samp, self.DATADICT[pulse]["TIMES"][iseg*Nseg::], \
|
654
|
|
- f0-1e-2, f0K1, f0KN, f0Ks, \
|
655
|
|
- f1+1e-2, f1K1, f1KN, f1Ks )
|
|
677
|
+ f0p[ichan], f0K1, f0KN, f0Ks, \
|
|
678
|
+ f1p[ichan], f1K1, f1KN, f1Ks )
|
656
|
679
|
|
657
|
680
|
# plot
|
658
|
681
|
if plot:
|
659
|
682
|
canvas.ax2.plot( self.DATADICT[pulse]["TIMES"], 1e9*self.DATADICT[pulse][ichan][ipm][istack], \
|
660
|
|
- label = "data " + pulse + " ipm=" + str(ipm) + " istack=" + str(istack) + " chan=" + str(ichan))
|
|
683
|
+ label = pulse + " ipm=" + str(ipm) + " istack=" + str(istack) + " chan=" + str(ichan))
|
661
|
684
|
|
662
|
685
|
if plot:
|
663
|
|
- canvas.ax1.set_xlabel(r"time [s]", fontsize=8)
|
664
|
|
- canvas.ax1.set_ylabel(r"signal [nV]", fontsize=8)
|
665
|
|
- canvas.ax2.set_xlabel(r"time [s]", fontsize=8)
|
666
|
|
- canvas.ax2.set_ylabel(r"signal [nV]", fontsize=8)
|
667
|
|
- canvas.ax1.legend(prop={'size':6})
|
668
|
|
- canvas.ax2.legend(prop={'size':6})
|
|
686
|
+ canvas.ax1.legend(prop={'size':6}, loc='upper right')
|
|
687
|
+ canvas.ax2.legend(prop={'size':6}, loc='upper right')
|
669
|
688
|
canvas.draw()
|
670
|
689
|
|
671
|
|
- percent = (int)(1e2*((float)(iFID*self.DATADICT["nPulseMoments"]+(ipm))/(len(self.DATADICT["PULSES"])*self.nPulseMoments)))
|
|
690
|
+ #percent = (int)(1e2*((float)(iFID*self.DATADICT["nPulseMoments"]+(ipm))/(len(self.DATADICT["PULSES"])*self.nPulseMoments)))
|
|
691
|
+ percent = (int)(1e2*((ipm+istack*self.nPulseMoments)/(self.nPulseMoments*len(self.DATADICT["stacks"]))))
|
672
|
692
|
self.progressTrigger.emit(percent)
|
673
|
693
|
iFID += 1
|
|
694
|
+
|
674
|
695
|
self.doneTrigger.emit()
|
675
|
696
|
self.updateProcTrigger.emit()
|
676
|
697
|
|
|
@@ -1990,15 +2011,20 @@ class GMRDataProcessor(SNMRDataProcessor):
|
1990
|
2011
|
canvas.draw()
|
1991
|
2012
|
return [bord, self.fe]
|
1992
|
2013
|
|
1993
|
|
- def downsample(self, truncate, dec, plot, canvas):
|
1994
|
|
- """ Downsamples and truncates the raw signal.
|
|
2014
|
+ def downsample(self, truncate, dec, plot=False, canvas=None):
|
|
2015
|
+ """ Downsamples and truncates the raw signal.
|
|
2016
|
+ Args
|
|
2017
|
+ truncate (float) : the length of the signal to truncate to
|
|
2018
|
+ dec (int) : the decimation factor, 1 results in no downsampling
|
|
2019
|
+ plot (bool) : perform plots
|
|
2020
|
+ canvas : MPL axis for plotting
|
1995
|
2021
|
"""
|
1996
|
|
- canvas.reAx2()
|
1997
|
|
-
|
1998
|
|
- canvas.ax1.tick_params(axis='both', which='major', labelsize=8)
|
1999
|
|
- canvas.ax1.ticklabel_format(style='sci', scilimits=(0,0), axis='y')
|
2000
|
|
- canvas.ax2.tick_params(axis='both', which='major', labelsize=8)
|
2001
|
|
- canvas.ax2.ticklabel_format(style='sci', scilimits=(0,0), axis='y')
|
|
2022
|
+
|
|
2023
|
+ if plot:
|
|
2024
|
+ canvas.reAx2()
|
|
2025
|
+ canvas.ax1.set_ylabel(r"signal [nV]", fontsize=8)
|
|
2026
|
+ canvas.ax2.set_xlabel(r"time [s]", fontsize=8)
|
|
2027
|
+ canvas.ax2.set_ylabel(r"signal [nV]", fontsize=8)
|
2002
|
2028
|
|
2003
|
2029
|
self.samp /= dec
|
2004
|
2030
|
self.dt = 1./self.samp
|
|
@@ -2009,8 +2035,8 @@ class GMRDataProcessor(SNMRDataProcessor):
|
2009
|
2035
|
for pulse in self.DATADICT["PULSES"]:
|
2010
|
2036
|
for ipm in range(self.DATADICT["nPulseMoments"]):
|
2011
|
2037
|
for istack in self.DATADICT["stacks"]:
|
2012
|
|
- canvas.ax1.clear()
|
2013
|
|
- canvas.ax2.clear()
|
|
2038
|
+ if plot:
|
|
2039
|
+ canvas.softClear()
|
2014
|
2040
|
for ichan in np.append(self.DATADICT[pulse]["chan"], self.DATADICT[pulse]["rchan"]):
|
2015
|
2041
|
# trim off indices that don't divide evenly
|
2016
|
2042
|
ndi = np.shape(self.DATADICT[pulse][ichan][ipm][istack])[0]%dec
|
|
@@ -2025,7 +2051,6 @@ class GMRDataProcessor(SNMRDataProcessor):
|
2025
|
2051
|
if truncate:
|
2026
|
2052
|
self.DATADICT[pulse][ichan][ipm][istack] = self.DATADICT[pulse][ichan][ipm][istack][0:itrunc]
|
2027
|
2053
|
RSTIMES = RSTIMES[0:itrunc]
|
2028
|
|
-
|
2029
|
2054
|
if plot:
|
2030
|
2055
|
for ichan in self.DATADICT[pulse]["chan"]:
|
2031
|
2056
|
canvas.ax2.plot( RSTIMES, 1e9*self.DATADICT[pulse][ichan][ipm][istack], \
|
|
@@ -2033,16 +2058,8 @@ class GMRDataProcessor(SNMRDataProcessor):
|
2033
|
2058
|
for ichan in self.DATADICT[pulse]["rchan"]:
|
2034
|
2059
|
canvas.ax1.plot( RSTIMES, 1e9*self.DATADICT[pulse][ichan][ipm][istack], \
|
2035
|
2060
|
label = pulse + " ipm=" + str(ipm) + " istack=" + str(istack) + " ichan=" + str(ichan))
|
2036
|
|
-
|
2037
|
|
- canvas.ax1.set_xlabel(r"time [s]", fontsize=8)
|
2038
|
|
- canvas.ax1.set_ylabel(r"signal [nV]", fontsize=8)
|
2039
|
|
- canvas.ax2.set_xlabel(r"time [s]", fontsize=8)
|
2040
|
|
- canvas.ax2.set_ylabel(r"signal [nV]", fontsize=8)
|
2041
|
|
-
|
2042
|
|
- canvas.ax1.legend(prop={'size':6})
|
2043
|
|
- canvas.ax2.legend(prop={'size':6})
|
2044
|
|
- canvas.ax1.ticklabel_format(style='sci', scilimits=(0,0), axis='y')
|
2045
|
|
- canvas.ax2.ticklabel_format(style='sci', scilimits=(0,0), axis='y')
|
|
2061
|
+ canvas.ax1.legend(prop={'size':6}, loc='upper right')
|
|
2062
|
+ canvas.ax2.legend(prop={'size':6}, loc='upper right')
|
2046
|
2063
|
canvas.draw()
|
2047
|
2064
|
percent = (int)(1e2*((float)(iFID*self.DATADICT["nPulseMoments"]+(ipm))/( len(self.DATADICT["PULSES"])*self.nPulseMoments)))
|
2048
|
2065
|
self.progressTrigger.emit(percent)
|