sora.star

The Star Class

class sora.Star(catalogue='gaiadr3', **kwargs)[source]

Defines a star.

Parameters
  • catalogue (str, VizierCatalogue) – The catalogue to download data. It can be 'gaiadr2', 'gaiaedr3', 'gaiadr3', or a VizierCatalogue object.. default=’gaiadr3’

  • code (str) – Gaia Source code for searching in VizieR.

  • coord (str, astropy.coordinates.SkyCoord) – If code is not given, coord nust have the coordinates RA and DEC of the star to search in VizieR: 'hh mm ss.ss +dd mm ss.ss'.

  • ra (int, float) – Right Ascension, in deg.

  • dec (int, float) – Declination, in deg.

  • parallax (int, float. default=0) – Parallax, in mas.

  • pmra (int, float, default=0) – Proper Motion in RA*, in mas/year.

  • pmdec (int, float, default=0) – Proper Motion in DEC, in mas/year.

  • rad_vel (int, float, default=0) – Radial Velocity, in km/s.

  • epoch (str, astropy.time.Time, default=’J2000’) – Epoch of the coordinates.

  • nomad (bool) – If True, it tries to download the magnitudes from NOMAD catalogue.

  • bjones (bool, default=True) – If True, it uses de star distance from Bailer-Jones et al. (2018).

  • cgaudin (bool, default=True) – If True, it uses de proper motion correction from Cantat-Gaudin & Brandt (2021). this option is only available for Gaia-EDR3.

  • verbose (bool, default=True) – If True, it prints the downloaded information

  • local (bool, default=False) – If True, it uses the given coordinate in ‘coord’ as final coordinate.

Note

The user can give either ‘coord’ or ‘ra’ and ‘dec’, but not both.

To download the coordinates from Gaia, “local” must be set as False and the (“code”) or (“coord”) or (“ra” and “dec”) must be given.

All values downloaded from Gaia will replace the ones given by the user.

add_offset(da_cosdec, ddec)[source]

Adds an offset to the star position.

Parameters
  • da_cosdec (int, float) – Offset in Delta_alpha_cos_delta, in mas.

  • ddec (int, float) – Offset in Delta_delta, in mas.

apparent_diameter(distance, mode='auto', band='V', star_type='sg', verbose=True)[source]

Calculates the apparent diameter of the star at a given distance.

Parameters
  • distance (int, float) – Object geocentric distance, in AU.

  • mode (str, default=’auto’) –

    The mode to calculate the apparent diameter.

    • 'user': calculates using user given diameter.

    • 'gaia': calculates using diameter obtained from Gaia.

    • 'kervella': calculates using Kervella equations.

    • 'van_belle': calculates using van Belle equations.

    • 'auto': tries all the above methods until it is able to calculate diameter.

    The order of try is the same as shown above (user, Gaia, Kervella, Van Belle).

  • band (str) – The band filter to calculate the diameter. If mode is kervella or van_belle, the filter must be given, 'B' or 'V'. If mode auto, 'V' is selected.

  • star_type (str) –

    Type of star to calculate the diameter. If mode is van_belle, the star type must be given. If mode is auto, star_type='sg'.

    Accepted types:

    • 'sg' for ‘Super Giant’.

    • 'ms' for ‘Main Sequence’.

    • 'vs' for ‘Variable Star’.

  • verbose (bool) – If True, it prints the mode used by auto.

barycentric(time)[source]

Calculates the position of the star using proper motion.

Parameters

time (str, astropy.time.Time) – Reference time to apply proper motion. It can be a string in the ISO format (yyyy-mm-dd hh:mm:ss.s) or an astropy Time object.

error_at(time)[source]

Estimates the star position error at a given time.

Parameters

time (str, astropy.time.Time) – Reference time to project star error. It can be a string in the ISO format (yyyy-mm-dd hh:mm:ss.s) or an astropy Time object.

Returns

errors – In RA* and DEC.

Return type

list

geocentric(time)[source]

Calculates the position of the star, propagating the position using parallax and proper motion

Parameters

time (str, astropy.time.Time) – Reference time to apply proper motion and calculate parallax. It can be a string in the ISO format (yyyy-mm-dd hh:mm:ss.s) or an astropy Time object.

get_position(time, observer='geocenter')[source]

Calculates the position of the star for given observer, propagating the position using parallax and proper motion

Parameters
  • time (float, astropy.time.Time) – Reference time to apply proper motion and calculate parallax. It can be a string in the ISO format (yyyy-mm-dd hh:mm:ss.s) or an astropy Time object.

  • observer (str, sora.observer.Observer, sora.observer.Spacecraft) – Observer of the star t calculate position. It can be ‘geocenter’ for a geocentric coordinate, ‘barycenter’ for a barycenter coordinate, or a sora observer object.

Returns

coord – Astropy SkyCoord object with the star coordinates at the given time.

Return type

astropy.coordinates.SkyCoord

kervella()[source]

Determines the diameter of a star in mas using equations from Kervella et. al (2004).

See: A&A Vol. 426, No. 1:.

set_diameter(diameter)[source]

Sets an user diameter for the star, in mas.

Parameters

diameter (int, float) – Sets the user diameter of the star, in mas.

set_magnitude(**kwargs)[source]

Sets the magnitudes of a star.

Parameters

band=value (str) – The star magnitude for given band. The band name can be any string the user wants.

Examples

To set the stars magnitude in the band G:

>>> set_magnitude(G=10)

To set the star’s magnitude in the band K:

>>> set_magnitude(K=15)

To set the star’s magnitude in a customized band:

>>> set_magnitude(newband=6)
to_log(namefile)[source]

Saves the star log to a file.

Parameters

namefile (str) – Filename to save the log.

van_belle()[source]

Determines the diameter of a star in mas using equations from van Belle (1999).

See: Publi. Astron. Soc. Pacific 111, 1515-1523:.

The Star Catalogue

class sora.star.catalog.VizierCatalogue(**kwargs)[source]

VizierCatalogue defines the parameters necessary to download all the information of stars from a catalogue on the Vizier webservice.

Parameters
  • name (str) – The name of the catalogue which will be referred in other processes

  • cat_path (str) – The path of the catalogue in the Vizier website. For instance, for GaiaEDR3, cat_path='I/350/gaiaedr3'

  • code (str) – The keyword referring to a unique code within the catalogue

  • ra (str) – The keyword referring to the Right Ascension within the catalogue

  • dec (str) – The keyword referring to the Declination within the catalogue

  • epoch (str, astropy.time.Time) – The epoch of the catalogue. If it is defined in the catalogue, just pass the keyword within the catalogue. If the epoch is not present in the catalogue table, we must pass a Time object directly, for example epoch=Time('J2000'), which defines the catalogue coordinates in J2000 TDB.

  • pmra (str, optional) – The keyword referring to the Proper Motion in ra*cosdec within the catalogue. If not available, set it to None.

  • pmdec (str, optional) – The keyword referring to the Proper Motion in dec within the catalogue. If not available, set it to None.

  • parallax (str, optional) – The keyword referring to the Parallax within the catalogue. If not available, set it to None.

  • rad_vel (str, optional) – The keyword referring to the Radial Velocity within the catalogue

  • bands (dict [str, str], optional) – A dictionary where the key is band name and the value is the keyword referring to the band within the catalogue. For instance, in Gaia: bands={'G': 'Gmag'}. If not available, set it to None.

  • errors (list [str], optional) – A list with the 6 keywords that refer to the uncertainty parameters within the catalogue in the order: [ra, dec, pmra, pmdec, parallax, rad_vel]. If some parameters are not available, please pass each one as None. Ex: errors=['eRA', 'eDEC', None, None, None, None], or errors=None if none of the errors is available.

Examples

To define the Gaia-EDR3 catalogue with VizierCatalogue, we must define a object like:

>>> catalogue = VizierCatalogue(name='GaiaEDR3', cat_path='I/350/gaiaedr3', code='Source', ra='RA_ICRS', dec='DE_ICRS',
>>>                             pmra='pmRA', pmdec='pmDE', epoch='Epoch', parallax='Plx', rad_vel='RVDR2', band={'G': 'Gmag'},
>>>                             errors=['e_RA_ICRS', 'e_DE_ICRS', 'e_pmRA', 'e_pmDE', 'e_Plx', 'e_RVDR2'])
parse_catalogue(table)

Properly interprets the table

Parameters

table (astropy.table.Table) – The table with the parameters read from the catalogue server

Returns

cat_info – Dictionary with the list of parameters

Return type

dict

search_region(coord, radius=None, width=None, height=None, columns=None, row_limit=10000000, timeout=600, **kwargs)[source]
Parameters
  • coord (str, astropy.coordinates.SkyCoord) – The target around which to search. It may be specified as a string in which case it is resolved using online services or as the appropriate astropy SkyCoord object. ICRS coordinates may also be entered as a string.

  • radius (number) – The radius of the circular region to query.

  • width (number) – The width in of the square region to query.

  • height (number) – When set in addition to width, the queried region becomes rectangular, with the specified width and height.

  • columns (list) – List of strings with the keyword to fetch the catalog. If columns=None it will download all the columns. If columns="simple" it will download only the columns for the code, epoch and astrometric parameters.

  • row_limit (int) – Maximum number of rows that will be fetched from the result (set to -1 for unlimited). Default: row_limit=10_000_000

  • timeout (number) – timeout for connecting to server in seconds. Default: timeout=600

  • **kwargs – Any other keyword argument will be passed to astroquery.vizier.Vizier

Returns

catalogue – An astropy Table with all the information about the star

Return type

astropy.table.Table

search_star(code=None, coord=None, radius=None)[source]

Looks for a specific star in the catalogue

Parameters
  • code (str) – The unique id of the star

  • coord (str, astropy.coordinates.SkyCoord) – The target coordinate which to search. It may be specified as a string in which case it is resolved using online services or as the appropriate astropy SkyCoord object. ICRS coordinates may also be entered as a string.

  • radius (number) – The radius of the circular region to query.

Returns

catalogue – An astropy Table with all the information about the star

Return type

astropy.table.Table

Raises

ValueError – Raised when code or (coord, radius) are not provided.

Notes

This function must be called in one of the following ways:

  • Using code if the unique id of the star is known

  • Using coord and radius if the catalogue position is known.

If both alternatives are provided, only the first is used.

Complementary functions

sora.star.utils.kervella(magB=None, magV=None, magK=None)[source]

Determines the diameter of a star in mas using equations from Kervella et. al (2004).

See: A&A Vol. 426, No. 1:.

Parameters
  • magB (float, default=None) – The magnitude B of the star.

  • magV (float, default=None) – The magnitude V of the star.

  • magK (float, default=None) – The magnitudes K of the star.

Note

If any of those values is ‘None’, ‘nan’ or higher than 49, it is not considered.

sora.star.utils.van_belle(magB=None, magV=None, magK=None)[source]

Determines the diameter of a star in mas using equations from van Belle (1999).

See: Publi. Astron. Soc. Pacific 111, 1515-1523:.

Parameters
  • magB (float, default=None) – The magnitude B of the star.

  • magV (float, default=None) – The magnitude V of the star.

  • magK (float, default=None) – The magnitude K of the star.

Note

If any of those values is ‘None’, ‘nan’ or higher than 49, it is not considered.