ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/px/phisto.pl
Revision: 2.2
Committed: Fri Feb 4 20:11:49 2022 UTC (2 years, 3 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad5R4, HEAD
Changes since 2.1: +5 -5 lines
Log Message:
feat(pvalue,pextrem): Added -O option to report watts/sr/meter^2 always

File Contents

# User Rev Content
1 greg 2.1 #!/usr/bin/perl -w
2 greg 2.2 # RCSid $Id: phisto.pl,v 2.1 2020/01/03 20:05:14 greg Exp $
3 greg 2.1 #
4     # Compute foveal histogram for picture set
5     #
6     # G. Ward
7     #
8     use strict;
9     my $windoz = ($^O eq "MSWin32" or $^O eq "MSWin64");
10     use File::Temp qw/ :mktemp /;
11     my $minop = 'L=$1*179;$1=if(L-1e-7,log10(L)-.01,-7)';
12     my $maxop = '$1=log10($1*179)+.01';
13     my $tf;
14     if ($windoz) {
15     my $tmploc = `echo \%TMP\%`;
16     chomp $tmploc;
17     $tf = mktemp("$tmploc\\phdXXXXXX");
18     chomp $tf;
19     if ($#ARGV < 0) {
20     system "pfilt -1 -x 128 -y 128 -p 1 " .
21 greg 2.2 "| pvalue -O -h -H -d -b > $tf";
22 greg 2.1 } else {
23     foreach (@ARGV) {
24     system "pfilt -1 -x 128 -y 128 -p 1 $_" .
25 greg 2.2 "| pvalue -O -h -H -d -b >> $tf";
26 greg 2.1 die "Bad picture '$_'\n" if ( $? );
27     }
28     }
29     my $Lmin=`total -l $tf | rcalc -e "$minop"`;
30     my $Lmax=`total -u $tf | rcalc -e "$maxop"`;
31     chomp $Lmin;
32     chomp $Lmax;
33     system q[rcalc -e "L=$1*179;cond=L-1e-7;$1=log10(L)" ] . $tf .
34     " | histo $Lmin $Lmax 777";
35     } else {
36     $tf = mktemp("/tmp/phdXXXXXX");
37     chomp $tf;
38     if ($#ARGV < 0) {
39     system "pfilt -1 -x 128 -y 128 -p 1 " .
40 greg 2.2 "| pvalue -O -h -H -df -b > $tf";
41 greg 2.1 } else {
42     foreach (@ARGV) {
43     system "pfilt -1 -x 128 -y 128 -p 1 '$_'" .
44 greg 2.2 "| pvalue -O -h -H -df -b >> $tf";
45 greg 2.1 die "Bad picture '$_'\n" if ( $? );
46     }
47     }
48     my $Lmin=`total -if -l $tf | rcalc -e '$minop'`;
49     my $Lmax=`total -if -u $tf | rcalc -e '$maxop'`;
50     chomp $Lmin;
51     chomp $Lmax;
52     system q[rcalc -if -e 'L=$1*179;cond=L-1e-7;$1=log10(L)' ] . $tf .
53     " | histo $Lmin $Lmax 777";
54     }
55     unlink $tf;