Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@
"outputs": [],
"source": [
"import os\n",
"import sys\n",
"from contextlib import contextmanager\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"from astropy.coordinates import SkyCoord\n",
Expand Down Expand Up @@ -176,6 +178,32 @@
"targ_band = \"r\""
]
},
{
"cell_type": "markdown",
"id": "7a6a4e19-109c-440c-9ad7-c9c3d7ec4379",
"metadata": {},
"source": [
"Define a function that will prevent the `RBTransiNetTask` from attempting to write a `pycache` file while running.\n",
"This file is not necessary in the context of this tutorial."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "84e1ffa3-29ee-4e55-9ed7-196049d48147",
"metadata": {},
"outputs": [],
"source": [
"@contextmanager\n",
"def suppress_bytecode():\n",
" prev_bc = sys.dont_write_bytecode\n",
" sys.dont_write_bytecode = True\n",
" try:\n",
" yield\n",
" finally:\n",
" sys.dont_write_bytecode = prev_bc"
]
},
{
"cell_type": "markdown",
"id": "7546554b-b650-4334-a169-80ae8ad96832",
Expand Down Expand Up @@ -631,7 +659,8 @@
"metadata": {},
"source": [
"Run the task by passing it the template, science, and difference images, and the sources table.\n",
"Extract the reliability scores (classifications) as an `astropy` table."
"Extract the reliability scores (classifications) as an `astropy` table.\n",
"Use the `suppress_bytecode` function defined in Section 1.2 to avoid the creation of unnecessary auxiliary files."
]
},
{
Expand All @@ -641,8 +670,9 @@
"metadata": {},
"outputs": [],
"source": [
"results = reliabilityTask.run(new_template.template, science, difference,\n",
" sources, pretrainedModel=None)\n",
"with suppress_bytecode():\n",
" results = reliabilityTask.run(new_template.template, science, difference,\n",
" sources, pretrainedModel=None)\n",
"rb_table = results.classifications.asAstropy()\n",
"del results"
]
Expand Down
Loading