Пример #1
0
	def clear(self):
		self.top_mass_spec = None
		self.bottom_mass_spec = None
		self.top_label = None
		self.bottom_label = None
		self.all_masses = None
		self.legend = None
		self.plotted = False
		ChartPanelBase.clear(self)
Пример #2
0
	def __init__(
			self, parent, top_mass_spec=None, bottom_mass_spec=None,
			top_label='', bottom_label='', id=wx.ID_ANY,
			pos=wx.DefaultPosition, size=wx.DefaultSize,
			style=0, name="Head2TailSpectrumPanel",
			):
		"""
		:param parent: The parent window.
		:type parent: wx.Window
		:param top_mass_spec: The Mass Spectrum to plot in the top half of the panel,
			or None for two-stage plotting
		:type top_mass_spec: :class:`pyms.Spectrum.MassSpectrum` or None
		:param bottom_mass_spec: The Mass Spectrum to plot in the bottom half of the panel,
			or None for two-stage plotting
		:type bottom_mass_spec: :class:`pyms.Spectrum.MassSpectrum` or None
		:param top_label: A label for the spectrum in the top half of the panel
		:type top_label: str, optional
		:param bottom_label: A label for the spectrum in the bottom half of the panel
		:type bottom_label: str, optional
		:param id: An identifier for the panel. wx.ID_ANY is taken to mean a default.
		:type id: wx.WindowID, optional
		:param pos: The panel position. The value wx.DefaultPosition indicates a default position,
			chosen by either the windowing system or wxWidgets, depending on platform.
		:type pos: wx.Point, optional
		:param size: The panel size. The value wx.DefaultSize indicates a default size,
			chosen by either the windowing system or wxWidgets, depending on platform.
		:type size: wx.Size, optional
		:param style: The window style. See wxPanel.
		:type style: int, optional
		:param name: Window name.
		:type name: str, optional
		"""
		
		fig = Figure()
		ax = fig.add_subplot(111, projection="XPanAxes")  # 1x1 grid, first subplot
		
		ChartPanelBase.__init__(self, parent, fig, ax, id, pos, size, style, name)
		
		pub.subscribe(self.view_mode_changed, "view_mode_changed")
		
		self.constrain_zoom("x")
		
		self.top_mass_spec = None
		self.bottom_mass_spec = None
		self.top_label = None
		self.bottom_label = None
		self.all_masses = None
		self.legend = None
		self.plotted = False
		
		if top_mass_spec and bottom_mass_spec:
			self.plot_head2tail(top_mass_spec, bottom_mass_spec, top_label, bottom_label)
Пример #3
0
	def set_mass_spec(self, mass_spec, label=''):
		"""
		Sets the mass spectrum for the SpectrumPanel for two step creation.
		Call plot_mass_spec without the mass_spec argument to actually plot the chart

		:param mass_spec: The Mass Spectrum to plot in the panel
		:type mass_spec: :class:`pyms.Spectrum.MassSpectrum`
		:param label: A label for the spectrum
		:type label: str, optional
		"""

		ChartPanelBase.clear(self)
		
		self.mass_spec = mass_spec
		if label:
			self.label = label
		self.plotted = False
Пример #4
0
	def set_bottom_mass_spec(self, bottom_mass_spec, bottom_label=''):
		"""
		Sets the mass spectrum for the bottom of the SpectrumPanel for two step creation.
		Call plot_mass_spec without the mass_spec argument to actually plot the chart

		:param bottom_mass_spec: The Mass Spectrum to plot in the bottom half of the panel
		:type bottom_mass_spec: :class:`pyms.Spectrum.MassSpectrum`
		:param bottom_label: A label for the spectrum in the bottom half of the panel
		:type bottom_label: str, optional
		"""
		
		ChartPanelBase.clear(self)
		
		# Normalize the mass spectrum
		self.bottom_mass_spec = normalize_mass_spec(bottom_mass_spec)
		if bottom_label:
			self.bottom_label = bottom_label
		self.plotted = False
Пример #5
0
    def __init__(
        self,
        experiment,
        parent,
        id=wx.ID_ANY,
        pos=wx.DefaultPosition,
        size=wx.DefaultSize,
        style=0,
        name="ChromatogramPanel",
    ):
        """
		:param experiment:
		:type experiment:
		:param parent: The parent window.
		:type parent: wx.Window
		:param id: An identifier for the panel. wx.ID_ANY is taken to mean a default.
		:type id: wx.WindowID, optional
		:param pos: The panel position. The value wx.DefaultPosition indicates a default position, chosen by either the windowing system or wxWidgets, depending on platform.
		:type pos: wx.Point, optional
		:param size: The panel size. The value wx.DefaultSize indicates a default size, chosen by, either the windowing system or wxWidgets, depending on platform.
		:type size: wx.Size, optional
		:param style: The window style. See wxPanel.
		:type style: int, optional
		:param name: Window name.
		:type name: str, optional
		"""

        self.experiment = experiment

        fig = Figure()
        ax = fig.add_subplot(111,
                             projection="XPanAxes")  # 1x1 grid, first subplot

        ChartPanelBase.__init__(self, parent, fig, ax, id, pos, size, style,
                                name)

        pub.subscribe(self.view_mode_changed, "view_mode_changed")

        self.display()
        self._view_spectrum_enabled = False
Пример #6
0
	def set_mass_specs(self, top_mass_spec, bottom_mass_spec, top_label='', bottom_label=''):
		"""
		Sets the mass spectra for the SpectrumPanel for two step creation.
		Call plot_mass_spec without the mass_spec argument to actually plot the chart

		:param top_mass_spec: The Mass Spectrum to plot in the top half of the panel
		:type top_mass_spec: :class:`pyms.Spectrum.MassSpectrum`
		:param bottom_mass_spec: The Mass Spectrum to plot in the bottom half of the panel
		:type bottom_mass_spec: :class:`pyms.Spectrum.MassSpectrum`
		:param top_label: A label for the spectrum in the top half of the panel
		:type top_label: str, optional
		:param bottom_label: A label for the spectrum in the bottom half of the panel
		:type bottom_label: str, optional
		"""
		
		ChartPanelBase.clear(self)
		
		self.top_mass_spec = top_mass_spec
		if top_label:
			self.top_label = top_label
		self.bottom_mass_spec = bottom_mass_spec
		if bottom_label:
			self.bottom_label = bottom_label
		self.plotted = False
Пример #7
0
	def clear(self):
		self.mass_spec = None
		self.label = None
		self.legend = None
		self.plotted = False
		ChartPanelBase.clear(self)