コード例 #1
0
ファイル: MainWindow.py プロジェクト: bovee/AstonQt
    def exportChromatogram(self):
        fopts = tr('PNG Image (*.png);;PGF Image (*.pgf);;RAW Image (*.raw);;'
                   'RGBA Image (*.rgba);;SVG Image (*.svg);;'
                   'EMF Image (*.emf);;EPS Image (*.eps);;'
                   'Portable Document Format (*.pdf);;'
                   'Postscript Image (*.ps);;Compressed SVG File (*.svgz);;'
                   'Comma-Delimited Text (*.csv)')
        fname = str(QtWidgets.QFileDialog.getSaveFileNameAndFilter(
            self, tr("Save As..."), filter=fopts
        )[0])
        if fname == '':
            return
        elif fname[-4:].lower() == '.csv':
            dt = self.obj_tab.active_file()
            ts = None
            for ion in dt.info['traces'].split(','):
                if ts is None:
                    ts = dt.trace(ion)
                else:
                    ts &= dt.trace(ion)

            with open(fname, 'w') as f:
                f.write(tr('Time') + ',' + ','.join(ts.ions) + ',\n')
                for t, d in zip(ts.times, ts.data):
                    f.write(str(t) + ',' + ','.join(str(i) for i in d) + '\n')
        else:
            self.plotter.plt.get_figure().savefig(fname, transparent=True)
コード例 #2
0
ファイル: MainWindow.py プロジェクト: bovee/AstonQt
 def exportItems(self):
     #TODO: options for exporting different delimiters (e.g. tab) or
     #exporting select items as pictures (e.g. selected spectra)
     fopts = tr('Comma-Delimited Text (*.csv)')
     fname = str(QtWidgets.QFileDialog.getSaveFileNameAndFilter(self, \
       tr("Save As..."), filter=fopts)[0])
     if fname == '':
         return
     sel = self.obj_tab.returnSelFiles()
     with codecs.open(fname, 'w', encoding='utf-8') as f:
         f.write(self.obj_tab.items_as_csv(sel))
コード例 #3
0
ファイル: FilterWindow.py プロジェクト: molliewebb/aston
    def iClickMenu(self, point):
        menu = QtGui.QMenu(self.ui.ionList)

        if len(self.ui.ionList.selectedItems()) > 0:
            menu.addAction(tr('Delete'), self.deleteIon)

        if not menu.isEmpty():
            menu.exec_(self.ui.ionList.mapToGlobal(point))
コード例 #4
0
ファイル: MainWindow.py プロジェクト: bovee/AstonQt
 def load_peaks(self):
     ftypes = 'AMDIS (*.*);;Isodat (*.*)'
     fname = QtWidgets.QFileDialog.getOpenFileName(self, tr("Open File"),
                                                   '', ftypes)
     if str(fname) == '':
         return
     from aston.peaks.PeakReader import read_peaks
     read_peaks(self.obj_tab.db, str(fname))
     self.plot_data(updateBounds=False)
コード例 #5
0
ファイル: MainWindow.py プロジェクト: molliewebb/aston
 def exportSpectrum(self):
     #TODO: this needs to be updated when SpecPlot becomes better
     fopts = tr('PNG Image (*.png);;PGF Image (*.pgf);;' + \
       'RAW Image (*.raw);;RGBA Image (*.rgba);;SVG Image (*.svg);;' + \
       'EMF Image (*.emf);;EPS Image (*.eps);;' + \
       'Portable Document Format (*.pdf);;Postscript Image (*.ps);;' + \
       'Compressed SVG File (*.svgz);;Comma-Delimited Text (*.csv)')
     fname = str(QtGui.QFileDialog.getSaveFileNameAndFilter(self, \
       tr("Save As..."), filter=fopts)[0])
     if fname == '':
         return
     elif fname[-4:].lower() == '.csv':
         if '' not in self.specplotter.scans:
             return
         with open(fname, 'w') as f:
             scan = self.specplotter.scans['']
             f.write(tr('mz') + ',' + tr('abun') + '\n')
             for mz, abun in scan.T:
                 f.write(str(mz) + ',' + str(abun) + '\n')
     else:
         self.specplotter.plt.get_figure().savefig(fname, transparent=True)
コード例 #6
0
ファイル: MainWindow.py プロジェクト: bovee/AstonQt
    def open_folder(self):
        folder = str(QtWidgets.QFileDialog.getExistingDirectory(self, tr("Open Folder")))  # noqa
        if folder == '':
            return

        #need to discard old connections
        #self.ui.fileTreeView.clicked.disconnect()
        #self.ui.fileTreeView.selectionModel().currentChanged.disconnect()
        #self.ui.fileTreeView.customContextMenuRequested.disconnect()
        #self.ui.fileTreeView.header().customContextMenuRequested.disconnect()
        #self.ui.fileTreeView.header().sectionMoved.disconnect()

        #self.ui.paletteTreeView.clicked.disconnect()
        self.ui.paletteTreeView.selectionModel().currentChanged.disconnect()
        #self.ui.paletteTreeView.customContextMenuRequested.disconnect()
        #self.ui.paletteTreeView.header().customContextMenuRequested.disconnect()
        #self.ui.paletteTreeView.header().sectionMoved.disconnect()

        self.load_new_file_db(folder)
コード例 #7
0
ファイル: Fields.py プロジェクト: molliewebb/aston
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from collections import OrderedDict
from aston.resources import tr
from aston.qtgui.MenuOptions import peak_models


aston_groups = OrderedDict()
aston_groups['m'] = tr('Method')
aston_groups['d'] = tr('Detector')
aston_groups['r'] = tr('Run')
aston_groups['s'] = tr('Stats')
aston_groups['p'] = tr('Peaks')

aston_fields = OrderedDict()

# aston specific information
aston_fields['name'] = tr('Name')
aston_fields['sel'] = tr('Sel?')
aston_fields['vis'] = tr('Vis?')
aston_fields['color'] = tr('Color')
aston_fields['style'] = tr('Style')

# method information
aston_fields['m-name'] = tr('Method Name')  # e.g. BPROT. strip out *.M suffix
aston_fields['m-type'] = tr('Chromatography Type')
aston_fields['m-col'] = tr('Column Name')
aston_fields['m-col-type'] = tr('Column Phase')
aston_fields['m-col-dim'] = tr('Column Dimensions (mm x mm)')
aston_fields['m-col-part-size'] = tr('Column Particle Size (µ)')
aston_fields['m-len'] = tr('Run Length (min)')
コード例 #8
0
ファイル: MenuOptions.py プロジェクト: bovee/AstonQt
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from collections import OrderedDict
from aston.resources import tr
import aston.peaks.Integrators as ami
import aston.peaks.PeakFinding as ampf


peak_finders = OrderedDict()
peak_finders[tr('Simple')] = ampf.simple_peak_find
peak_finders[tr('StatSlope')] = ampf.stat_slope_peak_find
peak_finders[tr('Wavelet')] = ampf.wavelet_peak_find
peak_finders[tr('Event')] = ampf.event_peak_find
#peak_finders[tr('Periodic')] = ampf.periodic_peak_find

integrators = OrderedDict()
integrators[tr('Drop')] = ami.drop_integrate
integrators[tr('Constant Background')] = ami.constant_bl_integrate
#integrators[tr('Least Squares')] = ami.leastsq_integrate

#TODO: keys and values should be flipped here so we don't need to in Fields.py
peak_models = OrderedDict()
peak_models[tr('None')] = None
peak_models[tr('Bigaussian')] = 'bigaussian'
peak_models[tr('Box')] = 'box'
peak_models[tr('ExpModGaussian')] = 'exp_mod_gaussian'
peak_models[tr('ExtremeValue')] = 'extreme_value'
peak_models[tr('Gamma')] = 'gamma_dist'
peak_models[tr('Gaussian')] = 'gaussian'
peak_models[tr('Giddings')] = 'giddings'
peak_models[tr('HVL')] = 'haarhoffvanderlinde'