Created
December 14, 2022 11:50
-
-
Save hayesla/57e3ae1e1112df388c407c89116e3b74 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"id": "b4ec5dec", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"from sunpy.coordinates import frames, get_horizons_coord\n", | |
"from astropy import units as u\n", | |
"from astropy.coordinates import SkyCoord\n", | |
"from astropy.time import Time" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "47b4ee0d", | |
"metadata": {}, | |
"source": [ | |
"define an observer time and then we can get the position of Solar Orbiter from JPL horizons at this time" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"id": "bfd3134b", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"INFO: Obtained JPL HORIZONS location for Solar Orbiter (spacecraft) (-144 [sunpy.coordinates.ephemeris]\n" | |
] | |
} | |
], | |
"source": [ | |
"obstime = Time(\"2022-12-14 00:00\")\n", | |
"solo_coord = get_horizons_coord(\"solo\", obstime)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "17733589", | |
"metadata": {}, | |
"source": [ | |
"We can define a coordinate as seen from Earth - say the center of the Sun (0, 0) in helioprojective frame.\n", | |
"As the helioprojective frame is observer based, we pass an observer (here \"earth\" but you can pass any SkyCoord object), and an observer time" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"id": "37831440", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"coord_from_earth = SkyCoord(0*u.arcsec, 0*u.arcsec, \n", | |
" frame=frames.Helioprojective(observer=\"earth\", obstime=obstime))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"id": "920e5b70", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"<SkyCoord (Helioprojective: obstime=2022-12-14 00:00:00.000, rsun=695700.0 km, observer=<HeliographicStonyhurst Coordinate for 'earth'>): (Tx, Ty) in arcsec\n", | |
" (0., 0.)>" | |
] | |
}, | |
"execution_count": 4, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"coord_from_earth" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "074aba03", | |
"metadata": {}, | |
"source": [ | |
"We can then transform this coordinate into other frames, say heliographic Carrington" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"id": "05428d9c", | |
"metadata": { | |
"scrolled": true | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"<SkyCoord (HeliographicCarrington: obstime=2022-12-14 00:00:00.000, rsun=695700.0 km, observer=<HeliographicStonyhurst Coordinate for 'earth'>): (lon, lat, radius) in (deg, deg, AU)\n", | |
" (242.08689194, -0.74324049, 0.00465047)>" | |
] | |
}, | |
"execution_count": 5, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"coord_carrington = coord_from_earth.transform_to(frames.HeliographicCarrington)\n", | |
"coord_carrington" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "e9cf3f6a", | |
"metadata": {}, | |
"source": [ | |
"And we can transform it to other helioprojective frames from other observers. To find out the helioprojective coordinate from the observer os Solar Orbiter we can pass the `solo_coord` as the observer to create a HPC frame and then transform the coordinate to that frame" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"id": "e0112f83", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"<SkyCoord (Helioprojective: obstime=2022-12-14 00:00:00.000, rsun=695700.0 km, observer=<HeliographicStonyhurst Coordinate (obstime=2022-12-14 00:00:00.000, rsun=695700.0 km): (lon, lat, radius) in (deg, deg, AU)\n", | |
" (-16.90639166, 5.39949693, 0.88712126)>): (Tx, Ty, distance) in (arcsec, arcsec, AU)\n", | |
" (315.99531972, -111.86391197, 0.88269874)>" | |
] | |
}, | |
"execution_count": 6, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"coord_from_solo = coord_from_earth.transform_to(frames.Helioprojective(observer=solo_coord))\n", | |
"coord_from_solo" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"id": "a2b3d87b", | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3 (ipykernel)", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.10.6" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 5 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment