SunPy sun

sunpy.sun Module

Contains astronomical and physical constants for use in SunPy or other places.

The package contains a _constants module that define the constants. A typical use case might be:

from sunpy.sun._constants import physical_constants as con


apparent_declination([t]) Returns the apparent declination of the Sun.
apparent_longitude([t]) Returns the apparent longitude of the Sun.
apparent_rightascenscion([t]) Returns the apparent right ascenscion of the Sun.
carrington_rotation_number([t]) Return the Carrington Rotation number
eccentricity_SunEarth_orbit([t]) Returns the eccentricity of the Sun Earth Orbit.
equation_of_center([t]) Returns the Sun’s equation of center (in degrees)
geometric_mean_longitude([t]) Returns the geometric mean longitude (in degrees)
heliographic_solar_center([t]) Returns the position of the solar center in heliographic coordinates.
mean_anomaly([t]) Returns the mean anomaly (the angle through which the Sun has moved assuming a circular orbit) as a function of time.
mean_ecliptic_longitude([t]) Returns the mean ecliptic longitude.
print_params([t]) Print out a summary of Solar ephemeris
solar_north([t]) Returns the position of the Solar north pole in degrees.
solar_semidiameter_angular_size([t]) Return the angular size of the semi-diameter of the Sun as a function of time as viewed from Earth (in arcsec) ..
sunearth_distance([t]) Returns the Sun Earth distance (AU).
true_anomaly([t]) Returns the Sun’s true anomaly (in degress).
true_latitude([t]) Returns the true latitude.
true_longitude([t]) Returns the Sun’s true geometric longitude (in degrees) (Refered to the mean equinox of date.

sunpy.sun.constants Module

Fundamental Solar Physical Constants

These constants are taken from various sources. The structure of this module is heavily based on if not directly copied from the SciPy constants module but contains olar Physical constants.


physical_constants : dict
A dictionary containing physical constants. Keys are the names of physical constants, values are tuples (value, units, uncertainty). The dictionary contains the following solar physical constants:
average density:
The average density of the Sun.
The average angular size of the Sun as seen from Earth in arcseconds.
effective temperature:
The effective black-body temperature of the Sun in Kelvin.
The ellipticity of the Sun.
escape velocity:
The velocity which an object needs to escape from the gravitational pull of the Sun.
The luminosity of the Sun.
The mass of the Sun.
mass conversion rate:
The rate at which the Sun converts mass to energy.
mean energy production:
The mean rate at which the Sun produces energy.
mean intensity:
The mean intensity of the Sun.
The metallicity of the Sun.
The radius of the Sun at the equator.
solar flux unit:
The definition of a solar flux unit.
sunspot cycle:
The average duration of the solar activity cycle.
surface area:
The surface area of the Sun.
surface gravity:
The gravitational acceleration at the surface of the Sun as measured at the equator.
visual magnitude:
A measure of the Sun’s brightness as seen by an observer on Earth without the presence of the atmosphere.
The volume of the Sun.


A number of variables from physical_constants are made available for convenience as attributes.


constant(key) The constant in physical_constants index by key :Parameters: key : Python string or unicode Key in dictionary in physical_constants :Returns: constant : constant constant in physical_constants corresponding to key ..
find([sub, disp]) Return list of physical_constants keys containing a given string :Parameters: sub : str, unicode Sub-string to search keys for.
print_all([key]) Prints out the complete list of physical_constants to the screen or one single value :Parameters: key : Python string or unicode Key in dictionary physical_constants :Returns: None : ..
uncertainty(key) Relative uncertainty in physical_constants indexed by key :Parameters: key : Python string or unicode Key in dictionary physical_constants :Returns: prec : float Relative uncertainty in physical_constants corresponding to key ..
unit(key) Unit in physical_constants indexed by key :Parameters: key : Python string or unicode Key in dictionary physical_constants :Returns: unit : Python string Unit in physical_constants corresponding to key ..
value(key) Value in physical_constants indexed by key :Parameters: key : Python string or unicode Key in dictionary physical_constants :Returns: value : float Value in physical_constants corresponding to key ..

sunpy.sun.models Module

Solar Physical Models

This module contains standard models of the sun from various sources. All data is saved in pandas DataFrames with two added attributes

  • source : names the source of the data
  • units : a dictionary with the units of each of the columns


interior : pandas.DataFrame
The standard model of the solar interior
evolution : pandas.DatFrame
The evolution as a function of time of the Sun

sunpy.sun.position Module

Position of the Sun.


position(date[, radian]) Routine to calculate the right ascension (RA) and declination (dec) of the Sun.