| 7 |
|
# |
| 8 |
|
use strict; |
| 9 |
|
my @skycolor = (0.960, 1.004, 1.118); |
| 10 |
+ |
my $mf = 4; |
| 11 |
|
while ($#ARGV >= 0) { |
| 12 |
|
if ("$ARGV[0]" eq "-c") { |
| 13 |
|
@skycolor = @ARGV[1..3]; |
| 14 |
|
shift @ARGV; shift @ARGV; shift @ARGV; |
| 15 |
+ |
} elsif ("$ARGV[0]" eq "-m") { |
| 16 |
+ |
$mf = $ARGV[1]; |
| 17 |
+ |
shift @ARGV; |
| 18 |
|
} |
| 19 |
|
shift @ARGV; |
| 20 |
|
} |
| 52 |
|
my $rhcal = ' |
| 53 |
|
DEGREE : PI/180; |
| 54 |
|
x1 = .5; x2 = .5; |
| 51 |
– |
MF : 2^2; |
| 55 |
|
alpha : 90/(MF*7 + .5); |
| 56 |
|
tnaz(r) : select(r, 30, 30, 24, 24, 18, 12, 6); |
| 57 |
|
rnaz(r) : if(r-(7*MF-.5), 1, MF*tnaz(floor((r+.5)/MF) + 1)); |
| 73 |
|
Dy = cos(Razi)*cos_ralt; |
| 74 |
|
Dz = sin(Ralt); |
| 75 |
|
'; |
| 76 |
< |
my $nbins = 2306; # This needs to be consistent with MF setting above |
| 76 |
> |
my $nbins = `rcalc -n -e MF:$mf -e \'$rhcal\' -e \'\$1=Rmax+1\'`; |
| 77 |
> |
chomp $nbins; |
| 78 |
|
# Create octree for rtrace |
| 79 |
|
my $octree = "/tmp/gtv$$.oct"; |
| 80 |
|
open OCONV, "| oconv - > $octree"; |
| 83 |
|
print OCONV "skyglow source sky 0 0 4 0 0 1 360\n"; |
| 84 |
|
close OCONV; |
| 85 |
|
# Run rtrace and average output for every 16 samples |
| 86 |
< |
my $tregcommand = "cnt $nbins 16 | rcalc -of -e '$rhcal' " . |
| 86 |
> |
my $tregcommand = "cnt $nbins 16 | rcalc -of -e MF:$mf -e '$rhcal' " . |
| 87 |
|
q{-e 'Rbin=$1;x1=rand(recno*.37-5.3);x2=rand(recno*-1.47+.86)' } . |
| 88 |
|
q{-e '$1=0;$2=0;$3=0;$4=Dx;$5=Dy;$6=Dz' } . |
| 89 |
|
"| rtrace -h -ff -ab 0 -w $octree | total -if3 -16 -m"; |
| 94 |
|
if (@sundir) { |
| 95 |
|
my $somega = ($sundir[3]/360)**2 * 3.141592654**3; |
| 96 |
|
my $cmd = "cnt " . ($nbins-1) . |
| 97 |
< |
" | rcalc -e '$rhcal' -e Rbin=recno " . |
| 97 |
> |
" | rcalc -e MF:$mf -e '$rhcal' -e Rbin=recno " . |
| 98 |
|
"-e 'dot=Dx*$sundir[0] + Dy*$sundir[1] + Dz*$sundir[2]' " . |
| 99 |
|
"-e 'cond=dot-.866' " . |
| 100 |
|
q{-e '$1=if(1-dot,acos(dot),0);$2=Romega;$3=recno' }; |