~reducedmodelling/fluidity/ROM_Non-intrusive-ann

« back to all changes in this revision

Viewing changes to tests/lagrangian_detectors_3d/readtool.py

  • Committer: cjc1
  • Date: 2011-03-09 13:03:12 UTC
  • Revision ID: svn-v4:5bf5533e-7014-46e3-b1bb-cce4b9d03719:trunk:3207
Added a 3D test for Lagrangian detectors.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from fluidity_tools import stat_parser
 
2
from numpy import zeros,fromfile, ones, shape
 
3
def readstat():
 
4
    s = stat_parser("lagrangian_detectors.detectors")
 
5
 
 
6
    last_locations_error = zeros((3,100))
 
7
    for i in range(100):
 
8
        n = i + 1
 
9
        padding = ''
 
10
        if(n<100):
 
11
            padding = '0'
 
12
            if(n<10):
 
13
                padding ='00'
 
14
        last_locations_error[0,i] = s['Steve_'+padding+str(n)]['position'][0][-1]
 
15
        last_locations_error[1,i] = s['Steve_'+padding+str(n)]['position'][1][-1]
 
16
        last_locations_error[2,i] = s['Steve_'+padding+str(n)]['position'][2][-1]
 
17
    X = fromfile('Xvals.txt',sep=' ')
 
18
    Y = fromfile('Yvals.txt',sep=' ')
 
19
    Z = 0.5*ones(shape(X))
 
20
    last_locations_error[0,:] = last_locations_error[0,:] - X
 
21
    last_locations_error[1,:] = last_locations_error[1,:] - Y
 
22
    last_locations_error[2,:] = last_locations_error[2,:] - Z 
 
23
    return last_locations_error