Skip to content

Commit

Permalink
PEP8
Browse files Browse the repository at this point in the history
  • Loading branch information
bhilbert4 committed Dec 16, 2024
1 parent bdfe57a commit 4763438
Showing 1 changed file with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@
" # Run the photom step to populate the name of the WFSS sensitivity \n",
" photom = PhotomStep.call(flat, save_results=True)\n",
"\n",
" \n",
" # Set the pupil back to the original value now that flat fielding is complete\n",
" if reset_pupil:\n",
" photom.meta.instrument.pupil = true_pupil\n",
Expand Down Expand Up @@ -302,7 +301,7 @@
" cax = ax.imshow(data, origin=\"lower\", aspect='auto', cmap='viridis', vmin=vmin, vmax=vmax)\n",
" ax.set_xlim(xlim[0], xlim[1]) # change to (0, 700) to see the entire spectrum)\n",
" ax.set_ylim(ylim[0], ylim[1])\n",
" plt.xticks(range(xlim[0], xlim[1], 5));\n",
" plt.xticks(range(xlim[0], xlim[1], 5))\n",
" plt.xlabel(\"Dispersion coordinate (pixel)\")\n",
" plt.ylabel(\"Cross dispersion coordinate (pixel)\")\n",
" colorbar = fig.colorbar(cax, orientation='vertical', pad=0.01)\n",
Expand Down Expand Up @@ -590,7 +589,7 @@
"outputs": [],
"source": [
"xd, yd = 405, 1465\n",
"ID = segment_map.data[yd,xd]\n",
"ID = segment_map.data[yd, xd]\n",
"print(f\"Object ID is: {ID}\")"
]
},
Expand Down Expand Up @@ -642,7 +641,7 @@
"min_y = np.min(yds)\n",
"max_y = np.max(yds)\n",
"\n",
"fig,axs = plt.subplots(1, 2, figsize=(15, 5))\n",
"fig, axs = plt.subplots(1, 2, figsize=(15, 5))\n",
"axs[0].imshow(imaging_data[min_y:max_y + 1, min_x:max_x + 1], origin=\"lower\")\n",
"axs[1].imshow(segment_map.data[min_y:max_y + 1, min_x:max_x + 1], origin=\"lower\")\n",
"axs[0].set_title(\"Source\")\n",
Expand Down Expand Up @@ -844,7 +843,7 @@
"metadata": {},
"outputs": [],
"source": [
"dlam = C.DDISPL(\"+1\",1000, 1000, 0.5) / C.DDISPX(\"+1\", 1000, 1000, 0.5)\n",
"dlam = C.DDISPL(\"+1\", 1000, 1000, 0.5) / C.DDISPX(\"+1\", 1000, 1000, 0.5)\n",
"print(f\"Dispersion is {dlam * 10000} Angstroms per pixel\")"
]
},
Expand Down Expand Up @@ -1003,7 +1002,7 @@
"metadata": {},
"outputs": [],
"source": [
"pxs = [ [xgsA[ii], xgsB[ii], xgsC[ii], xgsD[ii]] for ii in range(len(xgsA))]"
"pxs = [[xgsA[ii], xgsB[ii], xgsC[ii], xgsD[ii]] for ii in range(len(xgsA))]"
]
},
{
Expand All @@ -1013,7 +1012,7 @@
"metadata": {},
"outputs": [],
"source": [
"pys = [ [ygsA[ii], ygsB[ii], ygsC[ii], ygsD[ii]] for ii in range(len(ygsA))]"
"pys = [[ygsA[ii], ygsB[ii], ygsC[ii], ygsD[ii]] for ii in range(len(ygsA))]"
]
},
{
Expand All @@ -1033,13 +1032,13 @@
"metadata": {},
"outputs": [],
"source": [
"fig,ax = plt.subplots(1, 1, figsize=(15, 3))\n",
"fig, ax = plt.subplots(1, 1, figsize=(15, 3))\n",
"for i in tqdm.tqdm(range(len(pxs))):\n",
" tx = pxs[i]\n",
" tx.append(pxs[i][0])\n",
" ty = pys[i]\n",
" ty.append(pys[i][0])\n",
" plt.plot(tx,ty)\n",
" plt.plot(tx, ty)\n",
"\n",
"plt.xticks(range(0, len(pxs)))\n",
"\n",
Expand Down Expand Up @@ -1132,8 +1131,8 @@
"\n",
" # Use the corners of the dispersed pixels, and compute the WFSS pixels which they\n",
" # overlap, and by how much\n",
" pxs = [ [xgsA[ii], xgsB[ii], xgsC[ii], xgsD[ii]] for ii in range(len(xgsA))]\n",
" pys = [ [ygsA[ii], ygsB[ii], ygsC[ii], ygsD[ii]] for ii in range(len(ygsA))]\n",
" pxs = [[xgsA[ii], xgsB[ii], xgsC[ii], xgsD[ii]] for ii in range(len(xgsA))]\n",
" pys = [[ygsA[ii], ygsB[ii], ygsC[ii], ygsD[ii]] for ii in range(len(ygsA))]\n",
" xc, yc, area, slices = clip_multi(pxs, pys, [2048, 2048])\n",
"\n",
" # Book keeping to track the wavelength of each of the areas being projected into\n",
Expand All @@ -1153,7 +1152,7 @@
" all_pxs.append(pxs)\n",
" all_pys.append(pys)\n",
" all_flams.append(flam)\n",
" all_counts.append(flam * C.SENS[\"+1\"](tlams) * dlam * 10000 )\n"
" all_counts.append(flam * C.SENS[\"+1\"](tlams) * dlam * 10000)"
]
},
{
Expand Down Expand Up @@ -1212,7 +1211,7 @@
"metadata": {},
"outputs": [],
"source": [
"fig,ax = plt.subplots(1, 1, figsize=(15, 3))\n",
"fig, ax = plt.subplots(1, 1, figsize=(15, 3))\n",
"for i in tqdm.tqdm(range(len(all_pxs))):\n",
" for j in range(len(all_pxs[i])):\n",
" \n",
Expand All @@ -1222,7 +1221,7 @@
" ty.append(ty[0])\n",
" plt.plot(tx, ty, color='b', alpha=0.02)\n",
" c = all_counts[i]\n",
" c[c<0] = 0\n",
" c[c < 0] = 0\n",
" plt.fill(tx, ty, color='k', alpha=c[j])\n",
"plt.grid()\n",
"plt.xlim(200, 240) # change to (0, 700) to see the entire spectrum)\n",
Expand Down Expand Up @@ -1250,7 +1249,7 @@
"ycs = np.array(ycs)\n",
"\n",
"# Ignore counts and coordinates that are outside of the detector\n",
"ok = (xcs >= 0) & (xcs < 2048) & (ycs >= 0) & (ycs < 2048) \n",
"ok = (xcs >= 0) & (xcs < 2048) & (ycs >= 0) & (ycs < 2048) \n",
"simulated = coo_matrix((counts[ok], (ycs[ok], xcs[ok])), shape=(2048, 2048)).toarray()"
]
},
Expand Down

0 comments on commit 4763438

Please sign in to comment.