Ejemplo n.º 1
0
    def spectrum_names(self):

        spectra = self.session.project.spectrum_list()
        names = pyutil.attribute_values(spectra, 'name')
        if self.allow_no_choice:
            names = ('', ) + names
        return names
Ejemplo n.º 2
0
  def spectrum_names(self):

    spectra = self.session.project.spectrum_list()
    names = pyutil.attribute_values(spectra, 'name')
    if self.allow_no_choice:
      names = ('',) + names
    return names
Ejemplo n.º 3
0
  def set_volume_error(self, peak):

    if peak.volume == None or peak.volume_error_method == 'manual':
      return

    method = peak.volume_method
    settings = self.settings
    e = 0

    if settings.fit_default_error:
      if method == 'gaussian' or method == 'lorentzian':
	e = e + settings.fit_default_error
      elif method == 'peak-group':
	methods = pyutil.attribute_values(peak.peaklets(), 'volume_method')
	if 'gaussian' in methods or 'lorentzian' in methods:
	  e = e + settings.fit_default_error

    if settings.box_default_error:
      if method == 'box' or method == 'ellipse':
	e = e + settings.box_default_error
      elif method == 'peak-group':
	methods = pyutil.attribute_values(peak.peaklets(), 'volume_method')
	if 'box' in methods or 'ellipse' in methods:
	  e = e + settings.box_default_error

    if settings.near_diagonal_error and settings.near_diagonal_range:
      f = peak.frequency
      if abs(f[0] - f[1]) <= settings.near_diagonal_range:
	e = e + settings.near_diagonal_error

    if settings.nearby_peaks:
      vol = peak.volume
      for p in settings.nearby_peaks[peak]:
	pvol = p.volume
	if pvol == None:
	  e = e + settings.nearby_error['unintegrated']
	elif pvol < .5 * vol:
	  e = e + settings.nearby_error['< .5']
	elif pvol < 2 * vol:
	  e = e + settings.nearby_error['.5 - 2']
	else:
	  e = e + settings.nearby_error['> 2']

    if e > 0:
      peak.volume_error = e / 100.0
      peak.volume_error_method = 'auto'
Ejemplo n.º 4
0
  def spectrum_names(self):

    Names = []
    spectra = self.session.project.spectrum_list()
    for spectrum in spectra:
      if spectrum.dimension == 2:
        Names.append(spectrum)
    names = pyutil.attribute_values(Names, 'name')
    if self.allow_no_choice:
      names = ('',) + names
    return names
Ejemplo n.º 5
0
  def sort_alternative_assignments(self, peak, alist):

    dim = peak.spectrum.dimension
    pfreq = peak.frequency
    scale = self.settings.ppm_range

    offsets = {}
    for assignment in alist:
      afreq = pyutil.attribute_values(assignment, 'frequency')
      offset2 = 0
      for k in range(dim):
        diff = afreq[k] - pfreq[k]
        if scale[k] != 0:
          w = diff / scale[k]
          offset2 = offset2 + w*w
      offsets[assignment] = offset2
      
    return pyutil.sort_keys_by_value(offsets)
Ejemplo n.º 6
0
    def sort_alternative_assignments(self, peak, alist):

        dim = peak.spectrum.dimension
        pfreq = peak.frequency
        scale = self.settings.ppm_range

        offsets = {}
        for assignment in alist:
            afreq = pyutil.attribute_values(assignment, 'frequency')
            offset2 = 0
            for k in range(dim):
                diff = afreq[k] - pfreq[k]
                if scale[k] != 0:
                    w = diff / scale[k]
                    offset2 = offset2 + w * w
            offsets[assignment] = offset2

        return pyutil.sort_keys_by_value(offsets)
Ejemplo n.º 7
0
  def update_graph_atoms(self):
    
    sgd = self.spin_graph()
    if sgd == None:
      return

    sgd.show_window(1)

    asys = self.assignments.assignment_system
    if asys.sequence == None:
      return

    galist = pyutil.attribute_values(asys.assignable_resonances, 'group_atom')
    if galist != self.shown_group_atoms:
      self.shown_group_atoms = galist
      self.progress_report('Showing spin graph atoms')
      groups_per_row = asys.sequence.last_residue_number + 1
      sgd.set_graph(galist, groups_per_row, 0, None)
      sgd.graph.update_what_to_show(show_line_label = 0,
                                    lines_to_groups = 0,
                                    shade_by_range = 0)
      sgd.graph.show_atoms(1)
      sgd.graph.full_view('y')
Ejemplo n.º 8
0
    def update_graph_atoms(self):

        sgd = self.spin_graph()
        if sgd == None:
            return

        sgd.show_window(1)

        asys = self.assignments.assignment_system
        if asys.sequence == None:
            return

        galist = pyutil.attribute_values(asys.assignable_resonances,
                                         'group_atom')
        if galist != self.shown_group_atoms:
            self.shown_group_atoms = galist
            self.progress_report('Showing spin graph atoms')
            groups_per_row = asys.sequence.last_residue_number + 1
            sgd.set_graph(galist, groups_per_row, 0, None)
            sgd.graph.update_what_to_show(show_line_label=0,
                                          lines_to_groups=0,
                                          shade_by_range=0)
            sgd.graph.show_atoms(1)
            sgd.graph.full_view('y')
Ejemplo n.º 9
0
  def view_names(self):

    views = self.session.project.view_list()
    return pyutil.attribute_values(views, 'name')
Ejemplo n.º 10
0
def assignment_position(assignment, spectrum):

  freq = pyutil.attribute_values(assignment, 'frequency')
  return alias_onto_spectrum(freq, spectrum)
Ejemplo n.º 11
0
    def view_names(self):

        views = self.session.project.view_list()
        return pyutil.attribute_values(views, 'name')
Ejemplo n.º 12
0
def assignment_position(assignment, spectrum):

    freq = pyutil.attribute_values(assignment, 'frequency')
    return alias_onto_spectrum(freq, spectrum)