ソースを参照

Legacy FID's can be loaded

add-license-1
Trevor Irons 7年前
コミット
fe9a4cc460
2個のファイルの変更49行の追加3行の削除
  1. 48
    3
      akvo/tressel/mrsurvey.py
  2. 1
    0
      setup.py

+ 48
- 3
akvo/tressel/mrsurvey.py ファイルの表示

@@ -1808,10 +1808,55 @@ class GMRDataProcessor(SNMRDataProcessor):
1808 1808
             for ichan in rchan:
1809 1809
                 self.DATADICT["Pulse 1"][ichan][ipm][istack] = DATA[:,eval(ichan)+3][nds:nds+nd1] * invGain 
1810 1810
                 self.DATADICT["Pulse 1"]["TIMES"] = TIMES[nds:nds+nd1]
1811
+    
1812
+    def loadGMRASCIIFID( self, rawfname, istack ):
1813
+        """Based on the geoMRI instrument manufactured by VistaClara. Imports 
1814
+        a suite of raw .lvm files with the following format (on one line)
1815
+
1816
+        time(s) DC_Bus/100(V) Current+/75(A)  Curr-/75(A)  Voltage+/200(V) \  
1817
+        Ch1(V) Ch2(V) Ch3(V) Ch4(V)
1818
+
1819
+        Sampling rate is assumed at 50 kHz 
1820
+        """
1821
+        import pandas as pd 
1822
+        #################################################################################
1823
+        # figure out key data indices
1824
+        # Pulse        
1825
+        nps  = (int)((self.prePulseDelay)*self.samp)
1826
+        npul   = (int)(self.pulseLength[0]*self.samp) #+ 100 
1827
+
1828
+        # Data 
1829
+        nds  = nps+npul+(int)((self.deadTime)*self.samp);        # indice pulse 1 data starts 
1830
+        nd1 = (int)(1.*self.samp) - nds                          # samples in first pulse
1831
+        ndr = (int)(1.*self.samp)                                # samples in record 
1832
+
1833
+        invGain = 1./self.RxGain        
1834
+        invCGain = self.CurrentGain        
1835
+
1836
+        pulse = "Pulse 1"
1837
+        chan = self.DATADICT[pulse]["chan"] 
1838
+        rchan = self.DATADICT[pulse]["rchan"] 
1839
+            
1840
+        T = 1.5 #N_samp * self.dt 
1841
+        TIMES = np.arange(0, T, self.dt) - .0002 # small offset in GMR DAQ?
1842
+        
1843
+        self.DATADICT["Pulse 1"]["TIMES"] = TIMES[nds:nds+nd1]
1844
+        self.DATADICT["Pulse 1"]["PULSE_TIMES"] = TIMES[nps:nps+npul]
1845
+
1846
+        # pandas is much faster than numpy for io
1847
+        #DATA = np.loadtxt(rawfname)
1848
+        DATA = pd.read_csv(rawfname, header=None, sep="\t").values
1849
+        for ipm in range(self.nPulseMoments):
1850
+            for ichan in np.append(chan,rchan):
1851
+                self.DATADICT["Pulse 1"][ichan][ipm][istack] =  DATA[:, eval(ichan)+4][nds:(nds+nd1)] * invGain
1852
+                self.DATADICT["Pulse 1"]["CURRENT"][ipm][istack] = DATA[:,2][nps:nps+npul] * invCGain
1853
+            nds += ndr
1854
+            nps += ndr 
1855
+
1811 1856
 
1812 1857
     def loadFIDData(self, base, procStacks, chanin, rchanin, FIDProc, canvas, deadTime, plot):
1813 1858
         '''
1814
-            Loads a GMR FID dataset, reads binary format files 
1859
+            Loads a GMR FID dataset, reads binary and ASCII format files 
1815 1860
         '''
1816 1861
 
1817 1862
         canvas.reAx3(True,False)
@@ -1860,7 +1905,8 @@ class GMRDataProcessor(SNMRDataProcessor):
1860 1905
         for istack in procStacks:
1861 1906
             
1862 1907
             if self.nDAQVersion < 2.3:
1863
-                rawfname = base + "_" + str(istack) 
1908
+                #rawfname = base + "_" + str(istack) 
1909
+                self.loadGMRASCIIFID( base + "_" + str(istack), istack )
1864 1910
             else:
1865 1911
                 self.loadGMRBinaryFID( base + "_" + str(istack) + ".lvm", istack )
1866 1912
 
@@ -1868,7 +1914,6 @@ class GMRDataProcessor(SNMRDataProcessor):
1868 1914
             if plot: 
1869 1915
 
1870 1916
                 for ipm in range(self.nPulseMoments):
1871
-
1872 1917
                     canvas.ax1.clear()
1873 1918
                     canvas.ax2.clear()
1874 1919
                     canvas.ax3.clear()

+ 1
- 0
setup.py ファイルの表示

@@ -40,6 +40,7 @@ setup(name='Akvo',
40 40
           'numpy',
41 41
           'PyQt5',
42 42
           'pyyaml',
43
+          'pandas',
43 44
           'pyqt-distutils',
44 45
           'cmocean'
45 46
       ],

読み込み中…
キャンセル
保存