ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cv/iso2klems.pl
(Generate patch)

Comparing ray/src/cv/iso2klems.pl (file contents):
Revision 2.3 by greg, Thu Mar 10 17:26:04 2022 UTC vs.
Revision 2.6 by greg, Thu Oct 6 14:22:44 2022 UTC

# Line 42 | Line 42 | while ($#ARGV >= 0) {
42          }
43          shift @ARGV;
44   }
45 + userror() if ($#ARGV > 0);
46   my $funcfile = "$td/isofuncs.cal";
47   my @vnm = ("Tspec","Tdiff","Rspec","Rdiff");
48 < system "cat @ARGV | tabfunc -i @vnm > $funcfile";
48 > if ($#ARGV == 0) {
49 >        system "tabfunc -i @vnm < \"$ARGV[0]\" > $funcfile";
50 > } else {
51 >        system "tabfunc -i @vnm > $funcfile";
52 > }
53   die "Invalid input data, requires 5 columns\n" if ( $? );
54   open (MYFH, ">> $funcfile");
55   print MYFH "DEG : PI/180;\n";
56 < print MYFH "and(a,b) : if(a,b,a);\n";
56 > print MYFH "sq(x) : x*x;\n";
57   print MYFH "eq(a,b) : min(a-b+1e-5,b-a+1e-5);\n";
58   print MYFH "rtheta(i) : select(i,5,15,25,35,45,55,65,75,90);\n";
59   print MYFH "nphis(i) : select(i,1,8,16,20,24,24,24,16,12);\n";
60   print MYFH "tdeg1(tb) : if(tb-1.5, (rtheta(tb)+rtheta(tb-1))/2, 0);\n";
61 < print MYFH "omega1(tb) : 2*PI*if(tb-1.5, (cos(rtheta(tb-1)*DEG)-cos(rtheta(tb)*DEG))/nphis(tb),";
62 < print MYFH "\t(1 - cos(rtheta(1)*DEG)));\n";
61 > print MYFH "omega1(tb) : PI*if(tb-1.5, (sq(cos(rtheta(tb-1)*DEG))-sq(cos(rtheta(tb)*DEG)))/nphis(tb),";
62 > print MYFH "\t(1 - sq(cos(rtheta(1)*DEG))));\n";
63   print MYFH "tbin(b,cnt) : if(nphis(b)-cnt-.5, b, tbin(b+1,cnt-nphis(b)));\n";
64   print MYFH "tdeg(b) : tdeg1(tbin(1,b-1));\n";
65   print MYFH "omega(b) : omega1(tbin(1,b-1));\n";
# Line 65 | Line 70 | my $nsamps = $hsamps * 2;
70   if ($windoz) {
71          $cmd = qq{cnt $nsamps } .
72                  qq{| rcalc -f $funcfile -w -e "tdeg=180/$nsamps*(\$1+.5);abs(x):if(x,x,-x)" } .
73 <                qq{-e "theta=tdeg*DEG;ifact=2*PI*abs(cos(theta))*sin(theta)" } .
73 >                qq{-e "theta=tdeg*DEG;ifact=PI*PI*abs(cos(theta))*sin(theta)" } .
74                  q{-e "$1=ifact*Tdiff(tdeg);$2=ifact*Rdiff(tdeg)" } .
75                  qq{| total -$hsamps -m};
76   } else {
77          $cmd = qq{cnt $nsamps } .
78                  qq{| rcalc -f $funcfile -w -e 'tdeg=180/$nsamps*(\$1+.5);abs(x):if(x,x,-x)' } .
79 <                qq{-e 'theta=tdeg*DEG;ifact=2*PI*abs(cos(theta))*sin(theta)' } .
79 >                qq{-e 'theta=tdeg*DEG;ifact=PI*PI*abs(cos(theta))*sin(theta)' } .
80                  q{-e '$1=ifact*Tdiff(tdeg);$2=ifact*Rdiff(tdeg)' -od } .
81                  qq{| total -id2 -$hsamps -m};
82   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines