Commit f2adb015 authored by Yan's avatar Yan
Browse files

timsTOF: logging, speedup

* DRL seems broken (wrong peaks picking)
* checks to be made
parent 09c75608
...@@ -284,9 +284,11 @@ def main(): ...@@ -284,9 +284,11 @@ def main():
drl_logger = logging.getLogger('drlLogger') drl_logger = logging.getLogger('drlLogger')
zce_logger = logging.getLogger('zcelogger') zce_logger = logging.getLogger('zcelogger')
rxn_logger = logging.getLogger('reactivityLogger') rxn_logger = logging.getLogger('reactivityLogger')
ds_logger = logging.getLogger('dsLogger')
logging.basicConfig() logging.basicConfig()
# p_logger.setLevel("WARN") # p_logger.setLevel("WARN")
p_logger.setLevel("DEBUG") p_logger.setLevel("DEBUG")
ds_logger.setLevel("DEBUG")
rxn_logger.setLevel("DEBUG") rxn_logger.setLevel("DEBUG")
# drl_logger.setLevel("INFO") # drl_logger.setLevel("INFO")
drl_logger.setLevel("DEBUG") drl_logger.setLevel("DEBUG")
......
...@@ -7,13 +7,15 @@ try: ...@@ -7,13 +7,15 @@ try:
autoparams = True autoparams = True
except ImportError: except ImportError:
autoparams = False autoparams = False
import pathlib
import opentims_bruker_bridge
import numpy as np import numpy as np
import logging
import opentims_bruker_bridge
import os.path
import pathlib
import prasopes.config as cf import prasopes.config as cf
import prasopes.datatools as dt import prasopes.datatools as dt
import os.path
logger = logging.getLogger('dsLogger')
class Dataset(): class Dataset():
def __init__(self, rawfile): def __init__(self, rawfile):
...@@ -26,6 +28,7 @@ class Dataset(): ...@@ -26,6 +28,7 @@ class Dataset():
self.maxtime = np.inf self.maxtime = np.inf
def get_chromargs(self, mint=None, maxt=None): def get_chromargs(self, mint=None, maxt=None):
logger.info("finding correct scans")
mint = mint or self.mintime mint = mint or self.mintime
maxt = maxt or self.maxtime maxt = maxt or self.maxtime
times = dt.argsubselect(np.concatenate( times = dt.argsubselect(np.concatenate(
...@@ -123,6 +126,7 @@ class BrukerTimsDataset(Dataset): ...@@ -123,6 +126,7 @@ class BrukerTimsDataset(Dataset):
self.refresh() self.refresh()
def refresh(self): def refresh(self):
logger.info("refreshing timsTOF dataset")
if(os.path.isdir(self.filename)): if(os.path.isdir(self.filename)):
self.dataset = OpenTIMS(pathlib.Path(self.filename)) self.dataset = OpenTIMS(pathlib.Path(self.filename))
else: else:
...@@ -132,6 +136,7 @@ class BrukerTimsDataset(Dataset): ...@@ -132,6 +136,7 @@ class BrukerTimsDataset(Dataset):
for i in (0,-1)] for i in (0,-1)]
def get_chromatograms(self): def get_chromatograms(self):
logger.info("getting timsTOF chromatogram")
keys = ('retention_time', 'intensity') keys = ('retention_time', 'intensity')
times = self.dataset.retention_times / 60 times = self.dataset.retention_times / 60
#devNote - summing is fast, asarray is fast, iterating is slow. #devNote - summing is fast, asarray is fast, iterating is slow.
...@@ -141,6 +146,7 @@ class BrukerTimsDataset(Dataset): ...@@ -141,6 +146,7 @@ class BrukerTimsDataset(Dataset):
return [[times,intensities]] return [[times,intensities]]
def get_spectra(self, mint=None, maxt=None): def get_spectra(self, mint=None, maxt=None):
logger.info("getting timsTOF spectra")
mint = mint or self.mintime mint = mint or self.mintime
maxt = maxt or self.maxtime maxt = maxt or self.maxtime
#TODO: set in config #TODO: set in config
...@@ -160,6 +166,7 @@ class BrukerTimsDataset(Dataset): ...@@ -160,6 +166,7 @@ class BrukerTimsDataset(Dataset):
return [[masses, ints]] return [[masses, ints]]
def get_peakchrom(self, startm, endm): def get_peakchrom(self, startm, endm):
logger.info("getting peak ion chromatogram")
intensity = np.divide([ intensity = np.divide([
np.sum(i['intensity'][dt.argsubselect(i['mz'], startm, endm)]) np.sum(i['intensity'][dt.argsubselect(i['mz'], startm, endm)])
for i in self.dataset.query_iter( for i in self.dataset.query_iter(
......
...@@ -448,7 +448,7 @@ def populate(augCanvas): ...@@ -448,7 +448,7 @@ def populate(augCanvas):
[pints.extend([np.nan, 0, i]) for i in crudeints] [pints.extend([np.nan, 0, i]) for i in crudeints]
augCanvas.spectplot.plot(pmasses, pints, linewidth=1) augCanvas.spectplot.plot(pmasses, pints, linewidth=1)
chromxy = augCanvas.ds.get_chromatograms() chromxy = augCanvas.ds.chromatograms
msxy = augCanvas.ds.get_spectra() msxy = augCanvas.ds.get_spectra()
for i in range(len(msxy)): for i in range(len(msxy)):
if len(augCanvas.ds.headers) == len(augCanvas.ds.chromatograms): if len(augCanvas.ds.headers) == len(augCanvas.ds.chromatograms):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment