fixed buggy parameter checking

This commit is contained in:
Philip Eisenlohr 2012-11-07 16:51:17 +00:00
parent e11d107956
commit 7cf2024be3
5 changed files with 12 additions and 12 deletions

View File

@ -114,12 +114,12 @@ for file in files:
else: else:
info[headitems[0]] = mappings[headitems[0]](headitems[1]) info[headitems[0]] = mappings[headitems[0]](headitems[1])
if options.resolution == [0,0,0]: if numpy.all(options.resolution == 0):
options.resolution = info['resolution'] options.resolution = info['resolution']
if info['resolution'].all() == 0: if numpy.all(info['resolution'] == 0):
file['croak'].write('no resolution info found.\n') file['croak'].write('no resolution info found.\n')
continue continue
if info['dimension'] == [0.0,0.0,0.0]: if numpy.all(info['dimension'] == 0.0):
file['croak'].write('no dimension info found.\n') file['croak'].write('no dimension info found.\n')
continue continue

View File

@ -43,9 +43,9 @@ generates geom file and material_config file using seeds file
) )
parser.add_option('-r', '--resolution', dest='resolution', type='int', nargs = 3, \ parser.add_option('-r', '--resolution', dest='resolution', type='int', nargs = 3, \
help='a,b,c resolution of specimen') help='a,b,c resolution of periodic box')
parser.add_option('-d', '--dimension', dest='dimension', type='float', nargs = 3, \ parser.add_option('-d', '--dimension', dest='dimension', type='float', nargs = 3, \
help='x,y,z dimension of specimen') help='x,y,z dimension of periodic box')
parser.add_option('--homogenization', dest='homogenization', type='int', \ parser.add_option('--homogenization', dest='homogenization', type='int', \
help='homogenization index to be used') help='homogenization index to be used')
parser.add_option('--phase', dest='phase', type='int', \ parser.add_option('--phase', dest='phase', type='int', \
@ -130,7 +130,7 @@ for file in files:
if 0 not in options.resolution: # user-specified resolution if 0 not in options.resolution: # user-specified resolution
info['resolution'] = numpy.array(options.resolution) info['resolution'] = numpy.array(options.resolution)
if info['resolution'].all() == 0: if numpy.all(info['resolution'] == 0):
file['croak'].write('no resolution info found.\n') file['croak'].write('no resolution info found.\n')
continue continue

View File

@ -111,10 +111,10 @@ for file in files:
else: else:
info[headitems[0]] = mappings[headitems[0]](headitems[1]) info[headitems[0]] = mappings[headitems[0]](headitems[1])
if info['resolution'].all() == 0: if numpy.all(info['resolution'] == 0):
file['croak'].write('no resolution info found.\n') file['croak'].write('no resolution info found.\n')
continue continue
if info['dimension'].all() == 0.0: if numpy.all(info['dimension'] == 0.0):
file['croak'].write('no dimension info found.\n') file['croak'].write('no dimension info found.\n')
continue continue

View File

@ -118,10 +118,10 @@ for file in files:
else: else:
info[headitems[0]] = mappings[headitems[0]](headitems[1]) info[headitems[0]] = mappings[headitems[0]](headitems[1])
if info['resolution'].all() == 0: if numpy.all(info['resolution'] == 0):
file['croak'].write('no resolution info found.\n') file['croak'].write('no resolution info found.\n')
continue continue
if info['dimension'] == [0.0,0.0,0.0]: if numpy.all(info['dimension'] == 0.0):
file['croak'].write('no dimension info found.\n') file['croak'].write('no dimension info found.\n')
continue continue

View File

@ -113,10 +113,10 @@ for file in files:
else: else:
info[headitems[0]] = mappings[headitems[0]](headitems[1]) info[headitems[0]] = mappings[headitems[0]](headitems[1])
if info['resolution'].all() == 0: if numpy.all(info['resolution'] == 0):
file['croak'].write('no resolution info found.\n') file['croak'].write('no resolution info found.\n')
continue continue
if info['dimension'].all() == 0: if numpy.all(info['dimension'] == 0.0):
file['croak'].write('no dimension info found.\n') file['croak'].write('no dimension info found.\n')
continue continue