Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
gsanand authored Jul 3, 2024
1 parent 5f29313 commit 9b9f7f6
Showing 1 changed file with 22 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,9 @@
"outputs": [],
"source": [
"for flc in glob.glob(\"./mastDownload/HST/*/*flc.fits\"):\n",
" flc_name = os.path.basename(flc)\n",
" flc_name = os.path.split(flc)[-1]\n",
" os.rename(flc, flc_name)\n",
"\n",
"if os.path.exists(\"mastDownload\"):\n",
" shutil.rmtree(\"mastDownload\")"
"shutil.rmtree(\"mastDownload/\")"
]
},
{
Expand Down Expand Up @@ -540,18 +538,14 @@
"rootname_A = \"j9irw4b1q\"\n",
"rootname_B = \"j9irw5kaq\"\n",
"\n",
"# make a subdirectory for storing images\n",
"os.mkdir('images')\n",
"\n",
"def rename_file(old_file_name, new_file_name):\n",
" if os.path.exists(old_file_name):\n",
" os.rename(old_file_name, new_file_name)\n",
" else:\n",
" print(f\"File {old_file_name} does not exist and cannot be renamed to {new_file_name}\")\n",
"\n",
"shutil.copy(f\"residuals_{rootname_A}_flc.png\", f\"images/residuals_{rootname_A}_flc_rscale.png\")\n",
"shutil.copy(f\"residuals_{rootname_B}_flc.png\", f\"images/residuals_{rootname_B}_flc_rscale.png\")\n",
"\n",
"rename_file(f\"residuals_{rootname_A}_flc.png\", f\"residuals_{rootname_A}_flc_rscale.png\")\n",
"rename_file(f\"residuals_{rootname_B}_flc.png\", f\"residuals_{rootname_B}_flc_rscale.png\")\n",
"rename_file(f\"vector_{rootname_A}_flc.png\", f\"vector_{rootname_A}_flc_rscale.png\")\n",
"rename_file(f\"vector_{rootname_B}_flc.png\", f\"vector_{rootname_B}_flc_rscale.png\")"
"shutil.copy(f\"vector_{rootname_A}_flc.png\", f\"images/vector_{rootname_A}_flc_rscale.png\")\n",
"shutil.copy(f\"vector_{rootname_B}_flc.png\", f\"images/vector_{rootname_B}_flc_rscale.png\")"
]
},
{
Expand All @@ -561,8 +555,8 @@
"outputs": [],
"source": [
"# read images\n",
"img_A = mpimg.imread(f\"residuals_{rootname_A}_flc_rscale.png\")\n",
"img_B = mpimg.imread(f\"residuals_{rootname_B}_flc_rscale.png\")\n",
"img_A = mpimg.imread(f\"images/residuals_{rootname_A}_flc_rscale.png\")\n",
"img_B = mpimg.imread(f\"images/residuals_{rootname_B}_flc_rscale.png\")\n",
"\n",
"# display images\n",
"fig, axs = plt.subplots(1, 2, figsize=(10, 10), dpi=200)\n",
Expand All @@ -582,8 +576,8 @@
"outputs": [],
"source": [
"# read images\n",
"img_A = mpimg.imread(f\"vector_{rootname_A}_flc_rscale.png\")\n",
"img_B = mpimg.imread(f\"vector_{rootname_B}_flc_rscale.png\")\n",
"img_A = mpimg.imread(f\"images/vector_{rootname_A}_flc_rscale.png\")\n",
"img_B = mpimg.imread(f\"images/vector_{rootname_B}_flc_rscale.png\")\n",
"\n",
"# display images\n",
"fig, axs = plt.subplots(1, 2, figsize=(10, 10), dpi=100)\n",
Expand Down Expand Up @@ -710,11 +704,11 @@
"outputs": [],
"source": [
"# Give the 'fit residual plots' a unique name for comparison with other tests.\n",
"os.rename(f\"residuals_{rootname_A}_flc.png\", f\"residuals_{rootname_A}_flc_general.png\")\n",
"os.rename(f\"residuals_{rootname_B}_flc.png\", f\"residuals_{rootname_B}_flc_general.png\")\n",
"shutil.copy(f\"residuals_{rootname_A}_flc.png\", f\"images/residuals_{rootname_A}_flc_general.png\")\n",
"shutil.copy(f\"residuals_{rootname_B}_flc.png\", f\"images/residuals_{rootname_B}_flc_general.png\")\n",
"\n",
"os.rename(f\"vector_{rootname_A}_flc.png\", f\"vector_{rootname_A}_flc_general.png\")\n",
"os.rename(f\"vector_{rootname_B}_flc.png\", f\"vector_{rootname_B}_flc_general.png\")"
"shutil.copy(f\"vector_{rootname_A}_flc.png\", f\"images/vector_{rootname_A}_flc_general.png\")\n",
"shutil.copy(f\"vector_{rootname_B}_flc.png\", f\"images/vector_{rootname_B}_flc_general.png\")"
]
},
{
Expand All @@ -731,8 +725,8 @@
"outputs": [],
"source": [
"# read images\n",
"img_A = mpimg.imread(f\"residuals_{rootname_A}_flc_general.png\")\n",
"img_B = mpimg.imread(f\"residuals_{rootname_B}_flc_general.png\")\n",
"img_A = mpimg.imread(f\"images/residuals_{rootname_A}_flc_general.png\")\n",
"img_B = mpimg.imread(f\"images/residuals_{rootname_B}_flc_general.png\")\n",
"\n",
"# display images\n",
"fig, axs = plt.subplots(1, 2, figsize=(20, 10), dpi=200)\n",
Expand All @@ -751,8 +745,8 @@
"outputs": [],
"source": [
"# read images\n",
"img_A = mpimg.imread(f\"vector_{rootname_A}_flc_general.png\")\n",
"img_B = mpimg.imread(f\"vector_{rootname_B}_flc_general.png\")\n",
"img_A = mpimg.imread(f\"images/vector_{rootname_A}_flc_general.png\")\n",
"img_B = mpimg.imread(f\"images/vector_{rootname_B}_flc_general.png\")\n",
"\n",
"# display images\n",
"fig, axs = plt.subplots(1, 2, figsize=(10, 10), dpi=100)\n",
Expand Down Expand Up @@ -1102,7 +1096,7 @@
"\n",
"\n",
" Created: 14 Dec 2018; C. Shanahan & J. Mack\n",
" Updated: XX May 2024; G. Anand & J. Mack \n",
" Updated: 03 Jul 2024; G. Anand & J. Mack \n",
"\n",
"**Source:** GitHub [spacetelescope/hst_notebooks](https://github.com/spacetelescope/hst_notebooks)\n",
"\n",
Expand Down Expand Up @@ -1157,7 +1151,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.11.7"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 9b9f7f6

Please sign in to comment.