Next: Spectral lines library, Previous: Git wrappers, Up: Gnuastro library [Contents][Index]

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.

- Function:

*int*

**gal_units_extract_decimal***(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.

- Function:

*double*

**gal_units_ra_to_degree***(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).

- Function:

*double*

**gal_units_dec_to_degree***(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).

- Function:

*char **

**gal_units_degree_to_ra***(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:`_:_:_`

.

- Function:

*char **

**gal_units_degree_to_dec***(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:`_:_:_`

.

- Function:

*double*

**gal_units_counts_to_mag***(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.

- Function:

*double*

**gal_units_counts_to_jy***(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.

Next: Spectral lines library, Previous: Git wrappers, Up: Gnuastro library [Contents][Index]

GNU Astronomy Utilities 0.15 manual, May 2021.