# ----------------------------------------------------------------------------- # Python classes and functions for accessing Sparky data. # # The module 'spy' written in C++ defines the classes and functions for # accessing Sparky data. This file describes the interface. # # The Sparky classes are Session, Project, Spectrum, Peak, Resonance, Label, # Line, Grid, Molecule, Condition, View. # # Here are the data members and methods of these classes: # # ----------------------------------------------------------------------------- # # class Session: # # __init__(tk) # # project = # # open_file('bpti.proj') = 0 or 1 # Open nmr data or Sparky file # open_spectrum('/home/smith/Sparky/Save/hsqc.save') = # command_characters(string) # Process key presses # # create_view(parent_window, ) # top level window created if # # parent is None # selected_view() = # can be None # selected_spectrum() = # can be None # selected_peaks() # Currently selected peaks # selected_ornaments() # Selected peaks, labels, ... # unselect_all_ornaments() # # Callbacks from the C++ code. # # Notice type Callback arguments # ------------------------------------------- # 'selection changed' None # 'drag region' tuple (min_ppm, max_ppm) # 'will drag peak' Peak # 'peak dragged' Peak # 'removed spectrum from project' Spectrum # 'added spectrum to project' Spectrum # 'pointer mode changed' None # # notify_me(notice_type, callback) = # dont_notify_me() # # add_input_callback(file, callback) = # only on Unix # remove_input_callback() # # add_command(accel, menu_text, func) # Add a Sparky command # show_manual_url(manual_url) # Show manual using Netscape # show_peak_list(peak_list) # Show a peak list window # show_resonance_peak_list(res) # List peaks for resonance # # pointer_mode = "select" # Can be "select", "center", "addGridBoth", # # "addGridHorz", "addGridVert", "addLabel", # # "addLine", "findAddPeak", "integrate", # # "zoom", "duplicateZoom", "assignCopy", # # "assignGuess" # # ----------------------------------------------------------------------------- # # class Project: # # save_path = '/home/smith/Sparky/Projects/abc.proj' # sparky_directory = '/home/smith/Sparky' # # spectrum_list() = list of # view_list() = list of # molecule_list() = list of # condition_list() = list of # create_dataless_spectrum(name, size, block_size, # spectrometer_freq_mhz, spectrum_width_hz, # origin_ppm, axis_labels) = # save_value(key, value) # key = string w/o spaces # saved_value(key) # value = string w/o newlines # close(ask) = 0 or 1 # # ----------------------------------------------------------------------------- # # class Spectrum: # # name = 'noesy150' # spectrum name # dimension = 2 # number of axes # data_size = (2048, 4096) # size along each axis # nuclei = ('1H', '1H') # '1H', '13C', '15N' for axes # hz_per_ppm = (500.123, 500.123) # spectrum_width = (11.205, 11.203) # ppm # sweep_width = (11.205, 11.203) # ppm # region = ((.4, -.5), (11.6, 10.7)) # (min-ppm, max-ppm) # scale_offset = (0, 0) # ppm, settable # noise = 22178.21 # data height noise # condition = # molecule = # data_path = '/data/bigdisk/noesy150' # nmr data # save_path = '/home/smith/Sparky/Save/noesy150.save' # pick_minimum_linewidth = (.04, .04) # for peak picking with mouse # pick_minimum_drop_factor = .5 # session = # # peak_list() # selected_peaks() # label_list() # line_list() # grid_list() # data_height((2.87, 4.334)) = 321833.23 # find_peak() = # can be None # find_peak('G18H8-T17H6') = # can be None # pick_peaks(((4.3, 2.1), (5.3, 8.4)), # region # (-100000, 100000), # height thresholds # (.04, .04), # minimum linewidths # .5) # minimum drop off # = List of # place_peak((4.123, 8.321)) = # save_value(key, value) # key = string w/o spaces # saved_value(key) # value = string w/o newlines # # ----------------------------------------------------------------------------- # # class Peak: # # assignment = 'C6H5-C5H1' # '?-?' for unassigned # is_assigned = 1 # all axes assigned # position = (4.35, 5.12) # in ppm # alias = (0, 0) # in ppm # frequency = (4.35, 5.12) # frequency = position + alias # spectrum = # data_height = 104334.23 # closest NMR data value # # returns None for peak groups # volume = 1.23e7 # can be None # volume_method = 'gaussian' # '', 'gaussian', # # 'lorentzian', 'box', # # 'ellipse', 'peak-group' # volume_error = .15 # error estimate fraction # volume_error_method = 'manual' # any string # fit_height = 105783.11 # can be None # line_width = (.024, .031) # ppm, can be None # line_width_method = 'fit' # any string # note = 'bad overlap' # settable # # selected = 0 # 0 or 1, settable # color = 'white' # 'red', 'blue', ... settable # label =