Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve star catalog documentation #3976

Merged
merged 4 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions guide/app_star_catalogue.tex
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ \subsection{General Description}%\label{general-description}
\midrule
\file{stars\_0\_0v0\_8.cat} & 0 & 28 bytes & 0 & 4,979 & Hipparcos\\
\file{stars\_1\_0v0\_8.cat} & 0 & 28 bytes & 1 & 21,806 & Hipparcos\\
\file{stars\_2\_0v0\_8.cat} & 0 & 28 bytes & 2 & 150,824 & Hipparcos\\
\file{stars\_2\_0v0\_8.cat} & 0 & 28 bytes & 2 & 150,826 & Hipparcos\\
10110111 marked this conversation as resolved.
Show resolved Hide resolved
\file{stars\_3\_1v0\_4.cat} & 1 & 10 bytes & 3 & 425,807 & Tycho 2\\
\file{stars\_4\_1v0\_2.cat} & 1 & 10 bytes & 4 & 1,692,779 & Tycho 2\\
\file{stars\_5\_2v0\_1.cat} & 2 & 8 bytes & 5 & 7,083,058 & NOMAD\\
Expand Down Expand Up @@ -225,16 +225,16 @@ \subsubsection{Star Data Records}%\label{star-data-records}
the line number in the file - 1\\%\midrule
x0 & 4 & int & 4 & position of the star relative to the central point in the star's zone, in axis 1\\%\midrule
x1 & 8 & int & 4 & position of the star relative to the central point in the star's zone, in axis 2\\%\midrule
b\_v & 9 & unsigned char & 1 & magnitude level in B-V colour. This value refers to one of 256 discrete steps
b\_v & 12 & unsigned char & 1 & magnitude level in B-V colour. This value refers to one of 256 discrete steps
in the magnitude range for the file\\%\midrule
mag & 10 & unsigned char & 1 & magnitude level in the V-I colour. This value refers to one of 256 discrete steps
mag & 13 & unsigned char & 1 & magnitude level in the V-I colour. This value refers to one of 256 discrete steps
in the magnitude range for the file\\%\midrule
sp\_int & 11 & unsigned short int & 2 & index into an array of spectral type descriptions
sp\_int & 14 & unsigned short int & 2 & index into an array of spectral type descriptions
which is taken from the file \file{stars\_hip\_sp.cat}, the index corresponds to the
line number in the file - 1\\%\midrule
dx0 & 13 & int & 4 & proper motion of the star in axis 1\\%\midrule
dx1 & 17 & int & 4 & proper motion of the star in axis 2\\%\midrule
plx & 21 & int & 4 & parallax of the star. To get the actual value, divide by 10000.\\\bottomrule
dx0 & 16 & int & 4 & proper motion of the star in axis 1\\%\midrule
dx1 & 20 & int & 4 & proper motion of the star in axis 2\\%\midrule
plx & 24 & int & 4 & parallax of the star. To get the actual value, divide by 10000.\\\bottomrule
\end{tabular}
\caption{Star Data Record Type 0}
\label{tab:StarDataRecord0}
Expand Down
47 changes: 24 additions & 23 deletions src/core/modules/Star.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,18 @@ struct Star1 { // 28 byte
//
// qint32 dx0,dx1,plx 32
private:
// Use an union so we can access the data as different types without
// aliasing issues.
union {
quint8 uint8[28];
quint16 uint16[14];
qint32 int32[7];
} d;
struct Data {
quint8 hip[3]; // 3 bytes
quint8 componentIds; // 1 byte
qint32 x0; // 4 bytes
qint32 x1; // 4 bytes
quint8 b_v; // 1 byte
quint8 vmag; // 1 bytes
quint16 spInt; // 2 bytes
qint32 dx0; // 4 bytes
qint32 dx1; // 4 bytes
qint32 plx; // 4 bytes
} d; // total is 28 bytes
10110111 marked this conversation as resolved.
Show resolved Hide resolved

public:
enum {MaxPosVal=0x7FFFFFFF};
Expand All @@ -114,26 +119,22 @@ struct Star1 { // 28 byte
pos+=(static_cast<float>(getX1())+movementFactor*getDx1())*z->axis1;
pos+=z->center;
}
inline int getBVIndex() const {return d.uint8[12];}
inline int getMag() const {return d.uint8[13];}
inline int getSpInt() const {return d.uint16[7];}
inline int getX0() const { return qFromLittleEndian(d.int32[1]);}
inline int getX1() const { return qFromLittleEndian(d.int32[2]);}
inline int getDx0() const {return qFromLittleEndian(d.int32[4]);}
inline int getDx1() const {return qFromLittleEndian(d.int32[5]);}
inline int getPlx() const {return qFromLittleEndian(d.int32[6]);}

inline int getBVIndex() const {return d.b_v;}
inline int getMag() const {return d.vmag;}
inline int getSpInt() const {return d.spInt;}
inline int getX0() const { return qFromLittleEndian(d.x0);}
inline int getX1() const { return qFromLittleEndian(d.x1);}
inline int getDx0() const {return qFromLittleEndian(d.dx0);}
inline int getDx1() const {return qFromLittleEndian(d.dx1);}
inline int getPlx() const {return qFromLittleEndian(d.plx);}
inline int getComponentIds() const {return d.componentIds;}

inline int getHip() const
{
quint32 v = d.uint8[0] | d.uint8[1] << 8 | d.uint8[2] << 16;
quint32 v = d.hip[0] | d.hip[1] << 8 | d.hip[2] << 16;
return (static_cast<qint32>(v)) << 8 >> 8;
}

inline int getComponentIds() const
{
return d.uint8[3];
}

float getBV(void) const {return IndexToBV(getBVIndex());}
bool hasName() const {return getHip();}
QString getNameI18n(void) const;
Expand Down Expand Up @@ -283,4 +284,4 @@ struct Star3 { // 6 byte
};
static_assert(sizeof(Star3) == 6, "Size of Star3 must be 6 bytes");

#endif // STAR_HPP
#endif // STAR_HPP
10110111 marked this conversation as resolved.
Show resolved Hide resolved
Loading