startextdump doesn't output spherical coordinates

Have a question about using Celestia? Check here first for FAQs and helpful advice.
Forum rules
Please help to make this forum more useful by checking the FAQs before posting! Keep it clean, keep it civil, keep it truthful, stay on topic, be responsible, share your knowledge.
Avatar
Topic author
LukeCEL
Posts: 267
Joined: 26.09.2017
With us: 2 years 6 months

startextdump doesn't output spherical coordinates

Post #1by LukeCEL » 23.02.2020, 20:30

Hi everyone,

I'm trying to get startextdump to output spherical coordinates (RA, Dec, Distance). However, when I type this into the command line:

Code: Select all

startextdump -s stars.dat
I get just the normal output options (x, y, z). I have also tried doing

Code: Select all

startextdump --spherical stars.dat
and changing

Code: Select all

static bool useSphericalCoords = false;
in line 27 to true. However, nothing seems to work, and it still outputs x, y, and z. What am I doing wrong?

Thanks,
Luke

Janus
Posts: 474
Joined: 13.08.2016
With us: 3 years 7 months

Post #2by Janus » 23.02.2020, 22:35

That file does not contain the information you are looking for.
It is the result of formulaic conversion of polar coords {Ra, Dec, Dist} into rectangular {x,y,z} then output into a binary format.

If you are looking for the polar coords, here.
Grab the file below, hip2.dat.gz, then extract hip2.dat from it.
Load it into a speadsheet or import it into a database if you like.
Parse using the following guide. {Taken from stardb.pl in the source tree.}
The first column is the HIP#, the rest as follows.

Code: Select all

   my %star = (
      'RArad'    => substr($curLine,  15, 13),
      'DErad'    => substr($curLine,  29, 13),
      'Plx'      => substr($curLine,  43,  7),
      'e_RArad'  => substr($curLine,  69,  6),
      'e_DErad'  => substr($curLine,  76,  6),
      'e_Plx'    => substr($curLine,  83,  6),
      'Hpmag'    => substr($curLine, 129,  7),
      'B-V'      => substr($curLine, 152,  6)
      );
Note: 15+13 = 28, 29+13 = 42, just to clarify how substr works in perl.


And you will have a list of polar coords.
Warning, parallax is computed by LY = 3.26156 * (1/Plx) if you want direct distance.

Merge with the dump you already have using HIP# as the common key, and you have it all in one place.
I hope that gives you what you need.

Sorry about short reply, but still getting the spherical projection coded to compile with VS2015.
Needed a break from a frustrating job, and now it is getting frustrating as well.


Janus.
Attachments
hip2.dat.gz
(8.56 MiB) Downloaded 2 times

Avatar
Topic author
LukeCEL
Posts: 267
Joined: 26.09.2017
With us: 2 years 6 months

Post #3by LukeCEL » 24.02.2020, 03:19

Hi Janus, this is not exactly what I'm looking for.

The reason I need stars.txt to be in exactly this format is because I was trying to generate a new catalog of stellar radii (jsdc.stc) using Andrew Tribick's new stars.dat. His file uses distances that AFAIK, are the most accurate and up-to-date.

Thanks anyway,
Luke

Added after 1 minute 21 seconds:
I did end up making an updated jsdc.stc by slightly tweaking the jsdc.pl I used. Here's the updated version, anyway:
Attachments
jsdc.stc.zip
(927.34 KiB) Downloaded 5 times

ajtribick
Developer
Posts: 1801
Joined: 11.08.2003
With us: 16 years 7 months
Location: Switzerland

Post #4by ajtribick » 25.02.2020, 22:09

Looking at the code, the useSpherical parameter is only passed to DumpOldStarDatabase, which as the name implies only handles the older format. At that time stars.dat contained the HD cross-index and stored coordinates as (right ascension, declination, parallax). I believe the reason for the change to storing Cartesian coordinates was because differences in the trigonometric functions made it impossible for cel URLs to work across different machines even when the same star database was used.

Avatar
Topic author
LukeCEL
Posts: 267
Joined: 26.09.2017
With us: 2 years 6 months

Post #5by LukeCEL » 25.02.2020, 22:45

Very interesting, thank you for that.

I saw this bit of code:

Code: Select all

            else if (!strcmp(argv[i], "-s") || !strcmp(argv[i], "--spherical"))
            {
                useSphericalCoords = true;
            }
which made me assume that I needed to set useSphericalCoords to true. But if useSphericalCoords is only passed to DumpOldStarDatabase, does that mean that the "--spherical" argument does not work for the new stars.txt format?

ajtribick
Developer
Posts: 1801
Joined: 11.08.2003
With us: 16 years 7 months
Location: Switzerland

Post #6by ajtribick » 25.02.2020, 23:05

Yes, the function DumpStarDatabase (used for the current star database format) is blissfully unaware of the existence of useSpherical.

Once you extract x, y and z from the file, the distance is easy to calculate from the usual Euclidean formula (x²+y²+z²). Extracting the right ascension and declination is somewhat complicated by the fact that the stored coordinates are in a left-handed (I think?) ecliptic frame rather than equatorial.

So you invert the transformation given in the Celestia wikibook (the matrix is a rotation matrix, so just negate the angle ε), then use atan2 and other inverse trigonometric functions to extract the angles.

Avatar
Topic author
LukeCEL
Posts: 267
Joined: 26.09.2017
With us: 2 years 6 months

Post #7by LukeCEL » 25.02.2020, 23:43

Thanks for the information! I've submitted a bug report on GitHub.


Return to “Help Central”

Who is online