X-Git-Url: http://git.tremily.us/?p=hooke.git;a=blobdiff_plain;f=hooke%2Fdriver%2Fmcs.py;h=f8208c04aea545dbfe482eeec35ff48e68feada7;hp=48836f2fb4b558506d89279b5342623957e7db3c;hb=c46aaa51003a6722a28eea0e49f63ef1bb0e882d;hpb=c0bd161ab41e18f33f4497b8e3206f0a12bf9616;ds=sidebyside diff --git a/hooke/driver/mcs.py b/hooke/driver/mcs.py index 48836f2..f8208c0 100644 --- a/hooke/driver/mcs.py +++ b/hooke/driver/mcs.py @@ -1,16 +1,16 @@ -''' -mcs.py +# Copyright -driver for mcs fluorescence files +"""Driver for mcs fluorescence files. +""" -Massimo Sandal, Allen Chen (c) 2009 -''' +import os.path -import libhookecurve as lhc -import libhooke as lh +import lib.curve +import lib.driver +import lib.plot import struct -class mcsDriver(lhc.Driver): +class mcsDriver(lib.driver.Driver): def __init__(self, filename): ''' @@ -38,32 +38,53 @@ class mcsDriver(lhc.Driver): self.filetype = 'mcs' self.experiment = 'smfluo' - def is_me(self): - if self.filename[-3:].lower()=='mcs': - return True - else: - return False - def close_all(self): self.filedata.close() self.filebluedata.close() - def default_plots(self): + #TODO: rename blue and red data to something more appropriate if possible red_data=self.read_file(self.reddata) blue_data=self.read_file(self.bluedata) blue_data=[-1*float(item) for item in blue_data] #visualize blue as "mirror" of red - main_plot=lhc.PlotObject() - main_plot.add_set(range(len(red_data)),red_data) - main_plot.add_set(range(len(blue_data)),blue_data) - main_plot.normalize_vectors() - main_plot.units=['time','count'] #FIXME: if there's an header saying something about the time count, should be used - main_plot.destination=0 - main_plot.title=self.filename - main_plot.colors=['red','blue'] + extension = lib.curve.Curve() + retraction = lib.curve.Curve() + + extension.color = 'red' + extension.label = 'extension' + extension.style = 'plot' + extension.title = 'Force curve' + #FIXME: if there's an header saying something about the time count, should be used + #TODO: time is not really a unit + extension.units.x = 'time' + extension.units.y = 'count' + extension.x = range(len(red_data)) + extension.y = red_data + retraction.color = 'blue' + retraction.label = 'retraction' + retraction.style = 'plot' + retraction.title = 'Force curve' + #FIXME: if there's an header saying something about the time count, should be used + #TODO: time is not really a unit + retraction.units.x = 'time' + retraction.units.y = 'count' + retraction.x = range(len(blue_data)) + retraction.y = blue_data + + plot = lib.plot.Plot() + plot.title = os.path.basename(self.filename) + plot.curves.append(extension) + plot.curves.append(retraction) + + plot.normalize() + return plot - return [main_plot] + def is_me(self): + if self.filename[-3:].lower()=='mcs': + return True + else: + return False def read_file(self, raw_data): real_data=[]