|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I'm trying to load a series of data points from a file, but I'm only getting
about half of them loaded. The data file is structured with three float
values per line:
raInDeg decInDeg zval
Each triplet defining the rightascention, declination, and zvalue(redshift)
of a celestial body. The data ranges (after a bit of processing!) are:
raInDeg: 0 ~ 360
decInDeg: -90.0 ~ +90.0
zval: estimated at 0.0 ~ 10.0
Someone suggested that it might be commas between numbers,
but when I comma delimit the file, it no longer reads.
It reads about 4000 out of 9000 entries when I tab-delimit them.
Any suggestions?
pertinent source:
//////////////////////////////////////////////////////////
// Load the data file
//
#declare RA = 0;
#declare DECL =1;
#declare ZVAL = 2;
#fopen dataFile "d:/docs/raytracing/redshiftData.txt" read
#declare LinesInFile = 10000;
#declare celestialData = array[3][ LinesInFile ];
#declare i = 0;
#while ( defined(dataFile) )
#declare rightAscentionAsDegrees = 0.0;
#declare declinationAsDegrees = 0.0;
#declare zVal = 0.0;
#read( dataFile, rightAscentionAsDegrees, declinationAsDegrees, zVal )
#declare celestialData[RA][i] = rightAscentionAsDegrees;
#declare celestialData[DECL][i] = declinationAsDegrees;
#declare celestialData[ZVAL][i] = zVal;
#declare i = i+1;
#end
#debug concat( "\n\nTotal values read from file: ", str(i,5,0), "\n\n" )
#fclose dataFile
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> I'm trying to load a series of data points from a file, but I'm only
getting
> about half of them loaded. The data file is structured with three float
> values per line:
>
> raInDeg decInDeg zval
Well, the data needs to be
[Float] , [Float], [Float],
...
(Repeat)
There needs to be a final comma, after which there is no data anymore.
Aside of that, no clue what could cause the problem.
Regards,
Tim
--
"Tim Nikias v2.0"
Homepage: <http://www.nolights.de>
Email: tim.nikias (@) nolights.de
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
AngleWyrm wrote:
> I'm trying to load a series of data points from a file, but I'm only getting
> about half of them loaded. The data file is structured with three float
> values per line:
>
> raInDeg decInDeg zval
>
> Each triplet defining the rightascention, declination, and zvalue(redshift)
> of a celestial body. The data ranges (after a bit of processing!) are:
> raInDeg: 0 ~ 360
> decInDeg: -90.0 ~ +90.0
> zval: estimated at 0.0 ~ 10.0
>
> Someone suggested that it might be commas between numbers,
> but when I comma delimit the file, it no longer reads.
> It reads about 4000 out of 9000 entries when I tab-delimit them.
> Any suggestions?
The amount of information you provided is not likely to be sufficient to
tell you where your problem lies. The POV-Ray #read function is only
able to read comma separated values. If you have the impression that
this does not work you should show the minimal code necessary to
reproduce this as well as the data file you try to read.
Christoph
--
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 11 Jan. 2004 _____./\/^>_*_<^\/\.______
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Tim Nikias v2.0" <tim.nikias (@) nolights.de> wrote in message
news:401816e6$1@news.povray.org...
> > I'm trying to load a series of data points from a file, but I'm only
> getting
> > about half of them loaded. The data file is structured with three float
> > values per line:
> >
> > raInDeg decInDeg zval
>
> Well, the data needs to be
>
> [Float] , [Float], [Float],
Thanks, that did it; it was the trailing commas at the end of line. Excel
doesn't export that way, so I had to do a search & replace on newline
character, adding the commas.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In article <40189740@news.povray.org> , "AngleWyrm"
<no_### [at] hotmailcom> wrote:
> Thanks, that did it; it was the trailing commas at the end of line. Excel
> doesn't export that way
You may want to set Excel to export one additional column. Assuming that
column is empty, you should get a comma at the end.
Thorsten
____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde
Visit POV-Ray on the web: http://mac.povray.org
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Thorsten Froehlich" <tho### [at] trfde> wrote in message
news:4018ead0@news.povray.org...
> In article <40189740@news.povray.org> , "AngleWyrm"
> <no_### [at] hotmailcom> wrote:
>
> You may want to set Excel to export one additional column. Assuming that
> column is empty, you should get a comma at the end.
Ok, for anyone who needs to have trailing commas, this worked: Add a dummy
value in the first row before you "save as", like so:
oneVal, twoVal, threeVal, dummyVal
oneVal, twoVal, threeVal
oneVal, twoVal, threeVal
and the resulting *.csv file will have trailing commas. Then delete the
dummyVal from the first row of the file.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Tim Nikias v2.0 schrieb:
>> I'm trying to load a series of data points from a file, but I'm only
> getting
>> about half of them loaded. The data file is structured with three float
>> values per line:
>>
>> raInDeg decInDeg zval
>
> Well, the data needs to be
>
> [Float] , [Float], [Float],
> ...
> (Repeat)
>
> There needs to be a final comma, after which there is no data anymore.
A suggestion to the POVRay developers:
Throw a warning when reading a file and finding the end of a line
without a ',' before it. I made the same mistake a few weeks ago and I
think this would happen to some more people in the future.
--
mat### [at] matweide
http://www.matwei.de
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
wrote:
> Throw a warning when reading a file and finding the end of a line
> without a ',' before it. I made the same mistake a few weeks ago and I
> think this would happen to some more people in the future.
But the problem is not with newlines! POV-Ray does not care about newlines.
All it cares about is the commas! For POV-Ray there coulkd be a million
newlines inbteween, it would still expect a comma between two values.
Everything else is an arithmetic (or string is quoted) expression.
Thorsten
____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde
Visit POV-Ray on the web: http://mac.povray.org
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Thorsten Froehlich" <tho### [at] trfde> wrote in message
news:40192e8c$1@news.povray.org...
> But the problem is not with newlines! POV-Ray does not care about newlines.
This has come up before - the problem is that it's a common assumption that a
newline will regarded as a value seperator. While it would be unreasonable and
absurd to list everything that Pov doesn't do in the docs*, this might be a
valid exception....
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
AngleWyrm <no_### [at] hotmailcom> wrote:
> oneVal, twoVal, threeVal, dummyVal
> oneVal, twoVal, threeVal
> oneVal, twoVal, threeVal
> and the resulting *.csv file will have trailing commas. Then delete the
> dummyVal from the first row of the file.
I think that if "dummyval" is "//" then you don't even need to remove it.
--
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|