[Radiance-general] rtcontrib scripts

Santiago Torres tiago at tkh.att.ne.jp
Wed Feb 8 08:53:01 CET 2006


Hi Dave,

I`ve also been using Perl to handle rtcontrib recently and it worked,  
although I used 10 illuminance points at most, and was only using  
monochrome scenes, so I was using only one of the three values.
But AFAIK , Perl should be quite efficient handling lots of data. If  
it is a memory problem you are having, maybe Python won`t be the  
solution either.
Below is part of the script I used. I`m not really a programer  
(you`ll see), but this worked for me.
hope it helps,

Santiago

--------------------------------


system ("time rtcontrib -I+ -h -ab 5 -ad 10000 -as 100 -lw 0.0001 - 
aa .1 -ar 300 -dt 0 -ds 0 -b 0 -o suncomp.dat -M suns.lst -f  
tregenza_h.cal -b tbin -o skycomp.dat -m skyglow scene.oct < test.dat");

open (SUC, "$base/suncomp.dat") or die "cannot open SUC $!";
open (SKC, "$base/skycomp.dat") or die "cannot open SKC $!";

# there are two points @test.dat > #0 vert illum, #1 horiz illum
for $i (0..1) {

	$lsuc[$i] = <SUC>; chomp $lsuc[$i];
	$lskc[$i] = <SKC>; chomp $lskc[$i];
}

close SUC; close SKC;
system ("rm suncomp.dat skycomp.dat");

# weather data > calculated average luminance from each patch for  
each hour, etc.
open (TKI, "tokyo_contribs.dat") or die "cannot open TKI $!";

while ($line=<TKI>) {

	chomp $line;
	@meteo = split (/,/,$line);

	# HORIZ ILLUM #
	for $i (1..1) { # test point #1 for horizontal illuminance, add  
other points here

		@soles = split (/\t/, $lsuc[$i]); # array with contribs from suns
		@cielo = split (/\t/, $lskc[$i]); # array with contribs from sky  
patches

		# calculate illuminance from sun
		$horz = $soles[$dato*3] * $meteo[116]  / 0.00005981;

		# add illuminance from sky patches
		# sky was divided in 113 patches > diff from tregenza
		for $j (1..113) {

			#depends on the definition of the weather file
			$horz += $cielo[($j*3)+1] * $meteo[$j+3];
		}

	}

}


--------------------------------




On Feb 8, 2006, at 2:40 AM, J. David Maino wrote:

> Jack,
>
> Actually, my knowledge of Perl is also rather limited, at least as  
> far as anything too complex goes, but file manipulations I can do  
> just fine. Mainly what I'm trying to do is just take a simple text  
> file that rtcontrib spits out and then manipulate that data. I'm  
> not sure if I'm just not parsing the data correctly or if the file  
> is just too large and my computer is dying trying to run my  
> inefficient algorithms, but Perl seems to be failing me for the  
> moment. I'm sure there are faster/easier ways to do this than what  
> I'm currently trying, but for now I'm kinda just sticking to what I  
> know how to do. Perhaps I will try Python though. Can anyone direct  
> me to any good books about programming with Python? Also, I will  
> have to look into trying to directly interface with rcalc as this  
> sounds much easier and much more efficient than all the  
> intermediate steps I'm taking.
>
> Thanks,
>
> Dave
>
> Jack de Valpine wrote:
>> Hi Dave,
>>
>> What kinds of problems are you having with Perl? You should be  
>> able to do most anything you want with Perl. The main problem area  
>> can be if you are feeding data to into and/or out of radiance  
>> programs and end up with buffering problems. For example I only  
>> recently learned that there is a '-u' switch for rcalc which  
>> causes output to be flushed after each record. This came in real  
>> handy for a perl program that uses open2 to both write to and read  
>> from an rcalc process.
>>
>> -Jack
>>
>> PS, as others on this list know I am a pretty strong advocate of  
>> Perl. However, there is also a strong group who use Python for  
>> Radiance related scripting. Of course Greg is all about shell....  
>> Nevertheless, as you indicate fairly good knowledge of Perl this  
>> might still be the best place to try to get things working....
>>
>> J. David Maino wrote:
>>> Hi all,
>>>
>>> Recently I've been playing around with rtcontrib for use on my  
>>> thesis and have been developing (or trying to rather) some  
>>> scripts to make data handling a bit easier. The problem is that  
>>> my knowledge of shell scripting is rather limited, and the only  
>>> other programming language I know fairly well (perl) is not  
>>> wanting to cooperate. I'm trying to automate the process of  
>>> multiplying the luminance values of the sky patches to the  
>>> corresponding RGB values that rtcontrib puts out so that I can  
>>> get illuminance data for a whole slew of sky conditions. Does  
>>> anyone know of any scripts out there that might do this, or what  
>>> programming language might be best suited to dealing with very  
>>> large files (I have a lot of illuminance points)? Any help you  
>>> could offer would be greatly appreciated!
>>>
>>> Thanks,
>>>
>>> Dave
>>>
>>>
>>>
>>> _______________________________________________
>>> Radiance-general mailing list
>>> Radiance-general at radiance-online.org
>>> http://www.radiance-online.org/mailman/listinfo/radiance-general
>>>
>>>
>>
>
> _______________________________________________
> Radiance-general mailing list
> Radiance-general at radiance-online.org
> http://www.radiance-online.org/mailman/listinfo/radiance-general
>




More information about the Radiance-general mailing list