Create Cubic Network


In [2]:
import json
import numpy as np
import scipy as sp

In [3]:
def cubic(shape, scale=1E-6):

    arr = np.atleast_3d(np.empty(shape))

    points = np.array([i for i, v in np.ndenumerate(arr)], dtype=float)
    points += 0.5
    points *= scale

    I = np.arange(arr.size).reshape(arr.shape)

    joints = [
        (I[:, :, :-1], I[:, :, 1:]),
        (I[:, :-1], I[:, 1:]),
        (I[:-1], I[1:]),
        ]

    I = np.arange(arr.size).reshape(arr.shape)
    tails, heads = [], []
    for T, H in joints:
        tails.extend(T.flat)
        heads.extend(H.flat)
    pairs = np.vstack([tails, heads]).T

    d = {}
    
    d.update({
            'pores': [{'index':i, 
                       'location':loc,
                       'radius':0.1*np.random.random()*scale,
                      } for i, loc in enumerate(points.tolist())],
              
              'throats': [{'index':i,
                           'pores':con,
                           'radius':0.01*np.random.random()*scale,
                          } for i, con in enumerate(pairs.tolist())],
             })

    return d

In [4]:
cubic((2, 2, 2))


Out[4]:
{'pores': [{'index': 0,
   'location': [5e-07, 5e-07, 5e-07],
   'radius': 1.3467171354463382e-08},
  {'index': 1,
   'location': [5e-07, 5e-07, 1.5e-06],
   'radius': 1.4653433552868688e-08},
  {'index': 2,
   'location': [5e-07, 1.5e-06, 5e-07],
   'radius': 4.978391584293456e-08},
  {'index': 3,
   'location': [5e-07, 1.5e-06, 1.5e-06],
   'radius': 3.110141714083763e-08},
  {'index': 4,
   'location': [1.5e-06, 5e-07, 5e-07],
   'radius': 3.231546768456974e-08},
  {'index': 5,
   'location': [1.5e-06, 5e-07, 1.5e-06],
   'radius': 4.405295738640411e-08},
  {'index': 6,
   'location': [1.5e-06, 1.5e-06, 5e-07],
   'radius': 6.497409361202314e-08},
  {'index': 7,
   'location': [1.5e-06, 1.5e-06, 1.5e-06],
   'radius': 4.0292992438497866e-08}],
 'throats': [{'index': 0, 'pores': [0, 1], 'radius': 7.597454823125685e-09},
  {'index': 1, 'pores': [2, 3], 'radius': 3.6097054033835514e-09},
  {'index': 2, 'pores': [4, 5], 'radius': 5.900202049179588e-09},
  {'index': 3, 'pores': [6, 7], 'radius': 4.395226747238418e-09},
  {'index': 4, 'pores': [0, 2], 'radius': 9.482311803269569e-09},
  {'index': 5, 'pores': [1, 3], 'radius': 3.6393440805354373e-09},
  {'index': 6, 'pores': [4, 6], 'radius': 5.747735013022057e-09},
  {'index': 7, 'pores': [5, 7], 'radius': 3.952224736105501e-09},
  {'index': 8, 'pores': [0, 4], 'radius': 1.6674772606530418e-09},
  {'index': 9, 'pores': [1, 5], 'radius': 9.049316731590705e-09},
  {'index': 10, 'pores': [2, 6], 'radius': 5.2757180236307334e-09},
  {'index': 11, 'pores': [3, 7], 'radius': 7.211600359230804e-09}]}

In [ ]:
# n = 100
# with open('data/cubic_'+str(n)+'.json', 'w') as f:
#     json.dump(cubic((n, n, n)), f)

In [44]:
from itertools import takewhile
import json
from json import encoder
encoder.FLOAT_REPR = lambda o: format(o, '.6G')

try:
    import numpy as np
    HAS_NUMPY = True
except ImportError:
    HAS_NUMPY = False

load = json.load
loads = json.loads


def compress(obj):
    """Outputs json without whitespace."""
    return json.dumps(obj, sort_keys=True, separators=(',', ':'),
                      cls=CustomEncoder)


def dumps(obj):
    """Outputs json with formatting edits + object handling."""
    return json.dumps(obj, indent=4, sort_keys=True, cls=CustomEncoder)


class CustomEncoder(json.JSONEncoder):
    def default(self, obj):
        """Fired when an unserializable object is hit."""
        if hasattr(obj, '__dict__'):
            return obj.__dict__.copy()
        elif HAS_NUMPY and isinstance(obj, np.ndarray):
            return obj.copy().tolist()
        else:
            raise TypeError(("Object of type {:s} with value of {:s} is not "
                             "JSON serializable").format(type(obj), repr(obj)))

    def encode(self, obj):
        """Fired for every object."""
        s = super(CustomEncoder, self).encode(obj)
        # If uncompressed, postprocess for formatting
        if len(s.splitlines()) > 1:
            s = self.postprocess(s)
        return s

    def postprocess(self, json_string):
        """Displays each atom and bond entry on its own line."""
        is_compressing = True
        compressed = []
        spaces = 0
        for row in json_string.split("\n"):
            if is_compressing:
                if row.strip() == "{":
                    compressed.append(row.rstrip())
                elif (len(row) > spaces and row[:spaces] == " " * spaces and
                        row[spaces:].rstrip() in ["]", "],"]):
                    compressed.append(row.rstrip())
                    is_compressing = False
                else:
                    compressed[-1] += " " + row.strip()
            else:
                compressed.append(row.rstrip())
                if any(a in row for a in ["atoms", "bonds"]):
                    # Fix to handle issues that arise with empty lists
                    if "[]" in row:
                        continue
                    spaces = sum(1 for _ in takewhile(str.isspace, row))
                    is_compressing = True
        return "\n".join(compressed)

In [53]:
data = cubic((2,2,2))
print json.dumps(data, sort_keys=True, separators=(",", ":"))
# json.dumps(obj, sort_keys=True, separators=(",", ":"),
#                       cls=CustomEncoder)


{"pores":[{"index":0,"location":[5E-07,5E-07,5E-07],"radius":8.10755E-08},{"index":1,"location":[5E-07,5E-07,1.5E-06],"radius":3.10195E-09},{"index":2,"location":[5E-07,1.5E-06,5E-07],"radius":1.97732E-08},{"index":3,"location":[5E-07,1.5E-06,1.5E-06],"radius":2.80213E-09},{"index":4,"location":[1.5E-06,5E-07,5E-07],"radius":5.91439E-08},{"index":5,"location":[1.5E-06,5E-07,1.5E-06],"radius":9.3406E-08},{"index":6,"location":[1.5E-06,1.5E-06,5E-07],"radius":5.02052E-08},{"index":7,"location":[1.5E-06,1.5E-06,1.5E-06],"radius":1.90053E-08}],"throats":[{"index":0,"pores":[0,1],"radius":9.47548E-09},{"index":1,"pores":[2,3],"radius":4.40599E-09},{"index":2,"pores":[4,5],"radius":8.14585E-09},{"index":3,"pores":[6,7],"radius":1.6279E-09},{"index":4,"pores":[0,2],"radius":7.73183E-09},{"index":5,"pores":[1,3],"radius":9.64809E-09},{"index":6,"pores":[4,6],"radius":1.3546E-09},{"index":7,"pores":[5,7],"radius":5.58651E-09},{"index":8,"pores":[0,4],"radius":5.03544E-09},{"index":9,"pores":[1,5],"radius":8.84434E-09},{"index":10,"pores":[2,6],"radius":7.31367E-09},{"index":11,"pores":[3,7],"radius":9.80149E-09}]}

In [52]:
print compress(data)


{"pores":[{"index":0,"location":[5E-07,5E-07,5E-07],"radius":4.20534E-08},{"index":1,"location":[5E-07,5E-07,1.5E-06],"radius":6.66714E-08},{"index":2,"location":[5E-07,1.5E-06,5E-07],"radius":7.77722E-08},{"index":3,"location":[5E-07,1.5E-06,1.5E-06],"radius":7.23195E-08},{"index":4,"location":[1.5E-06,5E-07,5E-07],"radius":2.95194E-08},{"index":5,"location":[1.5E-06,5E-07,1.5E-06],"radius":4.04907E-08},{"index":6,"location":[1.5E-06,1.5E-06,5E-07],"radius":8.9346E-08},{"index":7,"location":[1.5E-06,1.5E-06,1.5E-06],"radius":9.17652E-08}],"throats":[{"index":0,"pores":[0,1],"radius":2.42613E-09},{"index":1,"pores":[2,3],"radius":7.33692E-09},{"index":2,"pores":[4,5],"radius":4.00721E-09},{"index":3,"pores":[6,7],"radius":9.93829E-09},{"index":4,"pores":[0,2],"radius":6.50034E-09},{"index":5,"pores":[1,3],"radius":4.33916E-09},{"index":6,"pores":[4,6],"radius":1.38916E-09},{"index":7,"pores":[5,7],"radius":5.84003E-09},{"index":8,"pores":[0,4],"radius":8.46435E-09},{"index":9,"pores":[1,5],"radius":3.12658E-09},{"index":10,"pores":[2,6],"radius":5.18623E-09},{"index":11,"pores":[3,7],"radius":8.71392E-09}]}

In [5]:
param = {
        'pnm':123,
        'div_id':123,
        'local_path':123,
        'remote_path':123,
        'width':123,
        'height':123,
        'default_pore_color':123,
        'default_throat_color':123,
        'shader':123,
        'z':123,
    }

html = """<div id="pnm_{div_id}"></div>
       <script type="text/javascript">
       require.config({{baseUrl: "/",
                         paths: {{ipnm: ['{local_path}', '{remote_path}']}}}});
       require(['ipnm'], function () {{
           var $d = $('#pnm_{div_id}');
           $d.width({width}); $d.height({height});
           $d.ipnm = jQuery.extend({{}}, ipnm);
           $d.ipnm.create($d, {{  defaultPoreColor: '{default_pore_color}',
                                 defaultThroatColor: '{default_throat_color}',
                                 shader: '{shader}', z: '{z}'}});
           $d.ipnm.draw({pnm});

           $d.resizable({{
               aspectRatio: {width} / {height},
               resize: function (evt, ui) {{
                   $d.ipnm.renderer.setSize(ui.size.width,
                                            ui.size.height);
               }}
           }});
       }});
       </script>""".format(**param)

print html


<div id="pnm_123"></div>
       <script type="text/javascript">
       require.config({baseUrl: "/",
                         paths: {ipnm: ['123', '123']}});
       require(['ipnm'], function () {
           var $d = $('#pnm_123');
           $d.width(123); $d.height(123);
           $d.ipnm = jQuery.extend({}, ipnm);
           $d.ipnm.create($d, {  defaultPoreColor: '123',
                                 defaultThroatColor: '123',
                                 shader: '123', z: '123'});
           $d.ipnm.draw(123);

           $d.resizable({
               aspectRatio: 123 / 123,
               resize: function (evt, ui) {
                   $d.ipnm.renderer.setSize(ui.size.width,
                                            ui.size.height);
               }
           });
       });
       </script>

In [1]:
f = """  1 9.282000E-004 9.894000E-004 1.305600E-003  
     2 8.313000E-004 1.020000E-003 4.539000E-004  
     3 1.152600E-003 6.987000E-004 6.528000E-004  
     4 5.100000E-006 4.692000E-004 1.198500E-003  
     5 1.494300E-003 1.224000E-003 6.324000E-004  
     6 7.956000E-004 1.239300E-003 6.885000E-004  
     7 7.140000E-004 1.055700E-003 1.785000E-004  
     8 1.020000E-005 8.925000E-004 1.305600E-003  
     9 1.040400E-003 8.313000E-004 3.978000E-004  
    10 1.020000E-005 1.259700E-003 1.142400E-003  
    11 4.437000E-004 2.703000E-004 7.701000E-004  
    12 8.364000E-004 1.173000E-003 9.792000E-004  
    13 4.131000E-004 3.060000E-004 8.619000E-004  
    14 9.588000E-004 9.996000E-004 1.509600E-003  
    15 3.978000E-004 4.590000E-004 7.548000E-004  
    16 1.142400E-003 9.588000E-004 1.519800E-003  
    17 5.100000E-005 3.774000E-004 3.264000E-004  
    18 7.293000E-004 1.091400E-003 7.242000E-004  
    19 9.996000E-004 1.004700E-003 3.519000E-004  
    20 3.264000E-004 4.335000E-004 8.109000E-004  
    21 1.632000E-004 1.632000E-004 9.639000E-004  
    22 6.732000E-004 2.550000E-005 1.468800E-003  
    23 5.967000E-004 6.171000E-004 1.091400E-003  
    24 8.721000E-004 1.167900E-003 6.936000E-004  
    25 1.377000E-004 8.925000E-004 1.341300E-003  
    26 6.120000E-005 2.703000E-004 2.040000E-004  
    27 6.681000E-004 5.712000E-004 6.885000E-004  
    28 6.630000E-004 5.457000E-004 6.681000E-004  
    29 2.601000E-004 1.377000E-004 1.060800E-003  
    30 4.539000E-004 9.435000E-004 4.539000E-004  
    31 8.670000E-004 1.229100E-003 1.030200E-003  
    32 5.661000E-004 1.519800E-003 2.091000E-004  
    33 1.224000E-004 5.100000E-006 9.690000E-004  
    34 1.193400E-003 1.071000E-004 1.443300E-003  
    35 1.530000E-005 1.009800E-003 1.484100E-003  
    36 8.976000E-004 1.504500E-003 3.978000E-004  
    37 1.249500E-003 1.142400E-003 9.486000E-004  
    38 1.239300E-003 1.122000E-003 8.976000E-004  
    39 1.101600E-003 9.639000E-004 1.519800E-003  
    40 9.537000E-004 1.489200E-003 3.978000E-004  
    41 7.038000E-004 5.967000E-004 7.038000E-004  
    42 1.530000E-005 3.060000E-005 9.180000E-005  
    43 1.336200E-003 4.131000E-004 5.712000E-004  
    44 3.621000E-004 4.794000E-004 1.285200E-003  
    45 8.619000E-004 1.167900E-003 7.242000E-004  
    46 5.100000E-006 7.599000E-004 6.630000E-004  
    47 1.836000E-004 5.610000E-005 1.785000E-004  
    48 8.313000E-004 1.157700E-003 7.956000E-004  
    49 4.284000E-004 2.907000E-004 7.344000E-004  
    50 4.080000E-004 4.131000E-004 6.375000E-004  
    51 1.494300E-003 4.131000E-004 1.514700E-003  
    52 9.690000E-004 1.489200E-003 3.060000E-004  
    53 6.120000E-005 1.448400E-003 2.244000E-004  
    54 6.477000E-004 6.630000E-004 8.721000E-004  
    55 5.916000E-004 1.504500E-003 2.193000E-004  
    56 5.814000E-004 1.494300E-003 2.244000E-004  
    57 1.361700E-003 6.426000E-004 1.091400E-003  
    58 9.282000E-004 1.734000E-004 1.167900E-003  
    59 1.188300E-003 9.384000E-004 1.519800E-003  
    60 1.417800E-003 5.814000E-004 1.387200E-003  
    61 2.550000E-004 5.253000E-004 1.259700E-003  
    62 1.014900E-003 1.734000E-004 1.499400E-003  
    63 5.100000E-006 3.060000E-005 1.122000E-004  
    64 4.641000E-004 5.100000E-006 1.244400E-003  
    65 1.009800E-003 2.805000E-004 1.111800E-003  
    66 1.025100E-003 2.754000E-004 1.106700E-003  
    67 1.116900E-003 8.415000E-004 9.180000E-005  
    68 1.249500E-003 5.100000E-006 1.453500E-003  
    69 6.630000E-005 1.402500E-003 1.290300E-003  
    70 1.407600E-003 5.559000E-004 1.387200E-003  
    71 1.071000E-004 3.723000E-004 3.723000E-004  
    72 9.792000E-004 2.703000E-004 1.152600E-003  
    73 1.275000E-004 5.406000E-004 3.417000E-004  
    74 2.703000E-004 8.160000E-004 1.519800E-003  
    75 4.080000E-005 8.976000E-004 2.142000E-004  
    76 8.109000E-004 7.446000E-004 1.417800E-003  
    77 1.494300E-003 5.559000E-004 1.458600E-003  
    78 1.479000E-003 5.712000E-004 1.448400E-003  
    79 1.035300E-003 8.007000E-004 3.162000E-004  
    80 4.590000E-005 2.754000E-004 1.244400E-003  
    81 7.548000E-004 5.457000E-004 1.060800E-003  
    82 1.167900E-003 6.681000E-004 2.142000E-004  
    83 1.147500E-003 6.834000E-004 1.683000E-004  
    84 9.384000E-004 8.670000E-004 3.621000E-004  
    85 8.976000E-004 9.231000E-004 3.417000E-004  
    86 3.570000E-004 5.100000E-004 8.262000E-004  
    87 1.530000E-005 1.025100E-003 5.100000E-006  
    88 1.111800E-003 3.060000E-005 9.690000E-005  
    89 6.018000E-004 6.987000E-004 8.364000E-004  
    90 3.570000E-004 4.029000E-004 8.619000E-004  
    91 5.100000E-006 2.856000E-004 3.315000E-004  
    92 9.792000E-004 1.096500E-003 1.519800E-003  
    93 5.610000E-005 9.741000E-004 3.060000E-005  
    94 5.100000E-006 3.825000E-004 3.162000E-004  
    95 1.336200E-003 1.132200E-003 6.477000E-004  
    96 1.341300E-003 1.091400E-003 6.783000E-004  
    97 1.071000E-004 4.590000E-005 9.639000E-004  
    98 1.020000E-005 1.060800E-003 1.519800E-003  
    99 3.621000E-004 4.488000E-004 8.058000E-004  
   100 1.152600E-003 4.080000E-005 2.244000E-004  
   101 4.488000E-004 3.315000E-004 8.619000E-004  
   102 6.120000E-004 6.426000E-004 8.976000E-004  
   103 2.499000E-004 5.100000E-006 8.517000E-004  
   104 7.548000E-004 5.100000E-006 1.509600E-003  
   105 7.803000E-004 5.100000E-006 1.443300E-003  
   106 7.599000E-004 5.100000E-006 1.473900E-003  
   107 1.397400E-003 6.477000E-004 1.422900E-003  
   108 8.517000E-004 3.519000E-004 6.120000E-005  
   109 6.273000E-004 7.038000E-004 8.058000E-004  
   110 5.814000E-004 6.987000E-004 5.304000E-004  
   111 6.630000E-004 3.009000E-004 1.836000E-004  
   112 6.834000E-004 2.856000E-004 1.785000E-004  
   113 1.218900E-003 1.045500E-003 4.233000E-004  
   114 1.142400E-003 1.320900E-003 5.151000E-004  
   115 8.823000E-004 1.519800E-003 3.825000E-004  
   116 4.590000E-005 2.091000E-004 1.683000E-004  
   117 1.519800E-003 1.173000E-003 6.885000E-004  
   118 6.069000E-004 1.249500E-003 1.530000E-005  
   119 3.060000E-004 9.690000E-005 4.947000E-004  
   120 1.300500E-003 1.030200E-003 7.038000E-004  
   121 9.996000E-004 1.050600E-003 1.183200E-003  
   122 8.619000E-004 1.122000E-003 1.096500E-003  
   123 3.162000E-004 4.539000E-004 5.508000E-004  
   124 1.632000E-004 1.086300E-003 5.661000E-004  
   125 2.754000E-004 8.466000E-004 1.504500E-003  
   126 1.275000E-004 1.173000E-004 9.435000E-004  
   127 1.632000E-004 2.040000E-004 1.377000E-003  
   128 8.874000E-004 8.466000E-004 4.284000E-004  
   129 8.670000E-005 5.457000E-004 3.315000E-004  
   130 6.426000E-004 6.987000E-004 7.497000E-004  
   131 1.020000E-003 1.065900E-003 1.453500E-003  
   132 5.100000E-006 2.040000E-004 1.581000E-004  
   133 8.160000E-004 3.468000E-004 1.224000E-004  
   134 1.147500E-003 1.116900E-003 1.336200E-003  
   135 2.397000E-004 1.030200E-003 2.754000E-004  
   136 4.080000E-004 4.386000E-004 6.477000E-004  
   137 1.244400E-003 1.009800E-003 6.783000E-004  
   138 5.151000E-004 5.610000E-004 7.242000E-004  
   139 1.249500E-003 1.157700E-003 1.014900E-003  
   140 3.570000E-005 3.672000E-004 3.519000E-004  
   141 9.282000E-004 2.754000E-004 1.305600E-003  
   142 6.732000E-004 2.193000E-004 1.244400E-003  
   143 1.530000E-005 8.211000E-004 5.610000E-005  
   144 6.018000E-004 6.120000E-004 7.905000E-004  
   145 4.947000E-004 5.967000E-004 7.446000E-004  
   146 1.224000E-004 2.550000E-004 1.938000E-004  
   147 7.140000E-004 1.030200E-003 1.346400E-003  
   148 1.519800E-003 1.428000E-004 4.692000E-004  
   149 1.178100E-003 8.211000E-004 1.173000E-004  
   150 5.661000E-004 6.477000E-004 4.029000E-004  
   151 8.721000E-004 1.076100E-003 8.160000E-004  
   152 4.947000E-004 1.009800E-003 4.692000E-004  
   153 2.040000E-005 1.836000E-004 1.122000E-004  
   154 1.035300E-003 1.060800E-003 1.152600E-003  
   155 5.610000E-004 6.681000E-004 4.080000E-004  
   156 6.681000E-004 1.004700E-003 1.336200E-003  
   157 2.550000E-005 1.519800E-003 1.484100E-003  
   158 9.741000E-004 1.519800E-003 3.825000E-004  
   159 1.504500E-003 1.152600E-003 1.519800E-003  
   160 3.570000E-005 2.550000E-004 1.683000E-004  
   161 5.100000E-005 2.244000E-004 1.836000E-004  
   162 9.180000E-004 9.588000E-004 5.100000E-006  
   163 2.040000E-005 1.045500E-003 1.448400E-003  
   164 4.182000E-004 3.315000E-004 7.242000E-004  
   165 1.020000E-003 7.854000E-004 3.774000E-004  
   166 1.310700E-003 1.122000E-004 1.514700E-003  
   167 1.020000E-005 1.377000E-004 2.091000E-004  
   168 6.069000E-004 7.599000E-004 6.426000E-004  
   169 8.415000E-004 6.120000E-005 1.514700E-003  
   170 9.894000E-004 1.025100E-003 1.224000E-003  
   171 1.025100E-003 1.045500E-003 1.183200E-003  
   172 7.803000E-004 1.208700E-003 9.435000E-004  
   173 1.020000E-005 1.632000E-004 5.100000E-004  
   174 9.690000E-005 1.530000E-005 9.945000E-004  
   175 9.690000E-005 4.029000E-004 3.570000E-004  
   176 1.377000E-004 3.978000E-004 3.315000E-004  
   177 1.020000E-005 7.446000E-004 3.927000E-004  
   178 1.055700E-003 8.415000E-004 1.071000E-004  
   179 8.007000E-004 1.463700E-003 3.825000E-004  
   180 6.120000E-004 8.109000E-004 4.386000E-004  
   181 4.488000E-004 4.488000E-004 6.222000E-004  
   182 1.020000E-005 9.486000E-004 1.530000E-005  
   183 2.907000E-004 4.488000E-004 8.007000E-004  
   184 1.020000E-005 3.213000E-004 3.621000E-004  
   185 3.060000E-005 1.473900E-003 1.489200E-003  
   186 2.805000E-004 7.293000E-004 1.514700E-003  
   187 5.406000E-004 1.494300E-003 2.856000E-004  
   188 6.426000E-004 3.162000E-004 2.346000E-004  
   189 1.275000E-003 1.009800E-003 7.242000E-004  
   190 1.326000E-004 4.131000E-004 4.080000E-004  
   191 5.814000E-004 7.242000E-004 7.446000E-004  
   192 6.069000E-004 6.426000E-004 1.122000E-003  
   193 1.473900E-003 5.304000E-004 3.621000E-004  
   194 7.599000E-004 6.579000E-004 5.253000E-004  
   195 7.752000E-004 6.630000E-004 5.508000E-004  
   196 1.632000E-004 4.131000E-004 3.927000E-004  
   197 9.945000E-004 1.076100E-003 1.162800E-003  
   198 1.020000E-004 2.244000E-004 1.479000E-004  
   199 1.096500E-003 6.171000E-004 1.020000E-005  
   200 1.076100E-003 5.661000E-004 1.234200E-003  
   201 3.570000E-004 9.180000E-005 4.794000E-004  
   202 3.774000E-004 4.845000E-004 6.477000E-004  
   203 3.468000E-004 4.539000E-004 6.477000E-004  
   204 6.069000E-004 1.514700E-003 1.494300E-003  
   205 7.089000E-004 1.020000E-005 1.448400E-003  
   206 1.458600E-003 5.355000E-004 4.080000E-004  
   207 9.792000E-004 1.484100E-003 4.233000E-004  
   208 1.173000E-004 1.147500E-003 1.530000E-005  
   209 1.122000E-003 5.814000E-004 2.040000E-005  
   210 1.178100E-003 1.020000E-005 1.397400E-003  
   211 6.783000E-004 1.020000E-005 1.514700E-003  
   212 7.701000E-004 2.907000E-004 1.020000E-004  
   213 1.326000E-004 6.120000E-005 1.025100E-003  
   214 4.896000E-004 7.344000E-004 7.242000E-004  
   215 5.508000E-004 6.987000E-004 7.191000E-004  
   216 4.080000E-005 8.772000E-004 7.140000E-005  
   217 3.570000E-005 9.282000E-004 3.060000E-005  
   218 1.412700E-003 6.273000E-004 1.392300E-003  
   219 9.435000E-004 2.397000E-004 1.285200E-003  
   220 3.366000E-004 2.244000E-004 6.885000E-004  
   221 1.530000E-005 6.375000E-004 1.836000E-004  
   222 5.253000E-004 7.344000E-004 6.426000E-004  
   223 4.947000E-004 7.344000E-004 6.375000E-004  
   224 6.273000E-004 9.792000E-004 1.346400E-003  
   225 4.233000E-004 4.182000E-004 1.989000E-004  
   226 9.129000E-004 7.140000E-004 1.346400E-003  
   227 8.670000E-004 6.681000E-004 1.356600E-003  
   228 4.182000E-004 5.661000E-004 7.905000E-004  
   229 5.049000E-004 5.508000E-004 7.599000E-004  
   230 6.273000E-004 4.998000E-004 1.734000E-004  
   231 7.038000E-004 1.514700E-003 3.621000E-004  
   232 8.211000E-004 1.468800E-003 1.020000E-003  
   233 3.723000E-004 1.530000E-005 1.020000E-005  
   234 6.120000E-005 9.690000E-005 9.945000E-004  
   235 4.947000E-004 3.672000E-004 9.333000E-004  
   236 3.264000E-004 8.160000E-005 1.530000E-004  
   237 8.160000E-005 1.428000E-004 9.843000E-004  
   238 6.783000E-004 3.009000E-004 2.805000E-004  
   239 2.295000E-004 1.244400E-003 1.014900E-003  
   240 1.030200E-003 3.315000E-004 1.285200E-003  
   241 4.335000E-004 4.131000E-004 8.211000E-004  
   242 3.672000E-004 3.723000E-004 8.160000E-004  
   243 6.630000E-005 1.020000E-005 9.333000E-004  
   244 5.865000E-004 5.610000E-004 9.945000E-004  
   245 2.040000E-005 1.632000E-004 1.020000E-005  
   246 2.499000E-004 4.131000E-004 8.619000E-004  
   247 2.295000E-004 3.774000E-004 8.415000E-004  
   248 8.517000E-004 1.142400E-003 8.313000E-004  
   249 1.147500E-003 6.834000E-004 2.754000E-004  
   250 5.253000E-004 6.324000E-004 7.395000E-004  
   251 1.224000E-004 2.091000E-004 1.040400E-003  
   252 4.590000E-005 3.672000E-004 4.182000E-004  
   253 3.060000E-005 3.774000E-004 1.290300E-003  
   254 7.803000E-004 8.415000E-004 2.244000E-004  
   255 6.375000E-004 6.222000E-004 7.905000E-004  
   256 8.160000E-004 1.514700E-003 3.468000E-004  
   257 5.304000E-004 5.406000E-004 9.078000E-004  
   258 9.690000E-005 7.191000E-004 4.947000E-004  
   259 1.468800E-003 1.229100E-003 1.315800E-003  
   260 8.568000E-004 1.504500E-003 2.601000E-004  
   261 1.173000E-004 2.805000E-004 2.244000E-004  
   262 1.020000E-005 3.672000E-004 3.774000E-004  
   263 7.905000E-004 1.081200E-003 1.331100E-003  
   264 3.060000E-005 2.244000E-004 1.173000E-004  
   265 7.446000E-004 9.282000E-004 1.632000E-004  
   266 9.894000E-004 6.324000E-004 7.650000E-004  
   267 1.086300E-003 1.132200E-003 1.402500E-003  
   268 1.045500E-003 1.111800E-003 1.433100E-003  
   269 1.366800E-003 1.412700E-003 1.014900E-003  
   270 1.122000E-004 1.269900E-003 6.630000E-004  
   271 1.632000E-004 8.211000E-004 2.703000E-004  
   272 1.887000E-004 3.978000E-004 3.519000E-004  
   273 5.916000E-004 1.020000E-005 9.384000E-004  
   274 6.120000E-005 6.987000E-004 1.836000E-004  
   275 8.874000E-004 3.468000E-004 1.530000E-005  
   276 1.020000E-005 7.905000E-004 4.692000E-004  
   277 8.670000E-005 7.344000E-004 1.683000E-004  
   278 2.244000E-004 1.020000E-005 8.007000E-004  
   279 1.275000E-004 3.723000E-004 1.275000E-003  
   280 8.313000E-004 8.670000E-004 1.020000E-005  
   281 8.721000E-004 1.127100E-003 9.894000E-004  
   282 9.384000E-004 1.514700E-003 4.590000E-004  
   283 9.384000E-004 1.514700E-003 2.142000E-004  
   284 5.100000E-005 1.275000E-004 1.275000E-004  
   285 1.458600E-003 4.947000E-004 1.412700E-003  
   286 1.392300E-003 5.355000E-004 1.050600E-003  
   287 1.785000E-004 1.290300E-003 5.202000E-004  
   288 8.007000E-004 9.945000E-004 8.058000E-004  
   289 1.530000E-005 9.690000E-005 1.173000E-004  
   290 1.071000E-004 8.976000E-004 3.570000E-004  
   291 4.641000E-004 3.876000E-004 4.998000E-004  
   292 9.231000E-004 1.285200E-003 1.407600E-003  
   293 8.211000E-004 1.433100E-003 3.417000E-004  
   294 4.641000E-004 3.927000E-004 5.865000E-004  
   295 1.009800E-003 8.772000E-004 8.160000E-005  
   296 1.025100E-003 1.326000E-003 1.086300E-003  
   297 9.792000E-004 2.397000E-004 1.045500E-003  
   298 6.120000E-004 6.222000E-004 7.497000E-004  
   299 9.996000E-004 8.976000E-004 2.040000E-005  
   300 1.530000E-005 1.122000E-004 4.386000E-004  
   301 1.224000E-003 1.530000E-004 1.509600E-003  
   302 5.304000E-004 6.477000E-004 9.282000E-004  
   303 3.468000E-004 2.856000E-004 7.446000E-004  
   304 7.803000E-004 1.111800E-003 8.109000E-004  
   305 1.198500E-003 8.517000E-004 1.071000E-004  
   306 1.326000E-004 8.772000E-004 3.366000E-004  
   307 1.504500E-003 1.030200E-003 1.504500E-003  
   308 1.025100E-003 8.415000E-004 4.590000E-005  
   309 5.202000E-004 1.530000E-005 5.253000E-004  
   310 1.081200E-003 9.078000E-004 3.621000E-004  
   311 6.069000E-004 6.222000E-004 9.792000E-004  
   312 5.202000E-004 6.732000E-004 9.792000E-004  
   313 7.089000E-004 6.885000E-004 1.045500E-003  
   314 1.938000E-004 9.690000E-005 9.843000E-004  
   315 2.550000E-005 3.570000E-005 1.116900E-003  
   316 1.280100E-003 1.193400E-003 1.060800E-003  
   317 4.335000E-004 2.652000E-004 1.530000E-005  
   318 7.038000E-004 1.509600E-003 3.213000E-004  
   319 1.402500E-003 6.120000E-004 1.504500E-003  
   320 8.211000E-004 1.142400E-003 7.599000E-004  
   321 6.987000E-004 2.550000E-004 8.670000E-005  
   322 9.384000E-004 3.264000E-004 1.280100E-003  
   323 7.956000E-004 8.058000E-004 4.794000E-004  
   324 5.151000E-004 5.406000E-004 6.375000E-004  
   325 6.732000E-004 9.639000E-004 1.081200E-003  
   326 6.273000E-004 1.509600E-003 2.754000E-004  
   327 8.109000E-004 7.956000E-004 5.202000E-004  
   328 1.530000E-005 1.836000E-004 6.630000E-005  
   329 8.466000E-004 1.509600E-003 4.233000E-004  
   330 6.222000E-004 2.550000E-005 8.466000E-004  
   331 4.437000E-004 1.938000E-004 1.122000E-003  
   332 2.091000E-004 1.356600E-003 2.805000E-004  
   333 1.162800E-003 1.285200E-003 1.310700E-003  
   334 4.029000E-004 1.499400E-003 5.814000E-004  
   335 1.479000E-004 5.253000E-004 1.244400E-003  
   336 8.976000E-004 1.101600E-003 8.466000E-004  
   337 8.517000E-004 6.069000E-004 6.783000E-004  
   338 6.528000E-004 1.065900E-003 1.035300E-003  
   339 2.142000E-004 1.428000E-004 7.650000E-005  
   340 1.137300E-003 4.029000E-004 3.417000E-004  
   341 9.792000E-004 5.610000E-005 1.473900E-003  
   342 7.446000E-004 1.045500E-003 1.030200E-003  
   343 1.178100E-003 1.989000E-004 1.509600E-003  
   344 1.116900E-003 8.670000E-005 1.530000E-005  
   345 1.509600E-003 4.080000E-004 5.559000E-004  
   346 4.080000E-005 1.530000E-005 1.071000E-003  
   347 1.004700E-003 3.570000E-004 6.885000E-004  
   348 1.392300E-003 2.856000E-004 4.335000E-004  
   349 1.275000E-003 3.315000E-004 2.856000E-004  
   350 2.295000E-004 3.672000E-004 7.752000E-004  
   351 6.120000E-005 6.477000E-004 2.652000E-004  
   352 1.275000E-004 1.020000E-003 4.692000E-004  
   353 1.331100E-003 1.086300E-003 1.259700E-003  
   354 2.244000E-004 4.743000E-004 3.825000E-004  
   355 2.040000E-005 6.222000E-004 2.652000E-004  
   356 2.550000E-005 5.763000E-004 3.213000E-004  
   357 4.284000E-004 5.049000E-004 6.426000E-004  
   358 9.894000E-004 6.171000E-004 6.987000E-004  
   359 1.106700E-003 9.231000E-004 1.785000E-004  
   360 6.885000E-004 1.040400E-003 2.040000E-005  
   361 9.843000E-004 2.040000E-005 1.040400E-003  
   362 1.137300E-003 3.417000E-004 5.610000E-004  
   363 2.040000E-005 1.581000E-004 1.030200E-003  
   364 2.499000E-004 4.692000E-004 4.947000E-004  
   365 8.313000E-004 1.096500E-003 9.078000E-004  
   366 8.670000E-004 1.020000E-003 8.925000E-004  
   367 8.925000E-004 6.069000E-004 4.539000E-004  
   368 1.086300E-003 3.366000E-004 3.264000E-004  
   369 2.040000E-005 9.180000E-004 2.754000E-004  
   370 2.040000E-005 8.823000E-004 3.111000E-004  
   371 2.346000E-004 5.610000E-005 1.050600E-003  
   372 1.050600E-003 3.009000E-004 3.825000E-004  
   373 4.794000E-004 5.100000E-004 5.967000E-004  
   374 4.692000E-004 5.559000E-004 6.324000E-004  
   375 2.040000E-005 6.120000E-005 1.009800E-003  
   376 2.040000E-005 9.690000E-005 1.060800E-003  
   377 6.375000E-004 4.692000E-004 1.377000E-004  
   378 7.599000E-004 1.106700E-003 1.137300E-003  
   379 6.018000E-004 7.293000E-004 1.035300E-003  
   380 5.916000E-004 1.229100E-003 1.122000E-004  
   381 2.040000E-004 1.081200E-003 2.448000E-004  
   382 5.355000E-004 5.100000E-004 9.741000E-004  
   383 7.140000E-004 1.234200E-003 7.752000E-004  
   384 1.438200E-003 1.417800E-003 5.814000E-004  
   385 3.774000E-004 3.825000E-004 1.331100E-003  
   386 9.690000E-005 1.887000E-004 1.081200E-003  
   387 1.275000E-004 2.550000E-005 8.874000E-004  
   388 1.479000E-004 1.122000E-004 8.670000E-004  
   389 1.009800E-003 2.448000E-004 1.244400E-003  
   390 3.213000E-004 6.120000E-005 4.080000E-005  
   391 1.224000E-004 9.690000E-005 1.116900E-003  
   392 1.836000E-004 3.978000E-004 1.331100E-003  
   393 7.038000E-004 1.142400E-003 7.650000E-004  
   394 7.140000E-004 7.191000E-004 4.182000E-004  
   395 1.071000E-004 8.415000E-004 2.550000E-004  
   396 3.162000E-004 1.504500E-003 3.876000E-004  
   397 7.140000E-005 1.683000E-004 1.137300E-003  
   398 1.122000E-003 9.945000E-004 3.366000E-004  
   399 9.384000E-004 1.683000E-004 1.035300E-003  
   400 4.335000E-004 1.504500E-003 3.162000E-004  
   401 5.406000E-004 9.333000E-004 9.486000E-004  
   402 1.224000E-004 9.537000E-004 4.641000E-004  
   403 1.412700E-003 8.466000E-004 1.101600E-003  
   404 1.341300E-003 1.366800E-003 6.681000E-004  
   405 1.173000E-004 8.262000E-004 1.836000E-004  
   406 1.422900E-003 3.060000E-005 1.494300E-003  
   407 3.060000E-005 1.275000E-004 3.009000E-004  
   408 6.477000E-004 1.938000E-004 9.078000E-004  
   409 8.262000E-004 1.422900E-003 6.273000E-004  
   410 1.402500E-003 2.040000E-005 8.364000E-004  
   411 1.387200E-003 1.315800E-003 6.171000E-004  
   412 9.486000E-004 2.958000E-004 2.907000E-004  
   413 7.446000E-004 9.282000E-004 5.355000E-004  
   414 1.938000E-004 2.550000E-005 1.076100E-003  
   415 9.486000E-004 1.060800E-003 7.956000E-004  
   416 1.377000E-004 2.550000E-005 1.162800E-003  
   417 7.395000E-004 6.681000E-004 7.497000E-004  
   418 6.885000E-004 7.497000E-004 1.030200E-003  
   419 2.754000E-004 1.224000E-004 2.550000E-005  
   420 1.173000E-004 6.120000E-005 4.080000E-005  
   421 5.202000E-004 2.091000E-004 1.157700E-003  
   422 8.823000E-004 4.794000E-004 5.355000E-004  
   423 7.497000E-004 7.752000E-004 7.242000E-004  
   424 3.570000E-005 8.058000E-004 3.825000E-004  
   425 6.120000E-005 8.568000E-004 4.182000E-004  
   426 6.834000E-004 8.160000E-004 8.160000E-004  
   427 1.326000E-004 9.537000E-004 2.091000E-004  
   428 1.734000E-004 9.486000E-004 2.652000E-004  
   429 7.395000E-004 3.621000E-004 2.856000E-004  
   430 5.610000E-004 4.488000E-004 1.030200E-003  
   431 1.422900E-003 1.173000E-003 7.905000E-004  
   432 8.058000E-004 7.446000E-004 6.069000E-004  
   433 2.397000E-004 2.907000E-004 8.466000E-004  
   434 1.494300E-003 2.805000E-004 1.494300E-003  
   435 6.375000E-004 3.417000E-004 1.494300E-003  
   436 6.987000E-004 1.463700E-003 4.488000E-004  
   437 9.384000E-004 4.029000E-004 1.336200E-003  
   438 4.641000E-004 3.570000E-005 1.127100E-003  
   439 3.825000E-004 3.060000E-005 1.106700E-003  
   440 4.488000E-004 6.171000E-004 9.843000E-004  
   441 1.060800E-003 1.377000E-004 1.377000E-003  
   442 1.132200E-003 4.080000E-004 1.351500E-003  
   443 1.479000E-003 5.049000E-004 5.712000E-004  
   444 5.967000E-004 9.384000E-004 7.905000E-004  
   445 6.069000E-004 9.384000E-004 6.987000E-004  
   446 8.364000E-004 9.078000E-004 1.499400E-003  
   447 1.116900E-003 5.763000E-004 3.978000E-004  
   448 1.264800E-003 5.610000E-004 5.610000E-005  
   449 4.029000E-004 1.489200E-003 4.488000E-004  
   450 7.089000E-004 4.692000E-004 2.193000E-004  
   451 8.517000E-004 5.916000E-004 5.712000E-004  
   452 7.446000E-004 4.794000E-004 4.590000E-005  
   453 1.734000E-004 1.581000E-004 1.836000E-004  
   454 5.712000E-004 7.701000E-004 8.517000E-004  
   455 5.559000E-004 7.650000E-004 9.384000E-004  
   456 4.692000E-004 7.701000E-004 9.639000E-004  
   457 1.035300E-003 7.599000E-004 6.222000E-004  
   458 1.065900E-003 1.326000E-004 1.091400E-003  
   459 8.823000E-004 4.743000E-004 1.300500E-003  
   460 1.887000E-004 1.178100E-003 1.938000E-004  
   461 7.854000E-004 8.517000E-004 3.519000E-004  
   462 5.916000E-004 9.333000E-004 4.845000E-004  
   463 1.326000E-003 5.253000E-004 2.091000E-004  
   464 3.570000E-005 7.038000E-004 5.610000E-004  
   465 8.364000E-004 5.559000E-004 5.100000E-004  
   466 1.494300E-003 1.025100E-003 1.361700E-003  
   467 7.038000E-004 1.422900E-003 3.060000E-004  
   468 1.071000E-003 7.446000E-004 6.630000E-005  
   469 1.218900E-003 8.160000E-005 4.029000E-004  
   470 1.275000E-004 6.375000E-004 1.157700E-003  
   471 1.086300E-003 3.774000E-004 6.324000E-004  
   472 6.528000E-004 1.479000E-003 5.763000E-004  
   473 9.639000E-004 7.242000E-004 5.814000E-004  
   474 6.783000E-004 5.406000E-004 3.468000E-004  
   475 8.313000E-004 7.242000E-004 2.295000E-004  
   476 6.120000E-004 1.438200E-003 5.100000E-004  
   477 6.681000E-004 1.463700E-003 6.834000E-004  
   478 7.599000E-004 1.183200E-003 3.570000E-005  
   479 7.854000E-004 6.630000E-004 3.570000E-005  
   480 1.127100E-003 2.142000E-004 1.101600E-003  
   481 8.925000E-004 9.690000E-005 1.234200E-003  
   482 1.162800E-003 1.014900E-003 5.661000E-004  
   483 9.129000E-004 7.293000E-004 6.630000E-005  
   484 1.009800E-003 7.395000E-004 1.428000E-004  
   485 5.610000E-005 1.244400E-003 4.743000E-004  
   486 3.468000E-004 4.233000E-004 1.402500E-003  
   487 1.096500E-003 3.111000E-004 4.590000E-005  
   488 1.178100E-003 2.907000E-004 2.550000E-004  
   489 2.499000E-004 9.690000E-004 3.876000E-004  
   490 4.590000E-004 3.468000E-004 1.106700E-003  
   491 3.672000E-004 3.672000E-004 9.996000E-004  
   492 8.568000E-004 1.326000E-003 6.069000E-004  
   493 1.020000E-004 1.076100E-003 2.856000E-004  
   494 9.690000E-005 1.198500E-003 2.805000E-004  
   495 3.570000E-005 6.222000E-004 1.167900E-003  
   496 5.406000E-004 1.122000E-004 1.428000E-003  
   497 7.548000E-004 3.162000E-004 1.473900E-003  
   498 9.180000E-005 1.371900E-003 3.060000E-004  
   499 2.193000E-004 1.468800E-003 3.009000E-004  
   500 1.055700E-003 9.078000E-004 1.371900E-003  
   501 9.384000E-004 1.193400E-003 1.127100E-003  
   502 1.060800E-003 6.630000E-004 3.927000E-004  
   503 3.570000E-004 5.100000E-005 3.366000E-004  
   504 1.351500E-003 8.721000E-004 1.443300E-003  
   505 1.239300E-003 7.650000E-005 1.035300E-003  
   506 1.055700E-003 4.692000E-004 5.151000E-004  
   507 1.224000E-003 5.406000E-004 6.324000E-004  
   508 9.078000E-004 1.076100E-003 6.120000E-004  
   509 1.433100E-003 1.004700E-003 1.234200E-003  
   510 3.213000E-004 6.273000E-004 4.743000E-004  
   511 8.211000E-004 3.264000E-004 1.081200E-003  
   512 6.324000E-004 4.998000E-004 1.111800E-003  
   513 1.453500E-003 6.324000E-004 7.140000E-005  
   514 3.927000E-004 5.508000E-004 1.407600E-003  
   515 2.958000E-004 1.371900E-003 8.415000E-004  
   516 5.610000E-005 1.433100E-003 1.157700E-003  
   517 3.315000E-004 6.171000E-004 1.137300E-003  
   518 4.233000E-004 3.213000E-004 2.244000E-004  
   519 4.233000E-004 4.794000E-004 3.825000E-004  
   520 1.422900E-003 1.632000E-004 1.106700E-003  
   521 6.375000E-004 1.356600E-003 1.463700E-003  
   522 1.030200E-003 1.473900E-003 5.304000E-004  
   523 5.100000E-005 5.100000E-005 1.295400E-003  
   524 1.122000E-004 1.315800E-003 1.387200E-003  
   525 1.020000E-004 2.601000E-004 1.422900E-003  
   526 5.100000E-005 6.120000E-005 1.463700E-003  
   527 1.280100E-003 5.457000E-004 1.285200E-003  
   528 7.038000E-004 9.792000E-004 1.468800E-003  
   529 7.140000E-005 4.590000E-004 6.732000E-004  
   530 1.448400E-003 6.579000E-004 8.721000E-004  
   531 1.193400E-003 6.426000E-004 9.690000E-004  
   532 1.259700E-003 6.630000E-004 8.670000E-004  
   533 7.650000E-005 4.233000E-004 9.435000E-004  
   534 1.683000E-004 1.377000E-004 6.426000E-004  
   535 1.086300E-003 1.244400E-003 1.989000E-004  
   536 7.344000E-004 4.794000E-004 1.428000E-003  
   537 5.763000E-004 5.508000E-004 1.295400E-003  
   538 7.242000E-004 4.182000E-004 4.998000E-004  
   539 4.743000E-004 1.259700E-003 1.208700E-003  
   540 5.610000E-004 1.071000E-004 6.477000E-004  
   541 5.712000E-004 2.346000E-004 4.947000E-004  
   542 7.803000E-004 1.122000E-004 2.244000E-004  
   543 6.375000E-004 1.382100E-003 9.537000E-004  
   544 6.273000E-004 1.193400E-003 8.670000E-004  
   545 1.259700E-003 8.313000E-004 1.254600E-003  
   546 1.142400E-003 7.038000E-004 1.188300E-003  
   547 4.182000E-004 8.466000E-004 1.208700E-003  
   548 5.508000E-004 1.081200E-003 1.438200E-003  
   549 8.313000E-004 7.140000E-005 6.936000E-004  
   550 9.588000E-004 1.683000E-004 5.202000E-004  
   551 7.803000E-004 2.193000E-004 3.723000E-004  
   552 1.320900E-003 1.438200E-003 1.203600E-003  
   553 1.249500E-003 1.428000E-003 1.453500E-003  
   554 1.091400E-003 9.129000E-004 8.313000E-004  
   555 8.976000E-004 7.905000E-004 8.517000E-004  
   556 4.284000E-004 1.433100E-003 9.180000E-005  
   557 5.712000E-004 1.280100E-003 3.315000E-004  
   558 1.147500E-003 8.466000E-004 5.610000E-005  
   559 9.537000E-004 2.805000E-004 2.193000E-004  
   560 5.100000E-006 3.468000E-004 2.346000E-004  
   561 5.100000E-006 4.182000E-004 2.754000E-004  
   562 4.080000E-005 4.437000E-004 3.162000E-004  
   563 1.392300E-003 6.375000E-004 3.315000E-004  
   564 7.905000E-004 9.945000E-004 3.876000E-004  
   565 2.448000E-004 5.151000E-004 4.692000E-004  
   566 1.371900E-003 1.519800E-003 4.845000E-004  
   567 1.463700E-003 8.517000E-004 5.457000E-004  
   568 1.300500E-003 1.137300E-003 6.120000E-004  
   569 7.038000E-004 8.007000E-004 6.732000E-004  
   570 1.152600E-003 7.803000E-004 7.191000E-004  
   571 4.794000E-004 2.295000E-004 7.497000E-004  
   572 1.530000E-004 5.100000E-006 7.752000E-004  
   573 5.916000E-004 2.142000E-004 7.956000E-004  
   574 6.834000E-004 5.661000E-004 8.211000E-004  
   575 4.590000E-004 5.610000E-005 8.466000E-004  
   576 4.233000E-004 1.173000E-004 8.466000E-004  
   577 5.355000E-004 5.049000E-004 8.466000E-004  
   578 4.080000E-004 6.630000E-005 8.517000E-004  
   579 4.743000E-004 1.224000E-004 8.517000E-004  
   580 4.539000E-004 1.989000E-004 8.517000E-004  
   581 3.672000E-004 4.335000E-004 8.874000E-004  
   582 5.049000E-004 5.814000E-004 8.874000E-004  
   583 3.774000E-004 3.876000E-004 8.925000E-004  
   584 9.843000E-004 4.029000E-004 9.282000E-004  
   585 1.300500E-003 8.772000E-004 9.894000E-004  
   586 1.060800E-003 4.080000E-004 1.035300E-003  
   587 3.417000E-004 1.280100E-003 1.040400E-003  
   588 2.040000E-005 4.233000E-004 1.239300E-003  
   589 1.530000E-005 4.488000E-004 1.269900E-003  
   590 1.428000E-004 8.568000E-004 1.280100E-003  
   591 1.208700E-003 1.198500E-003 1.285200E-003  
   592 7.854000E-004 3.417000E-004 1.331100E-003  
   593 1.989000E-004 1.530000E-004 1.371900E-003  
   594 2.091000E-004 1.989000E-004 1.377000E-003  
   595 1.519800E-003 1.234200E-003 1.382100E-003  
   596 4.692000E-004 1.484100E-003 1.407600E-003  
   597 6.630000E-005 1.422900E-003 1.489200E-003  
"""

In [7]:
import numpy
data = numpy.array([float(i) for i in f.split()]).reshape((-1, 4))

In [12]:
dmin = data.min(axis=0)
dmax = data.max(axis=0) 
ddif = dmax-dmin

print dmin
print dmax
print ddif


[  1.00000000e+00   5.10000000e-06   5.10000000e-06   5.10000000e-06]
[  5.97000000e+02   1.51980000e-03   1.51980000e-03   1.51980000e-03]
[  5.96000000e+02   1.51470000e-03   1.51470000e-03   1.51470000e-03]

In [17]:
lmin = numpy.sqrt(numpy.sum(dmin[1:]**2))
lmax = numpy.sqrt(numpy.sum(dmax[1:]**2))
ldif = lmax-lmin

print lmin
print lmax
print ldif


8.8334591186e-06
0.00263237081734
0.00262353735822

In [ ]:
import json
data = 
print json.dumps(data, sort_keys=True, separators=(",", ":"))

In [59]:
import os
# Check if all `_node1`, `_node2`, `_link1`, `_link2` files exist
fname = 'test'
ext = ''
fsuffix = ['_node1', '_node2', '_link1', '_link2']
fprefix = os.path.basename(fname).split('_')[0]
flist = [fprefix+i+ext for i in fsuffix]
fmiss = [int(not i) for i in map(os.path.isfile, flist)]

# Throw an exception if any file is missing
if any(fmiss):
    raise Exception('Missing file(s): ' +
        ', '.join([i for i, t in zip(flist, fbool) if t]))


---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)
<ipython-input-59-52b5e1f84ea6> in <module>()
     11 if any(fmiss):
     12     raise Exception('Missing file(s): ' +
---> 13         ', '.join([i for i, t in zip(flist, fbool) if t]))

Exception: Missing file(s): test_link2

In [20]:
import json

class CustomEncoder(json.JSONEncoder):
    def default(self, obj):
        """Fired when an unserializable object is hit."""
        if hasattr(obj, '__dict__'):
            return obj.__dict__.copy()
        elif HAS_NUMPY and isinstance(obj, np.ndarray):
            return obj.copy().tolist()
        else:
            raise TypeError(("Object of type {:s} with value of {:s} is not "
                             "JSON serializable").format(type(obj), repr(obj)))

    def encode(self, obj):
        """Fired for every object."""
        s = super(CustomEncoder, self).encode(obj)
        # If uncompressed, postprocess for formatting
        if len(s.splitlines()) > 1:
            s = self.postprocess(s)
        return s

    def postprocess(self, json_string):
        """Displays each atom and bond entry on its own line."""
        is_compressing = True
        compressed = []
        spaces = 0
        for row in json_string.split("\n"):
            if is_compressing:
                if row.strip() == "{":
                    compressed.append(row.rstrip())
                elif (len(row) > spaces and row[:spaces] == " " * spaces and
                        row[spaces:].rstrip() in ["]", "],"]):
                    compressed.append(row.rstrip())
                    is_compressing = False
                else:
                    compressed[-1] += " " + row.strip()
            else:
                compressed.append(row.rstrip())
                if any(a in row for a in ["pores", "throats"]):
                    # Fix to handle issues that arise with empty lists
                    if "[]" in row:
                        continue
                    spaces = sum(1 for _ in takewhile(str.isspace, row))
                    is_compressing = True
        return "\n".join(compressed)

In [21]:
with open('data/cube.json', 'r') as f:
    data = json.load(f)
    
print json.dumps(data, indent=4, sort_keys=True, cls=CustomEncoder)


{ "pores": [
        { "index": 0, "location": [ 0.0, 0.0, 0.0 ], "radius": 1.0 },
        { "index": 1, "location": [ 10.0, 0.0, 0.0 ], "radius": 2.0 },
        { "index": 2, "location": [ 10.0, 10.0, 0.0 ], "radius": 3.0 },
        { "index": 3, "location": [ 0.0, 10.0, 0.0 ], "radius": 2.0 },
        { "index": 4, "location": [ 0.0, 0.0, 10.0 ], "radius": 1.0 },
        { "index": 5, "location": [ 10.0, 0.0, 10.0 ], "radius": 2.0 },
        { "index": 6, "location": [ 10.0, 10.0, 10.0 ], "radius": 3.0 },
        { "index": 7, "location": [ 0.0, 10.0, 10.0 ], "radius": 2.0 } ], "throats": [
        { "index": 0, "pores": [ 0, 1 ], "radius": 0.25 },
        { "index": 1, "pores": [ 1, 2 ], "radius": 0.5 },
        { "index": 2, "pores": [ 2, 3 ], "radius": 0.75 },
        { "index": 3, "pores": [ 3, 0 ], "radius": 0.5 },
        { "index": 4, "pores": [ 4, 5 ], "radius": 0.25 },
        { "index": 5, "pores": [ 5, 6 ], "radius": 0.5 },
        { "index": 6, "pores": [ 6, 7 ], "radius": 0.75 },
        { "index": 7, "pores": [ 7, 4 ], "radius": 0.5 },
        { "index": 8, "pores": [ 0, 4 ], "radius": 0.25 },
        { "index": 9, "pores": [ 1, 5 ], "radius": 0.5 },
        { "index": 10, "pores": [ 2, 6 ], "radius": 0.75 },
        { "index": 11, "pores": [ 3, 7 ], "radius": 0.5 } ] }

In [ ]: