Skip to content

Commit

Permalink
fix for minsource option; use 'rb' mode for reading text files for gz…
Browse files Browse the repository at this point in the history
…ip compression
  • Loading branch information
jchiang87 committed Nov 29, 2017
1 parent 80325c5 commit 9bf1273
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/protoDC2/generateDc2InstCat.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def get_isBright(self):
cat.phoSimHeaderMap = phosim_header_map
with open(cat_name, 'w') as output:
cat.write_header(output)
output.write('minsource %i\n' % args.min_source)
output.write('minsource %i\n' % args.minsource)
output.write('includeobj %s.gz\n' % star_name)
output.write('includeobj %s.gz\n' % gal_name)
#output.write('includeobj %s.gz\n' % agn_name)
Expand Down Expand Up @@ -171,7 +171,7 @@ def get_isBright(self):

for orig_name in (star_name, gal_name):
full_name = os.path.join(out_dir, orig_name)
with open(full_name, 'r') as input_file:
with open(full_name, 'rb') as input_file:
with gzip.open(full_name+'.gz', 'wb') as output_file:
output_file.writelines(input_file)
os.unlink(full_name)

0 comments on commit 9bf1273

Please sign in to comment.