Skip to content

Instantly share code, notes, and snippets.

@sariths
Last active October 23, 2023 14:22
Show Gist options
  • Save sariths/5ee19cc0f8aac35954ea1791b932507c to your computer and use it in GitHub Desktop.
Save sariths/5ee19cc0f8aac35954ea1791b932507c to your computer and use it in GitHub Desktop.
from pyradiance import write,falsecolor,ra_tiff,pcond
from pathlib import Path
import os
os.chdir('D:/falsecolortest')
test_img= r"D:\DC_R1.hdr"
if True:
#test label
fls = falsecolor(inp=test_img,label='Testing' )
ra_tiff(inp=fls, out=f"label.tiff")
with open(test_img,mode='rb') as read_binary:
fls_bytes=read_binary.read()
fls = falsecolor(inp=fls_bytes)
ra_tiff(inp=fls, out=f"bytes.tiff")
if True:
# test logarithmic and scale.
fls = falsecolor(inp=test_img, decades=3, scale="10000",digits=5)
ra_tiff(inp=fls, out=f"scalelogdigits.tiff")
if True:
os.makedirs('cntr', exist_ok=True)
# test logarithmic and scale.
pcnd=pcond(hdr=Path(test_img),human=True)
cnd_img='cntr/cnd_img.hdr'
write(cnd_img,pcnd)
for ctyp in ('l','b','p'):
fls = falsecolor(inp=r"D:\DC_R1.hdr", contour=ctyp, scale="10000",digits=0,pic_overlay=cnd_img)
ra_tiff(inp=fls, out=f"cntr/{ctyp}.tiff")
if True:
os.makedirs('pal',exist_ok=True)
# test mapping.
for mapp in ('spec','hot','pm3d','tbo','eco','def'):
fls=falsecolor(inp=r"D:\DC_R1.hdr",palette=mapp)
ra_tiff(inp=fls,out=f"pal/{mapp}.tiff")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment