Ejemplo n.º 1
0
    def calibrate_mass_spectrum(self):
        try:
            self.progress.reset_bar()
            self.process_parameters.calibration = True

            peak_list = functions.get_peak_list(
                self.process_parameters.calibration_file)
            self.peak_list = peak_list
            self.process_mass_spectrum()

            self.task_label.set('Calibrating Mass Spectra')
            for index, mass_spectrum in enumerate(self.mass_spectra):
                mass_spectrum.calibrate()
                self.progress.counter.set(
                    (float(index) / len(self.mass_spectra)) * 100)
                self.progress.update_progress_bar()
            self.task_label.set('Idle')
            self.progress.fill_bar()

            self.axes.clear()
            for mass_spectrum in self.mass_spectra:
                mass_spectrum.plot_mass_spectrum()
            finalize_plot(self)

            self.process_parameters.calibration = False

            if not self.process_parameters.calibration_file:
                messagebox.showinfo('Warning',
                                    'No Calibration File ' + 'Selected')
        except Exception as e:
            self.logger.error(e)
Ejemplo n.º 2
0
    def open_mass_spectrum(self):
        try:
            self.progress.reset_bar()
            data_buffer = []
            files = filedialog.askopenfilenames(title='Select Mass ' +
                                                'Spectrum File(s)')

            self.task_label.set('Opening Mass Spectra')
            for index, file in enumerate(files):
                self.progress.counter.set((float(index) / len(files)) * 100)
                self.progress.update_progress_bar()
                self.filename = file
                mass_spec_buffer = MassSpectrum(self)
                mass_spec_buffer.open_mass_spectrum()
                data_buffer.append(mass_spec_buffer)
            self.mass_spectra = data_buffer
            self.task_label.set('Idle')
            self.progress.fill_bar()

            self.task_label.set('Plotting Mass Spectra')
            if self.mass_spectra:
                self.axes.clear()
                for index, mass_spectrum in enumerate(self.mass_spectra):
                    self.progress.counter.set(
                        (float(index) / len(files)) * 100)
                    self.progress.update_progress_bar()
                    mass_spectrum.plot_mass_spectrum()
                finalize_plot(self)
            self.task_label.set('Idle')
            self.progress.fill_bar()
        except Exception as e:
            messagebox.showinfo('Warning',
                                'The selected files could ' + 'not be opened.')
            self.logger.error(e)
Ejemplo n.º 3
0
    def open_mass_spectrum(self):
        try:
            self.progress.reset_bar()
            data_buffer = []
            files = filedialog.askopenfilenames(title='Select Mass '+
                                                'Spectrum File(s)')

            self.task_label.set('Opening Mass Spectra')
            for index, file in enumerate(files):
                self.progress.counter.set((float(index) /
                        len(files))*100)
                self.progress.update_progress_bar()
                self.filename = file
                mass_spec_buffer = MassSpectrum(self)
                mass_spec_buffer.open_mass_spectrum()
                data_buffer.append(mass_spec_buffer)
            self.mass_spectra = data_buffer
            self.task_label.set('Idle')
            self.progress.fill_bar()

            self.task_label.set('Plotting Mass Spectra')
            if self.mass_spectra:
                self.axes.clear()
                for index, mass_spectrum in enumerate(self.mass_spectra):
                    self.progress.counter.set((float(index) /
                        len(files))*100)
                    self.progress.update_progress_bar()
                    mass_spectrum.plot_mass_spectrum()
                finalize_plot(self)
            self.task_label.set('Idle')
            self.progress.fill_bar()
        except Exception as e:
            messagebox.showinfo('Warning','The selected files could '+
                                'not be opened.')
            self.logger.error(e)
Ejemplo n.º 4
0
    def calibrate_mass_spectrum(self):
        try:
            self.progress.reset_bar()
            self.process_parameters.calibration = True

            peak_list = functions.get_peak_list(
                self.process_parameters.calibration_file)
            self.peak_list = peak_list
            self.process_mass_spectrum()

            self.task_label.set('Calibrating Mass Spectra')
            for index, mass_spectrum in enumerate(self.mass_spectra):
                mass_spectrum.calibrate()
                self.progress.counter.set((float(index) /
                        len(self.mass_spectra))*100)
                self.progress.update_progress_bar()
            self.task_label.set('Idle')
            self.progress.fill_bar()

            self.axes.clear()
            for mass_spectrum in self.mass_spectra:
                mass_spectrum.plot_mass_spectrum()
            finalize_plot(self)

            self.process_parameters.calibration = False

            if not self.process_parameters.calibration_file:
                messagebox.showinfo('Warning','No Calibration File '+
                                    'Selected')
        except Exception as e:
            self.logger.error(e)
Ejemplo n.º 5
0
 def baseline_correct(self):
     try:
         self.axes.clear()
         for mass_spectrum in self.mass_spectra:
             mass_spectrum.baseline_correct()
             mass_spectrum.plot_mass_spectrum()
         finalize_plot(self)
     except Exception as e:
         self.logger.error(e)
Ejemplo n.º 6
0
 def baseline_correct(self):
     try:
         self.axes.clear()
         for mass_spectrum in self.mass_spectra:
             mass_spectrum.baseline_correct()
             mass_spectrum.plot_mass_spectrum()
         finalize_plot(self)
     except Exception as e:
         self.logger.error(e)
Ejemplo n.º 7
0
    def classify_mass_spectra(self):
        try:
            classification.classify_mass_spectra(self.mass_spectra)

            self.axes.clear()
            for mass_spectrum in self.mass_spectra:
                mass_spectrum.plot_mass_spectrum()
            finalize_plot(self)

        except Exception as e:
            self.logger.error(e)
Ejemplo n.º 8
0
    def normalize_mass_spectrum(self):
        try:
            for mass_spectrum in self.mass_spectra:
                mass_spectrum.normalize_mass_spectrum()

            if self.mass_spectra:
                self.axes.clear()
                for mass_spectrum in self.mass_spectra:
                    mass_spectrum.plot_mass_spectrum()
                finalize_plot(self)
        except Exception as e:
            self.logger.error(e)
Ejemplo n.º 9
0
    def normalize_mass_spectrum(self):
        try:
            for mass_spectrum in self.mass_spectra:
                mass_spectrum.normalize_mass_spectrum()

            if self.mass_spectra:
                self.axes.clear()
                for mass_spectrum in self.mass_spectra:
                    mass_spectrum.plot_mass_spectrum()
                finalize_plot(self)
        except Exception as e:
            self.logger.error(e)