calculating percentages of a given value in a .dat / .ok file

Hi Nick,

you can use rtrace's -f option to change the output format from floating
point to ascii. (-faa)

The conversion from RGB irradiance to illuminance is:
179 * ( 0.265*R + 0.670*G + 0.065*B )

so you can use rcalc to calculate the percentage you desire like so:
rtrace ... | rcalc -e 'ill=($1*0.265+$2*0.670+$3*0.065)*179' -e
'$1=ill/300'

Best,
Andy

···

On Wed, Mar 10, 2010 at 10:22 AM, Nick Hubof <[email protected]> wrote:

Hi,

I am trying to do a similar process as below email, but with an illuminance plot.

I would like to know the % above a lighting threshold of 300lux in an illumination grid output from radiance.

My office uses Ecotect to build daylight models with 2d analysis grids (.pts). After running radiance the analysis grid is populated into a .dat file that is renamed in the Ecotect Batch to a .ok file.

The .ok file consists of illumination data by point.

So when I open the .ok file in a text editor the values are in exponential form, ie.. (1.501146e+000 1.570207e+000 9.277438e-001).

When viewed in the Ecotect grid this value is 270.316 lux.

Is there a way to have rtrace give me that percentage while the batch is running or at least convert the data from exponential form to ‘real’ values?

Please let me know what to add to the batch, I assume it will be at the rtrace section or after in the batch:

rtrace …rendering settings… gridtest.oct < gridtest.pts > gridtest.dat

@RENAME gridtest3.dat gridtest3.ok

Thanks,

Nick

From Greg Ward (*Mon Oct 20 10:12:17 PDT 2008)_*

And here is one of the many possible standard Radiance tools ways:

pvalue -h -H -o -b -df input.pic | rcalc -if -of -e '$1=1;$2=if(179*

$1-THRESHOLD,1,0)' | total -if2

You need to set THRESHOLD to the desired luminance value (in cd/

m^2). This will give you two numbers, the ratio of which is the

percentage you seek. If you want to do it all on the command line,

you can add:

        > rcalc -e '$1=100*$2/$1'

to the end of the pipe.

Best,

-Greg

>* From: "Marija Velickovic" <maricanis at gmail.com <http://www.radiance-online.org/mailman/listinfo/radiance-general>>*

>* Date: October 20, 2008 3:42:28 AM PDT*

>* *

>* Hi,*

>* *

>* I suppose you can use some of standard Radiance tools for that, but *

>* here is another way we use.*

>* *

>* In Raddisplay http://deluminaelab.com/en/raddisplay_details.html *

>* program you can create falsecolor image from your original radiance *

>* image. If you define false color palette with 2 colors - one has *

>* value 0 and another value you want to use as a threshold, and open *

>* Statistiques dialog, you'll have percent for each color in the *

>* tablle. You can also define the palette with more colors, for *

>* various threshold values.*

>* *

>* Hope this helps,*

>* Marija*

>* De Luminae.*

>* *

>* 2008/10/20 Galen Burrell <galenburrell at yahoo.com <http://www.radiance-online.org/mailman/listinfo/radiance-general>>*

>* Hi All,*

>* I have a radiance .pic with lux values calculated using rpict -i. *

>* Is there a way to calculate the percentage of the pixels that are *

>* at or above a specified value?*

>* Thanks,*

>* Galen*

>

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general

Oops! Lars you're right. I should have looked closer at the emails Nick
referenced.

Nick, you'll need some of what I gave you to get from rtrace output to
illuminance:
rtrace ... | rcalc -e '$1=($1*0.265+$2*0.670+$3*0.065)*179' > test.dat

Then what Lars gave to calculate the percent of points above a threshold.

···

On Wed, Mar 10, 2010 at 5:31 PM, Lars O. Grobe <[email protected]> wrote:

Hi,

I am not sure whether Nick wants to find out the fraction of the required
illuminance level each point achieves (that is what Andrew calculates) or
the fraction of (the amount of) points that meet the criteria. For the
second you have three steps involved:

1) filter the input according to you treshold (300lx)
2) count the value meeting the criteria
3) divide by the total number of points and multiply by 100 to get a
percentage

This can be translated like into:

cat test.dat | rcalc -e '$1=1; $2=if($1-299,1,0)' | total | rcalc -e
'$1=100*$2/$1'

The first step, rcalc, takes one column (you can adapt this according to
your input file) and writes out two columns. The first is set to 1 for any
input, the second is set to one for inputs > 2990 and to 0 for anything
below.

The second step, total, sums up the result of the first step. You get the
sums of two columns - two numbers, the first being the amount of original
input values, the second the amount of values that are above 299.

The third step, rcalc again, divides the number of points meeting the
criteria by the total number of values and multiplies this by 100. This
results in the percentage of values meeting the criteria.

There are quicker ways to achieve this, but I wanted a transparent format
that one can explain. Hope this helps, cheers

Lars.

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general