POV-Ray : Newsgroups : povray.text.scene-files : Filed() macro for CSV data file handling Server Time
28 Mar 2024 19:48:30 EDT (-0400)
  Filed() macro for CSV data file handling (Message 1 to 10 of 20)  
Goto Latest 10 Messages Next 10 Messages >>>
From: jr
Subject: Filed() macro for CSV data file handling
Date: 13 Oct 2021 10:45:00
Message: <web.6166f0a2818378305bd1b3ba6cde94f1@news.povray.org>
hi,

attached include file provides a macro for reading and writing the POV-Ray
variant of CSV data files.  the use is documented in a HTML page, and a few
demo/example scenes.


enjoy, jr.


Post a reply to this message


Attachments:
Download 'filed.zip' (26 KB)

From: William F Pokorny
Subject: Re: Filed() macro for CSV data file handling
Date: 14 Oct 2021 13:38:39
Message: <61686b1f@news.povray.org>
On 10/13/21 10:43 AM, jr wrote:
> hi,
> 
> attached include file provides a macro for reading and writing the POV-Ray
> variant of CSV data files.  the use is documented in a HTML page, and a few
> demo/example scenes.
> 
> 

Great work! Another useful macro - and some cool demos too. Robot 
battles... ;-)

Ran through all the demos and didn't pick up any issues with my current 
package of IO fixes / changes. I do have some comments on the Filed() 
package itself.

---

"...missing out a field or an empty field..."

perhaps?

"...a missing field or an empty field..."

---

The flowers.pov file already has the tabulated.inc guard set to 1 
contrary to the scene's comments.

---

The flowers_read.pov animation doesn't look to me to be picking up all 
the yellow flowers? Maybe one or two per asteroid? I didn't investigate 
though, perhaps it's working as expected?

---

With the flowers.ini AA, at least on linux with v3.8 and povr, the 
method 3 AA doesn't look very good. Perhaps something like:

sampling_method = 2
antialias_threshold = 0.005
antialias_depth = 3
jitter = on

---

The toa example needs too the jr's ruled.inc - Ruled() and this is not 
mentioned in the documentation and there is no pointer as to where to 
grab it.

---

The toa example needs the arial.ttf font which is not - by default - 
available for most non windows users.

---

With the toa example, where the "toa_state.txt" or "toa_run.log" already 
exist we get an error message via toal__chkFilesExist(), but the error 
message only says "existing file(s)" were found.

---

Bill P.


Post a reply to this message

From: Thomas de Groot
Subject: Re: Filed() macro for CSV data file handling
Date: 15 Oct 2021 03:05:38
Message: <61692842$1@news.povray.org>
Hi Bill,
I shall just answer on those issues you mention about flowers.

Op 14/10/2021 om 19:38 schreef William F Pokorny:
> On 10/13/21 10:43 AM, jr wrote:
>> hi,
>>
>> attached include file provides a macro for reading and writing the 
>> POV-Ray

>> a few
>> demo/example scenes.
>>
>>
> 
> Great work! Another useful macro - and some cool demos too. Robot 
> battles... ;-)
> 
> Ran through all the demos and didn't pick up any issues with my current 
> package of IO fixes / changes. I do have some comments on the Filed() 
> package itself.
> 
> ---
> 
> "...missing out a field or an empty field..."
> 
> perhaps?
> 
> "...a missing field or an empty field..."
> 
> ---
> 
> The flowers.pov file already has the tabulated.inc guard set to 1 
> contrary to the scene's comments.
> 
I missed that one!

> ---
> 
> The flowers_read.pov animation doesn't look to me to be picking up all 
> the yellow flowers? Maybe one or two per asteroid? I didn't investigate 
> though, perhaps it's working as expected?
> 
If you kept the default numbers of flowers (400 Red; 300 Yellow; total 
of 700 flowers in flowers.txt), those numbers are also rendered in 
flowers_read.pov. At least, that is what I see here. To be certain, just 
delete flowers.txt, and run flowers.pov again, after checking the number 
of flowers to be planted.

However, if you run the flowers.ini animation, be sure to set 
initial_frame and final_frame to the values you want. Standard, a range 
of frames is given, typically showing the passage from the Red flowers 
to the Yellow ones (in the default settings). For a complete animation, 
both values of course should be set accordingly.

> ---
> 
> With the flowers.ini AA, at least on linux with v3.8 and povr, the 
> method 3 AA doesn't look very good. Perhaps something like:
> 
> sampling_method = 2
> antialias_threshold = 0.005
> antialias_depth = 3
> jitter = on
> 
These are jr's settings. Note that I had to comment out the file_gamma = 
1 line, as this command resulted in very dark frames, compared to the 
original renders.

> ---
> 
> The toa example needs too the jr's ruled.inc - Ruled() and this is not 
> mentioned in the documentation and there is no pointer as to where to 
> grab it.
> 
> ---
> 
> The toa example needs the arial.ttf font which is not - by default - 
> available for most non windows users.
> 
> ---
> 
> With the toa example, where the "toa_state.txt" or "toa_run.log" already 
> exist we get an error message via toal__chkFilesExist(), but the error 
> message only says "existing file(s)" were found.
> 
> ---
> 
> Bill P.


-- 
Thomas


Post a reply to this message

From: jr
Subject: Re: Filed() macro for CSV data file handling
Date: 15 Oct 2021 05:15:00
Message: <web.6169466020122b7c5bd1b3ba6cde94f1@news.povray.org>
hi,

William F Pokorny <ano### [at] anonymousorg> wrote:
> On 10/13/21 10:43 AM, jr wrote:
> > attached include file provides a macro for reading and writing the POV-Ray
> > variant of CSV data files.  the use is documented in a HTML page, and a few
> > demo/example scenes.
>
> Great work! Another useful macro - and some cool demos too. Robot
> battles... ;-)

thank you.


> Ran through all the demos and didn't pick up any issues with my current
> package of IO fixes / changes. I do have some comments on the Filed()
> package itself.

nice.  (and taken time for feedback.  \o/ yay..  :-)  in order, then)


> ---
>
> "...missing out a field or an empty field..."
>
> perhaps?
>
> "...a missing field or an empty field..."

agree.  will make the change.


> ---
>
> The flowers.pov file already has the tabulated.inc guard set to 1
> contrary to the scene's comments.

Thomas held up his hand, but I did not "see" it either.  will change the
default, and thinking of adding an '#if' guard in 'flowers_read.pov' too.


> ---
>
> The flowers_read.pov animation doesn't look to me to be picking up all
> the yellow flowers? Maybe one or two per asteroid? I didn't investigate
> though, perhaps it's working as expected?

the animation runs from planting the last few reds to the first few dozen
yellows only.


> ---
>
> With the flowers.ini AA, at least on linux with v3.8 and povr, the
> method 3 AA doesn't look very good. Perhaps something like:
>
> sampling_method = 2
> antialias_threshold = 0.005
> antialias_depth = 3
> jitter = on

as Thomas wrote, setting the 'file_gamma' in the ini was a bad idea, will remove
it.  does removing it address the issue without changing 'sampling_method' etc?


> ---
>
> The toa example needs too the jr's ruled.inc - Ruled() and this is not
> mentioned in the documentation and there is no pointer as to where to
> grab it.

yes.  will add a 'references' section to the html, for both 'ruled.inc' and
'tabulated.inc'.


> ---
>
> The toa example needs the arial.ttf font which is not - by default -
> available for most non windows users.

good point too.  will switch to a distribution font.


> ---
>
> With the toa example, where the "toa_state.txt" or "toa_run.log" already
> exist we get an error message via toal__chkFilesExist(), but the error
> message only says "existing file(s)" were found.

or, conversely, "missing file(s)".  my thinking was/is that for animation run, I
only need to know whether both or neither (state + log) exist, depending on
frame_number, so the macro only provides a result for that.  how should I write
the corresponding messages to read better?


regards, jr.


Post a reply to this message

From: William F Pokorny
Subject: Re: Filed() macro for CSV data file handling
Date: 15 Oct 2021 10:46:17
Message: <61699439$1@news.povray.org>
On 10/15/21 5:14 AM, jr wrote:
> hi,
> 
...
> 
>> ---
>>
>> The flowers.pov file already has the tabulated.inc guard set to 1
>> contrary to the scene's comments.
> 
> Thomas held up his hand, but I did not "see" it either.  will change the
> default, and thinking of adding an '#if' guard in 'flowers_read.pov' too.
> 

Adding it too flowers_read.pov would be helpful. Aiding my confusion as 
to how the animation was supposed to work was the table being in the 
background showing about half red(1) entries and yellow entries - which 
I rather dumbly took as some indication of what I should see for 
distribution for flower colors.

(1) The initial set of flowers end up orange. Maybe?

#declare AmericanRose = srgb <1,0.01176,0.24314>;
...
pigment {AmericanRose*0.5}


> 
>> ---
>>
>> The flowers_read.pov animation doesn't look to me to be picking up all
>> the yellow flowers? Maybe one or two per asteroid? I didn't investigate
>> though, perhaps it's working as expected?
> 
> the animation runs from planting the last few reds to the first few dozen
> yellows only.
> 

Thanks Thomas, I now understand.

> 
>> ---
>>
>> With the flowers.ini AA, at least on linux with v3.8 and povr, the
>> method 3 AA doesn't look very good. Perhaps something like:
>>
>> sampling_method = 2
>> antialias_threshold = 0.005
>> antialias_depth = 3
>> jitter = on
> 
> as Thomas wrote, setting the 'file_gamma' in the ini was a bad idea, will remove
> it.  does removing it address the issue without changing 'sampling_method' etc?
> 

I dug a little. The ugly background table AA comes from using 
'antialias_gamma = 1' though the file_gamma at 1.0 makes the saved 
images linear/dark too. Both settings should go away.

Of interest, perhaps, regarding aa method 3 here. I measured these times 
and results on my Ubuntu 20.04 system.

  8.16cpu 0:03.16elapsed (antialias_gamma = 1; shipped result ugly)
26.76cpu 0:07.89elapsed (No antialias_gamma = 1; result good)
19.31cpu 0:06.10elapsed (No antialias_gamma = 1; result good; povr(*))

(*) Here the development compile being used is not that optimized and 
it's still faster. This is demonstrating the povr branch's fix to 
prevent the color channel sqrt() of negative values and subsequent 
undefined behavior. With povr the method 3 AA isn't sometimes running 
exhaustively to the recursion limit no matter other settings.

First, I screwed up on my recommendation in not have the 
antialias_threshold at 0.0. The fastest good result I see for the 
suggested render sizes, if that's your aim when shipping the package, is 
to use:

sampling_method = 2
antialias_threshold = 0.0
antialias_depth = 2
jitter = off
// 10.85user 0.09system 0:03.86elapsed

With the background table we have a very regular grid and this a case. 
Ultimately, we have to shoot enough rays to 'see' the detail we want 
cleanly visible.

The method 3 AA often works, but it presently has a known weakness in 
not being able to force an initial minimum set of samples (and this 
should probably be done to some isotropic density of samples).

The faster method 2 approach above might miss detail too at other render 
resolutions / aspect ratios.

...
> 
>> ---
>>
>> With the toa example, where the "toa_state.txt" or "toa_run.log" already
>> exist we get an error message via toal__chkFilesExist(), but the error
>> message only says "existing file(s)" were found.
> 
> or, conversely, "missing file(s)".  my thinking was/is that for animation run, I
> only need to know whether both or neither (state + log) exist, depending on
> frame_number, so the macro only provides a result for that.  how should I write
> the corresponding messages to read better?
> 

I'm a fan of seeing the actual file names if relatively easy, but at a 
minimum maybe something like "existing output files()" were found. 
(Missing input...?). Maybe the issue not that important with other 
include sorted.

My initial animation render didn't work because I was missing an 
include. That first attempt did create those two output files, but I 
didn't notice. And because I'd played around with the earlier demos I 
first thought perhaps I'd created some file which was colliding with the 
toa demo. I was slow to realize I had created files on the first failed 
attempt which were now an issue. If everything is cleaner from the 
start, there will be less potential for confusion.

Bill P.


Post a reply to this message

From: Thomas de Groot
Subject: Re: Filed() macro for CSV data file handling
Date: 16 Oct 2021 02:51:18
Message: <616a7666@news.povray.org>
Op 15/10/2021 om 16:46 schreef William F Pokorny:

> (1) The initial set of flowers end up orange. Maybe?
> 
> #declare AmericanRose = srgb <1,0.01176,0.24314>;
> ...
> pigment {AmericanRose*0.5}
> 

That is a beautiful colour! I added it to my collection of 
textures/pigments (under construction).


-- 
Thomas


Post a reply to this message


Attachments:
Download 'wfp_textures_americanrose.jpg' (48 KB)

Preview of image 'wfp_textures_americanrose.jpg'
wfp_textures_americanrose.jpg


 

From: jr
Subject: Re: Filed() macro for CSV data file handling
Date: 16 Oct 2021 11:35:00
Message: <web.616aeffa20122b7c5bd1b3ba6cde94f1@news.povray.org>
hi,

William F Pokorny <ano### [at] anonymousorg> wrote:
> ...
> I dug a little. The ugly background table AA comes from using
> 'antialias_gamma = 1' though the file_gamma at 1.0 makes the saved
> images linear/dark too. Both settings should go away.
> ...
> First, I screwed up on my recommendation in not have the
> antialias_threshold at 0.0. The fastest good result I see for the
> suggested render sizes, if that's your aim when shipping the package, is
> to use:
>
> sampling_method = 2
> antialias_threshold = 0.0
> antialias_depth = 2
> jitter = off
> // 10.85user 0.09system 0:03.86elapsed

thank you for "digging" and recommending a better set of parameters.  will
simply use those.


> ... That first attempt did create those two output files, but I
> didn't notice. ...

:-)  lost count of the number of times this happened to me, in the later stages
of development.


regards, jr.


Post a reply to this message

From: jr
Subject: Re: Filed() macro for CSV data file handling
Date: 18 Oct 2021 11:35:00
Message: <web.616d93c020122b7c5bd1b3ba6cde94f1@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:
> attached include file provides a macro for reading and writing the POV-Ray
> variant of CSV data files.  the use is documented in a HTML page, and a few
> demo/example scenes.

version 2.  includes the various improvements to documentation and demo code
suggested by WFP (thanks!).


enjoy, jr.


Post a reply to this message


Attachments:
Download 'filed2.zip' (27 KB)

From: jr
Subject: Re: Filed() macro for CSV data file handling
Date: 18 Oct 2021 11:35:00
Message: <web.616d93da20122b7c5bd1b3ba6cde94f1@news.povray.org>
hi,

William F Pokorny <ano### [at] anonymousorg> wrote:
> ...
> antialias_threshold = 0.0

adopted the settings as suggested.  see a little over 3 seconds improvement for
'toa'.  :-)


> ...
> I'm a fan of seeing the actual file names if relatively easy, but at a
> minimum maybe something like "existing output files()" were found.
> (Missing input...?). Maybe the issue not that important with other
> include sorted.

not easy, hope the compromise will suit.  have posted an updated version
incorporating all suggestions a moment ago.


regards, jr.


Post a reply to this message

From: jr
Subject: Re: Filed() macro for CSV data file handling
Date: 26 Oct 2021 10:00:00
Message: <web.6178093720122b7c527292826cde94f1@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:
> "jr" <cre### [at] gmailcom> wrote:
> > attached include file provides a macro for reading and writing the POV-Ray
> > variant of CSV data files.  the use is documented in a HTML page, and a few
> > demo/example scenes.
>
> version 2.  includes the various improvements to documentation and demo code
> suggested by WFP (thanks!).

after running some tests with larger files, I have added the following paragraph
to the HTML page:

"using the Filed() macro comes at a run-time cost, alas.  for data sets of
hundreds, or low thousands, of records, the time taken is unnoticeable, though
if there are hundreds of thousands or more, it may (in an animation, perhaps)
become enough of an issue to consider sticking with the #read and #write
directives."

with 100k sphere centre and radius records for instance, POV-Ray needs around
one second for the writing and the same for the read back.  Filed() comes in at
around eight seconds write and ten seconds read.


regards, jr.


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.