Skip to content

Commit

Permalink
colour and outlier nbs
Browse files Browse the repository at this point in the history
  • Loading branch information
jrob93 committed Oct 7, 2024
1 parent c1e99d8 commit 7324815
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 21 deletions.
4 changes: 3 additions & 1 deletion docs/notebooks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ Notebooks

Introducing Jupyter Notebooks <notebooks/intro_notebook>
Adler phasecurve models <notebooks/adler_phasecurve_example>
Adler plotting example <notebooks/plotting_utilities_example>
Adler plotting example <notebooks/plotting_utilities_example>
Adler outlier detection <notebooks/outlier_detection_example>
Adler colour measurement <notebooks/colour_functions_example>
22 changes: 16 additions & 6 deletions docs/notebooks/colour_functions_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "d3190549",
"id": "6ebe3e22",
"metadata": {},
"source": [
"# Adler running colour measurement\n",
Expand Down Expand Up @@ -146,22 +146,32 @@
"adler_data.get_phase_parameters_in_filter(\"g\", \"HG12_Pen16\").__dict__"
]
},
{
"cell_type": "markdown",
"id": "e07e86a8",
"metadata": {},
"source": [
"# Get determine the apparitions (periods of observability) of the object\n",
"Get the boundary times for each apparation of the object in the survey using the Adler helper function `apparition_gap_finder`.\n",
"In this example we will just look at changes in colour for a single apparition"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "73871e56",
"metadata": {},
"outputs": [],
"source": [
"# get the boundary times for each apparation of the object in the survey\n",
"# in this example we will just look at changes in colour for a single apparition\n",
"# combine all measurements in r and g into one dataframe as apparitions are filter independent\n",
"df_obs_all = pd.DataFrame()\n",
"for filt in [\"r\", \"g\"]:\n",
" obs = planetoid.observations_in_filter(filt)\n",
" _df_obs = pd.DataFrame(obs.__dict__)\n",
" df_obs_all = pd.concat([df_obs_all, _df_obs])\n",
"df_obs_all = df_obs_all.sort_values(\"midPointMjdTai\")\n",
"\n",
"# get the boundary times\n",
"t_app = apparition_gap_finder(np.array(df_obs_all[\"midPointMjdTai\"]))\n",
"print(t_app)"
]
Expand All @@ -176,7 +186,7 @@
},
{
"cell_type": "markdown",
"id": "5fd261a3",
"id": "08f25eb8",
"metadata": {},
"source": [
"Here we simulate observations coming night-by-night and the calculation of a g-r colour for the object\n"
Expand Down Expand Up @@ -298,7 +308,7 @@
},
{
"cell_type": "markdown",
"id": "7f505a7e",
"id": "fae0b512",
"metadata": {},
"source": [
"Now we can plot how the colour changes as a function of time"
Expand Down Expand Up @@ -344,7 +354,7 @@
},
{
"cell_type": "markdown",
"id": "620fe556",
"id": "2aad6ee0",
"metadata": {},
"source": [
"These colours can then be run through the previously written outlier detection functions.\n",
Expand Down
34 changes: 20 additions & 14 deletions docs/notebooks/outlier_detection_example.ipynb
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "5b6823e7",
"metadata": {},
"source": [
"# Adler outlier detection\n",
"This notebook demonstrates some of the functions provide by Adler to assist with simple outlier detection"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -60,7 +69,7 @@
"metadata": {},
"outputs": [],
"source": [
"# calculate data - model residuals\n",
"# calculate data minus model residuals\n",
"res = obs_r.reduced_mag - pc.ReducedMag(obs_r.phaseAngle * u.degree).value"
]
},
Expand Down Expand Up @@ -151,13 +160,12 @@
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "13e25b85",
"cell_type": "markdown",
"id": "4318568a",
"metadata": {},
"outputs": [],
"source": [
"# return a list of flags for outlying objects"
"# return a list of flags for outlying objects\n",
"The Adler `utils.sigma_clip` function is a wrapper for `astropy.stats.sigma_clip`. We do this in order to return just the clip mask, and also to make it easier to call a \"zero\" central function."
]
},
{
Expand Down Expand Up @@ -255,13 +263,11 @@
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8c935b03",
"cell_type": "markdown",
"id": "e66bfbee",
"metadata": {},
"outputs": [],
"source": [
"# NB that for phase curve models, residuals can be much larger than the photometric uncertainty!"
"NB that for phase curve models, residuals can be much larger than the photometric uncertainty!"
]
},
{
Expand All @@ -275,9 +281,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "adler-dev",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "adler-dev"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -289,7 +295,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.14"
"version": "3.9.19"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 7324815

Please sign in to comment.