Skip to content

Instantly share code, notes, and snippets.

@codemartial
Created March 13, 2014 04:29
Show Gist options
  • Save codemartial/9521904 to your computer and use it in GitHub Desktop.
Save codemartial/9521904 to your computer and use it in GitHub Desktop.
A filter to normalise ISO values to the nearest lower standard ISO
#!/usr/bin/python
import sys
limits = [0, 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200]
if __name__ == "__main__":
for line in sys.stdin:
iso = float(line)
print max([x for x in limits if x <= iso])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment