{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# _prediction()_ function and the PredictionTable Class\n",
"\n",
"The prediction module within SORA was created to predict stellar occultation, organize the prediction and plot the occultation maps. The documentation here contains the details about every step. \n",
"\n",
"This Jupyter-Notebook was designed as a tutorial for how to work with the prediction module. Any further question, please contact the core team: Altair Ramos Gomes Júnior, Bruno Eduardo Morgado, Gustavo Benedetti Rossi, and Rodrigo Carlos Boufleur.\n",
"\n",
"**All functions have their Docstring containing its main purpose and the needed parameters (physical description and formats). Please, do not hesitate to use it.**\n",
"\n",
"## 0. Index\n",
"\n",
"1. [Predicting stellar occultation](#section_1)\n",
"2. [Setting and/or modifying parameters](#section_2)\n",
"3. [Apparent Sidereal Time](#section_3)\n",
"4. [Ksi and Eta projection](#section_4)\n",
"5. [MPC observatories](#section_5)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"\n",
"## 1. Predicting stellar occultation\n",
"\n",
"To predict a stellar occultation, the function `prediction()` must be used. It will need a `Body` Object and the time interval for the search. The function will generate the ephemeris within the given interval (with a default step of 60 seconds between positions, that may be changed by the user) and download the star coordinates from VizieR. The function is able to download stars from Gaia-DR2, Gaia-EDR3 and Gaia-DR3. The user must select the one desired by the keys _\"gaiadr2\"_, _\"gaiaedr3\"_ or _\"gaiadr3\"_ (default in v0.3). For every star, it checks the closest ephemeris. An occultation is identified if the distance is smaller than the radius of the Earth plus the radius of the object (given in `Body`) plus the error of the ephemeris (multiplied by a sigma factor given by the user). In the next step, the coordinate of the star is propagated to date using proper motion and parallax. It results in the occultation parameters, such as the Closest Approach distance, the Position Angle, Velocity, etc.\n",
"\n",
"The function returns a `PredictionTable` with all the information."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"SORA version: 0.3\n"
]
}
],
"source": [
"from sora.prediction import prediction"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"\u001b[0;31mSignature:\u001b[0m\n",
"\u001b[0mprediction\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mtime_beg\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mtime_end\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mbody\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mephem\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mmag_lim\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mcatalogue\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'gaiadr3'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mstep\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m60\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mdivs\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0msigma\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mradius\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mverbose\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mreference_center\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'geocenter'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mDocstring:\u001b[0m\n",
"Predicts stellar occultations.\n",
"\n",
"Parameters\n",
"----------\n",
"time_beg : `str`, `astropy.time.Time`, required\n",
" Initial time for prediction.\n",
"\n",
"time_end : `str`, `astropy.time.Time`, required\n",
" Final time for prediction.\n",
"\n",
"body : `sora.Body`, `str`, default=None\n",
" Object that will occult the stars. It must be a Body object or its name\n",
" to search in the Small Body Database.\n",
"\n",
"ephem : `sora.Ephem`, default=None\n",
" object ephemeris. It must be an Ephemeris object.\n",
" If using a EphemHorizons object, please use 'divs' to make division\n",
" at most a month, or a timeout error may be raised by the Horizon query.\n",
"\n",
"mag_lim : `int`, `float`, `dict`, default=None\n",
" Faintest magnitude allowed in the search. If the catalogue has more\n",
" than one band defined in the catalogue object, the magnitude limit can\n",
" be done for a specific band or a set of band. Ex: ``mag_lim={'V': 15}``,\n",
" which will only download stars with V<=15 or ``mag_lim={'V': 15, 'B': 14}``\n",
" which will download stars with V<=15 AND B<=14.\n",
"\n",
"catalogue : `str`, `VizierCatalogue`\n",
" The catalogue to download data. It can be ``'gaiadr2'``, ``'gaiaedr3'``,\n",
" ``'gaiadr3'``, or a VizierCatalogue object. default='gaiadr3'\n",
"\n",
"step : `int`, `float`, default=60\n",
" Step, in seconds, of ephem times for search\n",
"\n",
"divs : `int`, default=1\n",
" Number of regions the ephemeris will be split for better search of\n",
" occultations.\n",
"\n",
"sigma : `int`, `float`, default=1\n",
" Ephemeris error sigma for search off-Earth.\n",
"\n",
"radius : `int`, `float`, default=None\n",
" The radius of the body. It is important if not defined in body or ephem.\n",
"\n",
"verbose : `bool`, default=True\n",
" To show what is being done at the moment.\n",
"\n",
"reference_center : `str`, `sora.Observer`, `sora.Spacecraft`\n",
" A SORA observer object or a string 'geocenter'.\n",
" The occultation parameters will be calculated in respect\n",
" to this reference as center of projection. If a Spacecraft\n",
" is used, please use smaller step since the search will be based\n",
" on the target size and ephemeris error only.\n",
"\n",
"\n",
"Important\n",
"---------\n",
"When instantiating with \"body\" and \"ephem\", the user may call the function\n",
"in 3 ways:\n",
"\n",
"1 - With \"body\" and \"ephem\".\n",
"\n",
"2 - With only \"body\". In this case, the \"body\" parameter must be a Body\n",
"object and have an ephemeris associated (see Body documentation).\n",
"\n",
"3 - With only \"ephem\". In this case, the \"ephem\" parameter must be one of\n",
"the Ephem Classes and have a name (see Ephem documentation) to search\n",
"for the body in the Small Body Database.\n",
"\n",
"Returns\n",
"-------\n",
" : `sora.prediction.PredictionTable`\n",
" PredictionTable with the occultation params for each event.\n",
"\u001b[0;31mFile:\u001b[0m ~/Documentos/códigos/SORA/sora/prediction/core.py\n",
"\u001b[0;31mType:\u001b[0m function\n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"prediction?"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Importing and defining the** `Body` **to be used.**\n",
"\n",
"As showed in the docstring of the `prediction()` function, the user can give a `Body` object, an `Ephem` object, or both (given their restrictions). Please refer to the `Body` tutorial for further explanation.\n",
"\n",
"**Important Note**: The files \"de438_small.bsp\" and \"Chariklo.bsp\" are modified files for the purpose of this guideline. If the user wants to predict for different objects or epochs, proper files should be provided."
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Obtaining data for Chariklo from SBDB\n"
]
}
],
"source": [
"from sora.body import Body\n",
"from sora.ephem import EphemKernel\n",
"\n",
"chariklo = Body(name='Chariklo', spkid='2010199', ephem=['input/bsp/Chariklo.bsp', 'input/bsp/de438_small.bsp'])"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Ephemeris was split in 3 parts for better search of stars\n",
"\n",
"Searching occultations in part 1/3\n",
"Generating Ephemeris between 2017-06-20 00:00:00.000 and 2017-06-23 15:59:00.000 ...\n",
"Downloading stars ...\n",
" 15 GaiaDR3 stars downloaded\n",
"Identifying occultations ...\n",
"\n",
"Searching occultations in part 2/3\n",
"Generating Ephemeris between 2017-06-23 16:00:00.000 and 2017-06-27 07:59:00.000 ...\n",
"Downloading stars ...\n",
" 11 GaiaDR3 stars downloaded\n",
"Identifying occultations ...\n",
"\n",
"Searching occultations in part 3/3\n",
"Generating Ephemeris between 2017-06-27 08:00:00.000 and 2017-06-30 23:59:00.000 ...\n",
"Downloading stars ...\n",
" 18 GaiaDR3 stars downloaded\n",
"Identifying occultations ...\n",
"\n",
"8 occultations found.\n"
]
}
],
"source": [
"pred = prediction(body=chariklo, time_beg='2017-06-20 00:00:00', time_end='2017-07-01 00:00:00', mag_lim=18, divs=3)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Important**\n",
"\n",
"The default prediction is made considering the geocenter as center of reference. However, the prediction can also be made for a specific observer. In this case, it is important to note that the search considers only the size of the object and ephemeris error. If the object is very small, consider using a time `step` for initial prediction smaller, or using a different `radius` to avoid losing a promising event. Notice the occultation parameters (closest appoach time and distance, ...) are referred to the observer."
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Ephemeris was split in 3 parts for better search of stars\n",
"\n",
"Searching occultations in part 1/3\n",
"Generating Ephemeris between 2017-06-20 00:00:00.000 and 2017-06-23 15:59:50.000 ...\n",
"Downloading stars ...\n",
" 10 GaiaDR3 stars downloaded\n",
"Identifying occultations ...\n",
"\n",
"Searching occultations in part 2/3\n",
"Generating Ephemeris between 2017-06-23 16:00:00.000 and 2017-06-27 07:59:50.000 ...\n",
"Downloading stars ...\n",
" 8 GaiaDR3 stars downloaded\n",
"Identifying occultations ...\n",
"\n",
"Searching occultations in part 3/3\n",
"Generating Ephemeris between 2017-06-27 08:00:00.000 and 2017-06-30 23:59:50.000 ...\n",
"Downloading stars ...\n",
" 15 GaiaDR3 stars downloaded\n",
"Identifying occultations ...\n",
"\n",
"1 occultations found.\n"
]
}
],
"source": [
"from sora import Observer\n",
"outeniqua = Observer(name='Outeniqua', lon='+16 49 17.710', lat='-21 17 58.170', height=1416,\n",
" ephem=['input/bsp/Chariklo.bsp', 'input/bsp/de438_small.bsp'])\n",
"\n",
"obs_pred = prediction(body=chariklo, time_beg='2017-06-20 00:00:00', time_end='2017-07-01 00:00:00', step=10,\n",
" mag_lim=18, divs=3, reference_center=outeniqua)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"PredictRow index=0\n",
"
\n",
"| Epoch | ICRS Star Coord at Epoch | Geocentric Object Position | C/A | P/A | Vel | Dist | G | long | loct | M-G-T | S-G-T | GaiaDR3 Source ID |
\n",
" | | | arcsec | deg | km / s | AU | mag | deg | hh:mm | deg | deg | |
\n",
"| object | object | object | float64 | float64 | float64 | float64 | float64 | float64 | str5 | float64 | float64 | str19 |
\n",
"| 2017-06-22 21:21:25.600 | 18 55 15.65251 -31 31 21.67062 | 18 55 15.65251 -31 31 21.67688 | 0.006 | 179.52 | -22.36 | 14.659 | 14.224 | 52 | 00:50 | 149 | 166 | 6760223758801661440 |
\n",
"
"
],
"text/plain": [
"\n",
" Epoch ICRS Star Coord at Epoch Geocentric Object Position C/A P/A Vel Dist G long loct M-G-T S-G-T GaiaDR3 Source ID \n",
" arcsec deg km / s AU mag deg hh:mm deg deg \n",
" object object object float64 float64 float64 float64 float64 float64 str5 float64 float64 str19 \n",
"----------------------- ------------------------------ ------------------------------ ------- ------- ------- ------- ------- ------- ----- ------- ------- -------------------\n",
"2017-06-22 21:21:25.600 18 55 15.65251 -31 31 21.67062 18 55 15.65251 -31 31 21.67688 0.006 179.52 -22.36 14.659 14.224 52 00:50 149 166 6760223758801661440"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"obs_pred[0]"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"PredictRow index=2\n",
"\n",
"| Epoch | ICRS Star Coord at Epoch | Geocentric Object Position | C/A | P/A | Vel | Dist | G | long | loct | M-G-T | S-G-T | GaiaDR3 Source ID |
\n",
" | | | arcsec | deg | km / s | AU | mag | deg | hh:mm | deg | deg | |
\n",
"| object | object | object | float64 | float64 | float64 | float64 | float64 | float64 | str5 | float64 | float64 | str19 |
\n",
"| 2017-06-22 21:18:48.200 | 18 55 15.65251 -31 31 21.67062 | 18 55 15.65249 -31 31 21.62190 | 0.049 | 359.72 | -22.00 | 14.659 | 14.224 | 53 | 00:50 | 149 | 166 | 6760223758801661440 |
\n",
"
"
],
"text/plain": [
"\n",
" Epoch ICRS Star Coord at Epoch Geocentric Object Position C/A P/A Vel Dist G long loct M-G-T S-G-T GaiaDR3 Source ID \n",
" arcsec deg km / s AU mag deg hh:mm deg deg \n",
" object object object float64 float64 float64 float64 float64 float64 str5 float64 float64 str19 \n",
"----------------------- ------------------------------ ------------------------------ ------- ------- ------- ------- ------- ------- ----- ------- ------- -------------------\n",
"2017-06-22 21:18:48.200 18 55 15.65251 -31 31 21.67062 18 55 15.65249 -31 31 21.62190 0.049 359.72 -22.00 14.659 14.224 53 00:50 149 166 6760223758801661440"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pred['2017-06-22 21']"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"\n",
"## 2. The PredictionTable\n",
"\n",
"The resulting variable of the prediction function is a `PredictionTable` Object. The `PredictionTable` Class was created to have all the information about the occultations predicted, plot occultation maps and save the table in other formats.\n",
"\n",
"**The** `PredictionTable` **is a class that inherits all methods from** `Astropy.table.Table` **. All the functions present in** `Astropy.table.Table` **should work for** `PredictionTable`.\n",
"\n",
"More information about it at https://docs.astropy.org/en/stable/table/"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**if the user asks to print the prediction, a summary of the table is shown.**"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" Epoch ICRS Star Coord at Epoch ... GaiaDR3 Source ID \n",
" ... \n",
"----------------------- ------------------------------ ... -------------------\n",
"2017-06-21 09:57:43.440 18 55 36.17454 -31 31 19.03261 ... 6760228702284187264\n",
"2017-06-22 02:58:37.480 18 55 26.31652 -31 31 20.38440 ... 6760228839723992320\n",
"2017-06-22 21:18:48.200 18 55 15.65251 -31 31 21.67062 ... 6760223758801661440\n",
"2017-06-23 21:34:37.660 18 55 01.48119 -31 31 22.44257 ... 6760223513963694208\n",
"2017-06-24 10:13:39.980 18 54 54.06755 -31 31 22.36732 ... 6760226503261782656\n",
"2017-06-25 10:55:09.320 18 54 39.55296 -31 31 21.69987 ... 6760225163236852864\n",
"2017-06-26 08:14:35.540 18 54 26.97503 -31 31 20.51255 ... 6760226060885482624\n",
"2017-06-26 20:46:07.140 18 54 19.56971 -31 31 20.43382 ... 6760225712991422208\n"
]
}
],
"source": [
"print(pred)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**to print the complete table, we must use:**"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" Epoch ICRS Star Coord at Epoch Geocentric Object Position C/A P/A Vel Dist G long loct M-G-T S-G-T GaiaDR3 Source ID \n",
" arcsec deg km / s AU mag deg hh:mm deg deg \n",
"----------------------- ------------------------------ ------------------------------ ------ ------ ------ ------- ------ ---- ----- ----- ----- -------------------\n",
"2017-06-21 09:57:43.440 18 55 36.17454 -31 31 19.03261 18 55 36.17500 -31 31 19.60516 0.573 179.41 -21.84 14.663 15.254 225 00:56 128 165 6760228702284187264\n",
"2017-06-22 02:58:37.480 18 55 26.31652 -31 31 20.38440 18 55 26.31674 -31 31 20.74213 0.358 179.55 -21.92 14.661 17.929 329 00:53 138 166 6760228839723992320\n",
"2017-06-22 21:18:48.200 18 55 15.65251 -31 31 21.67062 18 55 15.65249 -31 31 21.62190 0.049 359.72 -22.00 14.659 14.224 53 00:50 149 166 6760223758801661440\n",
"2017-06-23 21:34:37.660 18 55 01.48119 -31 31 22.44257 18 55 01.48116 -31 31 22.22700 0.216 359.91 -22.10 14.657 17.818 48 00:46 162 167 6760223513963694208\n",
"2017-06-24 10:13:39.980 18 54 54.06755 -31 31 22.36732 18 54 54.06755 -31 31 22.28669 0.081 0.01 -22.15 14.656 17.928 218 00:43 167 168 6760226503261782656\n",
"2017-06-25 10:55:09.320 18 54 39.55296 -31 31 21.69987 18 54 39.55291 -31 31 21.89148 0.192 180.23 -22.23 14.654 16.955 206 00:39 164 168 6760225163236852864\n",
"2017-06-26 08:14:35.540 18 54 26.97503 -31 31 20.51255 18 54 26.97476 -31 31 20.99937 0.487 180.41 -22.30 14.653 17.603 245 00:35 154 169 6760226060885482624\n",
"2017-06-26 20:46:07.140 18 54 19.56971 -31 31 20.43382 18 54 19.56985 -31 31 20.23484 0.199 0.51 -22.33 14.652 17.702 57 00:33 147 169 6760225712991422208\n"
]
}
],
"source": [
"pred.pprint_all()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"*M-G-T stands for Moon-Geocenter-Target, the on-sky angle between the star and the moon*\n",
"\n",
"*S-G-T stands for Sun-Geocenter-Target, the on-sky angle between the star and the sun*"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**The** `PredictionTable` **can be exported to PRAIA format file**\n",
"\n",
"In this case, some information, such as the Gaia-DR2 Source ID, S-G-T and M-G-T, are lost."
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"\u001b[0;31mSignature:\u001b[0m \u001b[0mpred\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mto_praia\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mDocstring:\u001b[0m\n",
"Writes PredictionTable to PRAIA format.\n",
"\n",
"Parameters\n",
"----------\n",
"filename : `str`\n",
" Name of the file to save table.\n",
"\u001b[0;31mFile:\u001b[0m ~/Documentos/códigos/SORA/sora/prediction/table.py\n",
"\u001b[0;31mType:\u001b[0m method\n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"pred.to_praia?"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"pred.to_praia('output/Chariklo_occs.table')\n",
"# Check your folder named output"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**The** `PredictionTable` **can also generate the files in the Occult Watcher feed format**\n",
"\n",
"These are two files, named 'LOG.dat' and 'tableOccult_update.txt'. The occult watcher designation for the object must be informed. For instance, for the satellite Himalia, the designation is \"P5M06\". If `mode='append'` the prediction will be appended to an existing file. If `mode='restart'`, the file will be overwritten."
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"\u001b[0;31mSignature:\u001b[0m \u001b[0mpred\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mto_ow\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mow_des\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmode\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'append'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mDocstring:\u001b[0m\n",
"Writes PredictionTable to OccultWatcher feeder update file format.\n",
"Tables will be saved in two files: \"tableOccult_update.txt\" and \"LOG.dat\"\n",
"\n",
"Parameters\n",
"----------\n",
"ow_des : `str`\n",
" Occult Watcher designation for the object.\n",
"\n",
"mode : `str`, default='append'\n",
" Use ``'append'`` to append table to already existing file and\n",
" ``'restart'`` to overwrite existing file.\n",
"\u001b[0;31mFile:\u001b[0m ~/Documentos/códigos/SORA/sora/prediction/table.py\n",
"\u001b[0;31mType:\u001b[0m method\n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"pred.to_ow?"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/altair/Documentos/códigos/SORA/sora/prediction/table.py:417: UserWarning: error_ra and/or error_dec is 0.0, please update the value manually in \"tableOccult_update.txt\" before submitting the file\n",
" warnings.warn('error_ra and/or error_dec is 0.0, please update the value manually in '\n"
]
}
],
"source": [
"pred.to_ow('1997CU26')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Using the functions from** `Astropy.table.Table` **, the data can be exported to many other formats using the funtion 'write'**\n",
"\n",
"The formats allowed can be seen in https://docs.astropy.org/en/stable/io/unified.html#built-in-readers-writers. This includes latex and csv."
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
"pred.write('output/prediction.tex', overwrite=True)\n",
"# Check your folder named output"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"\n",
"## 3. Using PredictionTable\n",
"\n",
"The `PredictionTable` was not created to be instantiated directly by the user. It was designed to be an insteresting output object from the prediction function. However, a `PredictionTable` can be instantiated from a PRAIA occultation table. For this, a `PredictionTable` method must be called directly as shown below."
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
"from sora.prediction import PredictionTable"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"\u001b[0;31mSignature:\u001b[0m \u001b[0mPredictionTable\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfrom_praia\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mname\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mDocstring:\u001b[0m\n",
"Creates a PredictionTable Table reading from a PRAIA table.\n",
"\n",
"Parameters\n",
"----------\n",
"filename : `str`\n",
" Path to the PRAIA table file.\n",
"\n",
"name : `str`\n",
" Name of the Object of the prediction.\n",
"\n",
"radius : `int`, `float`, optional\n",
" Object radius, in km.\n",
" If not given it's searched in online database.\n",
" When not found online, the default is set to zero.\n",
"\n",
"Returns\n",
"-------\n",
" : `sora.prediction.PredictionTable`\n",
" A PredictionTable object.\n",
"\u001b[0;31mFile:\u001b[0m ~/Documentos/códigos/SORA/sora/prediction/table.py\n",
"\u001b[0;31mType:\u001b[0m method\n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"PredictionTable.from_praia?"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Obtaining data for chariklo from SBDB\n"
]
}
],
"source": [
"pred_1 = PredictionTable.from_praia(filename='output/Chariklo_occs.table', name='Chariklo')"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" Epoch ICRS Star Coord at Epoch Geocentric Object Position C/A P/A Vel Dist G long loct M-G-T S-G-T Source ID\n",
" arcsec deg km / s AU mag deg hh:mm deg deg \n",
"----------------------- ------------------------------ ------------------------------ ------ ------ ------ ------- ------ ---- ----- ----- ----- ----------\n",
"2017-06-21 09:57:43.400 18 55 36.17450 -31 31 19.03260 18 55 36.17500 -31 31 19.60520 0.573 179.41 -21.84 14.660 15.204 225 00:56 128 165 \n",
"2017-06-22 02:58:37.400 18 55 26.31650 -31 31 20.38440 18 55 26.31670 -31 31 20.74210 0.358 179.55 -21.92 14.660 17.900 329 00:53 138 166 \n",
"2017-06-22 21:18:48.200 18 55 15.65250 -31 31 21.67060 18 55 15.65250 -31 31 21.62190 0.049 359.72 -22.00 14.660 14.197 53 00:50 149 166 \n",
"2017-06-23 21:34:37.600 18 55 01.48120 -31 31 22.44260 18 55 01.48120 -31 31 22.22700 0.216 359.91 -22.10 14.660 17.792 48 00:46 162 167 \n",
"2017-06-24 10:13:39.900 18 54 54.06750 -31 31 22.36730 18 54 54.06750 -31 31 22.28670 0.081 0.01 -22.15 14.660 17.889 218 00:43 167 168 \n",
"2017-06-25 10:55:09.300 18 54 39.55300 -31 31 21.69990 18 54 39.55290 -31 31 21.89150 0.192 180.23 -22.23 14.650 16.985 206 00:39 164 168 \n",
"2017-06-26 08:14:35.500 18 54 26.97500 -31 31 20.51260 18 54 26.97480 -31 31 20.99940 0.487 180.41 -22.30 14.650 17.582 245 00:35 154 169 \n",
"2017-06-26 20:46:07.100 18 54 19.56970 -31 31 20.43380 18 54 19.56980 -31 31 20.23480 0.199 0.51 -22.33 14.650 17.680 57 00:33 147 169 \n"
]
}
],
"source": [
"pred_1.pprint_all()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To remove some occultations the User can use two functions. The first is the _PredictionTable.remove_occ()_."
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"\u001b[0;31mSignature:\u001b[0m \u001b[0mpred_1\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mremove_occ\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdate\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mDocstring:\u001b[0m\n",
"Removes stellar occultations from table.\n",
"\n",
"Parameters\n",
"----------\n",
"date : `str`, `list`\n",
" Date or list of dates of the occultation to be removed.\n",
" The dates mut be as shown in the 'Epoch' column. If the date is not\n",
" complete, the function will select all occultations that matches the\n",
" given string. For instance, ``date='2020-06'`` will remove all\n",
" occultations from the month of June 2020.\n",
"\u001b[0;31mFile:\u001b[0m ~/Documentos/códigos/SORA/sora/prediction/table.py\n",
"\u001b[0;31mType:\u001b[0m method\n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"pred_1.remove_occ?"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
"pred_1.remove_occ('2017-06-21 09:57')"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" Epoch ICRS Star Coord at Epoch Geocentric Object Position C/A P/A Vel Dist G long loct M-G-T S-G-T Source ID\n",
" arcsec deg km / s AU mag deg hh:mm deg deg \n",
"----------------------- ------------------------------ ------------------------------ ------ ------ ------ ------- ------ ---- ----- ----- ----- ----------\n",
"2017-06-22 02:58:37.400 18 55 26.31650 -31 31 20.38440 18 55 26.31670 -31 31 20.74210 0.358 179.55 -21.92 14.660 17.900 329 00:53 138 166 \n",
"2017-06-22 21:18:48.200 18 55 15.65250 -31 31 21.67060 18 55 15.65250 -31 31 21.62190 0.049 359.72 -22.00 14.660 14.197 53 00:50 149 166 \n",
"2017-06-23 21:34:37.600 18 55 01.48120 -31 31 22.44260 18 55 01.48120 -31 31 22.22700 0.216 359.91 -22.10 14.660 17.792 48 00:46 162 167 \n",
"2017-06-24 10:13:39.900 18 54 54.06750 -31 31 22.36730 18 54 54.06750 -31 31 22.28670 0.081 0.01 -22.15 14.660 17.889 218 00:43 167 168 \n",
"2017-06-25 10:55:09.300 18 54 39.55300 -31 31 21.69990 18 54 39.55290 -31 31 21.89150 0.192 180.23 -22.23 14.650 16.985 206 00:39 164 168 \n",
"2017-06-26 08:14:35.500 18 54 26.97500 -31 31 20.51260 18 54 26.97480 -31 31 20.99940 0.487 180.41 -22.30 14.650 17.582 245 00:35 154 169 \n",
"2017-06-26 20:46:07.100 18 54 19.56970 -31 31 20.43380 18 54 19.56980 -31 31 20.23480 0.199 0.51 -22.33 14.650 17.680 57 00:33 147 169 \n"
]
}
],
"source": [
"pred_1.pprint_all()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The second function is the `PredictionTable.keep_from_selected_images()` this function will check the names in the saved images and eliminate the occultations without the map. This functions allows that after the user deleted the maps of the unwanted occultation it will eliminate the respective rows in the `PredictionTable`. "
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"\u001b[0;31mSignature:\u001b[0m \u001b[0mpred_1\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mkeep_from_selected_images\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mpath\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'.'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mDocstring:\u001b[0m\n",
"Keeps predictions which images were not deleted in given path.\n",
"This function uses the name of the images to identify predictions.\n",
"The name must be the automatic one generated by plot_occ_map().\n",
"The format of the image is not relevant.\n",
"\n",
"Parameters\n",
"----------\n",
"path : `str`\n",
" Path where images are located.\n",
"\u001b[0;31mFile:\u001b[0m ~/Documentos/códigos/SORA/sora/prediction/table.py\n",
"\u001b[0;31mType:\u001b[0m method\n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"pred_1.keep_from_selected_images?"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"\n",
"## 4. Plotting occultation maps\n",
"\n",
"SORA is also able to generate an occultation map. The only required parameters are the occultation parameters. The function also has many inputs to configure the plot.\n",
"\n",
"The first time the function is called, cartopy will download some data referring to the features presented in the map, such as the country and state division, lakes, rivers, etc."
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [],
"source": [
"from sora.prediction import plot_occ_map"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"\u001b[0;31mSignature:\u001b[0m\n",
"\u001b[0mplot_occ_map\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mname\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mradius\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mcoord\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mtime\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mca\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mpa\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mvel\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mdist\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mmag\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mlongi\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mDocstring:\u001b[0m\n",
"Plots the map of the occultation.\n",
"\n",
"Parameters\n",
"----------\n",
"name : `str`\n",
" Name of the object.\n",
"\n",
"radius : `int`, `float`\n",
" Radius of the object, in km.\n",
"\n",
"coord : `str`, `astropy.coordinates.SkyCoord`\n",
" Coordinates of the star (``\"hh mm ss.sss dd mm ss.sss\"`` or\n",
" ``\"hh.hhhhhhhh dd.dddddddd\"``).\n",
"\n",
"time : `str`, `astropy.time.Time`\n",
" Instant of Closest Approach (iso or isot format).\n",
"\n",
"ca : `int`, `float`\n",
" Closest Approach Distance, in arcsec.\n",
"\n",
"pa : `int`, `float`\n",
" Position Angle at C/A, in degrees.\n",
"\n",
"vel : `int`, `float`\n",
" Velocity of the event, in km/s.\n",
"\n",
"dist : `int`, `float`\n",
" Object distance at C/A, in AU.\n",
"\n",
"mag : `int`, `float`, default=0\n",
" Mag* = Normalized magnitude to vel=20km/s.\n",
"\n",
"longi : `int`, `float`, default=0\n",
" East longitude of sub-planet point, deg, positive towards East.\n",
"\n",
"nameimg : `str`\n",
" Change the name of the imaged saved.\n",
"\n",
"path : `str`\n",
" Path to a directory where to save map.\n",
"\n",
"resolution : `int`, default=2\n",
" Cartopy feature resolution.\n",
"\n",
" - ``1`` means a resolution of \"10m\";\n",
"\n",
" - ``2`` a resolution of \"50m\";\n",
"\n",
" - ``3`` a resolution of \"100m\".\n",
"\n",
"states : `bool`\n",
" If True, plots the states borders of the countries. The states\n",
" of some countries will only be shown depending on the resolution.\n",
"\n",
"zoom : `int`, `float`\n",
" Zooms in or out of the map.\n",
"\n",
"centermap_geo : `list`, default=None\n",
" Center the map given coordinates in longitude and latitude. It must be\n",
" a list with two numbers.\n",
"\n",
"centermap_delta : `list`, default=None\n",
" Displace the center of the map given displacement in X and Y, in km.\n",
" It must be a list with two numbers.\n",
"\n",
"centerproj : `list`\n",
" Rotates the Earth to show occultation with the center projected at a\n",
" given longitude and latitude. It must be a list with two numbers.\n",
"\n",
"labels : `bool`, default=True\n",
" Plots text above and below the map with the occultation parameters.\n",
"\n",
"meridians : `int`, default=30\n",
" Plots lines representing the meridians for given interval, in degrees.\n",
"\n",
"parallels : `int`, default=30\n",
" Plots lines representing the parallels for given interval, in degrees.\n",
"\n",
"sites : `dict`\n",
" Plots site positions in map. It must be a python dictionary where the\n",
" key is the `name` of the site, and the value is a list with `longitude`,\n",
" `latitude`, `delta_x`, `delta_y`, `color` and `marker`. `delta_x` and \n",
" `delta_y` are displacement, in km, from the point position of the site \n",
" in the map and the `name`. `color` is the color of the point. `marker` is\n",
" the symbols used for each stations following matplotlib.pyplot properties. \n",
"\n",
"site_name : `bool`\n",
" If True, it prints the name of the sites given, else it plots only the points.\n",
"\n",
"site_box_alpha : `int`, `float`, default=0\n",
" Sets the transparency of a box surrounding each station name. 0 equals to\n",
" transparent, and 1 equals to opaque.\n",
"\n",
"countries : `dict`\n",
" Plots the names of countries. It must be a python dictionary where the\n",
" key is the name of the country and the value is a list with longitude\n",
" and latitude of the lower left part of the text.\n",
"\n",
"offset : `list`\n",
" Applies an offset to the ephemeris, calculating new CA and instant of\n",
" CA. It is a pair of `delta_RA*cosDEC` and `delta_DEC`.\n",
"\n",
"mapstyle : `int`, default=1\n",
" Define the color style of the map. ``'1'`` is the default black\n",
" and white scale. ``'2'`` is a colored map.\n",
"\n",
"error : `int`, `float`\n",
" Ephemeris error in mas. It plots a dashed line representing radius + error.\n",
"\n",
"ercolor : `str`\n",
" Changes the color of the lines of the error bar.\n",
"\n",
"ring : `int`, `float`\n",
" Plots a dashed line representing the location of a ring. It is given\n",
" in km, from the center.\n",
"\n",
"rncolor : `str`\n",
" Changes the color of ring lines.\n",
"\n",
"atm : `int`, `float`\n",
" Plots a dashed line representing the location of an atmosphere. It is\n",
" given in km, from the center.\n",
"\n",
"atcolor : `str`\n",
" Changes the color of atm lines.\n",
"\n",
"chord_delta : `list`\n",
" List with distances from center to plot chords.\n",
"\n",
"chord_geo : `2d-list`\n",
" List with pairs of coordinates to plot chords.\n",
"\n",
"chcolor : `str`, default='grey'\n",
" Color of the line of the chords.\n",
"\n",
"heights : `list`\n",
" It plots a circular dashed line showing the locations where the observer\n",
" would observe the occultation at a given height above the horizons.\n",
" This must be a list.\n",
"\n",
"hcolor : `str`\n",
" Changes the color of the height lines.\n",
"\n",
"mapsize : `list`, default= [46.0, 38.0]\n",
" The size of figure, in cm. It must be a list with two values.\n",
"\n",
"cpoints : `int`, `float`, default=60\n",
" Interval for the small points marking the center of shadow, in seconds.\n",
"\n",
"ptcolor : `str`\n",
" Change the color of the center points.\n",
"\n",
"alpha : `float`, default=0.2\n",
" The transparency of the night shade, where 0.0 is full transparency and\n",
" 1.0 is full black.\n",
"\n",
"fmt : `str`, default:'png'\n",
" The format to save the image. It is parsed directly by `matplotlib.pyplot`.\n",
"\n",
"dpi : `int`, default=100\n",
" Resolution in \"dots per inch\". It defines the quality of the image.\n",
"\n",
"lncolor : `str`\n",
" Changes the color of the line that represents the limits of the shadow\n",
" over Earth.\n",
"\n",
"outcolor :`str`\n",
" Changes the color of the lines that represents the limits of the shadow\n",
" outside Earth.\n",
"\n",
"scale : `int`, `float`\n",
" Arbitrary scale for the size of the name of the site.\n",
"\n",
"cscale : `int`, `float`\n",
" Arbitrary scale for the name of the country.\n",
"\n",
"sscale : `int`, `float`\n",
" Arbitrary scale for the size of point of the site.\n",
"\n",
"pscale : `int`, `float`\n",
" Arbitrary scale for the size of the points that represent the center of\n",
" the shadow.\n",
"\n",
"arrow : `bool`\n",
" If True, it plots the arrow with the occultation direction.\n",
"\n",
"\n",
"Important\n",
"---------\n",
"Required parameters to plot an occultation map: 'name', 'radius', 'coord',\n",
"'time', 'ca', 'pa', 'vel', and 'dist'.\n",
"\n",
"\n",
"Note\n",
"----\n",
"The parameters 'mag' and 'longi' are optional and only printed in label.\n",
"All other remaining parameters can be used to further customize the Map\n",
"configuration.\n",
"\n",
"When producing the map, only one of 'centermap_geo' or 'centermap_delta'\n",
"options can be used at a time.\n",
"\u001b[0;31mFile:\u001b[0m ~/Documentos/códigos/SORA/sora/prediction/occmap.py\n",
"\u001b[0;31mType:\u001b[0m function\n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plot_occ_map?"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**To make it easier to plot the predictions, the `PredictionTable.plot_occ_map()` function can be called which automatically fills the required parameters.**\n",
"\n",
"To plot the map for all the predictions\n"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"10199 Chariklo_2017-06-21T09_57_43.440.png generated\n",
"10199 Chariklo_2017-06-22T02_58_37.480.png generated\n",
"10199 Chariklo_2017-06-22T21_18_48.200.png generated\n",
"10199 Chariklo_2017-06-23T21_34_37.660.png generated\n",
"10199 Chariklo_2017-06-24T10_13_39.980.png generated\n",
"10199 Chariklo_2017-06-25T10_55_09.320.png generated\n",
"10199 Chariklo_2017-06-26T08_14_35.540.png generated\n",
"10199 Chariklo_2017-06-26T20_46_07.140.png generated\n"
]
}
],
"source": [
"pred.plot_occ_map(path='output/')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To plot the map for only one prediction, just give an item to the `PredictionTable` object."
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"10199 Chariklo_2017-06-21T09_57_43.440.png generated\n"
]
}
],
"source": [
"pred[0].plot_occ_map(path='output/')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**The** `PredictionTable` **can also be plotted by giving the date of the occultation. All the occultations that matches the date will be plotted.**\n",
"\n",
"The date can be as constrained as the user wants, and must match the text that appears in the _'Epoch'_ column."
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"10199 Chariklo_2017-06-26T08_14_35.540.png generated\n",
"10199 Chariklo_2017-06-26T20_46_07.140.png generated\n"
]
}
],
"source": [
"pred['2017-06-26'].plot_occ_map()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"\n",
"## 5. Occultation parameters\n",
"\n",
"Finally, a function is implemented in the prediction module which calculates the occultation parameters. For this function, it must be passed a `Star` Object, an `Ephem` Object (it can be any of the `Ephem` classes) and a time. The time does not need to be precise, but it must be close within 60 minutes from the Closest Approach time."
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [],
"source": [
"from sora.prediction import occ_params"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"\u001b[0;31mSignature:\u001b[0m\n",
"\u001b[0mocc_params\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mstar\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mephem\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mtime\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mn_recursions\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m5\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mmax_tdiff\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mreference_center\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'geocenter'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mDocstring:\u001b[0m\n",
"Calculates the parameters of the occultation, as instant, CA, PA.\n",
"\n",
"Parameters\n",
"----------\n",
"star : `sora.Star`\n",
" The coordinate of the star in the same reference frame as the ephemeris.\n",
" It must be a Star object.\n",
"\n",
"ephem : `sora.Ephem*`\n",
" Object ephemeris. It must be an Ephemeris object.\n",
"\n",
"time : `astropy.time.Time`\n",
" Time close to occultation epoch to calculate occultation parameters.\n",
"\n",
"n_recursions : `int`, default=5\n",
" The number of attempts to try obtain prediction parameters in case the\n",
" event is outside the previous range of time.\n",
"\n",
"max_tdiff : `int`, default=None\n",
" Maximum difference from given time it will attempt to identify the\n",
" occultation, in minutes. If given, 'n_recursions' is ignored.\n",
"\n",
"reference_center : `str`, `sora.Observer`, `sora.Spacecraft`\n",
" A SORA observer object or a string 'geocenter'.\n",
" The occultation parameters will be calculated in respect\n",
" to this reference as center of projection.\n",
"\n",
"Returns\n",
"-------\n",
" Oredered list : `list`\n",
" - Instant of CA (Time): Instant of Closest Approach.\n",
"\n",
" - CA (arcsec): Distance of Closest Approach.\n",
"\n",
" - PA (deg): Position Angle at Closest Approach.\n",
"\n",
" - vel (km/s): Velocity of the occultation.\n",
"\n",
" - dist (AU): the object geocentric distance.\n",
"\u001b[0;31mFile:\u001b[0m ~/Documentos/códigos/SORA/sora/prediction/core.py\n",
"\u001b[0;31mType:\u001b[0m function\n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"occ_params?"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {},
"outputs": [],
"source": [
"from sora.star import Star\n",
"\n",
"s = Star(code='6760225712991422208', verbose=False)"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Time of the CA: 2017-06-26 20:46:07.140 UTC\n",
"Closest Approach: 0.199 arcsec\n",
"Position Angle: 0.511 deg\n",
"Shadow Velocity: -22.333 km / s\n",
"Object Distance: 14.65229 AU\n"
]
}
],
"source": [
"tca, ca, pa, vel, dist = occ_params(star=s, ephem=chariklo.ephem, time='2017-06-26 20:40')\n",
"\n",
"print('Time of the CA: {} UTC'.format(tca))\n",
"print('Closest Approach: {:.3f}'.format(ca))\n",
"print('Position Angle: {:.3f}'.format(pa))\n",
"print('Shadow Velocity: {:.3f}'.format(vel))\n",
"print('Object Distance: {:.5f}'.format(dist))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**This Jupyter-Notebook was designed as a tutorial for how to work with the** `prediction()` **function and** `PredictionTable` **Class. More information about the other classes, please refer to their specif Jupyter-Notebook. Any further question, please contact the core team: Altair Ramos Gomes Júnior, Bruno Eduardo Morgado, Gustavo Benedetti Rossi, and Rodrigo Carlos Boufleur.**\n",
"\n",
"**The End**"
]
}
],
"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.8.13"
}
},
"nbformat": 4,
"nbformat_minor": 4
}