Example #1
0
def ar_pxscale(inmap, cmsqr, mmppx, cmppx):
    """
    Calculate the area of an magnetogram pixel at disk-centre on the solar surface.
    """
    ## Area of pixel in Mm^2
    rsunmm = constants.get('radius').value/1e6
    mmperarcsec = rsunmm/inmap.meta["RSUN_OBS"] # Mm/arcsec
    pixarea = ((inmap.meta["CDELT1"] * mmperarcsec) * (inmap.meta["CDELT2"] * mmperarcsec)) # Mm^2
    if cmsqr is True:
        pixarea = pixarea*1e16
    ## Length of a side of a pixel
    retmmppx = (inmap.meta["CDELT1"]/inmap.meta["RSUN_OBS"])*rsunmm # Mm/px
    if cmppx is True:
        return retmmppx*1e16
    elif mmppx is True:
        return retmmppx
    else:
        return pixarea
Example #2
0
from sunpy import log
from sunpy.sun import constants
from .frames import (
    _J2000,
    GeocentricEarthEquatorial,
    GeocentricSolarEcliptic,
    Heliocentric,
    HeliocentricEarthEcliptic,
    HeliocentricInertial,
    HeliographicCarrington,
    HeliographicStonyhurst,
    Helioprojective,
)

RSUN_METERS = constants.get('radius').si.to(u.m)

__all__ = ['transform_with_sun_center',
           'propagate_with_solar_surface',
           'hgs_to_hgc', 'hgc_to_hgs', 'hcc_to_hpc',
           'hpc_to_hcc', 'hcc_to_hgs', 'hgs_to_hcc',
           'hpc_to_hpc',
           'hcrs_to_hgs', 'hgs_to_hcrs',
           'hgs_to_hgs', 'hgc_to_hgc', 'hcc_to_hcc',
           'hme_to_hee', 'hee_to_hme', 'hee_to_hee',
           'hee_to_gse', 'gse_to_hee', 'gse_to_gse',
           'hgs_to_hci', 'hci_to_hgs', 'hci_to_hci',
           'hme_to_gei', 'gei_to_hme', 'gei_to_gei']


# Boolean flag for whether to ignore the motion of the center of the Sun in inertial space
def test_get_function(this_key):
    """Test that the get function works for all the keys"""
    assert type(con.get(this_key)) is Constant
Example #4
0
def test_get_function(this_key):
    """Test that the get function works for all the keys"""
    assert isinstance(con.get(this_key), Constant)
Example #5
0
                                                UnitSphericalRepresentation)
from astropy.coordinates.transformations import FunctionTransform, DynamicMatrixTransform
from astropy.coordinates.matrix_utilities import matrix_product, rotation_matrix, matrix_transpose

from sunpy.sun import constants

from .frames import Heliocentric, Helioprojective, HeliographicCarrington, HeliographicStonyhurst

try:
    from astropy.coordinates.builtin_frames import _make_transform_graph_docs as make_transform_graph_docs
except ImportError:
    from astropy.coordinates import make_transform_graph_docs as _make_transform_graph_docs
    make_transform_graph_docs = lambda: _make_transform_graph_docs(
        frame_transform_graph)

RSUN_METERS = constants.get('radius').si.to(u.m)

__all__ = [
    'hgs_to_hgc', 'hgc_to_hgs', 'hcc_to_hpc', 'hpc_to_hcc', 'hcc_to_hgs',
    'hgs_to_hcc', 'hpc_to_hpc', 'hcrs_to_hgs', 'hgs_to_hcrs', 'hgs_to_hgs',
    'hgc_to_hgc', 'hcc_to_hcc'
]


def _carrington_offset(obstime):
    """
    Calculate the HG Longitude offest based on a time
    """
    if obstime is None:
        raise ValueError("To perform this transformation the coordinate"
                         " Frame needs a obstime Attribute")
Example #6
0
from sunpy import log
from sunpy.sun import constants
from .frames import (
    _J2000,
    GeocentricEarthEquatorial,
    GeocentricSolarEcliptic,
    Heliocentric,
    HeliocentricEarthEcliptic,
    HeliocentricInertial,
    HeliographicCarrington,
    HeliographicStonyhurst,
    Helioprojective,
)

RSUN_METERS = constants.get('radius').si.to(u.m)

__all__ = [
    'transform_with_sun_center', 'hgs_to_hgc', 'hgc_to_hgs', 'hcc_to_hpc',
    'hpc_to_hcc', 'hcc_to_hgs', 'hgs_to_hcc', 'hpc_to_hpc', 'hcrs_to_hgs',
    'hgs_to_hcrs', 'hgs_to_hgs', 'hgc_to_hgc', 'hcc_to_hcc', 'hme_to_hee',
    'hee_to_hme', 'hee_to_hee', 'hee_to_gse', 'gse_to_hee', 'gse_to_gse',
    'hgs_to_hci', 'hci_to_hgs', 'hci_to_hci', 'hme_to_gei', 'gei_to_hme',
    'gei_to_gei'
]

# Boolean flag for whether to ignore the motion of the center of the Sun in inertial space
_ignore_sun_motion = False


@contextmanager
Example #7
0
    coord_detilt = coord.hcrs.cartesian.transform(_SUN_DETILT_MATRIX)
    return coord_detilt.represent_as(SphericalRepresentation).lon.to('deg')


# J2000.0 epoch
_J2000 = Time('J2000.0', scale='tt')

# One of the two nodes of intersection between the ICRF equator and Sun's equator in HCRS
_NODE = SkyCoord(_SOLAR_NORTH_POLE_HCRS.lon + 90 * u.deg,
                 0 * u.deg,
                 frame='hcrs')

# The longitude in the de-tilted frame of the Sun's prime meridian.
# The IAU (Seidelmann et al. 2007 and later) defines the true longitude of the meridian (i.e.,
# without light travel time to Earth and aberration effects) as 84.176 degrees eastward at J2000.
_DLON_MERIDIAN = Longitude(_detilt_lon(_NODE) + constants.get('W_0'))


@add_common_docstring(**_variables_for_parse_time_docstring())
def L0(time='now',
       light_travel_time_correction=True,
       nearest_point=True,
       aberration_correction=False):
    """
    Return the L0 angle for the Sun at a specified time, which is the apparent Carrington longitude
    of the Sun-disk center as seen from Earth.

    Observer corrections can be disabled, and then this function will instead return the true
    Carrington longitude.

    Parameters
Example #8
0
def test_get_function(this_key):
    """
    Test that the get function works for all the keys.
    """
    assert isinstance(con.get(this_key), Constant)
Example #9
0
def test_get_function(this_key):
    """Test that the get function works for all the keys"""
    assert type(con.get(this_key)) is Constant