Skip to content

Commit

Permalink
Adding Figures to Quickstart (#403)
Browse files Browse the repository at this point in the history
* added plots to TAPE quickstart. Including a small routine for plotting multi-band light curves

* added new markdown cell for light curve searching

* Added brief doc on fetching the source table and plotting a light curve

* Made edits to quickstart tutorial by improving plots and using ens.to_timeseries() for light curve plotting

* final changes

* added matplotlib import
  • Loading branch information
AndyTza authored Mar 21, 2024
1 parent 86a0c45 commit dae414b
Showing 1 changed file with 58 additions and 3 deletions.
61 changes: 58 additions & 3 deletions docs/gettingstarted/quickstart.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,68 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The result is a table of delta times (dts) and structure function (sf2) for each unique lightcurve (labeled by lc_id)."
"The result is a table of delta times (dts) and structure function (sf2) for each unique lightcurve (labeled by lc_id). We can now visualize our delta times versus the computed structure function for each unique object."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"from matplotlib import rcParams\n",
"\n",
"%matplotlib inline\n",
"%config InlineBackend.figure_format = \"retina\"\n",
"rcParams[\"savefig.dpi\"] = 550\n",
"rcParams[\"font.size\"] = 20\n",
"plt.rc(\"font\", family=\"serif\")\n",
"\n",
"fig, ax = plt.subplots(nrows=1, ncols=1, figsize=(5, 4))\n",
"plt.scatter(result[\"dt\"], result[\"sf2\"], s=20, alpha=1, color=\"#353935\")\n",
"plt.yscale(\"log\")\n",
"plt.ylabel(\"Log(SF) (mag)\")\n",
"plt.xlabel(\"Time Lag (days)\")\n",
"plt.ylim(1e-3, 1e1)\n",
"plt.xlim(0, 2e3)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
"source": [
"Finally, suppose we want to select the ID with the maximum sf2 value from the computed feature. Using the available `ens.to_timeseries()` that creates a TimeSeries object, we can access the light curve for the target ID."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"max_id = result.compute()[\"sf2\"].idxmax()[0]\n",
"lc = ens.to_timeseries(max_id)\n",
"lc"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"filter_r = lc.band == \"r\" # select filter\n",
"\n",
"plt.figure(figsize=(8, 5))\n",
"plt.errorbar(\n",
" lc.time[filter_r], lc.flux[filter_r], lc.flux_err[filter_r], fmt=\"o\", color=\"red\", alpha=0.8, label=\"r\"\n",
")\n",
"plt.minorticks_on()\n",
"plt.ylabel(\"Flux (mJy)\")\n",
"plt.xlabel(\"Time (MJD)\")\n",
"plt.legend(title=\"Band\", loc=\"upper left\")"
]
}
],
"metadata": {
Expand All @@ -145,7 +200,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.11"
"version": "3.10.13"
},
"vscode": {
"interpreter": {
Expand Down

0 comments on commit dae414b

Please sign in to comment.