def get_scans_labels_for_scan_number(self, scan_number): scan_label = BSTR() scan_number = c_long(scan_number) self.thermo_Library.GetFilterForScanNum(scan_number, scan_label) return scan_label
def get_bruker_tics(self): strAnalysisData = BSTR("SumIntensity") if self.Bruker_Library.HasAnalysisData(strAnalysisData): tics_array = self.Bruker_Library.GetAnalysisData(strAnalysisData) tics_array = array(tics_array) return tics_array
def get_bruker_retention_time(self): strAnalysisData = BSTR("RetentionTime") if self.Bruker_Library.HasAnalysisData(strAnalysisData): tics_array = self.Bruker_Library.GetAnalysisData(strAnalysisData) tics_array = array(tics_array) else: tics_array = [0] return tics_array
def get_filter_for_scan_num(self, scan_number): """Returns the closest matching run time that corresponds to scan_number for the current controller. This function is only supported for MS device controllers. e.g. ['FTMS', '-', 'p', 'NSI', 'Full', 'ms', '[200.00-1000.00]'] """ str_filter = BSTR(None) error = self.thermo_Library.GetFilterForScanNum(scan_number, byref(str_filter)) if error: raise IOError( "scan %i GetFilterForScanNum error : %s" % (scan_number, str(error)) ) else: return str(str_filter.value).split()
def QueryPathOfRegTypeLib(libid, wVerMajor, wVerMinor, lcid=0): "Return the path of a registered type library" pathname = BSTR() _oleaut32.QueryPathOfRegTypeLib(byref(GUID(libid)), wVerMajor, wVerMinor, lcid, byref(pathname)) return pathname.value.split("\0")[0]
def RetrieveData(hRaw): MatPyLib = { 'InstrumentName': '', 'InstrumentModel': '', 'Reply': 0, 'DetectorCount': 0, 'ScanList': [], 'Filters': [], 'FiltersCount': 0, 'ScanInfo': OrderedDict() } pnNumControllers = c_long() hRaw.GetNumberOfControllers(pnNumControllers) MatPyLib['DetectorCount'] = pnNumControllers.value if pnNumControllers.value == 0 or pnNumControllers.value > 1: print "Warning: Number of Controlers is 0 or larger than 1" nControllerType = 0 #MS pnNumControllers = c_long() hRaw.GetNumberOfControllersOfType(nControllerType, pnNumControllers) if pnNumControllers.value > 1: print "Warning: Multipe ControllersOfType of MS" reply = 0 hRaw.SetCurrentController(0, 1) pbstrInstName = BSTR() hRaw.GetInstName(pbstrInstName) MatPyLib['InstrumentName'] = pbstrInstName.value pvarFilterArray = VARIANT() pnArraySize = c_long() hRaw.GetFilters(pvarFilterArray, pnArraySize) MatPyLib['FiltersCount'] = pnArraySize.value MatPyLib["Filters"] = zeros((pnArraySize.value,), dtype = nobj) MatPyLib["Filters"][:] = pvarFilterArray.value MatPyLib["Filters"] = [] pnFirstSpectrum = c_long() pnLastSpectrum = c_long() hRaw.GetFirstSpectrumNumber(pnFirstSpectrum) hRaw.GetLastSpectrumNumber(pnLastSpectrum) MatPyLib['ScanList'] = range(pnFirstSpectrum.value, pnLastSpectrum.value + 1) for i in MatPyLib['ScanList']: ScanNumber = "Scan" + str(int(i)) nScanNumber = c_long(int(i)) MatPyLib['ScanInfo'][ScanNumber] = {} pbstrFilter = BSTR() hRaw.GetFilterForScanNum(nScanNumber, pbstrFilter) MatPyLib['ScanInfo'][ScanNumber]["Filter"] = pbstrFilter.value if pbstrFilter.value not in MatPyLib["Filters"]: MatPyLib["Filters"].append(pbstrFilter.value) pnNumPackets = c_long() pdStartTime = c_double() pdLowMass = c_double() pdHighMass = c_double() pdTIC = c_double() pdBasePeakMass = c_double() pdBasePeakIntensity = c_double() pnNumChannels = c_long() pbUniformTime = c_long() pdFrequency = c_double() hRaw.GetScanHeaderInfoForScanNum(nScanNumber, pnNumPackets, pdStartTime, pdLowMass, pdHighMass, pdTIC, pdBasePeakMass, pdBasePeakIntensity, pnNumChannels, pbUniformTime, pdFrequency ) MatPyLib['ScanInfo'][ScanNumber]["TIC"] = float(pdTIC.value) MatPyLib['ScanInfo'][ScanNumber]["LowMass"] = float(pdLowMass.value) MatPyLib['ScanInfo'][ScanNumber]["HighMass"] = float(pdHighMass.value) pvarNoisePackets = VARIANT() pnScanNumber = c_long(int(i)) hRaw.GetNoiseData(pvarNoisePackets, pnScanNumber); MatPyLib['ScanInfo'][ScanNumber]["NoisePackets"] = {"Mass":pvarNoisePackets.value[0]} MatPyLib['ScanInfo'][ScanNumber]["NoisePackets"]["Noise"] = pvarNoisePackets.value[1] MatPyLib['ScanInfo'][ScanNumber]["NoisePackets"]["Base"] = pvarNoisePackets.value[2] pvarLabels = VARIANT() pvarValues = VARIANT() pnArraySize = c_long() hRaw.GetTrailerExtraForScanNum(nScanNumber, pvarLabels, pvarValues, pnArraySize) MatPyLib['ScanInfo'][ScanNumber]["IT"] = float(pvarValues.value[pvarLabels.value.index('Ion Injection Time (ms):')]) if "Q Exactive" in MatPyLib['InstrumentName'] or "Orbitrap" in MatPyLib['InstrumentName']: MatPyLib['ScanInfo'][ScanNumber]["B"] = float( pvarValues.value[pvarLabels.value.index('Conversion Parameter B:')]) MatPyLib['ScanInfo'][ScanNumber]["C"] = float( pvarValues.value[pvarLabels.value.index('Conversion Parameter C:')]) elif "LTQ FT" in MatPyLib['InstrumentName']: MatPyLib['ScanInfo'][ScanNumber]["A"] = float( pvarValues.value[pvarLabels.value.index('Conversion Parameter A:')]) MatPyLib['ScanInfo'][ScanNumber]["B"] = float( pvarValues.value[pvarLabels.value.index('Conversion Parameter B:')]) else: print "Instrument name not available" return szFilter = BSTR() nIntensityCutoffType = c_long(0) nIntensityCutoffValue = c_long(0) nMaxNumberOfPeaks = c_long(0) bCentroidResult = c_long(0) pdCentroidPeakWidth = c_double(0) pvarMassList = VARIANT() pvarPeakFlags = VARIANT() pnArraySize = c_long() hRaw.GetMassListFromScanNum(nScanNumber, szFilter, nIntensityCutoffType, nIntensityCutoffValue, nMaxNumberOfPeaks, bCentroidResult, pdCentroidPeakWidth, pvarMassList, pvarPeakFlags, pnArraySize ) MatPyLib['ScanInfo'][ScanNumber]["scanmz"] = array(pvarMassList.value[0]) MatPyLib['ScanInfo'][ScanNumber]["scand"] = array(pvarMassList.value[1]) return MatPyLib