Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/ein16/synth/d2/test_observed.py
ViewVC logotype

Diff of /branches/ein16/synth/d2/test_observed.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3945, Thu Jun 9 20:00:15 2016 UTC revision 3946, Sat Jun 11 00:39:19 2016 UTC
# Line 1  Line 1 
1  import re  import re
2    import os
3  from obj_ty import *  from obj_ty import *
4  from obj_operator import *  from obj_operator import *
5    
# Line 7  Line 8 
8  #one input per line  #one input per line
9  def getObserv_1(p_out):  def getObserv_1(p_out):
10      obs = []      obs = []
11      obsf = open(p_out+".txt", 'r')      name = p_out+".txt"
12        if(os.path.exists(name)):
13            obsf = open(name, 'r')
14      obsf.readline()      obsf.readline()
15      for line in obsf:      for line in obsf:
16          m = re.split(r'\n',line)          m = re.split(r'\n',line)
# Line 15  Line 18 
18              u0 = m[0]              u0 = m[0]
19              obs.append(float(u0))              obs.append(float(u0))
20      return obs      return obs
21        return []
22    
23  #n inputs per line  #n inputs per line
24  def getObserv_t(p_out, n):  def getObserv_t(p_out, n):
25      obs = []      obs = []
26      obsf = open(p_out+".txt", 'r')      name = p_out+".txt"
27        if(os.path.exists(name)):
28            obsf = open(name, 'r')
29      obsf.readline()      obsf.readline()
30      for line in obsf:      for line in obsf:
31          m = re.split(r'\s',line)          m = re.split(r'\s',line)
# Line 30  Line 36 
36                  cur.append(float(u0))                  cur.append(float(u0))
37              obs.append(cur)              obs.append(cur)
38      return obs      return obs
39        return []
40    
41  #chooose function based on number of input per line  #chooose function based on number of input per line
42  def observed(app, p_out):  def observed(app, p_out):

Legend:
Removed from v.3945  
changed lines
  Added in v.3946

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0