Datasets can contain values in various formats or units. The functions in this section are defined to facilitate the easy conversion between them and are declared in units.h. If there are certain conversions that are useful for your work, please get in touch.
int
(char *convert
, const char *delimiter
, double *args
, size_t n
)
¶Parse the input convert
string with a certain delimiter (for example, 01:23:45
, where the delimiter is ":"
) as multiple numbers (for example, 1,23,45) and write them as an array in the space that args
is pointing to.
The expected number of values in the string is specified by the n
argument (3 in the example above).
If the function succeeds, it will return 1, otherwise it will return 0 and the values may not be fully written into args
.
If the number of values parsed in the string is different from n
, this function will fail.
double
(char *convert
)
¶Convert the input Right Ascension (RA) string (in the format of hours, minutes and seconds either as _h_m_s
or _:_:_
) to degrees (a single floating point number).
double
(char *convert
)
¶Convert the input Declination (Dec) string (in the format of degrees, arc-minutes and arc-seconds either as _d_m_s
or _:_:_
) to degrees (a single floating point number).
char *
(double decimal
, int usecolon
)
¶Convert the input Right Ascension (RA) degree (a single floating point number) to old/standard notation (in the format of hours, minutes and seconds of _h_m_s
).
If usecolon!=0
, then the delimiters between the components will be colons: _:_:_
.
char *
(double decimal
, int usecolon
)
¶Convert the input Declination (Dec) degree (a single floating point number) to old/standard notation (in the format of degrees, arc-minutes and arc-seconds of _d_m_s
).
If usecolon!=0
, then the delimiters between the components will be colons: _:_:_
.
double
(double counts
, double zeropoint
)
¶Convert counts to magnitudes through the given zero point. For more on the equation, see Brightness, Flux, Magnitude and Surface brightness.
double
(double mag
, double zeropoint
)
¶Convert magnitudes to counts through the given zero point. For more on the equation, see Brightness, Flux, Magnitude and Surface brightness.
double
(double mag
, double area_arcsec2
)
¶Calculate the surface brightness of a given magnitude, over a certain area in units of arcsec\(^2\). For more on the equation, see Brightness, Flux, Magnitude and Surface brightness.
double
(double sb
, double area_arcsec2
)
¶Calculate the magnitude of a given surface brightness, over a certain area in units of arcsec\(^2\). For more on the equation, see Brightness, Flux, Magnitude and Surface brightness.
double
(double counts
, double zeropoint_ab
, double area_arcsec2
)
¶Calculate the surface brightness of a given count level, over a certain area in units of arcsec\(^2\), assuming a certain AB zero point. For more on the equation, see Brightness, Flux, Magnitude and Surface brightness.
double
(double sb
, double zeropoint_ab
, double area_arcsec2
)
¶Calculate the counts corresponding to a given surface brightness, over a certain area in units of arcsec\(^2\). For more on the equation, see Brightness, Flux, Magnitude and Surface brightness.
double
(double counts
, double zeropoint_ab
)
¶Convert counts to Janskys through an AB magnitude-based zero point. For more on the equation, see Brightness, Flux, Magnitude and Surface brightness.
double
(double au
)
¶Convert the input value (assumed to be in Astronomical Units) to Parsecs.
For the conversion equation, see the description of au-to-pc
operator in Arithmetic operators.
double
(double counts
, double zeropoint_in
, double zeropoint_out
)
¶Convert the zero point of counts
(which is zeropoint_in
) to zeropoint_out
.
double
(double counts
, double zeropoint_ab
)
¶Convert counts to Nanomaggy (with fixed zero point of 22.5) through an AB magnitude-based zero point.
This is just a wrapper around gal_units_zeropoint_change
with zeropoint_out=22.5
.
double
(double counts
, double zeropoint_ab
)
¶Convert Nanomaggy (with fixed zero point of 22.5) to counts through an AB magnitude-based zero point.
This is just a wrapper around gal_units_zeropoint_change
with zeropoint_in=22.5
.
double
(double pc
)
¶Convert the input value (assumed to be in Parsecs) to Astronomical Units (AUs).
For the conversion equation, see the description of au-to-pc
operator in Arithmetic operators.
double
(double ly
)
¶Convert the input value (assumed to be in Light-years) to Parsecs.
For the conversion equation, see the description of ly-to-pc
operator in Arithmetic operators.
double
(double pc
)
¶Convert the input value (assumed to be in Parsecs) to Light-years.
For the conversion equation, see the description of ly-to-pc
operator in Arithmetic operators.
double
(double ly
)
¶Convert the input value (assumed to be in Light-years) to Astronomical Units.
For the conversion equation, see the description of ly-to-pc
operator in Arithmetic operators.
double
(double au
)
¶Convert the input value (assumed to be in Astronomical Units) to Light-years.
For the conversion equation, see the description of ly-to-pc
operator in Arithmetic operators.
JavaScript license information
GNU Astronomy Utilities 0.23 manual, July 2024.