simplified option parsing
This commit is contained in:
parent
e45dcb7948
commit
03fef5fd6e
|
@ -26,22 +26,13 @@ parser.add_option('--no-volume','-v', dest='noVolume', action='store_false',
|
||||||
help='do not calculate volume mismatch')
|
help='do not calculate volume mismatch')
|
||||||
parser.add_option('-c','--coordinates', dest='coords', metavar='string',
|
parser.add_option('-c','--coordinates', dest='coords', metavar='string',
|
||||||
help='column heading for coordinates [%default]')
|
help='column heading for coordinates [%default]')
|
||||||
parser.add_option('-f','--defgrad', dest='defgrad', metavar='string',
|
parser.add_option('-f','--defgrad', dest='defgrad', metavar='string ',
|
||||||
help='column heading for coordinates [%defgrad]')
|
help='column heading for coordinates [%default]')
|
||||||
parser.set_defaults(noVolume = False)
|
parser.set_defaults(coords = 'ipinitialcoord')
|
||||||
parser.set_defaults(noShape = False)
|
parser.set_defaults(defgrad = 'f')
|
||||||
parser.set_defaults(coords = 'ipinitialcoord')
|
|
||||||
parser.set_defaults(defgrad = 'f')
|
|
||||||
|
|
||||||
(options,filenames) = parser.parse_args()
|
(options,filenames) = parser.parse_args()
|
||||||
|
|
||||||
datainfo = { # list of requested labels per datatype
|
|
||||||
'defgrad': {'len':9,
|
|
||||||
'label':[]},
|
|
||||||
}
|
|
||||||
|
|
||||||
datainfo['defgrad']['label'].append(options.defgrad)
|
|
||||||
|
|
||||||
# ------------------------------------------ setup file handles ------------------------------------
|
# ------------------------------------------ setup file handles ------------------------------------
|
||||||
files = []
|
files = []
|
||||||
for name in filenames:
|
for name in filenames:
|
||||||
|
@ -79,18 +70,10 @@ for file in files:
|
||||||
max(map(float,coords[2].keys()))-min(map(float,coords[2].keys())),\
|
max(map(float,coords[2].keys()))-min(map(float,coords[2].keys())),\
|
||||||
],'d') # size from bounding box, corrected for cell-centeredness
|
],'d') # size from bounding box, corrected for cell-centeredness
|
||||||
|
|
||||||
for i, points in enumerate(grid):
|
|
||||||
if points == 1:
|
|
||||||
options.packing[i] = 1
|
|
||||||
options.shift[i] = 0
|
|
||||||
mask = np.ones(3,dtype=bool)
|
|
||||||
mask[i]=0
|
|
||||||
size[i] = min(size[mask]/grid[mask]) # third spacing equal to smaller of other spacing
|
|
||||||
|
|
||||||
N = grid.prod()
|
N = grid.prod()
|
||||||
|
|
||||||
# --------------- figure out columns to process ---------------------------------------------------
|
# --------------- figure out columns to process ---------------------------------------------------
|
||||||
key = '1_%s'%datainfo['defgrad']['label'][0]
|
key = '1_%s'%options.defgrad
|
||||||
if key not in table.labels:
|
if key not in table.labels:
|
||||||
file['croak'].write('column %s not found...\n'%key)
|
file['croak'].write('column %s not found...\n'%key)
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue