Skip to content

Commit

Permalink
Merge pull request #234 from prabhuramachandran/fix-bugs
Browse files Browse the repository at this point in the history
Fix a few minor issues in the cull and binder cmds
  • Loading branch information
prabhuramachandran committed Aug 27, 2019
2 parents 45e52b5 + 912a44b commit 766dbb1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 4 additions & 1 deletion pysph/tools/binder.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ def find_viewer_type(path):

log_file_path = os.path.abspath(path) + '/*.log'
regex = r'dim=(\d)'
log_files = glob.glob(log_file_path)
if not log_files:
return '2D'

match_list = []
with open(glob.glob(log_file_path)[0], 'r') as file:
with open(log_files[0], 'r') as file:
for line in file:
for match in re.finditer(regex, line, re.S):
match_text = match.group()
Expand Down
9 changes: 4 additions & 5 deletions pysph/tools/cull.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,9 @@ def main(argv=None):
)

parser.add_argument(
"-c",
metavar='c',
"-c", "--cull-factor",
metavar="cull_factor",
type=int,
nargs=1,
default=2,
help="one in every 'c' files is spared, all remaining output " +
"files are deleted [default=2]"
Expand All @@ -80,9 +79,9 @@ def main(argv=None):
options, extra = parser.parse_known_args(argv)

src_path = options.src_path[0]
x = options.c[0]
x = options.cull_factor

cull(src_path, c)
cull(src_path, x)


if __name__ == '__main__':
Expand Down

0 comments on commit 766dbb1

Please sign in to comment.