orig/colorcal.csh
author Axel Jacobs <axel@jaloxa.eu>
Mon, 14 Apr 2014 22:21:17 +0100
changeset 73 87fa3132a136
parent 0 0aa115157c9c
permissions -rw-r--r--
New IES test file with spaces in file name
     1 #!/bin/csh -f
     2 # RCSid: $Id: colorcal.csh,v 1.1 2003/02/22 02:07:21 greg Exp $
     3 #
     4 # Compute CIE chromaticities from spectral reflectance data
     5 #
     6 if ( $#argv < 1 ) goto userr
     7 set cal = .
     8 if ( $argv[1] == "-i" ) then
     9 	if ( $#argv < 3 ) goto userr
    10 	shift argv
    11 	set illum=$argv[1]
    12 	shift argv
    13 	foreach r ( $argv[*] )
    14 		tabfunc -i rf < $r > /tmp/rf$$.cal
    15 		rcalc -f $cal/cieresp.cal -f /tmp/rf$$.cal \
    16 			-e 'r=rf($1);ty=$2*triy($1)' \
    17 			-e '$1=ty;$2=$2*r*trix($1);$3=r*ty' \
    18 			-e '$4=$2*r*triz($1)' \
    19 			-e 'cond=if($1-359,831-$1,-1)' \
    20 			$illum | total -m >> /tmp/rc$$.dat
    21 	end
    22 	rm -f /tmp/rf$$.cal
    23 else
    24 	foreach r ( $argv[*] )
    25 		rcalc -f $cal/cieresp.cal -e 'ty=triy($1);$1=ty' \
    26 		-e '$2=$2*trix($1);$3=$2*ty;$4=$2*triz($1)' \
    27 		-e 'cond=if($1-359,831-$1,-1)' $r \
    28 			| total -m >> /tmp/rc$$.dat
    29 	end
    30 endif
    31 rcalc -e 'X=$2/$1;Y=$3/$1;Z=$4/$1' \
    32 	-e 'x=X/(X+Y+Z);y=Y/(X+Y+Z);u=4*X/(X+15*Y+3*Z);v=9*Y/(X+15*Y+3*Z)' \
    33 	-o $cal/color.fmt /tmp/rc$$.dat
    34 rm -f /tmp/rc$$.dat
    35 exit 0
    36 userr:
    37 echo "Usage: $0 [-i illum.dat] refl.dat .."
    38 exit 1