Last active
November 28, 2018 15:21
-
-
Save boada/a610786609fa04798150f7e99a311a2d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def make_RGB(self, newfirm=False, conf='stiff-common.conf'): | |
try: | |
print() | |
check_exe('stiff') | |
except FileNotFoundError: | |
return | |
_conf = os.path.join(pipeline, 'confs', conf) | |
if newfirm: | |
red = './{}{}.fits'.format(tilename, 'Red') | |
green = './{}{}.fits'.format(tilename, 'Green') | |
blue = './{}{}.fits'.format(tilename, 'Blue') | |
bands = 'rgb' | |
else: | |
red = './{}{}.fits'.format(tilename, 'i') | |
green = './{}{}.fits'.format(tilename, 'r') | |
blue = './{}{}.fits'.format(tilename, 'g') | |
bands = 'irg' | |
# output file | |
output = '{}{}.tiff'.format(tilename, bands) | |
# options | |
opts = ['-MIN_LEVEL', '0.01', | |
'-MAX_LEVEL', '0.993', | |
'-MIN_TYPE', 'GREYLEVEL', | |
'-MAX_TYPE', 'QUANTILE', | |
'-COLOUR_SAT', '2.0', | |
'-DESCRIPTION', "'{} RGB'".format(tilename), | |
'-WRITE_XML', 'N', | |
'-COPYRIGHT', "'Steven Boada'"] | |
# build the command -- a space is always last | |
cmd = 'stiff {} {} {} -c {} '.format(red, green, blue, _conf) | |
cmd += '-OUTFILE_NAME {} '.format(output) | |
# append the options | |
for opt in opts: | |
cmd += '{} '.format(opt) | |
print(cmd) | |
if not dryrun: | |
os.system(cmd) | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment