| 8 |
|
binary rounding errors. |
| 9 |
|
''' |
| 10 |
|
|
| 11 |
– |
import string |
| 12 |
– |
import types |
| 11 |
|
|
| 12 |
|
class error(Exception): pass |
| 13 |
|
|
| 70 |
|
lltest = filter(None, lltest) |
| 71 |
|
llref = filter(None, llref) |
| 72 |
|
if len(lltest) != len(llref): |
| 73 |
< |
raise error, 'Comparision failed: Different number of lines (%d,%d)' %( |
| 73 |
> |
raise error, 'Comparision failed: Different number of lines (%d, %d)' %( |
| 74 |
|
len(lltest), len(llref)) |
| 75 |
|
for i in range(len(llref)): |
| 76 |
|
if llref[i]: |
| 88 |
|
'''split Radiance file headers |
| 89 |
|
return a list of lists of tokens suitable for llcompare() |
| 90 |
|
this is useful to check the output of getinfo''' |
| 91 |
< |
ll = map(string.strip,string.split(s, '\n')) |
| 91 |
> |
ll = [ss.strip() for ss in s.split('\n')] |
| 92 |
|
nll = [] |
| 93 |
|
for l in ll: |
| 94 |
< |
parts = string.split(l, '=', 1) |
| 94 |
> |
parts = l.split('=', 1) |
| 95 |
|
if len(parts) == 2: |
| 96 |
< |
left = map(_typify_token, string.split(parts[0])) |
| 97 |
< |
right = map(_typify_token, string.split(parts[1])) |
| 96 |
> |
left = map(_typify_token, parts[0].split()) |
| 97 |
> |
right = map(_typify_token, parts[1].split()) |
| 98 |
|
nll.append(left + ['='] + right) |
| 99 |
< |
else: nll.append(map(_typify_token, string.split(l))) |
| 99 |
> |
else: nll.append(map(_typify_token, l.split())) |
| 100 |
|
return nll |
| 101 |
|
|
| 102 |
|
def split_rad(s): |
| 103 |
|
'''Split the contents of a scene description string |
| 104 |
|
return a list of list of tokens suitable for llcompare()''' |
| 105 |
< |
ll = map(string.strip,string.split(s, '\n')) |
| 105 |
> |
ll = [ss.strip() for ss in s.split('\n')] |
| 106 |
|
nll = [] |
| 107 |
|
for l in ll: |
| 108 |
< |
nll.append(map(_typify_token, string.split(l))) |
| 108 |
> |
nll.append(map(_typify_token, l.split())) |
| 109 |
|
return nll |
| 110 |
|
|
| 111 |
|
def split_radfile(fn): |