ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/osprai/osprai/trunk/io_module.py
(Generate patch)
# Line 8 | Line 8
8  
9   .. moduleauthor:: Christopher Lausted,
10                    Institute for Systems Biology,
11 <                  OSPRAI developers.                      
11 >                  OSPRAI developers.
12 >
13   Examples::
14  
15    >>> import io_module as io
# Line 23 | Line 24
24    >>> io.writesprit(ba3, "newspritfile.txt")
25    >>> io.writeclamp(ba3, "newclampfile.txt")
26   """
27 < __version__ = "110208"
27 > __version__ = "110321"
28  
29  
30   ## Import libraries.
31   from copy import deepcopy
32   from os import getcwd
33   from time import mktime
34 + import re
35   import numpy as np                  ## Numpy array library.
36   import ba_class as ba               ## Our Biosensor Array class.
37   reload(ba)
# Line 309 | Line 311
311      ## Write sensorgram data header line.
312      for i,roi in enumerate(ba0.roi):
313          if (i>0): fp.write("\t")
314 <        name = roi.name.strip() + " " + roi.desc.strip()
315 <        fp.write("%s_X\t%s_Y" % (name, name))
314 >        name = roi.name.strip()
315 >        name = re.sub(r'\W+', '', name)  ## Remove nonprinting characters.
316 >        name = re.sub(r'_ ', '', name)  ## Remove other unwanted stuff.
317 >        name = re.sub(r'Fc=[0-9]+', '', name)
318 >        name = re.sub(r'[0-9]+_[XY]', '', name)
319 >        txt = name + " Fc=" + str(i+1) + "-1_X\t"
320 >        txt = txt + name + " Fc=" + str(i+1) + "-1_Y"
321 >        fp.write(txt)
322      ## Write sensorgram data lines. Three decimal places.
323      for dpoint in range(len(ba0.roi[0].time)):
324          fp.write("\r\n")
# Line 329 | Line 337
337      """
338      Read a comma-separated value text file into a ba class.
339      The first column contains time data while the others contain response data.
340 <    Here is a very simple example of the tab-delimited format::
340 >    Here is a very simple example of the format::
341      
342        1.0001, 23.7644, 0.7139
343        2.0001, 23.4265, 0.0541

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines