Readable .dat files?

General discussion about Celestia that doesn't fit into other forums.
Avatar
Topic author
Hungry4info
Posts: 1133
Joined: 11.09.2005
With us: 19 years 2 months
Location: Indiana, United States

Readable .dat files?

Post #1by Hungry4info » 04.11.2008, 01:19

For fun, I'm making a fictional catalogue of stars using a java program, whose output is to a dat file. When I run the program, it generates the .dat file which I slip into the /extras/ folder.

Celestia doesn't read it =(.

How can I get Celestia to show .dat files that I make?
Current Setup:
Windows 7 64 bit. Celestia 1.6.0.
AMD Athlon Processor, 1.6 Ghz, 3 Gb RAM
ATI Radeon HD 3200 Graphics

Reiko
Posts: 1119
Joined: 05.10.2006
Age: 41
With us: 18 years 1 month
Location: Out there...

Re: Readable .dat files?

Post #2by Reiko » 04.11.2008, 01:31

You'll probably have to replace the Celestia star.dat file with yours to make them show or turn that .dat file into an .stc file.

I'm just guess of course.

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 2 months
Location: NY, USA

Re: Readable .dat files?

Post #3by selden » 04.11.2008, 12:47

Celestia only uses a single stars.dat
If your file is in the correct binary format, you can replace the file that comes with Celestia.

Otherwise, create a textual STC file containing your star definitions.
Selden

Avatar
Topic author
Hungry4info
Posts: 1133
Joined: 11.09.2005
With us: 19 years 2 months
Location: Indiana, United States

Re: Readable .dat files?

Post #4by Hungry4info » 16.11.2008, 00:28

Hmm. How in the world do I make a file in binary format?
Current Setup:
Windows 7 64 bit. Celestia 1.6.0.
AMD Athlon Processor, 1.6 Ghz, 3 Gb RAM
ATI Radeon HD 3200 Graphics

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 2 months
Location: NY, USA

Re: Readable .dat files?

Post #5by selden » 16.11.2008, 03:41

To create a binary file, you run a program which reads a textual input file and writes a binary file.
There is no specific format for binary files in general, each is different depending on the intent of the program's author.

Celestia's stars.dat is created using such a special program. It translates stars.txt into stars.dat
Unfortunately, SourceForge's svn archive is returning a "Bad Gateway" error to me right now,
so I can't point you to the program that's used.
Selden

ajtribick
Developer
Posts: 1855
Joined: 11.08.2003
With us: 21 years 3 months

Re: Readable .dat files?

Post #6by ajtribick » 16.11.2008, 12:31

Selden's information is slightly out of date, that was how things worked before I got my hands on the star database and updated it to the new Hipparcos revision. :)

The program used is a Perl script: src/tools/stardb/buildstardb.pl. It builds stars.dat and stars.txt directly from the Hipparcos catalogue (mostly the new revision of the Hipparcos catalog CDS I/311, but the spectral types are from CDS I/298 since this information is not present in the new Hipparcos catalogue.)

I have described the format of stars.dat on the Celestia Wikibook here.

Avatar
Topic author
Hungry4info
Posts: 1133
Joined: 11.09.2005
With us: 19 years 2 months
Location: Indiana, United States

Re: Readable .dat files?

Post #7by Hungry4info » 19.11.2008, 21:26

Is it possible to modify a perl script to take information from me? instead of from the Hipparcos database? Basically, I want to make a few million fictional stars, and I have come to the conclusion that .dat files load faster than .stc files.

While we're on the subject, is there any way to have .ssc files in .dat format?
Current Setup:
Windows 7 64 bit. Celestia 1.6.0.
AMD Athlon Processor, 1.6 Ghz, 3 Gb RAM
ATI Radeon HD 3200 Graphics

Reiko
Posts: 1119
Joined: 05.10.2006
Age: 41
With us: 18 years 1 month
Location: Out there...

Re: Readable .dat files?

Post #8by Reiko » 20.11.2008, 03:10

Yes that would be nice to convert those huge STC files used to populate other galaxies into DAT files. They take forever to load.

Avatar
Fenerit M
Posts: 1880
Joined: 26.03.2007
Age: 17
With us: 17 years 7 months
Location: Thyrrenian sea

Re: Readable .dat files?

Post #9by Fenerit » 20.11.2008, 13:51

Hungry4info wrote:Hmm. How in the world do I make a file in binary format?

You need an HEX editor (there are lot for free on the net). Open the ASCII dat then save it as binary.

For some free HEX editors:

http://www.snapfiles.com/downloadfind.php?action=s&search.x=22&search.y=11&st=hex+editor
Never at rest.
Massimo

Avatar
Topic author
Hungry4info
Posts: 1133
Joined: 11.09.2005
With us: 19 years 2 months
Location: Indiana, United States

Re: Readable .dat files?

Post #10by Hungry4info » 29.11.2008, 00:14

Okay. I've downloaded AptEdit Pro ... and am uncertain just how to save my ASCII dat file as a bin file.

Image

++++++++++++++

Also, is it possible to have .ssc files like this?
Current Setup:
Windows 7 64 bit. Celestia 1.6.0.
AMD Athlon Processor, 1.6 Ghz, 3 Gb RAM
ATI Radeon HD 3200 Graphics

Reiko
Posts: 1119
Joined: 05.10.2006
Age: 41
With us: 18 years 1 month
Location: Out there...

Re: Readable .dat files?

Post #11by Reiko » 30.11.2008, 04:01

If you figure out how to convert a txt to .DAT let me know please. :)
Also, how does one combine two .DAT files? For example if I were to convert a large .DAT would I be able to merge it with the one used by celestia?

Avatar
jogad
Posts: 458
Joined: 17.09.2008
With us: 16 years 2 months
Location: Paris France

Re: Readable .dat files?

Post #12by jogad » 30.11.2008, 11:29

Hello

Searching in the forum I found the answer here.

http://www.shatters.net/forum/viewtopic.php?f=2&t=11625&p=94997&hilit=makestardb#p94997

I am very surprised that you forgot it, Reiko.

Then merging the two text files is easy with a command like:
copy /B stars1.txt + stars2.text stars.txt
Or the equivalent with your OS.
That gives you a merged text file that you can convert into a .dat file using the makestardb.exe utility.

Regards

Reiko
Posts: 1119
Joined: 05.10.2006
Age: 41
With us: 18 years 1 month
Location: Out there...

Re: Readable .dat files?

Post #13by Reiko » 30.11.2008, 17:51

jogad wrote:Hello

Searching in the forum I found the answer here.

http://www.shatters.net/forum/viewtopic.php?f=2&t=11625&p=94997&hilit=makestardb#p94997

I am very surprised that you forgot it, Reiko.

Then merging the two text files is easy with a command like:
copy /B stars1.txt + stars2.text stars.txt
Or the equivalent with your OS.
That gives you a merged text file that you can convert into a .dat file using the makestardb.exe utility.

Regards
Oh yeah!! Thanks :)

Reiko
Posts: 1119
Joined: 05.10.2006
Age: 41
With us: 18 years 1 month
Location: Out there...

Re: Readable .dat files?

Post #14by Reiko » 02.12.2008, 00:47

Is there something out there to do this with that isn't a command line utility? Most of the time I can never get them to work properly.

Avatar
Topic author
Hungry4info
Posts: 1133
Joined: 11.09.2005
With us: 19 years 2 months
Location: Indiana, United States

Re: Readable .dat files?

Post #15by Hungry4info » 02.12.2008, 00:49

Yeah I'm having trouble getting makestarsdb to work properly. It says I need to specify the number of stars, but I'm unsure how it wants me to do it.
Current Setup:
Windows 7 64 bit. Celestia 1.6.0.
AMD Athlon Processor, 1.6 Ghz, 3 Gb RAM
ATI Radeon HD 3200 Graphics

Avatar
jogad
Posts: 458
Joined: 17.09.2008
With us: 16 years 2 months
Location: Paris France

Re: Readable .dat files?

Post #16by jogad » 03.12.2008, 11:30

Hello

Yes Hungry4info. To build a stars datafile you must specify yourself the number of stars in it.
The first line of your text file is the number of stars.

Then each line describes a particular star.
There are two possible formats for that.

The first one is more precise but data are a bit more difficult to interpret by us, poor humans beings, and more difficult to find. Each line contains the following data:
- # catalog HIP
- X Y and Z coordinates in light years
- ABSOLUTE magnitude of the star
- Spectral type

An easiest other way is to provide data as follows:
- # catalog HIP
- Right Ascension in decimal degrees
- Declination in decimal degrees
- Distance in light years
- RELATIVE magnitude of the star
- Spectral type

Data in a line are separated by spaces or tabulations.

In the first case you build your data file with

Code: Select all

makestardb textfile datafile

In the second case with

Code: Select all

makestardb –s textfile datafile

And for your Reiko I suppose that if you have trouble with command line it is because you operate under Windows.
It is possible to use command line without open a command window and get lost here.
Just put all files that you need in the same directory. Then make a text file witch contains the command line(s) and save it with a name witch ends by .bat. Don’t forget to end the last line of your command file by a carriage return. Double clicking on it will execute the command lines without quitting the GUI.
The command to make a text file from a stars data file is

Code: Select all

startextfump stardatafile textfile

A+

ajtribick
Developer
Posts: 1855
Joined: 11.08.2003
With us: 21 years 3 months

Re: Readable .dat files?

Post #17by ajtribick » 03.12.2008, 11:50

It's probably better to work with stars.dat itself -- regard stars.txt as a human-readable view into stars.dat, however given the coordinates conversion (from rectangular to polar) and the conversion to decimal, generating stars.dat from stars.txt will probably result in slightly different positions.

I'm personally not convinced we need to keep stars.txt around in v1.6.0 -- it's a holdover from the old generation process; the new star database generation process does not need it at all, and it is a very large file that only serves to duplicate another large file.

Avatar
jogad
Posts: 458
Joined: 17.09.2008
With us: 16 years 2 months
Location: Paris France

Re: Readable .dat files?

Post #18by jogad » 03.12.2008, 13:15

Hi

You are perfectly right!

The method is possible but anyhow it is not correct to merge a text file with X, Y and Z coordinates with one containing AR, Dec and Distance.

Only the First format is acceptable. If we have' only AR, Dec, Distance and relative magnitudes, the conversion must be done in X, Y, Z and absolute magnitues before trying to build the data file.
With this method, there is no conversion and thus no precision loss. In fact I noticed a (very) little one, not in the coordinates, but curiously on the magnitude! (on the third decimal place).

But for an add-on it seems that the best method is always to make a stc file witch is human readable and preserves the original stars.

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 9 months
Location: Seattle, Washington, USA

Re: Readable .dat files?

Post #19by chris » 03.12.2008, 17:00

ajtribick wrote:It's probably better to work with stars.dat itself -- regard stars.txt as a human-readable view into stars.dat, however given the coordinates conversion (from rectangular to polar) and the conversion to decimal, generating stars.dat from stars.txt will probably result in slightly different positions.

I'm personally not convinced we need to keep stars.txt around in v1.6.0 -- it's a holdover from the old generation process; the new star database generation process does not need it at all, and it is a very large file that only serves to duplicate another large file.

I agree with you. With the new process for generating stars.dat and the improvements to stc files, stars.txt is unnecessary now.

--Chris

Guckytos
Posts: 439
Joined: 01.06.2004
With us: 20 years 5 months
Location: Germany

Re: Readable .dat files?

Post #20by Guckytos » 03.12.2008, 18:31

Just a few short questions/suggestions on making a stars.dat for an addon.

I have also a huge load of data that I am currently converting to .STCs (~1200 entries [without a load of binaries])

Do I really need to assign them a HIP number?
I have the data in an X Y Z coordinate system, but I am not sure, if it is the same as used in Celestia. I tried to look that one up, but didn't find its center and orientation (yet).
Can I also define barycenters?

So, from these questions I'd like to edrive the following feature requests for future Celestia versions:
  • Possibility to add user .dat files (binary or text) with addons
  • define barycenters
  • Possibility to use modify commands for already existing stars within these .dat files

My 2 cents.

Regards,

Guckytos


Return to “Celestia Users”