From cad8637c7f037cfd94bcd18f519930da126c1687 Mon Sep 17 00:00:00 2001 From: Ori Date: Tue, 31 Aug 2021 15:05:51 -0400 Subject: [PATCH 01/11] ifu continuum advanced --- .../NGC4151_FeII_ContinuumFit.ipynb | 745 +++++++++++++----- 1 file changed, 529 insertions(+), 216 deletions(-) diff --git a/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb b/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb index c324c190..2870fecc 100644 --- a/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb +++ b/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# IFU Data Modeling, NGC 4151 Notebook #1 - Isolating Line Emission\n" + "# IFU Data Modeling\n" ] }, { @@ -15,7 +15,7 @@ "**Data:** [NIFS](https://www.gemini.edu/instrumentation/current-instruments/nifs) on Gemini; NGC 4151.
\n", "**Tools:** specutils, jdaviz/cubeviz, astropy, matplotlib, bottleneck.
\n", "**Cross-intrument:** NIRSpec; potentially MIRI
\n", - "**Documentation:** This notebook is part of a STScI's larger [post-pipeline Data Analysis Tools Ecosystem](https://jwst-docs.stsci.edu/jwst-post-pipeline-data-analysis).
\n", + "**Documentation:** This notebook is part of a STScI's larger [post-pipeline Data Analysis Tools Ecosystem](https://jwst-docs.stsci.edu/jwst-post-pipeline-data-analysis) and can be [downloaded](https://github.com/spacetelescope/jdat_notebooks/tree/main/notebooks/IFU_cube_continuum_fit/) directly from the [JDAT Notebook Github directory](https://github.com/spacetelescope/jdat_notebooks).
\n", "\n", "## Introduction\n", "\n", @@ -25,7 +25,7 @@ "\n", "**Note:** This notebook is designed to analyze the 1.6440 [Fe II] emission but the wavelengths can be altered to fit and remove continuum around any emission line of interest.\n", "\n", - "## Imports\n", + "## Import Packages\n", " - time for timing\n", " - numpy for array processing and math\n", " - matplotlib.pyplot for plotting images and spectra\n", @@ -44,7 +44,6 @@ "metadata": {}, "outputs": [], "source": [ - "\n", "# load important packages\n", "import time\n", "from copy import copy\n", @@ -68,7 +67,6 @@ "metadata": {}, "outputs": [], "source": [ - "\n", "# load and configure matplotlib\n", "%matplotlib inline\n", "import matplotlib.pyplot as plt\n", @@ -83,8 +81,7 @@ }, "outputs": [], "source": [ - "\n", - "#This cell access the datacube file, defines the wavelength grid from header information and then plots a simple\n", + "#This cell accesses the datacube file, defines the wavelength grid from header information and then plots a simple\n", "# 1-D collapsed spectrum of the IFU data.\n", "\n", "# Read in a 3-D IFU datacube of interest, and header.\n", @@ -179,6 +176,17 @@ "plt.show()\n" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "print(wave)\n", + "#print(wave-wave_emission_limit1)\n", + "#print(continuummin,continuummax)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -189,47 +197,73 @@ " derive a more accurate fit in the below poly-fit analysis." ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Cubeviz Visualization\n", + "You can also visualize images inside a Jupyter notebook using [Cubeviz](https://jdaviz.readthedocs.io/en/latest/cubeviz/index.html)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Video1: \n", + "\n", + "YouTube Demo" + ] + }, { "cell_type": "code", "execution_count": null, - "metadata": { - "scrolled": true - }, + "metadata": {}, "outputs": [], "source": [ - "\n", - "# Use cubeviz to look at the data in the cube. Here, we configure and bring up the app.\n", - "app = Application(configuration='cubeviz')\n", - "app\n" + "from IPython.display import YouTubeVideo\n", + "vid = YouTubeVideo(\"HMSYwiH3Gl4\")\n", + "display(vid)" ] }, { "cell_type": "code", "execution_count": null, - "metadata": { - "scrolled": true - }, + "metadata": {}, + "outputs": [], + "source": [ + "from jdaviz import CubeViz\n", + "cubeviz = CubeViz()\n", + "cubeviz.app" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ - "\n", "# Here, we load the data into the cubeviz app.\n", - "app.load_data(fn)\n", - " " + "cubeviz.load_data(fn) " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ + "### Some Notes:\n", "\n", - "Set the left cubeviz panel to view our cube by linking the dataset to the visualization. This is done in the cube visualization panel that is to the upper left; it is an expandible menu that shows up as lines at the left display view. When you click the gear icon in this expanded menu, the dataset should show up as a weird name next to a blank checkbox. Check the box.\n", + "*If your cell window requires you to scroll to see the different displays in cubeviz, you can toggle the scroll window in the main menu of the notebook: Cell -> Current Outputs -> Toggle Scrolling\n", "\n", - "In the same way, select the datacube in the spectral viewer at the bottom of the cubeviz pane.\n", - "Use the expandible menu gear icon and select the loaded datacube. This is the summed 1-D spectrum from the full spatial field of the data cube. \n", + "*In the datacube viewing panel, you can select the 'layer' tab (horizontal line settings icon) in the upper panel within the viewer and change the display scaling. Decreasing the maximum display value by 10x brings out the low level extended emission in this dataset. In this cube, data from slice ~1060 to ~1090 shows the extended [Fe II] emission. " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Video2: \n", "\n", - "In the datacube viewing panel, you can also select the 'layer' tab in the gear (data) icon and change \n", - "display scaling. Decreasing the maximum display value by 10x brings out the low level extended emission\n", - "in this dataset. In this cube, data from slice ~1060 to ~1090 shows the extended [Fe II] emission. " + "Here is a video illustrating how to load and manipulate data for this particular notebook." ] }, { @@ -238,28 +272,28 @@ "metadata": {}, "outputs": [], "source": [ - "# show the 1-D spectrum by grabbing the cubeviz spectral viewer app within the notebook.\n", - "# If the 1-D spectrum hasn't been selected in the cubeviz window, automatically collapse\n", - "# and plot the loaded data cube.\n", - "\n", - "spectrum_viewer = app.get_viewer('spectrum-viewer')\n", - "if not spectrum_viewer.data():\n", - " app.add_data_to_viewer('spectrum-viewer',app.data_collection[0].label)\n", - "# spectrum_viewer.add_data(app.data_collection[0].label)\n", - " \n", - "spectrum_viewer.show()" + "from IPython.display import Video\n", + "Video(\"./cubeviz1.mov\", embed=True, width=500)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "Use the flux viewer in cubeviz to extract a spectrum located at the central AGN position.\n", - "It should show in the above spectral viewer, too.\n", - "\n", - "To do this, use the expandable menu at the left of the flux viewer window and select the 'define circular region of interest' icon. Make a circular region at the central position of the bright AGN flux, which is at approximately the cube center position.\n", + "### Video3:\n", "\n", - "(If the notebook is being run non-interactively, this cell will automatically make a dataset that mimics the AGN specrum)." + "Here is a video illustrating how to define your regions of interest and extract them into the notebook for more analysis below." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#PART 1\n", + "from IPython.display import Video\n", + "Video(\"./cubeviz2_1.mov\", embed=True, width=500)" ] }, { @@ -268,33 +302,24 @@ "metadata": {}, "outputs": [], "source": [ - "# Grab the layer spectrum that corresponds to the central AGN position as an array in the notebook, then plot it.\n", - "# If there is no subset in cubeviz, make one to plot.\n", - "\n", - "spec_agn = app.get_data_from_viewer('spectrum-viewer', 'Subset 1')\n", - "spec_agn\n", "\n", - "if not spec_agn:\n", - " flux_agn = np.sum(cube[:,(ny//2)-3:(ny//2)+3,(nx//2)-3:(nx//2)+3], axis=(1,2))\n", - " spec_agn = Spectrum1D(flux=flux_agn*u.Unit('count'), spectral_axis=wave*u.micron) \n", - " \n", - "# plot the 1-D spectrum of this smaller sub-region.\n", - "plt.figure(2)\n", - "plt.plot(wave[wavemin:wavemax], spec_agn.flux[wavemin:wavemax])\n", - "plt.show()" + "#PART 2\n", + "from IPython.display import Video\n", + "Video(\"./cubeviz2_2.mov\", embed=True, width=500)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "Now, use the flux viewer and again use the 'define circular region of interest' icon to make spectra at two positions associated with the outflow emission in [Fe II].\n", - "\n", - "The redshifted outflow is at approximate x position = 12, y position = 36. This will be 'Subset 2' and will show up in green in the display.\n", - "\n", - "The blueshifted outflow is at approximately x position = 50, y position = 28 in pixel index units. This will be 'Subset 3' and will show up in blue in the display.\n", - "\n", - "(If the notebook is being run non-interactively, automatically make two datasets that mimic the AGN outflow red/blueshifted spectra)." + "# Extract Subset Spectrum in Cubeviz Spectrum Viewer" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Retrieve the spectrum (Subset1) of the user-defined region from the Spectrum Viewer as a Spectrum1D object." ] }, { @@ -303,34 +328,109 @@ "metadata": {}, "outputs": [], "source": [ + "#Extract spectra corresponding to the colored regions in cubeviz\n", + "spectrum1 = cubeviz.app.get_data_from_viewer('spectrum-viewer','Subset 1') #AGN Center\n", + "spectrum2 = cubeviz.app.get_data_from_viewer('spectrum-viewer','Subset 2') #Red shifted component\n", + "spectrum3 = cubeviz.app.get_data_from_viewer('spectrum-viewer','Subset 3') #Blue shifted component\n", + "#spectrum3 = cubeviz.app.get_data_from_viewer('spectrum-viewer')['Subset 3'] #Blue shifted component\n", + "spectrum1" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#regions = cubeviz.specviz.get_spectral_regions()\n", + "#regions" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#regions = cubeviz.app.get_data_from_viewer('flux-viewer')['Subset 4'] #AGN Center\n", + "#regions" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#regions = cubeviz.app.get" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "scrolled": true + }, + "outputs": [], + "source": [ + "#Extract the spectral regions defined in the spectral viewer\n", + "from specutils.spectra import SpectralRegion\n", + "regions = cubeviz.specviz.get_spectral_regions()\n", + "regions\n", "\n", - "#grab the redshifted and blueshifted outflow spectra from the spectral viewer window.\n", - "\n", - "spec_feii_red = app.get_data_from_viewer('spectrum-viewer', 'Subset 2')\n", - "spec_feii_red\n", + "line_region = regions[\"Subset 4\"]\n", + "continuum_region = regions[\"Subset 5\"]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#Define Missing Spectral Regions if User Did Not in Cubeviz\n", + "if not regions:\n", + " line_region = SpectralRegion(1.630*u.um, 1.665*u.um)\n", + " \n", + "if not regions:\n", + " continuum_region = SpectralRegion(1.656*u.um, 1.673*u.um)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#Apply the spectral region\n", + "from specutils.manipulation import extract_region\n", "\n", - "if not spec_feii_red:\n", + "if not spectrum1:\n", + " flux_agn = np.sum(cube[:,(ny//2)-3:(ny//2)+3,(nx//2)-3:(nx//2)+3], axis=(1,2))\n", + " tmpspec = Spectrum1D(flux=flux_agn*u.Unit('count'), spectral_axis=wave*u.micron) \n", + " spec_agn = extract_region(tmpspec, line_region)\n", + " spec_agn_continuum = extract_region(tmpspec, continuum_region)\n", + "else: \n", + " spec_agn = extract_region(spectrum1, line_region)\n", + " spec_agn_continuum = extract_region(spectrum1, continuum_region)\n", + "\n", + "if not spectrum2:\n", " flux_feii_red = np.sum(cube[:,(36)-3:(36)+3,(12)-3:(12)+3], axis=(1,2))\n", - " spec_feii_red = Spectrum1D(flux=flux_feii_red*u.Unit('count'), spectral_axis=wave*u.micron) \n", - "\n", - "spec_feii_blue = app.get_data_from_viewer('spectrum-viewer', 'Subset 3')\n", - "spec_feii_blue\n", - "\n", - "if not spec_feii_blue:\n", + " tmpspec = Spectrum1D(flux=flux_feii_red*u.Unit('count'), spectral_axis=wave*u.micron) \n", + " spec_feii_red = extract_region(tmpspec, line_region)\n", + " spec_feii_red_continuum = extract_region(tmpspec, continuum_region)\n", + "else: \n", + " spec_feii_red = extract_region(spectrum2, line_region)\n", + " spec_feii_red_continuum = extract_region(spectrum2, continuum_region)\n", + "\n", + "if not spectrum3:\n", " flux_feii_blue = np.sum(cube[:,(28)-3:(28)+3,(50)-3:(50)+3], axis=(1,2))\n", - " spec_feii_blue = Spectrum1D(flux=flux_feii_blue*u.Unit('count'), spectral_axis=wave*u.micron) \n", - "\n", - "#plot a zoomed view of the spectra grabbed from cubeviz\n", - "\n", - "# plot the 1-D redshifted outflow spectrum.\n", - "plt.figure(3)\n", - "plt.plot(wave[wavemin:wavemax], spec_feii_blue.flux[wavemin:wavemax])\n", - "plt.show()\n", - "\n", - "# plot the 1-D spectrum blueshifted outflow spectrum.\n", - "plt.figure(3)\n", - "plt.plot(wave[wavemin:wavemax], spec_feii_red.flux[wavemin:wavemax], color='r')\n", - "plt.show()\n" + " tmpspec = Spectrum1D(flux=flux_feii_blue*u.Unit('count'), spectral_axis=wave*u.micron) \n", + " spec_feii_blue = extract_region(tmpspec, line_region)\n", + " spec_feii_blue_continuum = extract_region(tmpspec, continuum_region)\n", + "else: \n", + " spec_feii_blue = extract_region(spectrum3, line_region)\n", + " spec_feii_blue_continuum = extract_region(spectrum3, continuum_region)" ] }, { @@ -339,25 +439,9 @@ "metadata": {}, "outputs": [], "source": [ - "\n", - "#demonstration of a linear fit to the continuum flux level\n", - "# this method uses simple functions in numpy to fit the continuum. \n", - "\n", - "cont_fit = np.polyfit(wave[continuummin:continuummax], flux1[continuummin:continuummax], 1)\n", - "fitval = np.poly1d(cont_fit)\n", - "continuum = fitval(wave)\n", - "\n", - "plt.figure(4)\n", - "plt.plot(wave, flux1)\n", - "plt.show()\n", - "\n", - "plt.figure(4)\n", - "plt.plot(wave[continuummin:continuummax], flux1[continuummin:continuummax])\n", - "plt.show()\n", - "\n", - "plt.figure(4)\n", - "plt.plot(wave, continuum)\n", - "plt.show()\n" + "#Visualize new subsets\n", + "plt.figure()\n", + "plt.plot(spec_agn.spectral_axis,spec_agn.flux,color='black')" ] }, { @@ -366,44 +450,10 @@ "metadata": {}, "outputs": [], "source": [ - "# That looks pretty good.\n", - "\n", - "# This cell continues a demonstration of a linear fit to the continuum flux level.\n", - "# This method uses the specutils and modeling packages available\n", - "# in astropy. It does the same thing as the prior cell, but in an astropy \n", - "# spectral format.\n", - "\n", - "# Here we use the polynomial routine to do a linear fit - this is so it's easy\n", - "# to update the fit order, if necessary.\n", - "\n", - "full_spectrum=Spectrum1D(\n", - " flux=flux1* u.Unit('count'), spectral_axis=wave* u.micron)\n", - "\n", - "# Make Spectrum1D specutils version of data for the continuum segment.\n", - "spectrum = Spectrum1D(\n", - " flux=flux1[continuummin:continuummax]*u.Unit('count'),\n", - " spectral_axis=wave[continuummin:continuummax]*u.micron)\n", - "\n", - "# Make an empty model with no initial guess of the coefficients\n", - "# If guessing make sure to only pass values (no units)\n", - "m = models.Polynomial1D(degree=1) # You can place a guess by setting c0 and c1\n", - "# Fit model and save fitted model containing the fitted params\n", - "fitted_model = fit_lines(spectrum, m)\n", - "# Just to showcase how to access the fitted params\n", - "cont_fit = [fitted_model.c1.value, fitted_model.c0.value]\n", - "\n", - "# notice I dont have to use cont_fit to get my continuum\n", - "# I just call the model with my spectral values\n", - "continuum = fitted_model(full_spectrum.spectral_axis)\n", - "\n", - "#plot the results - identical to above numpy code - looks good.\n", - "plt.figure(5)\n", - "plt.plot(wave, flux1)\n", - "plt.show()\n", - "\n", - "plt.figure(5)\n", - "plt.plot(wave, continuum)\n", - "plt.show()\n" + "#Visualize new subsets\n", + "plt.figure()\n", + "plt.plot(spec_feii_blue.spectral_axis,spec_feii_blue.flux,color='b')\n", + "plt.plot(spec_feii_red.spectral_axis,spec_feii_red.flux,color='r')" ] }, { @@ -412,37 +462,12 @@ "metadata": {}, "outputs": [], "source": [ + "#EDITOR NOTE, LIST HERE DIFFERENT VIEWERS\n", + "#Now fit the continuum in Cubeviz\n", "\n", - "# This cell makes a data sub-cube around the emission feature that has the continuum flux \n", - "# level subtracted off. then make another datacube that is only the continuum flux, to serve\n", - "# as a PSF model to correct out the bright, central HI features.\n", - "\n", - "# Here I'm using the numpy functions for continuum fitting and subtraction.\n", - "\n", - "# This is done in nested for loops, looping over the spatial axes in the cube.\n", - "\n", - "start_time = time.time()\n", - "\n", - "cont_sub_cube=np.zeros([nz,ny,nx])\n", - "cont_psf_cube=np.zeros([nz,ny,nx])\n", - "\n", - "for i in range(1, nx-2):\n", - " for j in range(1, ny-2):\n", - " flux1 = cube[:,j,i] \n", - " cont_fit = np.polyfit(wave[continuummin:continuummax], flux1[continuummin:continuummax], 1)\n", - " fitval = np.poly1d(cont_fit)\n", - " continuum = fitval(wave) \n", - " cont_sub_cube[:,j,i]= flux1 - continuum\n", - " cont_psf_cube[:,j,i]= continuum \n", - "\n", - "del header_cube['MODE']\n", - "\n", - "fits.writeto('NGC4151_Hband_ContinuumSubtract.fits', cont_sub_cube, header_cube, overwrite=True)\n", - "fits.writeto('NGC4151_Hband_ContinuumPSF.fits', cont_psf_cube, header_cube, overwrite=True)\n", - "print('Continuum subtracted cube saved. PSF continuum cube saved.')\n", - "\n", - "print('Time count')\n", - "print(\"--- %s seconds ---\" % (time.time() - start_time))\n" + "#PART 1\n", + "from IPython.display import Video\n", + "Video(\"./bestfitcube_p1.mov\", embed=True, width=500)" ] }, { @@ -451,34 +476,192 @@ "metadata": {}, "outputs": [], "source": [ + "#PART 2\n", + "from IPython.display import Video\n", + "Video(\"./bestfitcube_p2.mov\", embed=True, width=500)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#List Data from Viewer\n", + "regions = cubeviz.app.get_data_from_viewer(\"uncert-viewer\")\n", + "regions" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#Extract Continuum Model from Cubeviz above\n", + "cont_psf_cube = cubeviz.app.get_data_from_viewer(\"uncert-viewer\", \"LinFitCont [Cube] 1\")\n", + "#cont_psf_cubee = cubeviz.app.get_data_from_viewer(\"uncert-viewer\", \"LinFitCont [Cube] 2\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Important Note: Always save data and variables when possible." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#Subtract Continuum\n", "\n", - "# This cell does the same thing as the prior cell, but uses specutils models polyfit instead of numpy \n", - "# to do the continuum fitting. This uses the poly fit options instead of line fitting so that you can \n", - "# change the polynomial order for the continuum fitting, if necessary.\n", - "\n", - "# This is done in nested for loops, looping over the RA, Dec axes in the cube.\n", - "\n", - "# This does the same thing but is slow compared to the prior cell...\n", - "\n", - "start_time = time.time()\n", + "#Re-read in original IFU cube for manipulation\n", + "cube_file = 'https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/IFU_cube_continuum_fit/NGC4151_Hband.fits'\n", + "newfn = download_file('https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/IFU_cube_continuum_fit/NGC4151_Hband.fits', cache=True)\n", + "newheader_cube = fits.getheader(cube_file)\n", + "\n", + "#Delete any existing output in current directory\n", + "import os\n", + "if os.path.exists(\"NGC4151_Hband_ContinuumSubtract.fits\"):\n", + " os.remove(\"NGC4151_Hband_ContinuumSubtract.fits\")\n", + "else:\n", + " print(\"The file does not exist\")\n", + "\n", + "import os\n", + "if os.path.exists(\"NGC4151_Hband_ContinuumPSF.fits\"):\n", + " os.remove(\"NGC4151_Hband_ContinuumPSF.fits\")\n", + "else:\n", + " print(\"The file does not exist\")\n", + "\n", + "#Check to see if user made a continuum fit in Cubeviz, make continuum subtraction, and save output\n", + "if not cont_psf_cube:\n", + " start_time = time.time()\n", + "\n", + " cont_sub_cube=np.zeros([nz,ny,nx])\n", + " cont_psf_cube=np.zeros([nz,ny,nx])\n", + "\n", + " for i in range(1, nx-2):\n", + " for j in range(1, ny-2):\n", + " flux1 = cube[:,j,i] \n", + " cont_fit = np.polyfit(wave[continuummin:continuummax], flux1[continuummin:continuummax], 1)\n", + " fitval = np.poly1d(cont_fit)\n", + " continuum = fitval(wave) \n", + " cont_sub_cube[:,j,i]= flux1 - continuum\n", + " cont_psf_cube[:,j,i]= continuum \n", + "\n", + " del newheader_cube['MODE']\n", + " fits.writeto('NGC4151_Hband_ContinuumSubtract.fits', cont_sub_cube, newheader_cube, overwrite=True)\n", + " fits.writeto('NGC4151_Hband_ContinuumPSF.fits', cont_psf_cube, newheader_cube, overwrite=True)\n", + " print('Continuum subtracted cube saved. PSF continuum cube saved.')\n", + "else:\n", + " with fits.open(newfn, memmap=False) as cont_sub_cube:\n", + " sci = cont_sub_cube['SCI'].data\n", + "\n", + " #Get List of different viewers\n", + " #linfitcube = cubeviz.app.get_data_from_viewer(\"uncert-viewer\", \"LinFitCube [Cube] 1\")\n", + " continuumflux = cont_psf_cube[\"flux\"]\n", + "\n", + " sci_contsub = sci-continuumflux\n", + " cont_sub_cube['SCI'].data = sci_contsub \n", + " #cubeviz.app.load_data(newcube)\n", + " #del newheader_cube['MODE']\n", + " del cont_sub_cube['PRIMARY'].header['MODE']\n", + " cont_sub_cube.writeto('NGC4151_Hband_ContinuumSubtract.fits')\n", + " del newheader_cube['MODE']\n", + " fits.writeto('NGC4151_Hband_ContinuumPSF.fits', continuumflux, newheader_cube, overwrite=True)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#You can also read out your model fit parameters \n", + "params=cubeviz.get_model_parameters(model_label=\"LinFitCont\")\n", + "params" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#And this is how you can acces the model fits\n", + "params['LinFitCont_3d']['slope']" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#Open up a new instance of Cubeviz to visualize continuum subtracted data\n", + "from jdaviz import CubeViz\n", + "cubeviz2 = CubeViz()\n", + "cubeviz2.app" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "cont_sub_cube = 'NGC4151_Hband_ContinuumSubtract.fits'\n", + "cubeviz2.app.load_data(cont_sub_cube, data_label='Continuum Subtracted')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Now we want to investigate an initial fit to the\n", + "# Br 12 emission feature, which is a pesky contaminant nearby in wavelength\n", + "# to our target [Fe II] emission. The Br 12 is centrally compact and arises from\n", + "# only from the nucleus of the AGN, not from the outflow. Make a plot of the fit\n", + "# results.\n", "\n", - "cont_sub_cube_specutils=np.zeros([nz,ny,nx])\n", - "cont_psf_cube_specutils=np.zeros([nz,ny,nx])\n", + "#PART2\n", + "from IPython.display import Video\n", + "Video(\"./multifit_p1.mov\", embed=True, width=500)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#PART2\n", + "from IPython.display import Video\n", + "Video(\"./multifit_p2.mov\", embed=True, width=500)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Wow, that multi-component fit looks great. Good deal.\n", "\n", - "for i in range(1, nx-2):\n", - " for j in range(1, ny-2):\n", - " flux1 = Spectrum1D(flux = cube[:,j,i]*u.Unit('count'), spectral_axis=wave*u.micron)\n", - " m = models.Polynomial1D(degree=1)\n", - " fitted_model = fit_lines(flux1[continuummin:continuummax], m)\n", - " cont_fit = [fitted_model.c1.value, fitted_model.c0.value]\n", - " continuum = fitted_model(flux1.spectral_axis)\n", - " cont_sub_cube_specutils[:,j,i]= flux1.flux - continuum\n", - " cont_psf_cube_specutils[:,j,i]= continuum\n", + "# Now we're going to use the continuum psf cube from a prior cell \n", + "# with the Brackett model created in the above cell to create a full\n", + "# 3-D model of the central emission that isn't caused by the outflow [Fe II].\n", "\n", - "print('Done')\n", + "#Extract the spectral regions defined in the spectral viewer\n", + "regions = cubeviz2.specviz.get_spectral_regions()\n", + "regions\n", "\n", - "print('Time count')\n", - "print(\"--- %s seconds ---\" % (time.time() - start_time))\n" + "line_region = regions[\"Subset 1\"]" ] }, { @@ -487,28 +670,149 @@ "metadata": {}, "outputs": [], "source": [ + "spec=cubeviz2.app.get_data_from_viewer('spectrum-viewer') #AGN Center\n", + "spec" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#Get Gauss Model Spectrum and Model Cube\n", + "all_spec = cubeviz2.app.get_data_from_viewer('spectrum-viewer','Continuum Subtracted[SCI]') #AGN Center Data Cube\n", + "gauss_spec = cubeviz2.app.get_data_from_viewer('spectrum-viewer','GaussAll') #AGN Center Model Spec\n", + "gauss_cube = cubeviz2.app.get_data_from_viewer(\"uncert-viewer\", \"GaussAll [Cube] 1\") #AGN Center Model Cube" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#You can also read out your model fit parameters \n", + "params=cubeviz2.get_model_parameters(model_label=\"GaussAll\")\n", + "params" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#Overwrite Gauss Model with only 2 of the components of interest\n", + "gauss_cube_2component = gauss_cube[\"flux\"]*0\n", + "from astropy.modeling import models\n", "\n", - "# Now, let's take a look at the emission line in the continuum by plotting some of the results\n", - "# of the subtracted cube.\n", - "flux1=np.sum(cont_sub_cube, axis=(1,2))\n", - "\n", - "# plot the 1-D spectrum of the full continuum subtracted cube\n", - "plt.figure(6)\n", - "plt.plot(wave[wavemin:wavemax], flux1[wavemin:wavemax])\n", - "plt.show()\n", - "\n", - "# plot the 1-D spectrum of a single spaxel.\n", - "plt.figure(7)\n", - "plt.plot(wave[wavemin:wavemax], cont_sub_cube[wavemin:wavemax,30,30])\n", - "plt.show()\n" + "nz, ny, nx = gauss_cube_2component.shape\n", + "for i in range(0, nx-1):\n", + " for j in range(0, ny-1):\n", + " amp1=params['GaussAll_3d']['amplitude_0'][i][j]\n", + " amp2=params['GaussAll_3d']['amplitude_2'][i][j]\n", + " m1=params['GaussAll_3d']['mean_0'][i][j]\n", + " m2=params['GaussAll_3d']['mean_2'][i][j]\n", + " stdev1=params['GaussAll_3d']['stddev_0'][i][j]\n", + " stdev2=params['GaussAll_3d']['stddev_2'][i][j]\n", + " g1 = models.Gaussian1D(amplitude=amp1*u.Unit('count'), mean=m1*u.m, stddev=stdev1*u.m)\n", + " g2 = models.Gaussian1D(amplitude=amp2*u.Unit('count'), mean=m2*u.m, stddev=stdev2*u.m)\n", + " gauss_cube_2component[:,i,j] = g1(all_spec.spectral_axis)+g2(all_spec.spectral_axis)" ] }, { "cell_type": "code", "execution_count": null, - "metadata": { - "scrolled": true - }, + "metadata": {}, + "outputs": [], + "source": [ + "#Add the continuum cube to the new model cube\n", + "continuum_file = 'NGC4151_Hband_ContinuumPSF.fits'\n", + "newfull_header = fits.getheader(continuum_file)\n", + "with fits.open(continuum_file, memmap=False) as continuum_cube: \n", + " #print(continuum_cube[0].data)\n", + " continuum_data = continuum_cube[0].data\n", + " full_model = gauss_cube_2component+continuum_data" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# subtract the model to create the final cube where the [Fe II] emission is isolated.\n", + "#Re-read in original IFU cube for manipulation\n", + "cube_file = 'https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/IFU_cube_continuum_fit/NGC4151_Hband.fits'\n", + "newfinalsub_header = fits.getheader(cube_file)\n", + "with fits.open(cube_file, memmap=False) as original_cube: \n", + " original_data = original_cube['SCI'].data\n", + " final_sub_cube = original_data - full_model" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#Delete any existing output in current directory\n", + "import os\n", + "if os.path.exists(\"NGC4151_Hband_FinalSubtract.fits\"):\n", + " os.remove(\"NGC4151_Hband_FinalSubtract.fits\")\n", + "else:\n", + " print(\"The file does not exist\")\n", + "\n", + "import os\n", + "if os.path.exists(\"NGC4151_Hband_ContinuumandBrackettModel.fits\"):\n", + " os.remove(\"NGC4151_Hband_ContinuumandBrackettModel.fits\")\n", + "else:\n", + " print(\"The file does not exist\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#del newfull_header['MODE']\n", + "del newfinalsub_header['MODE']\n", + "fits.writeto('NGC4151_Hband_ContinuumandBrackettModel.fits', full_model, newfull_header, overwrite=True)\n", + "fits.writeto('NGC4151_Hband_FinalSubtract.fits', final_sub_cube, newfinalsub_header, overwrite=True)\n", + "print('Continuum subtracted cube saved. PSF continuum cube saved.')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#Make the final plots to illustrated\n", + "plt.figure()\n", + "plt.xlim([1.630E-6, 1.665E-6])\n", + "plt.ylim([600, 900])\n", + "plt.plot(all_spec.spectral_axis, continuum_data[:,30,30],label='Continuum')\n", + "plt.plot(all_spec.spectral_axis, original_data[:,30,30],label='Original Data')\n", + "plt.plot(all_spec.spectral_axis, full_model[:,30,30],label='2 Component Model')\n", + "plt.plot(all_spec.spectral_axis, final_sub_cube[:,30,30]+700,label='Model Subtraction+Offset')\n", + "plt.legend()\n", + "plt.show()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Alternative Code in Case You Don't Use CubeViz" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "\n", @@ -556,7 +860,8 @@ "plt.show()\n", "\n", "#we want to isolate just the [Fe II] outflow emission, so subtract off the central compact flux sources\n", - "central_flux_model_only = component1 + component2\n" + "central_flux_model_only = component1 + component2\n", + "\n" ] }, { @@ -606,15 +911,23 @@ "#make a plot of the central spectrum, the full model and the continuum.\n", "plt.figure(9)\n", "plt.plot(minwave, continuum_subcube[:,30,30])\n", - "plt.plot(minwave, cube[wavemin:wavemax,30,30])\n", + "#plt.plot(minwave, cube[wavemin:wavemax,30,30])\n", "plt.plot(minwave, full_model[:,30,30])\n", - "plt.show()\n" + "plt.show()\n", + "\n" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -628,7 +941,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.1" + "version": "3.9.6" } }, "nbformat": 4, From 5c2858f9d11e2764d22cf08d0e3073d31ab71bf9 Mon Sep 17 00:00:00 2001 From: Ori Date: Tue, 31 Aug 2021 16:34:33 -0400 Subject: [PATCH 02/11] added remote movie playing --- .../NGC4151_FeII_ContinuumFit.ipynb | 202 ++++++++++++++---- 1 file changed, 165 insertions(+), 37 deletions(-) diff --git a/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb b/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb index 2870fecc..035e933e 100644 --- a/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb +++ b/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb @@ -40,7 +40,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "metadata": {}, "outputs": [], "source": [ @@ -58,12 +58,14 @@ "from specutils.fitting import fit_lines\n", "from specutils import Spectrum1D\n", "\n", - "from jdaviz.app import Application\n" + "from jdaviz.app import Application\n", + "\n", + "from IPython.display import HTML\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": {}, "outputs": [], "source": [ @@ -75,11 +77,24 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "metadata": { "scrolled": true }, - "outputs": [], + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYkAAAD4CAYAAAAZ1BptAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAibklEQVR4nO3deXwd1X338c9PV/suWbItJC/ygvGCwdixHbaQmIATkpi0JIGkQCkNTUL6pE2XkD7PE56SV54n6ZYmTZrEDQTSpiwhpLgUMC5rIBhswHgHy/ImedNqWYu13fP8MUfiSr4jC1tXV8Lf9+ull+eembnneCzP9845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AgsAX4inMuyggf9zH/pUPj3OsEz0NpNbOPAv8BzE5uk4ZlqHZf6pyrNbOJwDoz2+k/8YwVqcBiYAWQBbxsZuuT26Rhi9t259zbjP3jDkF3zUvOufF4lRqv7WP9mF8NbAI+BMwkaONvRroSXUkkkHOuxTnX6pcfB9LMrASoBabEbFrhy8aEIdqNc67W/3kU+DVBl8JYUgOsdc61OefqgReACxjjx9wLa/t4OO4QfAd9bHfNeDjmfQa3fTwc81sIuiedc64K2AOcxwgfd4VEApnZZN9fiJktJTjeDcAGYLaZVZpZOsEv6JrktXSgsHabWY6Z5fnyHOAqIHSmTpI8ClxqZqm+C2EZsIMxfsy9uG0fD8fdzAqADxD8HfqMh2Met+3j4ZgD+wmuOjGzScAcgkHqtcBVZlZkZkUEbV97upWou+kMmNn9BDOBSsysBrgTSANwzv0YuA74opn1AB3A9S6YitBjZl8m+IeLAPc457aN9Xb7X8Rf+/xIBf7dOffkaLV7OG13zu0wsyeBzUAU+KlzbqvfN2nH/EzabmYzSOJxH8bvC8Angaecc219+znnkvp7fiZtB8b87zrwTeBeM9sCGPA1fwWKmX2TIKQB7jqTLkA9lkNEREKpu0lEREIpJEREJJRCQkREQikkREQklEJCRERCKSRERCSUQkJEREL9f6yaP84ADiU/AAAAAElFTkSuQmCC\n", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], "source": [ "#This cell accesses the datacube file, defines the wavelength grid from header information and then plots a simple\n", "# 1-D collapsed spectrum of the IFU data.\n", @@ -216,9 +231,31 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "image/jpeg": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEABALDBoYFhoaGBodHRgfHR0dHR0dHSUdHR0dLicxMC0nLS01PVBCNThLOS0tRWFFS1NWW1xbMkFlbWRYbFBZW1cBERISGRYZLxsbMFc9NTdXV1dXV1dXV1dXV1dXV1dXV1d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Ho/EHtWo/5YdH4iyq2OrmBs5PpOfKPR+Iek58o9H4h40eUdUa5yPSc+Uej8SPSU+Uej8SbzVTuR12MzkelKnuw6PxD0rU92HR+JPhVfycutYeJxvStTlDo/EPStTlHo/EfhSnyR2xbnH9LVOUOj8RXtSpyj0fiL+Oq/l5deQtzlek6nKPR+JHpKfKPR+I/Cl/Jy6jYrOb6Rnyj0fiHpGfKPR+I/Cj+Tl0UxmjlraM+Uej8SfSU+Uej8ReFH8nLoJEPRmB7Rnyj0fiRLaE3wj0fiPxpefLIAAasAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB//2Q==\n", + "text/html": [ + "\n", + " \n", + " " + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "from IPython.display import YouTubeVideo\n", "vid = YouTubeVideo(\"HMSYwiH3Gl4\")\n", @@ -268,12 +305,25 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 25, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 25, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "from IPython.display import Video\n", - "Video(\"./cubeviz1.mov\", embed=True, width=500)" + "HTML('')\n" ] }, { @@ -287,25 +337,50 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 26, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 26, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "#PART 1\n", - "from IPython.display import Video\n", - "Video(\"./cubeviz2_1.mov\", embed=True, width=500)" + "HTML('')" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 27, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 27, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "\n", "#PART 2\n", - "from IPython.display import Video\n", - "Video(\"./cubeviz2_2.mov\", embed=True, width=500)" + "HTML('')\n" ] }, { @@ -458,27 +533,53 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 28, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 28, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "#EDITOR NOTE, LIST HERE DIFFERENT VIEWERS\n", "#Now fit the continuum in Cubeviz\n", "\n", "#PART 1\n", - "from IPython.display import Video\n", - "Video(\"./bestfitcube_p1.mov\", embed=True, width=500)" + "HTML('')" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 29, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 29, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "#PART 2\n", - "from IPython.display import Video\n", - "Video(\"./bestfitcube_p2.mov\", embed=True, width=500)" + "HTML('')" ] }, { @@ -619,9 +720,23 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 30, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 30, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Now we want to investigate an initial fit to the\n", "# Br 12 emission feature, which is a pesky contaminant nearby in wavelength\n", @@ -629,20 +744,33 @@ "# only from the nucleus of the AGN, not from the outflow. Make a plot of the fit\n", "# results.\n", "\n", - "#PART2\n", - "from IPython.display import Video\n", - "Video(\"./multifit_p1.mov\", embed=True, width=500)" + "#PART1\n", + "\n", + "HTML('')" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 32, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 32, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "#PART2\n", - "from IPython.display import Video\n", - "Video(\"./multifit_p2.mov\", embed=True, width=500)" + "HTML('')\n" ] }, { From 71e787c231b34332b0a990c30ede9aac7ff97f8f Mon Sep 17 00:00:00 2001 From: Ori Date: Wed, 1 Sep 2021 15:20:34 -0400 Subject: [PATCH 03/11] added saved variable to enable running notebook without using Cubeviz --- .../NGC4151_FeII_ContinuumFit.ipynb | 523 ++++++++---------- 1 file changed, 222 insertions(+), 301 deletions(-) diff --git a/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb b/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb index 035e933e..3c2fa3f8 100644 --- a/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb +++ b/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb @@ -40,7 +40,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -59,13 +59,13 @@ "from specutils import Spectrum1D\n", "\n", "from jdaviz.app import Application\n", - "\n", - "from IPython.display import HTML\n" + "from IPython.display import HTML\n", + "\n" ] }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -77,24 +77,28 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#Save and Load Objects Using Pickle\n", + "import pickle\n", + "def save_obj(obj, name):\n", + " with open(name, 'wb') as f:\n", + " pickle.dump(obj, f, pickle.HIGHEST_PROTOCOL)\n", + "\n", + "def load_obj(name):\n", + " with open(name, 'rb') as f:\n", + " return pickle.load(f)" + ] + }, + { + "cell_type": "code", + "execution_count": null, "metadata": { "scrolled": true }, - "outputs": [ - { - "data": { - "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYkAAAD4CAYAAAAZ1BptAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAibklEQVR4nO3deXwd1X338c9PV/suWbItJC/ygvGCwdixHbaQmIATkpi0JIGkQCkNTUL6pE2XkD7PE56SV54n6ZYmTZrEDQTSpiwhpLgUMC5rIBhswHgHy/ImedNqWYu13fP8MUfiSr4jC1tXV8Lf9+ull+eembnneCzP9845Z+aacw4REZF4UpLdABERGbsUEiIiEkohISIioRQSIiISSiEhIiKhUpPdgJFWUlLipk+fnuxmiIiMK6+99lq9c650cPl7LiSmT5/Oxo0bk90MEZFxxcz2xStXd5OIiIRSSIiISCiFhIiIhFJIiIhIKIWEiIiEUkiIiEgohYSIiIRSSMRo6+zh12/UJLsZIiJjxnvuZroz8Y1Ht/Gr12uYWpzD4mlFyW6OiEjS6UoixuGWDgDau3qS3BIRkbFBIRGHYclugojImKCQiKFvchURGUghISIioRQSIiISSiERo6+7yTQkISICKCTiUkaIiAQUEiIiEkohEcOh6U0iIrEUEvGov0lEBFBIDKD7JEREBlJIxKE7rkVEAgoJEREJpZCIod4mEZGBFBJx6GY6EZGAQkJEREIpJGKpv0lEZACFRBzqbRIRCSgkYuiOaxGRgRQScZhGrkVEAIWEiIgMQSERQ4/lEBEZSCERh3qbREQCCgkREQk1rJAwsz81s21mttXM7jezTDOrNLNXzKzKzB40s3S/bYZ/XeXXT495n6/78rfM7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H/EzabmYzSOJxH8bvC8Angaecc219+znnkvp7fiZtB8b87zrwTeBeM9sCGPA1fwWKmX2TIKQB7jqTLkA9lkNEREKpu0lEREIpJEREJJRCQkREQikkREQklEJCRERCKSRERCSUQkJEREL9f6yaP84ADiU/AAAAAElFTkSuQmCC\n", - "text/plain": [ - "
" - ] - }, - "metadata": { - "needs_background": "light" - }, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "#This cell accesses the datacube file, defines the wavelength grid from header information and then plots a simple\n", "# 1-D collapsed spectrum of the IFU data.\n", @@ -231,31 +235,9 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "data": { - "image/jpeg": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEABALDBoYFhoaGBodHRgfHR0dHR0dHSUdHR0dLicxMC0nLS01PVBCNThLOS0tRWFFS1NWW1xbMkFlbWRYbFBZW1cBERISGRYZLxsbMFc9NTdXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV11XV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV//AABEIAWgB4AMBIgACEQEDEQH/xAAbAAACAwEBAQAAAAAAAAAAAAAAAgEDBAUGB//EAEQQAAIBAgMFAwkGAwYGAwAAAAABAgMRBBIhBTFBUZETcdEGFBUiMlJhgaEjM3OxssEWQnIkNFNikpMlQ3TC8PFjguH/xAAZAQADAQEBAAAAAAAAAAAAAAAAAQIDBAX/xAAmEQEBAQEAAgICAgEFAQAAAAAAARECEiEDMUFREzJhBCJxgaGR/9oADAMBAAIRAxEAPwD5+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB//2Q==\n", - "text/html": [ - "\n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "from IPython.display import YouTubeVideo\n", "vid = YouTubeVideo(\"HMSYwiH3Gl4\")\n", @@ -283,6 +265,28 @@ "cubeviz.load_data(fn) " ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Defining your data sets\n", + "\n", + "A video is shown below illustrating the procedure. The following steps are applied:\n", + "\n", + "Use the flux viewer in cubeviz to extract a spectrum located at the central AGN position.\n", + "It should show in the above spectral viewer, too.\n", + "\n", + "To do this, use the expandable menu at the left of the flux viewer window and select the 'define circular region of interest' icon. Make a circular region at the central position of the bright AGN flux, which is at approximately the cube center position.\n", + "\n", + "Now, use the flux viewer and again use the 'define circular region of interest' icon to make spectra at two positions associated with the outflow emission in [Fe II].\n", + "\n", + "The redshifted outflow is at approximate x position = 12, y position = 36. This will be 'Subset 2' and will show up in green in the display.\n", + "\n", + "The blueshifted outflow is at approximately x position = 50, y position = 28 in pixel index units. This will be 'Subset 3' and will show up in blue in the display.\n", + "\n", + "(If the notebook is being run non-interactively, automatically make two datasets that mimic the AGN outflow red/blueshifted spectra)." + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -305,23 +309,9 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 25, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "HTML('')\n" ] @@ -337,23 +327,9 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 26, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "#PART 1\n", "HTML('')" @@ -361,23 +337,9 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 27, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "#PART 2\n", "HTML('')\n" @@ -532,56 +494,60 @@ ] }, { - "cell_type": "code", - "execution_count": 28, + "cell_type": "markdown", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 28, - "metadata": {}, - "output_type": "execute_result" - } - ], "source": [ - "#EDITOR NOTE, LIST HERE DIFFERENT VIEWERS\n", - "#Now fit the continuum in Cubeviz\n", + "## Fit the Continuum at the Spectral Region Location\n", "\n", + "A video is shown below illustrating the procedure. The following steps are applied to this particular example:
\n", + "\n", + "Open up Model Fitting Plugin.
\n", + "Select Data Cube contentsSCI
\n", + "Select Spectral Region Subset 5
\n", + "Model: Linear1D
\n", + "ModelID: L1
\n", + "Model Parameters: Leave Default
\n", + "Model Equation Editor: L1
\n", + "Model Label: LinFitCont
\n", + "
\n", + "Hit Fit, and then Apply to Cube." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#VIDEO OF CONTINUUM FITTING\n", "#PART 1\n", "HTML('')" ] }, { "cell_type": "code", - "execution_count": 29, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 29, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "#PART 2\n", "HTML('')" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Pulling Data from Viewers\n", + "\n", + "Note, in cubeviz, you have 4 viewers from which you can pull data. Make sure your data are properly loaded into each viewer before executing the get_data_from_viewer command:
\n", + "\n", + "Top Left: flux-viewer
\n", + "Center: uncert-viewer
\n", + "Top Right: mask-viewer
\n", + "Bottom: spectrum-viewer
" + ] + }, { "cell_type": "code", "execution_count": null, @@ -617,13 +583,6 @@ "metadata": {}, "outputs": [], "source": [ - "#Subtract Continuum\n", - "\n", - "#Re-read in original IFU cube for manipulation\n", - "cube_file = 'https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/IFU_cube_continuum_fit/NGC4151_Hband.fits'\n", - "newfn = download_file('https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/IFU_cube_continuum_fit/NGC4151_Hband.fits', cache=True)\n", - "newheader_cube = fits.getheader(cube_file)\n", - "\n", "#Delete any existing output in current directory\n", "import os\n", "if os.path.exists(\"NGC4151_Hband_ContinuumSubtract.fits\"):\n", @@ -635,7 +594,21 @@ "if os.path.exists(\"NGC4151_Hband_ContinuumPSF.fits\"):\n", " os.remove(\"NGC4151_Hband_ContinuumPSF.fits\")\n", "else:\n", - " print(\"The file does not exist\")\n", + " print(\"The file does not exist\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#Subtract Continuum\n", + "\n", + "#Re-read in original IFU cube for manipulation\n", + "cube_file = 'https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/IFU_cube_continuum_fit/NGC4151_Hband.fits'\n", + "newfn = download_file('https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/IFU_cube_continuum_fit/NGC4151_Hband.fits', cache=True)\n", + "newheader_cube = fits.getheader(cube_file)\n", "\n", "#Check to see if user made a continuum fit in Cubeviz, make continuum subtraction, and save output\n", "if not cont_psf_cube:\n", @@ -692,8 +665,8 @@ "metadata": {}, "outputs": [], "source": [ - "#And this is how you can acces the model fits\n", - "params['LinFitCont_3d']['slope']" + "#And this is just an example of how you can acces the model fit parameter values\n", + "#params['LinFitCont_3d']['slope']" ] }, { @@ -719,57 +692,49 @@ ] }, { - "cell_type": "code", - "execution_count": 30, + "cell_type": "markdown", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 30, - "metadata": {}, - "output_type": "execute_result" - } - ], "source": [ - "# Now we want to investigate an initial fit to the\n", - "# Br 12 emission feature, which is a pesky contaminant nearby in wavelength\n", - "# to our target [Fe II] emission. The Br 12 is centrally compact and arises from\n", - "# only from the nucleus of the AGN, not from the outflow. Make a plot of the fit\n", - "# results.\n", + "## Fitting your multiple component Gaussian Model\n", + "\n", + "Now we want to investigate an initial fit to the Br 12 emission feature, which is a pesky contaminant nearby in wavelength to our target [Fe II] emission. The Br 12 is centrally compact and arises from only from the nucleus of the AGN, not from the outflow. Make a plot of the fit results.
\n", + "\n", + "A video is shown below illustrating the procedure. The following steps are applied:
\n", + "\n", + "For this example, we recommend setting up a 3 component gaussian model with the following inputs
\n", + "Open up Model Fitting Plugin.
\n", + "Data: Continuum Subtracted
\n", + "Spectral region or subset covering about 1.632 to 1.656 um
\n", + "Model: Three different Gaussians with ModelID's set to G1, G2, and G3
\n", + "Model Parameters:
\n", "\n", - "#PART1\n", + "G1: stdev=0.0008E-6, mean=1.641E-6
\n", + "G2: stdev=0.0007E-6, mean=1.648E-6
\n", + "G3: stdev=0.005E-6, mean=1.646E-6
\n", "\n", + "Model Equation Editor: G1+G2+g3
\n", + "Model Label: GaussAll
\n", + "
\n", + "Hit Fit, and then Apply to Cube." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#VIDEO PART1\n", "HTML('')" ] }, { "cell_type": "code", - "execution_count": 32, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 32, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ - "#PART2\n", + "#VIDEO PART2\n", "HTML('')\n" ] }, @@ -789,7 +754,9 @@ "regions = cubeviz2.specviz.get_spectral_regions()\n", "regions\n", "\n", - "line_region = regions[\"Subset 1\"]" + "line_region = regions[\"Subset 1\"]\n", + "if not line_region:\n", + " line_region = SpectralRegion(1.6322*u.um, 1.6563*u.um)" ] }, { @@ -798,7 +765,8 @@ "metadata": {}, "outputs": [], "source": [ - "spec=cubeviz2.app.get_data_from_viewer('spectrum-viewer') #AGN Center\n", + "#List spectra available in spectrum-viewer\n", + "spec=cubeviz2.app.get_data_from_viewer('spectrum-viewer') \n", "spec" ] }, @@ -814,6 +782,57 @@ "gauss_cube = cubeviz2.app.get_data_from_viewer(\"uncert-viewer\", \"GaussAll [Cube] 1\") #AGN Center Model Cube" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "##Save your Gauss Model Cube If Necessary\n", + "#import os\n", + "#if os.path.exists(\"gauss_model_cube.fits\"):\n", + "# os.remove(\"gauss_model_cube.fits\")\n", + "#else:\n", + "# print(\"The file does not exist\")\n", + "#\n", + "#gaussmodelflux = gauss_cube[\"flux\"]\n", + "#fits.writeto('gauss_model_cube.fits', gaussmodelflux, overwrite=True)\n", + "#print(type(gauss_cube[\"flux\"]))\n", + "#print(type(all_spec.flux))\n", + "\n", + "#Saving with 'Count' doesn't work.\n", + "#print(all_spec.flux)\n", + "#os.remove(\"all_spec.fits\")\n", + "#specref=Spectrum1D(flux=all_spec.flux*u.Unit('Jy'), spectral_axis=all_spec.spectral_axis)\n", + "#specref.write(\"all_spec.fits\")\n", + "\n", + "#os.remove(\"gauss_spec.fits\")\n", + "#specref=Spectrum1D(flux=gauss_spec.flux*u.Unit('Jy'), spectral_axis=gauss_spec.spectral_axis)\n", + "#specref.write(\"gauss_spec.fits\")\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#Check to see if user used Cubeviz (above), and, if not, read in premade data\n", + "if not gauss_cube:\n", + " fn = download_file('https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/IFU_cube_continuum_fit/gauss_model_cube.fits', cache=False)\n", + " gauss_cube = fits.getdata(fn)\n", + "else:\n", + " gauss_cube = gauss_cube[\"flux\"]\n", + " \n", + "if not all_spec:\n", + " fn = download_file('https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/IFU_cube_continuum_fit/all_spec.fits', cache=False)\n", + " all_spec = Spectrum1D.read(fn)\n", + " \n", + "if not gauss_spec:\n", + " fn = download_file('https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/IFU_cube_continuum_fit/gauss_spec.fits', cache=False)\n", + " gauss_spec = Spectrum1D.read(fn)" + ] + }, { "cell_type": "code", "execution_count": null, @@ -825,6 +844,30 @@ "params" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#Save Parameters as a Pickle File if necessary\n", + "#save_obj(params, \"gauss_params.pkl\")\n", + "#params=load_obj(\"gauss_params.pkl\")\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#Check to see if user used Cubeviz (above), and, if not, read in premade data\n", + "if not params:\n", + " fn = download_file('https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/IFU_cube_continuum_fit/gauss_params.pkl', cache=True)\n", + " params=load_obj(fn)\n", + " print(\"Loaded\")" + ] + }, { "cell_type": "code", "execution_count": null, @@ -832,7 +875,7 @@ "outputs": [], "source": [ "#Overwrite Gauss Model with only 2 of the components of interest\n", - "gauss_cube_2component = gauss_cube[\"flux\"]*0\n", + "gauss_cube_2component = gauss_cube*0\n", "from astropy.modeling import models\n", "\n", "nz, ny, nx = gauss_cube_2component.shape\n", @@ -929,128 +972,6 @@ "plt.legend()\n", "plt.show()" ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Alternative Code in Case You Don't Use CubeViz" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "\n", - "# This cell builds the spectrum at the central location into the format\n", - "# needed for use with specutils. It then investigates an initial fit to the\n", - "# Br 12 emission feature, which is a pesky contaminant nearby in wavelength\n", - "# to our target [Fe II] emission. The Br 12 is centrally compact and arises from\n", - "# only from the nucleus of the AGN, not from the outflow. Make a plot of the fit\n", - "# results.\n", - "\n", - "#zoom in wavelength into the region of interest, create subcube and subwave arrays.\n", - "flux = (cont_sub_cube[wavemin:wavemax,30,30])\n", - "minwave = wave[wavemin:wavemax]\n", - "\n", - "# put the flux spectrum into the spec utils expected format.\n", - "spectrum = Spectrum1D(flux=(flux)*u.Unit('count'), spectral_axis=minwave*u.micron)\n", - "\n", - "#define the fit the line for the Brackett emission (position was found by hand @ pix 1023):\n", - "# the central emission is best fit by two gaussian components: one @ br12, one @ [Fe II].\n", - "# Here we fit a third component too: the [Fe II] outflow emission.\n", - "l1 = models.Gaussian1D(amplitude = (flux[1023-wavemin])*u.Unit('count'), mean = minwave[1023-wavemin]*u.micron, stddev = 0.0009*u.micron)\n", - "l2 = models.Gaussian1D(amplitude = (flux[emission_line_index-wavemin])*u.Unit('count'), mean = minwave[emission_line_index-wavemin]*u.micron, stddev = 0.005*u.micron)\n", - "#define and fit the line for the outflow [Fe II] emission:\n", - "l3 = models.Gaussian1D(amplitude = (flux[emission_line_index-wavemin])*u.Unit('count'), mean = minwave[emission_line_index-wavemin]*u.micron, stddev = 0.0008*u.micron)\n", - "\n", - "#run the lfit - this tweaks the above parameters to optimize the fits of the three components.\n", - "lfit = fit_lines(spectrum, l1 + l2 + l3)\n", - "#make the yfit\n", - "y_fit = lfit(minwave*u.micron)\n", - "\n", - "# Build the fits from the fit_lines function into specutils format for plotting.\n", - "lineflux = (lfit[0](minwave*u.micron))\n", - "linemodel = Spectrum1D(spectral_axis=minwave*u.micron, flux=lineflux*u.Unit('count'))\n", - "\n", - "component1 = lfit[0](minwave*u.micron)\n", - "component2 = lfit[1](minwave*u.micron)\n", - "component3 = lfit[2](minwave*u.micron)\n", - "\n", - "plt.figure(8)\n", - "plt.plot(minwave, flux)\n", - "plt.plot(minwave, component1)\n", - "plt.plot(minwave, component2)\n", - "plt.plot(minwave, component3)\n", - "plt.plot(minwave, component1 + component2 + component3)\n", - "plt.show()\n", - "\n", - "#we want to isolate just the [Fe II] outflow emission, so subtract off the central compact flux sources\n", - "central_flux_model_only = component1 + component2\n", - "\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "\n", - "# Wow, that multi-component fit looks great. Good deal.\n", - "\n", - "#now we're going to use the continuum psf cube from a prior cell \n", - "# with the Brackett model created in the above cell to create a full\n", - "# 3-D model of the central emission that isn't caused by the outflow [Fe II].\n", - "\n", - "continuum_subcube = cont_psf_cube[wavemin:wavemax,:,:]\n", - "nz, ny, nx = continuum_subcube.shape\n", - "\n", - "model_cube=np.zeros([nz,ny,nx])\n", - "\n", - "#construct the scaled Brackett flux model\n", - "model_cube[0,:,:] = continuum_subcube[0,:,:] * (central_flux_model_only[0]/continuum_subcube[0, 30, 30])\n", - "for i in range(1, nz-2):\n", - " model_cube[i,:,:] = continuum_subcube[i,:,:] * (central_flux_model_only[i] / continuum_subcube[i, 30, 30])\n", - "model_cube[nz-1,:,:] = continuum_subcube[nz-1,:,:] * (central_flux_model_only[nz-1] / continuum_subcube[nz-1,30,30])\n", - "\n", - "# the full model of the AGN central emission is the continuum plus Brackett line.\n", - "full_model = continuum_subcube + model_cube\n", - "\n", - "# subtract the model to create the final cube where the [Fe II] emission\n", - "# is isolated.\n", - "final_sub_cube = cube[wavemin:wavemax,:,:] - full_model\n", - "\n", - "# make an appropriate header for the output sub-cube\n", - "header_cube_small = copy(header_cube)\n", - "del header_cube_small['CRVAL3']\n", - "header_cube_small['CRVAL3'] = wave[wavemin] * 10000.0\n", - "del header_cube_small['CRPIX3']\n", - "header_cube_small['CRPIX3'] = 1\n", - "\n", - "# Save the .fits data sub-cube that has the continuum and Br model subtracted off of the\n", - "# [Fe II] emission, and the datacube that is the continuum+Br model.\n", - "fits.writeto('NGC4151_Hband_FinalSubtract.fits', final_sub_cube, header_cube_small, overwrite=True)\n", - "fits.writeto('NGC4151_Hband_ContinuumandBrackettModel.fits', full_model, header_cube_small, overwrite=True)\n", - "print('Continuum and Brackett subtracted cube saved. Full model cube saved.')\n", - "\n", - "#make a plot of the central spectrum, the full model and the continuum.\n", - "plt.figure(9)\n", - "plt.plot(minwave, continuum_subcube[:,30,30])\n", - "#plt.plot(minwave, cube[wavemin:wavemax,30,30])\n", - "plt.plot(minwave, full_model[:,30,30])\n", - "plt.show()\n", - "\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { From edd4f98f8dba740ca6eaa135017a80662a43dc57 Mon Sep 17 00:00:00 2001 From: ojustino Date: Tue, 14 Sep 2021 15:26:17 -0400 Subject: [PATCH 04/11] Initiated technical review --- .../NGC4151_FeII_ContinuumFit.ipynb | 598 ++++++++++++++++-- 1 file changed, 553 insertions(+), 45 deletions(-) diff --git a/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb b/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb index 3c2fa3f8..044aed18 100644 --- a/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb +++ b/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb @@ -59,8 +59,7 @@ "from specutils import Spectrum1D\n", "\n", "from jdaviz.app import Application\n", - "from IPython.display import HTML\n", - "\n" + "from IPython.display import HTML" ] }, { @@ -72,7 +71,7 @@ "# load and configure matplotlib\n", "%matplotlib inline\n", "import matplotlib.pyplot as plt\n", - "plt.rcParams.update({'figure.max_open_warning': 0})\n" + "plt.rcParams.update({'figure.max_open_warning': 0})" ] }, { @@ -92,13 +91,81 @@ " return pickle.load(f)" ] }, + { + "cell_type": "markdown", + "metadata": { + "tags": [] + }, + "source": [ + "

Reviewer note: Begin PEP8 check cells (delete below when finished)

" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# disable all imported packages' loggers\n", + "import logging\n", + "logging.root.manager.loggerDict = {}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1: E999 SyntaxError: invalid syntax\n", + "INFO:pycodestyle:3:13: E225 missing whitespace around operator\n", + "INFO:pycodestyle:3:25: E231 missing whitespace after ','\n", + "INFO:pycodestyle:3:30: E231 missing whitespace after ','\n", + "INFO:pycodestyle:3:35: E231 missing whitespace after ','\n" + ] + } + ], + "source": [ + "# enable PEP8 checker for this notebook\n", + "%load_ext pycodestyle_magic\n", + "%flake8_on --ignore E261,E501,W291,W293\n", + "\n", + "# only allow the checker to throw warnings when there's a violation\n", + "logging.getLogger('flake8').setLevel('ERROR')\n", + "logging.getLogger('stpipe').setLevel('ERROR')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Reviewer note: End PEP8 check cells (delete above when finished)

" + ] + }, { "cell_type": "code", "execution_count": null, "metadata": { "scrolled": true }, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:10:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:15:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:17:7: E225 missing whitespace around operator\n", + "INFO:pycodestyle:17:31: E231 missing whitespace after ','\n", + "INFO:pycodestyle:17:34: E231 missing whitespace after ','\n", + "INFO:pycodestyle:23:29: E231 missing whitespace after ','\n" + ] + } + ], "source": [ "#This cell accesses the datacube file, defines the wavelength grid from header information and then plots a simple\n", "# 1-D collapsed spectrum of the IFU data.\n", @@ -153,7 +220,19 @@ "metadata": { "scrolled": true }, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:2:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:3:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:24:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:32:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:37:75: E231 missing whitespace after ','\n" + ] + } + ], "source": [ "\n", "#This cell defines the wavelength regions of interest: around the emission line, and the location\n", @@ -199,7 +278,16 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:2:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:3:1: E265 block comment should start with '# '\n" + ] + } + ], "source": [ "print(wave)\n", "#print(wave-wave_emission_limit1)\n", @@ -307,6 +395,13 @@ "Here is a video illustrating how to load and manipulate data for this particular notebook." ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "IFrame(\"https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/IFU_cube_continuum_fit/cubeviz1.mov\", width=700, height=500)\n" + ] + }, { "cell_type": "code", "execution_count": null, @@ -329,7 +424,15 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n" + ] + } + ], "source": [ "#PART 1\n", "HTML('')" @@ -339,7 +442,15 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n" + ] + } + ], "source": [ "#PART 2\n", "HTML('')\n" @@ -363,7 +474,22 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:2:63: E231 missing whitespace after ','\n", + "INFO:pycodestyle:2:76: E262 inline comment should start with '# '\n", + "INFO:pycodestyle:3:63: E231 missing whitespace after ','\n", + "INFO:pycodestyle:3:76: E262 inline comment should start with '# '\n", + "INFO:pycodestyle:4:63: E231 missing whitespace after ','\n", + "INFO:pycodestyle:4:76: E262 inline comment should start with '# '\n", + "INFO:pycodestyle:5:1: E265 block comment should start with '# '\n" + ] + } + ], "source": [ "#Extract spectra corresponding to the colored regions in cubeviz\n", "spectrum1 = cubeviz.app.get_data_from_viewer('spectrum-viewer','Subset 1') #AGN Center\n", @@ -377,7 +503,16 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:2:1: E265 block comment should start with '# '\n" + ] + } + ], "source": [ "#regions = cubeviz.specviz.get_spectral_regions()\n", "#regions" @@ -387,7 +522,16 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:2:1: E265 block comment should start with '# '\n" + ] + } + ], "source": [ "#regions = cubeviz.app.get_data_from_viewer('flux-viewer')['Subset 4'] #AGN Center\n", "#regions" @@ -397,7 +541,15 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n" + ] + } + ], "source": [ "#regions = cubeviz.app.get" ] @@ -408,7 +560,26 @@ "metadata": { "scrolled": true }, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n" + ] + }, + { + "ename": "KeyError", + "evalue": "'Subset 4'", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m/var/folders/ls/7lh0_8jn0ndbm6g7plbzw8n400028t/T/ipykernel_48321/1159788268.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mregions\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 6\u001b[0;31m \u001b[0mline_region\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mregions\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"Subset 4\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 7\u001b[0m \u001b[0mcontinuum_region\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mregions\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"Subset 5\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mKeyError\u001b[0m: 'Subset 4'" + ] + } + ], "source": [ "#Extract the spectral regions defined in the spectral viewer\n", "from specutils.spectra import SpectralRegion\n", @@ -423,7 +594,15 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n" + ] + } + ], "source": [ "#Define Missing Spectral Regions if User Did Not in Cubeviz\n", "if not regions:\n", @@ -437,7 +616,24 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:5:29: E231 missing whitespace after ','\n", + "INFO:pycodestyle:5:49: E231 missing whitespace after ','\n", + "INFO:pycodestyle:5:79: E231 missing whitespace after ','\n", + "INFO:pycodestyle:14:34: E231 missing whitespace after ','\n", + "INFO:pycodestyle:14:48: E231 missing whitespace after ','\n", + "INFO:pycodestyle:14:72: E231 missing whitespace after ','\n", + "INFO:pycodestyle:23:35: E231 missing whitespace after ','\n", + "INFO:pycodestyle:23:49: E231 missing whitespace after ','\n", + "INFO:pycodestyle:23:73: E231 missing whitespace after ','\n" + ] + } + ], "source": [ "#Apply the spectral region\n", "from specutils.manipulation import extract_region\n", @@ -474,7 +670,17 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:3:32: E231 missing whitespace after ','\n", + "INFO:pycodestyle:3:46: E231 missing whitespace after ','\n" + ] + } + ], "source": [ "#Visualize new subsets\n", "plt.figure()\n", @@ -485,7 +691,19 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:3:38: E231 missing whitespace after ','\n", + "INFO:pycodestyle:3:58: E231 missing whitespace after ','\n", + "INFO:pycodestyle:4:37: E231 missing whitespace after ','\n", + "INFO:pycodestyle:4:56: E231 missing whitespace after ','\n" + ] + } + ], "source": [ "#Visualize new subsets\n", "plt.figure()\n", @@ -517,7 +735,16 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:2:1: E265 block comment should start with '# '\n" + ] + } + ], "source": [ "#VIDEO OF CONTINUUM FITTING\n", "#PART 1\n", @@ -528,7 +755,15 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n" + ] + } + ], "source": [ "#PART 2\n", "HTML('')" @@ -552,7 +787,15 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n" + ] + } + ], "source": [ "#List Data from Viewer\n", "regions = cubeviz.app.get_data_from_viewer(\"uncert-viewer\")\n", @@ -563,7 +806,16 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:3:1: E265 block comment should start with '# '\n" + ] + } + ], "source": [ "#Extract Continuum Model from Cubeviz above\n", "cont_psf_cube = cubeviz.app.get_data_from_viewer(\"uncert-viewer\", \"LinFitCont [Cube] 1\")\n", @@ -581,7 +833,19 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:4:3: E111 indentation is not a multiple of 4\n", + "INFO:pycodestyle:6:3: E111 indentation is not a multiple of 4\n", + "INFO:pycodestyle:10:3: E111 indentation is not a multiple of 4\n", + "INFO:pycodestyle:12:3: E111 indentation is not a multiple of 4\n" + ] + } + ], "source": [ "#Delete any existing output in current directory\n", "import os\n", @@ -601,7 +865,35 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:3:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:8:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:12:18: E225 missing whitespace around operator\n", + "INFO:pycodestyle:12:31: E231 missing whitespace after ','\n", + "INFO:pycodestyle:12:34: E231 missing whitespace after ','\n", + "INFO:pycodestyle:13:18: E225 missing whitespace around operator\n", + "INFO:pycodestyle:13:31: E231 missing whitespace after ','\n", + "INFO:pycodestyle:13:34: E231 missing whitespace after ','\n", + "INFO:pycodestyle:17:27: E231 missing whitespace after ','\n", + "INFO:pycodestyle:17:29: E231 missing whitespace after ','\n", + "INFO:pycodestyle:21:28: E231 missing whitespace after ','\n", + "INFO:pycodestyle:21:30: E231 missing whitespace after ','\n", + "INFO:pycodestyle:21:33: E225 missing whitespace around operator\n", + "INFO:pycodestyle:22:28: E231 missing whitespace after ','\n", + "INFO:pycodestyle:22:30: E231 missing whitespace after ','\n", + "INFO:pycodestyle:22:33: E225 missing whitespace around operator\n", + "INFO:pycodestyle:32:9: E265 block comment should start with '# '\n", + "INFO:pycodestyle:33:9: E265 block comment should start with '# '\n", + "INFO:pycodestyle:38:9: E265 block comment should start with '# '\n", + "INFO:pycodestyle:39:9: E265 block comment should start with '# '\n" + ] + } + ], "source": [ "#Subtract Continuum\n", "\n", @@ -652,7 +944,16 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:2:7: E225 missing whitespace around operator\n" + ] + } + ], "source": [ "#You can also read out your model fit parameters \n", "params=cubeviz.get_model_parameters(model_label=\"LinFitCont\")\n", @@ -663,7 +964,16 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:2:1: E265 block comment should start with '# '\n" + ] + } + ], "source": [ "#And this is just an example of how you can acces the model fit parameter values\n", "#params['LinFitCont_3d']['slope']" @@ -673,7 +983,15 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n" + ] + } + ], "source": [ "#Open up a new instance of Cubeviz to visualize continuum subtracted data\n", "from jdaviz import CubeViz\n", @@ -722,7 +1040,15 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n" + ] + } + ], "source": [ "#VIDEO PART1\n", "HTML('')" @@ -732,7 +1058,15 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n" + ] + } + ], "source": [ "#VIDEO PART2\n", "HTML('')\n" @@ -742,7 +1076,26 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:7:1: E265 block comment should start with '# '\n" + ] + }, + { + "ename": "KeyError", + "evalue": "'Subset 1'", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m/var/folders/ls/7lh0_8jn0ndbm6g7plbzw8n400028t/T/ipykernel_48321/4088308880.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0mregions\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 10\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 11\u001b[0;31m \u001b[0mline_region\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mregions\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"Subset 1\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 12\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mline_region\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 13\u001b[0m \u001b[0mline_region\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mSpectralRegion\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m1.6322\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mu\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mum\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m1.6563\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mu\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mum\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mKeyError\u001b[0m: 'Subset 1'" + ] + } + ], "source": [ "# Wow, that multi-component fit looks great. Good deal.\n", "\n", @@ -763,7 +1116,16 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:2:5: E225 missing whitespace around operator\n" + ] + } + ], "source": [ "#List spectra available in spectrum-viewer\n", "spec=cubeviz2.app.get_data_from_viewer('spectrum-viewer') \n", @@ -774,7 +1136,20 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:2:63: E231 missing whitespace after ','\n", + "INFO:pycodestyle:2:93: E262 inline comment should start with '# '\n", + "INFO:pycodestyle:3:65: E231 missing whitespace after ','\n", + "INFO:pycodestyle:3:78: E262 inline comment should start with '# '\n", + "INFO:pycodestyle:4:86: E262 inline comment should start with '# '\n" + ] + } + ], "source": [ "#Get Gauss Model Spectrum and Model Cube\n", "all_spec = cubeviz2.app.get_data_from_viewer('spectrum-viewer','Continuum Subtracted[SCI]') #AGN Center Data Cube\n", @@ -786,7 +1161,30 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:2:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:3:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:5:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:8:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:9:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:10:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:11:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:13:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:14:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:15:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:16:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:17:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:19:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:20:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:21:1: E265 block comment should start with '# '\n" + ] + } + ], "source": [ "##Save your Gauss Model Cube If Necessary\n", "#import os\n", @@ -815,7 +1213,15 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n" + ] + } + ], "source": [ "#Check to see if user used Cubeviz (above), and, if not, read in premade data\n", "if not gauss_cube:\n", @@ -837,7 +1243,16 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:2:7: E225 missing whitespace around operator\n" + ] + } + ], "source": [ "#You can also read out your model fit parameters \n", "params=cubeviz2.get_model_parameters(model_label=\"GaussAll\")\n", @@ -848,7 +1263,17 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:2:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:3:1: E265 block comment should start with '# '\n" + ] + } + ], "source": [ "#Save Parameters as a Pickle File if necessary\n", "#save_obj(params, \"gauss_params.pkl\")\n", @@ -859,7 +1284,16 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:4:11: E225 missing whitespace around operator\n" + ] + } + ], "source": [ "#Check to see if user used Cubeviz (above), and, if not, read in premade data\n", "if not params:\n", @@ -872,7 +1306,24 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:3:1: E402 module level import not at top of file\n", + "INFO:pycodestyle:8:13: E225 missing whitespace around operator\n", + "INFO:pycodestyle:9:13: E225 missing whitespace around operator\n", + "INFO:pycodestyle:10:11: E225 missing whitespace around operator\n", + "INFO:pycodestyle:11:11: E225 missing whitespace around operator\n", + "INFO:pycodestyle:12:15: E225 missing whitespace around operator\n", + "INFO:pycodestyle:13:15: E225 missing whitespace around operator\n", + "INFO:pycodestyle:16:32: E231 missing whitespace after ','\n", + "INFO:pycodestyle:16:34: E231 missing whitespace after ','\n" + ] + } + ], "source": [ "#Overwrite Gauss Model with only 2 of the components of interest\n", "gauss_cube_2component = gauss_cube*0\n", @@ -896,7 +1347,16 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:5:5: E265 block comment should start with '# '\n" + ] + } + ], "source": [ "#Add the continuum cube to the new model cube\n", "continuum_file = 'NGC4151_Hband_ContinuumPSF.fits'\n", @@ -911,7 +1371,15 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:2:1: E265 block comment should start with '# '\n" + ] + } + ], "source": [ "# subtract the model to create the final cube where the [Fe II] emission is isolated.\n", "#Re-read in original IFU cube for manipulation\n", @@ -926,7 +1394,19 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:4:3: E111 indentation is not a multiple of 4\n", + "INFO:pycodestyle:6:3: E111 indentation is not a multiple of 4\n", + "INFO:pycodestyle:10:3: E111 indentation is not a multiple of 4\n", + "INFO:pycodestyle:12:3: E111 indentation is not a multiple of 4\n" + ] + } + ], "source": [ "#Delete any existing output in current directory\n", "import os\n", @@ -946,7 +1426,15 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n" + ] + } + ], "source": [ "#del newfull_header['MODE']\n", "del newfinalsub_header['MODE']\n", @@ -959,7 +1447,27 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", + "INFO:pycodestyle:5:50: E231 missing whitespace after ','\n", + "INFO:pycodestyle:5:53: E231 missing whitespace after ','\n", + "INFO:pycodestyle:5:57: E231 missing whitespace after ','\n", + "INFO:pycodestyle:6:49: E231 missing whitespace after ','\n", + "INFO:pycodestyle:6:52: E231 missing whitespace after ','\n", + "INFO:pycodestyle:6:56: E231 missing whitespace after ','\n", + "INFO:pycodestyle:7:46: E231 missing whitespace after ','\n", + "INFO:pycodestyle:7:49: E231 missing whitespace after ','\n", + "INFO:pycodestyle:7:53: E231 missing whitespace after ','\n", + "INFO:pycodestyle:8:50: E231 missing whitespace after ','\n", + "INFO:pycodestyle:8:53: E231 missing whitespace after ','\n", + "INFO:pycodestyle:8:61: E231 missing whitespace after ','\n" + ] + } + ], "source": [ "#Make the final plots to illustrated\n", "plt.figure()\n", @@ -976,9 +1484,9 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "Python [conda env:dat-ifu-cont-adv] *", "language": "python", - "name": "python3" + "name": "conda-env-dat-ifu-cont-adv-py" }, "language_info": { "codemirror_mode": { @@ -990,7 +1498,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.6" + "version": "3.8.10" } }, "nbformat": 4, From c4835bcba1df017b2ea58feab0cbf88e4c1b0ad2 Mon Sep 17 00:00:00 2001 From: ojustino Date: Wed, 15 Sep 2021 12:06:26 -0400 Subject: [PATCH 05/11] Addressed style issues from technical review --- .../NGC4151_FeII_ContinuumFit.ipynb | 881 +++++------------- 1 file changed, 210 insertions(+), 671 deletions(-) diff --git a/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb b/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb index 044aed18..43cb6bb4 100644 --- a/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb +++ b/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb @@ -46,6 +46,7 @@ "source": [ "# load important packages\n", "import time\n", + "import os\n", "from copy import copy\n", "\n", "import numpy as np\n", @@ -80,8 +81,9 @@ "metadata": {}, "outputs": [], "source": [ - "#Save and Load Objects Using Pickle\n", + "# Save and Load Objects Using Pickle\n", "import pickle\n", + "\n", "def save_obj(obj, name):\n", " with open(name, 'wb') as f:\n", " pickle.dump(obj, f, pickle.HIGHEST_PROTOCOL)\n", @@ -115,19 +117,7 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1: E999 SyntaxError: invalid syntax\n", - "INFO:pycodestyle:3:13: E225 missing whitespace around operator\n", - "INFO:pycodestyle:3:25: E231 missing whitespace after ','\n", - "INFO:pycodestyle:3:30: E231 missing whitespace after ','\n", - "INFO:pycodestyle:3:35: E231 missing whitespace after ','\n" - ] - } - ], + "outputs": [], "source": [ "# enable PEP8 checker for this notebook\n", "%load_ext pycodestyle_magic\n", @@ -151,23 +141,9 @@ "metadata": { "scrolled": true }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:10:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:15:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:17:7: E225 missing whitespace around operator\n", - "INFO:pycodestyle:17:31: E231 missing whitespace after ','\n", - "INFO:pycodestyle:17:34: E231 missing whitespace after ','\n", - "INFO:pycodestyle:23:29: E231 missing whitespace after ','\n" - ] - } - ], - "source": [ - "#This cell accesses the datacube file, defines the wavelength grid from header information and then plots a simple\n", + "outputs": [], + "source": [ + "# This cell accesses the datacube file, defines the wavelength grid from header information and then plots a simple\n", "# 1-D collapsed spectrum of the IFU data.\n", "\n", "# Read in a 3-D IFU datacube of interest, and header.\n", @@ -176,25 +152,25 @@ "cube = fits.getdata(cube_file)\n", "header_cube = fits.getheader(cube_file)\n", "\n", - "#grab data information and wavelength definitions.\n", + "# grab data information and wavelength definitions.\n", "nz, ny, nx = cube.shape\n", "crdelt3 = header_cube['CDELT3']\n", "crval3 = header_cube['CRVAL3']\n", "\n", - "#define the wavelength grid (microns) from the header (Angstroms)\n", + "# define the wavelength grid (microns) from the header (Angstroms)\n", "# and the AGN redshift and the emission line of interest.\n", - "wave =((crdelt3 * (np.arange(0,nz,1))) + crval3)/10000.0\n", + "wave = ((crdelt3 * (np.arange(0, nz, 1))) + crval3)/10000.0\n", "redshift = 0.00332\n", "emission_line = 1.64400*(1 + redshift)\n", "emission_line_index = (np.abs(wave-emission_line)).argmin()\n", "\n", "# make a simple summed 1d spectrum of the full cube\n", - "flux1 = np.sum(cube, axis=(1,2))\n", + "flux1 = np.sum(cube, axis=(1, 2))\n", "\n", "# plot the full 1-D spectrum.\n", "plt.figure(0)\n", "plt.plot(wave, flux1)\n", - "plt.show()\n" + "plt.show()" ] }, { @@ -220,23 +196,10 @@ "metadata": { "scrolled": true }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:2:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:3:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:24:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:32:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:37:75: E231 missing whitespace after ','\n" - ] - } - ], - "source": [ - "\n", - "#This cell defines the wavelength regions of interest: around the emission line, and the location\n", - "#where you want to fit and remove the continuum very accurately. Make a plot that shows the regions.\n", + "outputs": [], + "source": [ + "# This cell defines the wavelength regions of interest: around the emission line, and the location\n", + "# where you want to fit and remove the continuum very accurately. Make a plot that shows the regions.\n", "\n", "# Here we select a region that includes the emission line\n", "# wavelength plus a small range of continuum around it. \n", @@ -257,7 +220,7 @@ "continuum_limit1 = 1.656\n", "continuum_limit2 = 1.673\n", " \n", - "#Define the wavelength region around the emission - indices\n", + "# Define the wavelength region around the emission - indices\n", "wavemin = (np.abs(wave-wave_emission_limit1)).argmin()\n", "wavemax = (np.abs(wave-wave_emission_limit2)).argmin()\n", "\n", @@ -265,33 +228,24 @@ "continuummin = (np.abs(wave-continuum_limit1)).argmin()\n", "continuummax = (np.abs(wave-continuum_limit2)).argmin()\n", "\n", - "#show the region used for the emission line and continuum fit. Alter the wavelengths \n", + "# Show the region used for the emission line and continuum fit. Alter the wavelengths \n", "# above if this doesn't look good. \n", "plt.figure(1)\n", "plt.plot(wave, flux1)\n", "plt.plot(wave[wavemin:wavemax], flux1[wavemin:wavemax])\n", "plt.plot(wave[continuummin:continuummax], flux1[continuummin:continuummax],color='r')\n", - "plt.show()\n" + "plt.show()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:2:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:3:1: E265 block comment should start with '# '\n" - ] - } - ], + "outputs": [], "source": [ "print(wave)\n", - "#print(wave-wave_emission_limit1)\n", - "#print(continuummin,continuummax)" + "# print(wave-wave_emission_limit1)\n", + "# print(continuummin,continuummax)" ] }, { @@ -408,7 +362,7 @@ "metadata": {}, "outputs": [], "source": [ - "HTML('')\n" + "HTML('')" ] }, { @@ -424,17 +378,9 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n" - ] - } - ], - "source": [ - "#PART 1\n", + "outputs": [], + "source": [ + "# PART 1\n", "HTML('')" ] }, @@ -442,18 +388,10 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n" - ] - } - ], + "outputs": [], "source": [ - "#PART 2\n", - "HTML('')\n" + "# PART 2\n", + "HTML('')" ] }, { @@ -474,28 +412,13 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:2:63: E231 missing whitespace after ','\n", - "INFO:pycodestyle:2:76: E262 inline comment should start with '# '\n", - "INFO:pycodestyle:3:63: E231 missing whitespace after ','\n", - "INFO:pycodestyle:3:76: E262 inline comment should start with '# '\n", - "INFO:pycodestyle:4:63: E231 missing whitespace after ','\n", - "INFO:pycodestyle:4:76: E262 inline comment should start with '# '\n", - "INFO:pycodestyle:5:1: E265 block comment should start with '# '\n" - ] - } - ], - "source": [ - "#Extract spectra corresponding to the colored regions in cubeviz\n", - "spectrum1 = cubeviz.app.get_data_from_viewer('spectrum-viewer','Subset 1') #AGN Center\n", - "spectrum2 = cubeviz.app.get_data_from_viewer('spectrum-viewer','Subset 2') #Red shifted component\n", - "spectrum3 = cubeviz.app.get_data_from_viewer('spectrum-viewer','Subset 3') #Blue shifted component\n", - "#spectrum3 = cubeviz.app.get_data_from_viewer('spectrum-viewer')['Subset 3'] #Blue shifted component\n", + "outputs": [], + "source": [ + "# Extract spectra corresponding to the colored regions in cubeviz\n", + "spectrum1 = cubeviz.app.get_data_from_viewer('spectrum-viewer', 'Subset 1') # AGN Center\n", + "spectrum2 = cubeviz.app.get_data_from_viewer('spectrum-viewer', 'Subset 2') # Red shifted component\n", + "spectrum3 = cubeviz.app.get_data_from_viewer('spectrum-viewer', 'Subset 3') # Blue shifted component\n", + "# spectrum3 = cubeviz.app.get_data_from_viewer('spectrum-viewer')['Subset 3'] # Blue shifted component\n", "spectrum1" ] }, @@ -503,55 +426,29 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:2:1: E265 block comment should start with '# '\n" - ] - } - ], + "outputs": [], "source": [ - "#regions = cubeviz.specviz.get_spectral_regions()\n", - "#regions" + "# regions = cubeviz.specviz.get_spectral_regions()\n", + "# regions" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:2:1: E265 block comment should start with '# '\n" - ] - } - ], + "outputs": [], "source": [ - "#regions = cubeviz.app.get_data_from_viewer('flux-viewer')['Subset 4'] #AGN Center\n", - "#regions" + "# regions = cubeviz.app.get_data_from_viewer('flux-viewer')['Subset 4'] #AGN Center\n", + "# regions" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n" - ] - } - ], + "outputs": [], "source": [ - "#regions = cubeviz.app.get" + "# regions = cubeviz.app.get" ] }, { @@ -560,31 +457,11 @@ "metadata": { "scrolled": true }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n" - ] - }, - { - "ename": "KeyError", - "evalue": "'Subset 4'", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m/var/folders/ls/7lh0_8jn0ndbm6g7plbzw8n400028t/T/ipykernel_48321/1159788268.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mregions\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 6\u001b[0;31m \u001b[0mline_region\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mregions\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"Subset 4\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 7\u001b[0m \u001b[0mcontinuum_region\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mregions\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"Subset 5\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mKeyError\u001b[0m: 'Subset 4'" - ] - } - ], - "source": [ - "#Extract the spectral regions defined in the spectral viewer\n", + "outputs": [], + "source": [ + "# Extract the spectral regions defined in the spectral viewer\n", "from specutils.spectra import SpectralRegion\n", "regions = cubeviz.specviz.get_spectral_regions()\n", - "regions\n", "\n", "line_region = regions[\"Subset 4\"]\n", "continuum_region = regions[\"Subset 5\"]" @@ -594,17 +471,9 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n" - ] - } - ], - "source": [ - "#Define Missing Spectral Regions if User Did Not in Cubeviz\n", + "outputs": [], + "source": [ + "# Define Missing Spectral Regions if User Did Not in Cubeviz\n", "if not regions:\n", " line_region = SpectralRegion(1.630*u.um, 1.665*u.um)\n", " \n", @@ -616,39 +485,22 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:5:29: E231 missing whitespace after ','\n", - "INFO:pycodestyle:5:49: E231 missing whitespace after ','\n", - "INFO:pycodestyle:5:79: E231 missing whitespace after ','\n", - "INFO:pycodestyle:14:34: E231 missing whitespace after ','\n", - "INFO:pycodestyle:14:48: E231 missing whitespace after ','\n", - "INFO:pycodestyle:14:72: E231 missing whitespace after ','\n", - "INFO:pycodestyle:23:35: E231 missing whitespace after ','\n", - "INFO:pycodestyle:23:49: E231 missing whitespace after ','\n", - "INFO:pycodestyle:23:73: E231 missing whitespace after ','\n" - ] - } - ], - "source": [ - "#Apply the spectral region\n", + "outputs": [], + "source": [ + "# Apply the spectral region\n", "from specutils.manipulation import extract_region\n", "\n", "if not spectrum1:\n", - " flux_agn = np.sum(cube[:,(ny//2)-3:(ny//2)+3,(nx//2)-3:(nx//2)+3], axis=(1,2))\n", + " flux_agn = np.sum(cube[:, (ny//2)-3:(ny//2)+3, (nx//2)-3:(nx//2)+3], axis=(1, 2))\n", " tmpspec = Spectrum1D(flux=flux_agn*u.Unit('count'), spectral_axis=wave*u.micron) \n", " spec_agn = extract_region(tmpspec, line_region)\n", - " spec_agn_continuum = extract_region(tmpspec, continuum_region)\n", + " spec_agn_continuum = extract_region(tmpspec, continuum_region) \n", "else: \n", " spec_agn = extract_region(spectrum1, line_region)\n", " spec_agn_continuum = extract_region(spectrum1, continuum_region)\n", "\n", "if not spectrum2:\n", - " flux_feii_red = np.sum(cube[:,(36)-3:(36)+3,(12)-3:(12)+3], axis=(1,2))\n", + " flux_feii_red = np.sum(cube[:, (36)-3:(36)+3, (12)-3:(12)+3], axis=(1, 2))\n", " tmpspec = Spectrum1D(flux=flux_feii_red*u.Unit('count'), spectral_axis=wave*u.micron) \n", " spec_feii_red = extract_region(tmpspec, line_region)\n", " spec_feii_red_continuum = extract_region(tmpspec, continuum_region)\n", @@ -657,7 +509,7 @@ " spec_feii_red_continuum = extract_region(spectrum2, continuum_region)\n", "\n", "if not spectrum3:\n", - " flux_feii_blue = np.sum(cube[:,(28)-3:(28)+3,(50)-3:(50)+3], axis=(1,2))\n", + " flux_feii_blue = np.sum(cube[:, (28)-3:(28)+3, (50)-3:(50)+3], axis=(1, 2))\n", " tmpspec = Spectrum1D(flux=flux_feii_blue*u.Unit('count'), spectral_axis=wave*u.micron) \n", " spec_feii_blue = extract_region(tmpspec, line_region)\n", " spec_feii_blue_continuum = extract_region(tmpspec, continuum_region)\n", @@ -670,45 +522,23 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:3:32: E231 missing whitespace after ','\n", - "INFO:pycodestyle:3:46: E231 missing whitespace after ','\n" - ] - } - ], - "source": [ - "#Visualize new subsets\n", + "outputs": [], + "source": [ + "# Visualize new subsets\n", "plt.figure()\n", - "plt.plot(spec_agn.spectral_axis,spec_agn.flux,color='black')" + "plt.plot(spec_agn.spectral_axis, spec_agn.flux, color='black')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:3:38: E231 missing whitespace after ','\n", - "INFO:pycodestyle:3:58: E231 missing whitespace after ','\n", - "INFO:pycodestyle:4:37: E231 missing whitespace after ','\n", - "INFO:pycodestyle:4:56: E231 missing whitespace after ','\n" - ] - } - ], - "source": [ - "#Visualize new subsets\n", + "outputs": [], + "source": [ + "# Visualize new subsets\n", "plt.figure()\n", - "plt.plot(spec_feii_blue.spectral_axis,spec_feii_blue.flux,color='b')\n", - "plt.plot(spec_feii_red.spectral_axis,spec_feii_red.flux,color='r')" + "plt.plot(spec_feii_blue.spectral_axis, spec_feii_blue.flux, color='b')\n", + "plt.plot(spec_feii_red.spectral_axis, spec_feii_red.flux, color='r')" ] }, { @@ -735,37 +565,22 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:2:1: E265 block comment should start with '# '\n" - ] - } - ], - "source": [ - "#VIDEO OF CONTINUUM FITTING\n", - "#PART 1\n", + "outputs": [], + "source": [ + "# VIDEO OF CONTINUUM FITTING\n", + "# PART 1\n", "HTML('')" ] }, { "cell_type": "code", "execution_count": null, - "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n" - ] - } - ], - "source": [ - "#PART 2\n", + "metadata": { + "scrolled": false + }, + "outputs": [], + "source": [ + "# PART 2\n", "HTML('')" ] }, @@ -787,17 +602,9 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n" - ] - } - ], - "source": [ - "#List Data from Viewer\n", + "outputs": [], + "source": [ + "# List Data from Viewer\n", "regions = cubeviz.app.get_data_from_viewer(\"uncert-viewer\")\n", "regions" ] @@ -806,20 +613,11 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:3:1: E265 block comment should start with '# '\n" - ] - } - ], - "source": [ - "#Extract Continuum Model from Cubeviz above\n", + "outputs": [], + "source": [ + "# Extract Continuum Model from Cubeviz above\n", "cont_psf_cube = cubeviz.app.get_data_from_viewer(\"uncert-viewer\", \"LinFitCont [Cube] 1\")\n", - "#cont_psf_cubee = cubeviz.app.get_data_from_viewer(\"uncert-viewer\", \"LinFitCont [Cube] 2\")" + "# cont_psf_cubee = cubeviz.app.get_data_from_viewer(\"uncert-viewer\", \"LinFitCont [Cube] 2\")" ] }, { @@ -833,90 +631,48 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:4:3: E111 indentation is not a multiple of 4\n", - "INFO:pycodestyle:6:3: E111 indentation is not a multiple of 4\n", - "INFO:pycodestyle:10:3: E111 indentation is not a multiple of 4\n", - "INFO:pycodestyle:12:3: E111 indentation is not a multiple of 4\n" - ] - } - ], - "source": [ - "#Delete any existing output in current directory\n", - "import os\n", + "outputs": [], + "source": [ + "# Delete any existing output in current directory\n", "if os.path.exists(\"NGC4151_Hband_ContinuumSubtract.fits\"):\n", - " os.remove(\"NGC4151_Hband_ContinuumSubtract.fits\")\n", + " os.remove(\"NGC4151_Hband_ContinuumSubtract.fits\")\n", "else:\n", - " print(\"The file does not exist\")\n", + " print(\"The file does not exist\")\n", "\n", - "import os\n", "if os.path.exists(\"NGC4151_Hband_ContinuumPSF.fits\"):\n", - " os.remove(\"NGC4151_Hband_ContinuumPSF.fits\")\n", + " os.remove(\"NGC4151_Hband_ContinuumPSF.fits\")\n", "else:\n", - " print(\"The file does not exist\")" + " print(\"The file does not exist\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:3:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:8:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:12:18: E225 missing whitespace around operator\n", - "INFO:pycodestyle:12:31: E231 missing whitespace after ','\n", - "INFO:pycodestyle:12:34: E231 missing whitespace after ','\n", - "INFO:pycodestyle:13:18: E225 missing whitespace around operator\n", - "INFO:pycodestyle:13:31: E231 missing whitespace after ','\n", - "INFO:pycodestyle:13:34: E231 missing whitespace after ','\n", - "INFO:pycodestyle:17:27: E231 missing whitespace after ','\n", - "INFO:pycodestyle:17:29: E231 missing whitespace after ','\n", - "INFO:pycodestyle:21:28: E231 missing whitespace after ','\n", - "INFO:pycodestyle:21:30: E231 missing whitespace after ','\n", - "INFO:pycodestyle:21:33: E225 missing whitespace around operator\n", - "INFO:pycodestyle:22:28: E231 missing whitespace after ','\n", - "INFO:pycodestyle:22:30: E231 missing whitespace after ','\n", - "INFO:pycodestyle:22:33: E225 missing whitespace around operator\n", - "INFO:pycodestyle:32:9: E265 block comment should start with '# '\n", - "INFO:pycodestyle:33:9: E265 block comment should start with '# '\n", - "INFO:pycodestyle:38:9: E265 block comment should start with '# '\n", - "INFO:pycodestyle:39:9: E265 block comment should start with '# '\n" - ] - } - ], - "source": [ - "#Subtract Continuum\n", - "\n", - "#Re-read in original IFU cube for manipulation\n", + "outputs": [], + "source": [ + "# Subtract Continuum\n", + "\n", + "# Re-read in original IFU cube for manipulation\n", "cube_file = 'https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/IFU_cube_continuum_fit/NGC4151_Hband.fits'\n", "newfn = download_file('https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/IFU_cube_continuum_fit/NGC4151_Hband.fits', cache=True)\n", "newheader_cube = fits.getheader(cube_file)\n", "\n", - "#Check to see if user made a continuum fit in Cubeviz, make continuum subtraction, and save output\n", + "# Check to see if user made a continuum fit in Cubeviz, make continuum subtraction, and save output\n", "if not cont_psf_cube:\n", " start_time = time.time()\n", "\n", - " cont_sub_cube=np.zeros([nz,ny,nx])\n", - " cont_psf_cube=np.zeros([nz,ny,nx])\n", + " cont_sub_cube = np.zeros([nz, ny, nx])\n", + " cont_psf_cube = np.zeros([nz, ny, nx])\n", "\n", " for i in range(1, nx-2):\n", " for j in range(1, ny-2):\n", - " flux1 = cube[:,j,i] \n", + " flux1 = cube[:, j, i] \n", " cont_fit = np.polyfit(wave[continuummin:continuummax], flux1[continuummin:continuummax], 1)\n", " fitval = np.poly1d(cont_fit)\n", " continuum = fitval(wave) \n", - " cont_sub_cube[:,j,i]= flux1 - continuum\n", - " cont_psf_cube[:,j,i]= continuum \n", + " cont_sub_cube[:, j, i] = flux1 - continuum\n", + " cont_psf_cube[:, j, i] = continuum \n", "\n", " del newheader_cube['MODE']\n", " fits.writeto('NGC4151_Hband_ContinuumSubtract.fits', cont_sub_cube, newheader_cube, overwrite=True)\n", @@ -926,14 +682,14 @@ " with fits.open(newfn, memmap=False) as cont_sub_cube:\n", " sci = cont_sub_cube['SCI'].data\n", "\n", - " #Get List of different viewers\n", - " #linfitcube = cubeviz.app.get_data_from_viewer(\"uncert-viewer\", \"LinFitCube [Cube] 1\")\n", + " # Get List of different viewers\n", + " # linfitcube = cubeviz.app.get_data_from_viewer(\"uncert-viewer\", \"LinFitCube [Cube] 1\")\n", " continuumflux = cont_psf_cube[\"flux\"]\n", "\n", " sci_contsub = sci-continuumflux\n", " cont_sub_cube['SCI'].data = sci_contsub \n", - " #cubeviz.app.load_data(newcube)\n", - " #del newheader_cube['MODE']\n", + " # cubeviz.app.load_data(newcube)\n", + " # del newheader_cube['MODE']\n", " del cont_sub_cube['PRIMARY'].header['MODE']\n", " cont_sub_cube.writeto('NGC4151_Hband_ContinuumSubtract.fits')\n", " del newheader_cube['MODE']\n", @@ -944,19 +700,10 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:2:7: E225 missing whitespace around operator\n" - ] - } - ], - "source": [ - "#You can also read out your model fit parameters \n", - "params=cubeviz.get_model_parameters(model_label=\"LinFitCont\")\n", + "outputs": [], + "source": [ + "# You can also read out your model fit parameters \n", + "params = cubeviz.get_model_parameters(model_label=\"LinFitCont\")\n", "params" ] }, @@ -964,36 +711,19 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:2:1: E265 block comment should start with '# '\n" - ] - } - ], + "outputs": [], "source": [ - "#And this is just an example of how you can acces the model fit parameter values\n", - "#params['LinFitCont_3d']['slope']" + "# And this is just an example of how you can acces the model fit parameter values\n", + "# params['LinFitCont_3d']['slope']" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n" - ] - } - ], - "source": [ - "#Open up a new instance of Cubeviz to visualize continuum subtracted data\n", + "outputs": [], + "source": [ + "# Open up a new instance of Cubeviz to visualize continuum subtracted data\n", "from jdaviz import CubeViz\n", "cubeviz2 = CubeViz()\n", "cubeviz2.app" @@ -1040,17 +770,9 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n" - ] - } - ], - "source": [ - "#VIDEO PART1\n", + "outputs": [], + "source": [ + "# VIDEO PART1\n", "HTML('')" ] }, @@ -1058,44 +780,17 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n" - ] - } - ], + "outputs": [], "source": [ - "#VIDEO PART2\n", - "HTML('')\n" + "# VIDEO PART2\n", + "HTML('')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:7:1: E265 block comment should start with '# '\n" - ] - }, - { - "ename": "KeyError", - "evalue": "'Subset 1'", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m/var/folders/ls/7lh0_8jn0ndbm6g7plbzw8n400028t/T/ipykernel_48321/4088308880.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0mregions\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 10\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 11\u001b[0;31m \u001b[0mline_region\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mregions\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"Subset 1\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 12\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mline_region\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 13\u001b[0m \u001b[0mline_region\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mSpectralRegion\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m1.6322\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mu\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mum\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m1.6563\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mu\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mum\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mKeyError\u001b[0m: 'Subset 1'" - ] - } - ], + "outputs": [], "source": [ "# Wow, that multi-component fit looks great. Good deal.\n", "\n", @@ -1103,9 +798,8 @@ "# with the Brackett model created in the above cell to create a full\n", "# 3-D model of the central emission that isn't caused by the outflow [Fe II].\n", "\n", - "#Extract the spectral regions defined in the spectral viewer\n", + "# Extract the spectral regions defined in the spectral viewer\n", "regions = cubeviz2.specviz.get_spectral_regions()\n", - "regions\n", "\n", "line_region = regions[\"Subset 1\"]\n", "if not line_region:\n", @@ -1116,19 +810,10 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:2:5: E225 missing whitespace around operator\n" - ] - } - ], - "source": [ - "#List spectra available in spectrum-viewer\n", - "spec=cubeviz2.app.get_data_from_viewer('spectrum-viewer') \n", + "outputs": [], + "source": [ + "# List spectra available in spectrum-viewer\n", + "spec = cubeviz2.app.get_data_from_viewer('spectrum-viewer') \n", "spec" ] }, @@ -1136,94 +821,50 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:2:63: E231 missing whitespace after ','\n", - "INFO:pycodestyle:2:93: E262 inline comment should start with '# '\n", - "INFO:pycodestyle:3:65: E231 missing whitespace after ','\n", - "INFO:pycodestyle:3:78: E262 inline comment should start with '# '\n", - "INFO:pycodestyle:4:86: E262 inline comment should start with '# '\n" - ] - } - ], - "source": [ - "#Get Gauss Model Spectrum and Model Cube\n", - "all_spec = cubeviz2.app.get_data_from_viewer('spectrum-viewer','Continuum Subtracted[SCI]') #AGN Center Data Cube\n", - "gauss_spec = cubeviz2.app.get_data_from_viewer('spectrum-viewer','GaussAll') #AGN Center Model Spec\n", - "gauss_cube = cubeviz2.app.get_data_from_viewer(\"uncert-viewer\", \"GaussAll [Cube] 1\") #AGN Center Model Cube" + "outputs": [], + "source": [ + "# Get Gauss Model Spectrum and Model Cube\n", + "all_spec = cubeviz2.app.get_data_from_viewer('spectrum-viewer', 'Continuum Subtracted[SCI]') # AGN Center Data Cube\n", + "gauss_spec = cubeviz2.app.get_data_from_viewer('spectrum-viewer', 'GaussAll') # AGN Center Model Spec\n", + "gauss_cube = cubeviz2.app.get_data_from_viewer(\"uncert-viewer\", \"GaussAll [Cube] 1\") # AGN Center Model Cube" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:2:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:3:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:5:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:8:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:9:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:10:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:11:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:13:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:14:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:15:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:16:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:17:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:19:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:20:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:21:1: E265 block comment should start with '# '\n" - ] - } - ], - "source": [ - "##Save your Gauss Model Cube If Necessary\n", - "#import os\n", - "#if os.path.exists(\"gauss_model_cube.fits\"):\n", - "# os.remove(\"gauss_model_cube.fits\")\n", - "#else:\n", - "# print(\"The file does not exist\")\n", - "#\n", - "#gaussmodelflux = gauss_cube[\"flux\"]\n", - "#fits.writeto('gauss_model_cube.fits', gaussmodelflux, overwrite=True)\n", - "#print(type(gauss_cube[\"flux\"]))\n", - "#print(type(all_spec.flux))\n", - "\n", - "#Saving with 'Count' doesn't work.\n", - "#print(all_spec.flux)\n", - "#os.remove(\"all_spec.fits\")\n", - "#specref=Spectrum1D(flux=all_spec.flux*u.Unit('Jy'), spectral_axis=all_spec.spectral_axis)\n", - "#specref.write(\"all_spec.fits\")\n", - "\n", - "#os.remove(\"gauss_spec.fits\")\n", - "#specref=Spectrum1D(flux=gauss_spec.flux*u.Unit('Jy'), spectral_axis=gauss_spec.spectral_axis)\n", - "#specref.write(\"gauss_spec.fits\")\n" + "outputs": [], + "source": [ + "# Save your Gauss Model Cube If Necessary\n", + "# import os\n", + "# if os.path.exists(\"gauss_model_cube.fits\"):\n", + "# os.remove(\"gauss_model_cube.fits\")\n", + "# else:\n", + "# print(\"The file does not exist\")\n", + "\n", + "# gaussmodelflux = gauss_cube[\"flux\"]\n", + "# fits.writeto('gauss_model_cube.fits', gaussmodelflux, overwrite=True)\n", + "# print(type(gauss_cube[\"flux\"]))\n", + "# print(type(all_spec.flux))\n", + "\n", + "# Saving with 'Count' doesn't work.\n", + "# print(all_spec.flux)\n", + "# os.remove(\"all_spec.fits\")\n", + "# specref=Spectrum1D(flux=all_spec.flux*u.Unit('Jy'), spectral_axis=all_spec.spectral_axis)\n", + "# specref.write(\"all_spec.fits\")\n", + "\n", + "# os.remove(\"gauss_spec.fits\")\n", + "# specref=Spectrum1D(flux=gauss_spec.flux*u.Unit('Jy'), spectral_axis=gauss_spec.spectral_axis)\n", + "# specref.write(\"gauss_spec.fits\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n" - ] - } - ], - "source": [ - "#Check to see if user used Cubeviz (above), and, if not, read in premade data\n", + "outputs": [], + "source": [ + "# Check to see if user used Cubeviz (above), and, if not, read in premade data\n", "if not gauss_cube:\n", " fn = download_file('https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/IFU_cube_continuum_fit/gauss_model_cube.fits', cache=False)\n", " gauss_cube = fits.getdata(fn)\n", @@ -1243,19 +884,10 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:2:7: E225 missing whitespace around operator\n" - ] - } - ], - "source": [ - "#You can also read out your model fit parameters \n", - "params=cubeviz2.get_model_parameters(model_label=\"GaussAll\")\n", + "outputs": [], + "source": [ + "# You can also read out your model fit parameters \n", + "params = cubeviz2.get_model_parameters(model_label=\"GaussAll\")\n", "params" ] }, @@ -1263,42 +895,23 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:2:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:3:1: E265 block comment should start with '# '\n" - ] - } - ], + "outputs": [], "source": [ - "#Save Parameters as a Pickle File if necessary\n", - "#save_obj(params, \"gauss_params.pkl\")\n", - "#params=load_obj(\"gauss_params.pkl\")\n" + "# Save Parameters as a Pickle File if necessary\n", + "# save_obj(params, \"gauss_params.pkl\")\n", + "# params=load_obj(\"gauss_params.pkl\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:4:11: E225 missing whitespace around operator\n" - ] - } - ], - "source": [ - "#Check to see if user used Cubeviz (above), and, if not, read in premade data\n", + "outputs": [], + "source": [ + "# Check to see if user used Cubeviz (above), and, if not, read in premade data\n", "if not params:\n", " fn = download_file('https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/IFU_cube_continuum_fit/gauss_params.pkl', cache=True)\n", - " params=load_obj(fn)\n", + " params = load_obj(fn)\n", " print(\"Loaded\")" ] }, @@ -1306,63 +919,37 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:3:1: E402 module level import not at top of file\n", - "INFO:pycodestyle:8:13: E225 missing whitespace around operator\n", - "INFO:pycodestyle:9:13: E225 missing whitespace around operator\n", - "INFO:pycodestyle:10:11: E225 missing whitespace around operator\n", - "INFO:pycodestyle:11:11: E225 missing whitespace around operator\n", - "INFO:pycodestyle:12:15: E225 missing whitespace around operator\n", - "INFO:pycodestyle:13:15: E225 missing whitespace around operator\n", - "INFO:pycodestyle:16:32: E231 missing whitespace after ','\n", - "INFO:pycodestyle:16:34: E231 missing whitespace after ','\n" - ] - } - ], - "source": [ - "#Overwrite Gauss Model with only 2 of the components of interest\n", + "outputs": [], + "source": [ + "# Overwrite Gauss Model with only 2 of the components of interest\n", "gauss_cube_2component = gauss_cube*0\n", - "from astropy.modeling import models\n", "\n", "nz, ny, nx = gauss_cube_2component.shape\n", "for i in range(0, nx-1):\n", " for j in range(0, ny-1):\n", - " amp1=params['GaussAll_3d']['amplitude_0'][i][j]\n", - " amp2=params['GaussAll_3d']['amplitude_2'][i][j]\n", - " m1=params['GaussAll_3d']['mean_0'][i][j]\n", - " m2=params['GaussAll_3d']['mean_2'][i][j]\n", - " stdev1=params['GaussAll_3d']['stddev_0'][i][j]\n", - " stdev2=params['GaussAll_3d']['stddev_2'][i][j]\n", + " amp1 = params['GaussAll_3d']['amplitude_0'][i][j]\n", + " amp2 = params['GaussAll_3d']['amplitude_2'][i][j]\n", + " m1 = params['GaussAll_3d']['mean_0'][i][j]\n", + " m2 = params['GaussAll_3d']['mean_2'][i][j]\n", + " stdev1 = params['GaussAll_3d']['stddev_0'][i][j]\n", + " stdev2 = params['GaussAll_3d']['stddev_2'][i][j]\n", " g1 = models.Gaussian1D(amplitude=amp1*u.Unit('count'), mean=m1*u.m, stddev=stdev1*u.m)\n", " g2 = models.Gaussian1D(amplitude=amp2*u.Unit('count'), mean=m2*u.m, stddev=stdev2*u.m)\n", - " gauss_cube_2component[:,i,j] = g1(all_spec.spectral_axis)+g2(all_spec.spectral_axis)" + " gauss_cube_2component[:, i, j] = g1(all_spec.spectral_axis)+g2(all_spec.spectral_axis)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:5:5: E265 block comment should start with '# '\n" - ] - } - ], - "source": [ - "#Add the continuum cube to the new model cube\n", + "outputs": [], + "source": [ + "# Add the continuum cube to the new model cube\n", "continuum_file = 'NGC4151_Hband_ContinuumPSF.fits'\n", "newfull_header = fits.getheader(continuum_file)\n", + "\n", "with fits.open(continuum_file, memmap=False) as continuum_cube: \n", - " #print(continuum_cube[0].data)\n", + " # print(continuum_cube[0].data)\n", " continuum_data = continuum_cube[0].data\n", " full_model = gauss_cube_2component+continuum_data" ] @@ -1371,21 +958,14 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:2:1: E265 block comment should start with '# '\n" - ] - } - ], - "source": [ - "# subtract the model to create the final cube where the [Fe II] emission is isolated.\n", - "#Re-read in original IFU cube for manipulation\n", + "outputs": [], + "source": [ + "# Subtract the model to create the final cube where the [Fe II] emission is isolated.\n", + "# Re-read in original IFU cube for manipulation\n", "cube_file = 'https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/IFU_cube_continuum_fit/NGC4151_Hband.fits'\n", "newfinalsub_header = fits.getheader(cube_file)\n", - "with fits.open(cube_file, memmap=False) as original_cube: \n", + "\n", + "with fits.open(cube_file, memmap=False) as original_cube:\n", " original_data = original_cube['SCI'].data\n", " final_sub_cube = original_data - full_model" ] @@ -1394,50 +974,29 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:4:3: E111 indentation is not a multiple of 4\n", - "INFO:pycodestyle:6:3: E111 indentation is not a multiple of 4\n", - "INFO:pycodestyle:10:3: E111 indentation is not a multiple of 4\n", - "INFO:pycodestyle:12:3: E111 indentation is not a multiple of 4\n" - ] - } - ], - "source": [ - "#Delete any existing output in current directory\n", - "import os\n", + "outputs": [], + "source": [ + "# Delete any existing output in current directory\n", "if os.path.exists(\"NGC4151_Hband_FinalSubtract.fits\"):\n", - " os.remove(\"NGC4151_Hband_FinalSubtract.fits\")\n", + " os.remove(\"NGC4151_Hband_FinalSubtract.fits\")\n", "else:\n", - " print(\"The file does not exist\")\n", + " print(\"The file does not exist\")\n", "\n", - "import os\n", "if os.path.exists(\"NGC4151_Hband_ContinuumandBrackettModel.fits\"):\n", - " os.remove(\"NGC4151_Hband_ContinuumandBrackettModel.fits\")\n", + " os.remove(\"NGC4151_Hband_ContinuumandBrackettModel.fits\")\n", "else:\n", - " print(\"The file does not exist\")" + " print(\"The file does not exist\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n" - ] - } - ], - "source": [ - "#del newfull_header['MODE']\n", + "outputs": [], + "source": [ + "# del newfull_header['MODE']\n", "del newfinalsub_header['MODE']\n", + "\n", "fits.writeto('NGC4151_Hband_ContinuumandBrackettModel.fits', full_model, newfull_header, overwrite=True)\n", "fits.writeto('NGC4151_Hband_FinalSubtract.fits', final_sub_cube, newfinalsub_header, overwrite=True)\n", "print('Continuum subtracted cube saved. PSF continuum cube saved.')" @@ -1447,36 +1006,16 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO:pycodestyle:1:1: E265 block comment should start with '# '\n", - "INFO:pycodestyle:5:50: E231 missing whitespace after ','\n", - "INFO:pycodestyle:5:53: E231 missing whitespace after ','\n", - "INFO:pycodestyle:5:57: E231 missing whitespace after ','\n", - "INFO:pycodestyle:6:49: E231 missing whitespace after ','\n", - "INFO:pycodestyle:6:52: E231 missing whitespace after ','\n", - "INFO:pycodestyle:6:56: E231 missing whitespace after ','\n", - "INFO:pycodestyle:7:46: E231 missing whitespace after ','\n", - "INFO:pycodestyle:7:49: E231 missing whitespace after ','\n", - "INFO:pycodestyle:7:53: E231 missing whitespace after ','\n", - "INFO:pycodestyle:8:50: E231 missing whitespace after ','\n", - "INFO:pycodestyle:8:53: E231 missing whitespace after ','\n", - "INFO:pycodestyle:8:61: E231 missing whitespace after ','\n" - ] - } - ], - "source": [ - "#Make the final plots to illustrated\n", + "outputs": [], + "source": [ + "# Make the final plots to illustrated\n", "plt.figure()\n", "plt.xlim([1.630E-6, 1.665E-6])\n", "plt.ylim([600, 900])\n", - "plt.plot(all_spec.spectral_axis, continuum_data[:,30,30],label='Continuum')\n", - "plt.plot(all_spec.spectral_axis, original_data[:,30,30],label='Original Data')\n", - "plt.plot(all_spec.spectral_axis, full_model[:,30,30],label='2 Component Model')\n", - "plt.plot(all_spec.spectral_axis, final_sub_cube[:,30,30]+700,label='Model Subtraction+Offset')\n", + "plt.plot(all_spec.spectral_axis, continuum_data[:, 30, 30], label='Continuum')\n", + "plt.plot(all_spec.spectral_axis, original_data[:, 30, 30], label='Original Data')\n", + "plt.plot(all_spec.spectral_axis, full_model[:, 30, 30], label='2 Component Model')\n", + "plt.plot(all_spec.spectral_axis, final_sub_cube[:, 30, 30]+700, label='Model Subtraction+Offset')\n", "plt.legend()\n", "plt.show()" ] From e6eb7197d6e07958240629f7a617ae7f6374579f Mon Sep 17 00:00:00 2001 From: ojustino Date: Wed, 15 Sep 2021 14:54:39 -0400 Subject: [PATCH 06/11] Removed technical review cells --- .../NGC4151_FeII_ContinuumFit.ipynb | 42 ------------------- 1 file changed, 42 deletions(-) diff --git a/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb b/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb index 43cb6bb4..635dc182 100644 --- a/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb +++ b/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb @@ -93,48 +93,6 @@ " return pickle.load(f)" ] }, - { - "cell_type": "markdown", - "metadata": { - "tags": [] - }, - "source": [ - "

Reviewer note: Begin PEP8 check cells (delete below when finished)

" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# disable all imported packages' loggers\n", - "import logging\n", - "logging.root.manager.loggerDict = {}" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# enable PEP8 checker for this notebook\n", - "%load_ext pycodestyle_magic\n", - "%flake8_on --ignore E261,E501,W291,W293\n", - "\n", - "# only allow the checker to throw warnings when there's a violation\n", - "logging.getLogger('flake8').setLevel('ERROR')\n", - "logging.getLogger('stpipe').setLevel('ERROR')" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Reviewer note: End PEP8 check cells (delete above when finished)

" - ] - }, { "cell_type": "code", "execution_count": null, From af98f80a813ed14437da558dfcc2152b1d7ca448 Mon Sep 17 00:00:00 2001 From: Ori Date: Wed, 15 Sep 2021 15:17:33 -0400 Subject: [PATCH 07/11] addressed some science and technical reviews --- .../NGC4151_FeII_ContinuumFit.ipynb | 196 +++++++++--------- .../IFU_cube_continuum_fit/requirements.txt | 12 +- 2 files changed, 101 insertions(+), 107 deletions(-) diff --git a/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb b/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb index 635dc182..f3c76034 100644 --- a/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb +++ b/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb @@ -195,27 +195,6 @@ "plt.show()" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "print(wave)\n", - "# print(wave-wave_emission_limit1)\n", - "# print(continuummin,continuummax)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - " For this particular dataset, this continuum region looks very good.\n", - " if you have a more structured continuum you can define additional\n", - " regions and append them into a larger set of wave / flux arrays to \n", - " derive a more accurate fit in the below poly-fit analysis." - ] - }, { "cell_type": "markdown", "metadata": {}, @@ -230,7 +209,7 @@ "source": [ "### Video1: \n", "\n", - "YouTube Demo" + "This Cubeviz Instructional Demo is from STScI's official YouTube channel and provides an introduction to Cubeviz." ] }, { @@ -269,22 +248,26 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Defining your data sets\n", - "\n", "A video is shown below illustrating the procedure. The following steps are applied:\n", "\n", - "Use the flux viewer in cubeviz to extract a spectrum located at the central AGN position.\n", - "It should show in the above spectral viewer, too.\n", + "When you load your cube, you will see a collapsed spectrum of all the spaxels in the spectral viewer at the bottom.\n", "\n", - "To do this, use the expandable menu at the left of the flux viewer window and select the 'define circular region of interest' icon. Make a circular region at the central position of the bright AGN flux, which is at approximately the cube center position.\n", + "If you draw a region (circle or square) in the flux viewer, you will see a collapsed spectrum of that particular region in the spectral viewer, too. To do this, use the expandable menu at the left of the flux viewer window and select the 'define circular region of interest' icon. For this example, we want to first define a circular region at the central position of the bright AGN flux, which is at approximately the cube center position.\n", "\n", - "Now, use the flux viewer and again use the 'define circular region of interest' icon to make spectra at two positions associated with the outflow emission in [Fe II].\n", + "Now, use the flux viewer and again use the 'define circular region of interest' icon to make spectra at two positions associated with the outflow emission in [Fe II]. The redshifted outflow is at approximate x position = 12, y position = 36. This will be 'Subset 2' and will show up in green in the display. The blueshifted outflow is at approximately x position = 50, y position = 28 in pixel index units. This will be 'Subset 3' and will show up in blue in the display.\n", "\n", - "The redshifted outflow is at approximate x position = 12, y position = 36. This will be 'Subset 2' and will show up in green in the display.\n", + "(If the notebook is being run non-interactively, automatically make two datasets that mimic the AGN outflow red/blueshifted spectra)." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Defining your Spectral Regions\n", "\n", - "The blueshifted outflow is at approximately x position = 50, y position = 28 in pixel index units. This will be 'Subset 3' and will show up in blue in the display.\n", + "Next, you will want to define the wavelengths of interest in your spectral viewer for both your line and continuum analysis. To do this, you will similarly click the 'define region of interest' icon in your spectral viewer and drag a box over the wavelengths you desire. Again, a video is show below illustrating the process.\n", "\n", - "(If the notebook is being run non-interactively, automatically make two datasets that mimic the AGN outflow red/blueshifted spectra)." + "There is no option to set the spectral regions to user input, so we recommend zooming in and drawing by eye. The line emission (;Subset 4' ) should span approximately 1.630 - 1.665 um, and the continuum emission ('Subset 5') should span approximately 1.656 - 1.673 um." ] }, { @@ -304,7 +287,7 @@ "source": [ "### Video2: \n", "\n", - "Here is a video illustrating how to load and manipulate data for this particular notebook." + "Here is a video illustrating how to load and manipulate data for this particular notebook. A description of how to manipulate the data and use the \"Collapse\" tool is given above." ] }, { @@ -376,39 +359,9 @@ "spectrum1 = cubeviz.app.get_data_from_viewer('spectrum-viewer', 'Subset 1') # AGN Center\n", "spectrum2 = cubeviz.app.get_data_from_viewer('spectrum-viewer', 'Subset 2') # Red shifted component\n", "spectrum3 = cubeviz.app.get_data_from_viewer('spectrum-viewer', 'Subset 3') # Blue shifted component\n", - "# spectrum3 = cubeviz.app.get_data_from_viewer('spectrum-viewer')['Subset 3'] # Blue shifted component\n", "spectrum1" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# regions = cubeviz.specviz.get_spectral_regions()\n", - "# regions" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# regions = cubeviz.app.get_data_from_viewer('flux-viewer')['Subset 4'] #AGN Center\n", - "# regions" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# regions = cubeviz.app.get" - ] - }, { "cell_type": "code", "execution_count": null, @@ -445,7 +398,7 @@ "metadata": {}, "outputs": [], "source": [ - "# Apply the spectral region\n", + "#Apply the spectral region (This code creates new collapsed spectra if you did not create any yourself within jdaviz)\n", "from specutils.manipulation import extract_region\n", "\n", "if not spectrum1:\n", @@ -505,10 +458,11 @@ "source": [ "## Fit the Continuum at the Spectral Region Location\n", "\n", - "A video is shown below illustrating the procedure. The following steps are applied to this particular example:
\n", + "A video is shown below illustrating the procedure for fitting the continuum for 'Subset 5' throughout the entire cube. The following steps are applied to this particular example:
\n", + "\n", + "Open up Model Fitting Plugin. There are a number of fields to fill in and drop down menus to select from. It is important to keep in mind that the Data menu will provide only spectra to model, while the Spectral Region menu will provide only spectral region subsets to choose. In other words, you can fit the spectra in specific spectral regions. If no spectral region is selected, the entire wavelength array will be fit by the mode.
\n", "\n", - "Open up Model Fitting Plugin.
\n", - "Select Data Cube contentsSCI
\n", + "Select Data Cube: contentsSCI
\n", "Select Spectral Region Subset 5
\n", "Model: Linear1D
\n", "ModelID: L1
\n", @@ -516,7 +470,14 @@ "Model Equation Editor: L1
\n", "Model Label: LinFitCont
\n", "
\n", - "Hit Fit, and then Apply to Cube." + "Hit Fit, which fits the collapsed spectrum.
\n", + "View the fit in the spectral viewer and confirm you are happy with it.
\n", + "Then hit Apply to Cube.
\n", + "\n", + "This will create two models that can now be accessed within the Data Dropdown menus:
\n", + "A 1D linear fit of the continuum for the collapsed cube.
\n", + "A 3D linear fit of the continuum for each spaxel in the cube.
\n", + "\n" ] }, { @@ -641,13 +602,10 @@ " sci = cont_sub_cube['SCI'].data\n", "\n", " # Get List of different viewers\n", - " # linfitcube = cubeviz.app.get_data_from_viewer(\"uncert-viewer\", \"LinFitCube [Cube] 1\")\n", " continuumflux = cont_psf_cube[\"flux\"]\n", "\n", " sci_contsub = sci-continuumflux\n", " cont_sub_cube['SCI'].data = sci_contsub \n", - " # cubeviz.app.load_data(newcube)\n", - " # del newheader_cube['MODE']\n", " del cont_sub_cube['PRIMARY'].header['MODE']\n", " cont_sub_cube.writeto('NGC4151_Hband_ContinuumSubtract.fits')\n", " del newheader_cube['MODE']\n", @@ -666,13 +624,12 @@ ] }, { - "cell_type": "code", - "execution_count": null, + "cell_type": "markdown", "metadata": {}, - "outputs": [], "source": [ - "# And this is just an example of how you can acces the model fit parameter values\n", - "# params['LinFitCont_3d']['slope']" + "And this is just an example of how you can acces the model fit parameter values:\n", + "\n", + "params['LinFitCont_3d']['slope']" ] }, { @@ -707,8 +664,11 @@ "\n", "A video is shown below illustrating the procedure. The following steps are applied:
\n", "\n", + "First, select the wavelength region of interest following a similar procedure as performed at the top. There is no option to set the spectral regions to a user input, so we recommend zooming in and drawing by eye. The line emission ('Subset 1' ) should again span approximately 1.630 - 1.665 um.\n", + "\n", "For this example, we recommend setting up a 3 component gaussian model with the following inputs
\n", - "Open up Model Fitting Plugin.
\n", + "Open up Model Fitting Plugin. There are a number of fields to fill in and drop down menus to select from. It is important to keep in mind that the Data menu will provide only spectra to model, while the Spectral Region menu will provide only spectral region subsets to choose. In other words, you can fit the spectra in specific spectral regions. If no spectral region is selected, the entire wavelength array will be fit by the mode.
\n", + "\n", "Data: Continuum Subtracted
\n", "Spectral region or subset covering about 1.632 to 1.656 um
\n", "Model: Three different Gaussians with ModelID's set to G1, G2, and G3
\n", @@ -717,11 +677,18 @@ "G1: stdev=0.0008E-6, mean=1.641E-6
\n", "G2: stdev=0.0007E-6, mean=1.648E-6
\n", "G3: stdev=0.005E-6, mean=1.646E-6
\n", + "You can turn on the 'Fixed' option if you need to, but these numbers should provide a good starting guess for the fit.
\n", "\n", "Model Equation Editor: G1+G2+g3
\n", "Model Label: GaussAll
\n", "
\n", - "Hit Fit, and then Apply to Cube." + "Hit Fit, which fits the collapsed spectrum.
\n", + "View the fit in the spectral viewer and confirm you are happy with it. Modify if necessary.
\n", + "Then hit Apply to Cube.
\n", + "\n", + "This will again create two models that can now be accessed within the Data Dropdown menus:
\n", + "A 1D linear fit of the lines in the collapsed cube.
\n", + "A 3D linear fit of the lines for each spaxel in the cube.
" ] }, { @@ -794,26 +761,32 @@ "outputs": [], "source": [ "# Save your Gauss Model Cube If Necessary\n", - "# import os\n", - "# if os.path.exists(\"gauss_model_cube.fits\"):\n", - "# os.remove(\"gauss_model_cube.fits\")\n", - "# else:\n", - "# print(\"The file does not exist\")\n", + "import os\n", + "if os.path.exists(\"gauss_model_cube.fits\"):\n", + " os.remove(\"gauss_model_cube.fits\")\n", + "else:\n", + " print(\"The file does not exist\")\n", "\n", - "# gaussmodelflux = gauss_cube[\"flux\"]\n", - "# fits.writeto('gauss_model_cube.fits', gaussmodelflux, overwrite=True)\n", - "# print(type(gauss_cube[\"flux\"]))\n", - "# print(type(all_spec.flux))\n", + "gaussmodelflux = gauss_cube[\"flux\"]\n", + "fits.writeto('gauss_model_cube.fits', gaussmodelflux, overwrite=True)\n", + "print(type(gauss_cube[\"flux\"]))\n", + "print(type(all_spec.flux))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Developer Note: Saving with 'Count' doesn't work.\n", "\n", - "# Saving with 'Count' doesn't work.\n", - "# print(all_spec.flux)\n", - "# os.remove(\"all_spec.fits\")\n", - "# specref=Spectrum1D(flux=all_spec.flux*u.Unit('Jy'), spectral_axis=all_spec.spectral_axis)\n", - "# specref.write(\"all_spec.fits\")\n", + "print(all_spec.flux)
\n", + "os.remove(\"all_spec.fits\")
\n", + "specref=Spectrum1D(flux=all_spec.flux*u.Unit('Jy'), spectral_axis=all_spec.spectral_axis)
\n", + "specref.write(\"all_spec.fits\")
\n", "\n", - "# os.remove(\"gauss_spec.fits\")\n", - "# specref=Spectrum1D(flux=gauss_spec.flux*u.Unit('Jy'), spectral_axis=gauss_spec.spectral_axis)\n", - "# specref.write(\"gauss_spec.fits\")" + "os.remove(\"gauss_spec.fits\")
\n", + "specref=Spectrum1D(flux=gauss_spec.flux*u.Unit('Jy'), spectral_axis=gauss_spec.spectral_axis)
\n", + "specref.write(\"gauss_spec.fits\")
\n" ] }, { @@ -856,8 +829,8 @@ "outputs": [], "source": [ "# Save Parameters as a Pickle File if necessary\n", - "# save_obj(params, \"gauss_params.pkl\")\n", - "# params=load_obj(\"gauss_params.pkl\")" + "save_obj(params, \"gauss_params.pkl\")\n", + "params=load_obj(\"gauss_params.pkl\")" ] }, { @@ -907,7 +880,6 @@ "newfull_header = fits.getheader(continuum_file)\n", "\n", "with fits.open(continuum_file, memmap=False) as continuum_cube: \n", - " # print(continuum_cube[0].data)\n", " continuum_data = continuum_cube[0].data\n", " full_model = gauss_cube_2component+continuum_data" ] @@ -966,7 +938,7 @@ "metadata": {}, "outputs": [], "source": [ - "# Make the final plots to illustrated\n", + "# Make the final plots to illustrate the original spectrum, model fits, and final continuum+gassian subtracted cube\n", "plt.figure()\n", "plt.xlim([1.630E-6, 1.665E-6])\n", "plt.ylim([600, 900])\n", @@ -977,13 +949,35 @@ "plt.legend()\n", "plt.show()" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#Open up a new instance of Cubeviz to visualize continuum subtracted data\n", + "from jdaviz import CubeViz\n", + "cubeviz3 = CubeViz()\n", + "cubeviz3.app" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "cont_sub_cube = 'NGC4151_Hband_FinalSubtract.fits'\n", + "cubeviz3.app.load_data(cont_sub_cube, data_label='Red/Blue Shift')" + ] } ], "metadata": { "kernelspec": { - "display_name": "Python [conda env:dat-ifu-cont-adv] *", + "display_name": "Python 3 (ipykernel)", "language": "python", - "name": "conda-env-dat-ifu-cont-adv-py" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -995,7 +989,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.10" + "version": "3.9.6" } }, "nbformat": 4, diff --git a/jdat_notebooks/IFU_cube_continuum_fit/requirements.txt b/jdat_notebooks/IFU_cube_continuum_fit/requirements.txt index cbfc4525..669df510 100644 --- a/jdat_notebooks/IFU_cube_continuum_fit/requirements.txt +++ b/jdat_notebooks/IFU_cube_continuum_fit/requirements.txt @@ -1,7 +1,7 @@ -astropy>=4.1 -specutils>=1.0 -matplotlib>=3.2 +astropy>=4.3.1 +specutils>=1.4.0 +matplotlib>=3.4.3 Bottleneck>=1.3.2 -ipyvue>=1.3.4 -ipyvuetify>=1.4.1 -git+https://github.com/spacetelescope/jdaviz.git@625acca8562249c2f4d9041c566c1820a4d480b2#egg=jdaviz +ipyvue>=1.5.0 +ipyvuetify>=1.8.1 +git+https://github.com/spacetelescope/jdaviz.git@main From fca2e46340cdabc460947c9e9cbc2c08c1546452 Mon Sep 17 00:00:00 2001 From: Ori Date: Wed, 15 Sep 2021 16:40:15 -0400 Subject: [PATCH 08/11] more small style edits --- .../NGC4151_FeII_ContinuumFit.ipynb | 31 +++++++++---------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb b/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb index f3c76034..d632acb0 100644 --- a/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb +++ b/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb @@ -398,7 +398,7 @@ "metadata": {}, "outputs": [], "source": [ - "#Apply the spectral region (This code creates new collapsed spectra if you did not create any yourself within jdaviz)\n", + "# Apply the spectral region (This code creates new collapsed spectra if you did not create any yourself within jdaviz)\n", "from specutils.manipulation import extract_region\n", "\n", "if not spectrum1:\n", @@ -535,8 +535,7 @@ "outputs": [], "source": [ "# Extract Continuum Model from Cubeviz above\n", - "cont_psf_cube = cubeviz.app.get_data_from_viewer(\"uncert-viewer\", \"LinFitCont [Cube] 1\")\n", - "# cont_psf_cubee = cubeviz.app.get_data_from_viewer(\"uncert-viewer\", \"LinFitCont [Cube] 2\")" + "cont_psf_cube = cubeviz.app.get_data_from_viewer(\"uncert-viewer\", \"LinFitCont [Cube] 1\")" ] }, { @@ -624,11 +623,10 @@ ] }, { - "cell_type": "markdown", + "cell_type": "raw", "metadata": {}, "source": [ - "And this is just an example of how you can acces the model fit parameter values:\n", - "\n", + "# And this is just an example of how you can acces the model fit parameter values:\n", "params['LinFitCont_3d']['slope']" ] }, @@ -774,19 +772,19 @@ ] }, { - "cell_type": "markdown", + "cell_type": "raw", "metadata": {}, "source": [ - "Developer Note: Saving with 'Count' doesn't work.\n", + "# Developer Note: Saving with 'Count' doesn't work.\n", "\n", - "print(all_spec.flux)
\n", - "os.remove(\"all_spec.fits\")
\n", - "specref=Spectrum1D(flux=all_spec.flux*u.Unit('Jy'), spectral_axis=all_spec.spectral_axis)
\n", - "specref.write(\"all_spec.fits\")
\n", + "print(all_spec.flux)\n", + "os.remove(\"all_spec.fits\")\n", + "specref=Spectrum1D(flux=all_spec.flux*u.Unit('Jy'), spectral_axis=all_spec.spectral_axis)\n", + "specref.write(\"all_spec.fits\")\n", "\n", - "os.remove(\"gauss_spec.fits\")
\n", - "specref=Spectrum1D(flux=gauss_spec.flux*u.Unit('Jy'), spectral_axis=gauss_spec.spectral_axis)
\n", - "specref.write(\"gauss_spec.fits\")
\n" + "os.remove(\"gauss_spec.fits\")\n", + "specref=Spectrum1D(flux=gauss_spec.flux*u.Unit('Jy'), spectral_axis=gauss_spec.spectral_axis)\n", + "specref.write(\"gauss_spec.fits\")" ] }, { @@ -924,7 +922,6 @@ "metadata": {}, "outputs": [], "source": [ - "# del newfull_header['MODE']\n", "del newfinalsub_header['MODE']\n", "\n", "fits.writeto('NGC4151_Hband_ContinuumandBrackettModel.fits', full_model, newfull_header, overwrite=True)\n", @@ -956,7 +953,7 @@ "metadata": {}, "outputs": [], "source": [ - "#Open up a new instance of Cubeviz to visualize continuum subtracted data\n", + "# Open up a new instance of Cubeviz to visualize continuum subtracted data\n", "from jdaviz import CubeViz\n", "cubeviz3 = CubeViz()\n", "cubeviz3.app" From 6aeff26a8000900357bce1519813349ab01c9610 Mon Sep 17 00:00:00 2001 From: ojustino Date: Wed, 15 Sep 2021 17:34:56 -0400 Subject: [PATCH 09/11] Completed secondary technical review --- .../NGC4151_FeII_ContinuumFit.ipynb | 83 +++++++++++-------- 1 file changed, 47 insertions(+), 36 deletions(-) diff --git a/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb b/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb index d632acb0..50c0e14b 100644 --- a/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb +++ b/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb @@ -48,19 +48,18 @@ "import time\n", "import os\n", "from copy import copy\n", - "\n", - "import numpy as np\n", + "from IPython.display import HTML, YouTubeVideo\n", "\n", "import astropy\n", + "import numpy as np\n", "from astropy.io import fits, ascii\n", "from astropy import units as u\n", "from astropy.modeling import models\n", "from astropy.utils.data import download_file\n", "from specutils.fitting import fit_lines\n", "from specutils import Spectrum1D\n", - "\n", - "from jdaviz.app import Application\n", - "from IPython.display import HTML" + "from jdaviz import Cubeviz\n", + "from jdaviz.app import Application" ] }, { @@ -84,10 +83,12 @@ "# Save and Load Objects Using Pickle\n", "import pickle\n", "\n", + "\n", "def save_obj(obj, name):\n", " with open(name, 'wb') as f:\n", " pickle.dump(obj, f, pickle.HIGHEST_PROTOCOL)\n", "\n", + "\n", "def load_obj(name):\n", " with open(name, 'rb') as f:\n", " return pickle.load(f)" @@ -191,7 +192,7 @@ "plt.figure(1)\n", "plt.plot(wave, flux1)\n", "plt.plot(wave[wavemin:wavemax], flux1[wavemin:wavemax])\n", - "plt.plot(wave[continuummin:continuummax], flux1[continuummin:continuummax],color='r')\n", + "plt.plot(wave[continuummin:continuummax], flux1[continuummin:continuummax], color='r')\n", "plt.show()" ] }, @@ -218,7 +219,6 @@ "metadata": {}, "outputs": [], "source": [ - "from IPython.display import YouTubeVideo\n", "vid = YouTubeVideo(\"HMSYwiH3Gl4\")\n", "display(vid)" ] @@ -229,8 +229,7 @@ "metadata": {}, "outputs": [], "source": [ - "from jdaviz import CubeViz\n", - "cubeviz = CubeViz()\n", + "cubeviz = Cubeviz()\n", "cubeviz.app" ] }, @@ -240,7 +239,7 @@ "metadata": {}, "outputs": [], "source": [ - "# Here, we load the data into the cubeviz app.\n", + "# Here, we load the data into the Cubeviz app.\n", "cubeviz.load_data(fn) " ] }, @@ -384,7 +383,7 @@ "metadata": {}, "outputs": [], "source": [ - "# Define Missing Spectral Regions if User Did Not in Cubeviz\n", + "# Define missing spectral regions if user did not in Cubeviz\n", "if not regions:\n", " line_region = SpectralRegion(1.630*u.um, 1.665*u.um)\n", " \n", @@ -398,7 +397,8 @@ "metadata": {}, "outputs": [], "source": [ - "# Apply the spectral region (This code creates new collapsed spectra if you did not create any yourself within jdaviz)\n", + "# Apply the spectral region\n", + "# (creates new collapsed spectra if user did not in jdaviz)\n", "from specutils.manipulation import extract_region\n", "\n", "if not spectrum1:\n", @@ -523,7 +523,7 @@ "metadata": {}, "outputs": [], "source": [ - "# List Data from Viewer\n", + "# List data from viewer\n", "regions = cubeviz.app.get_data_from_viewer(\"uncert-viewer\")\n", "regions" ] @@ -534,7 +534,7 @@ "metadata": {}, "outputs": [], "source": [ - "# Extract Continuum Model from Cubeviz above\n", + "# Extract continuum model from Cubeviz above\n", "cont_psf_cube = cubeviz.app.get_data_from_viewer(\"uncert-viewer\", \"LinFitCont [Cube] 1\")" ] }, @@ -622,11 +622,17 @@ "params" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "*(The following cell is just an example of how you can acces the model fit parameter values):*" + ] + }, { "cell_type": "raw", "metadata": {}, "source": [ - "# And this is just an example of how you can acces the model fit parameter values:\n", "params['LinFitCont_3d']['slope']" ] }, @@ -637,8 +643,7 @@ "outputs": [], "source": [ "# Open up a new instance of Cubeviz to visualize continuum subtracted data\n", - "from jdaviz import CubeViz\n", - "cubeviz2 = CubeViz()\n", + "cubeviz2 = Cubeviz()\n", "cubeviz2.app" ] }, @@ -709,18 +714,21 @@ "HTML('')" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Wow, that multi-component fit looks great. Good deal.\n", + "\n", + "Now we're going to use the continuum psf cube from a prior cell with the Brackett model created in the above cell to create a full 3-D model of the central emission that isn't caused by the outflow [Fe II]." + ] + }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "# Wow, that multi-component fit looks great. Good deal.\n", - "\n", - "# Now we're going to use the continuum psf cube from a prior cell \n", - "# with the Brackett model created in the above cell to create a full\n", - "# 3-D model of the central emission that isn't caused by the outflow [Fe II].\n", - "\n", "# Extract the spectral regions defined in the spectral viewer\n", "regions = cubeviz2.specviz.get_spectral_regions()\n", "\n", @@ -746,7 +754,7 @@ "metadata": {}, "outputs": [], "source": [ - "# Get Gauss Model Spectrum and Model Cube\n", + "# Get gauss model spectrum and model cube\n", "all_spec = cubeviz2.app.get_data_from_viewer('spectrum-viewer', 'Continuum Subtracted[SCI]') # AGN Center Data Cube\n", "gauss_spec = cubeviz2.app.get_data_from_viewer('spectrum-viewer', 'GaussAll') # AGN Center Model Spec\n", "gauss_cube = cubeviz2.app.get_data_from_viewer(\"uncert-viewer\", \"GaussAll [Cube] 1\") # AGN Center Model Cube" @@ -758,8 +766,7 @@ "metadata": {}, "outputs": [], "source": [ - "# Save your Gauss Model Cube If Necessary\n", - "import os\n", + "# Save your gauss model cube if necessary\n", "if os.path.exists(\"gauss_model_cube.fits\"):\n", " os.remove(\"gauss_model_cube.fits\")\n", "else:\n", @@ -771,12 +778,17 @@ "print(type(all_spec.flux))" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "*(Developer Note: if saving with 'Count' doesn't work, try the following code.)*" + ] + }, { "cell_type": "raw", "metadata": {}, "source": [ - "# Developer Note: Saving with 'Count' doesn't work.\n", - "\n", "print(all_spec.flux)\n", "os.remove(\"all_spec.fits\")\n", "specref=Spectrum1D(flux=all_spec.flux*u.Unit('Jy'), spectral_axis=all_spec.spectral_axis)\n", @@ -826,9 +838,9 @@ "metadata": {}, "outputs": [], "source": [ - "# Save Parameters as a Pickle File if necessary\n", + "# Save parameters as a pickle file if necessary\n", "save_obj(params, \"gauss_params.pkl\")\n", - "params=load_obj(\"gauss_params.pkl\")" + "params = load_obj(\"gauss_params.pkl\")" ] }, { @@ -850,7 +862,7 @@ "metadata": {}, "outputs": [], "source": [ - "# Overwrite Gauss Model with only 2 of the components of interest\n", + "# Overwrite gauss model with only 2 of the components of interest\n", "gauss_cube_2component = gauss_cube*0\n", "\n", "nz, ny, nx = gauss_cube_2component.shape\n", @@ -954,8 +966,7 @@ "outputs": [], "source": [ "# Open up a new instance of Cubeviz to visualize continuum subtracted data\n", - "from jdaviz import CubeViz\n", - "cubeviz3 = CubeViz()\n", + "cubeviz3 = Cubeviz()\n", "cubeviz3.app" ] }, @@ -972,9 +983,9 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "Python [conda env:dat-ifu-cont-adv] *", "language": "python", - "name": "python3" + "name": "conda-env-dat-ifu-cont-adv-py" }, "language_info": { "codemirror_mode": { @@ -986,7 +997,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.6" + "version": "3.8.10" } }, "nbformat": 4, From 6c9464a9eeba4205ea7441386df4652d9d4dee75 Mon Sep 17 00:00:00 2001 From: ojustino Date: Thu, 16 Sep 2021 12:32:53 -0400 Subject: [PATCH 10/11] Tried to address test failures --- .../NGC4151_FeII_ContinuumFit.ipynb | 90 +++++++++---------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb b/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb index 50c0e14b..4ae78c5a 100644 --- a/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb +++ b/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb @@ -59,7 +59,9 @@ "from specutils.fitting import fit_lines\n", "from specutils import Spectrum1D\n", "from jdaviz import Cubeviz\n", - "from jdaviz.app import Application" + "from jdaviz.app import Application\n", + "from specutils.manipulation import extract_region\n", + "from specutils.spectra import SpectralRegion" ] }, { @@ -369,25 +371,27 @@ }, "outputs": [], "source": [ - "# Extract the spectral regions defined in the spectral viewer\n", - "from specutils.spectra import SpectralRegion\n", + "# Extract the line region defined in the spectral viewer\n", "regions = cubeviz.specviz.get_spectral_regions()\n", - "\n", - "line_region = regions[\"Subset 4\"]\n", - "continuum_region = regions[\"Subset 5\"]" + " \n", + "if regions and \"Subset 4\" in regions.keys():\n", + " line_region = regions[\"Subset 4\"]\n", + "else:\n", + " line_region = SpectralRegion(1.630*u.um, 1.665*u.um)" ] }, { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "scrolled": true + }, "outputs": [], "source": [ - "# Define missing spectral regions if user did not in Cubeviz\n", - "if not regions:\n", - " line_region = SpectralRegion(1.630*u.um, 1.665*u.um)\n", - " \n", - "if not regions:\n", + "# Extract the continuum region defined in the spectral viewer\n", + "if regions and \"Subset 5\" in regions.keys():\n", + " continuum_region = regions[\"Subset 5\"]\n", + "else:\n", " continuum_region = SpectralRegion(1.656*u.um, 1.673*u.um)" ] }, @@ -399,8 +403,6 @@ "source": [ "# Apply the spectral region\n", "# (creates new collapsed spectra if user did not in jdaviz)\n", - "from specutils.manipulation import extract_region\n", - "\n", "if not spectrum1:\n", " flux_agn = np.sum(cube[:, (ny//2)-3:(ny//2)+3, (nx//2)-3:(nx//2)+3], axis=(1, 2))\n", " tmpspec = Spectrum1D(flux=flux_agn*u.Unit('count'), spectral_axis=wave*u.micron) \n", @@ -494,9 +496,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "scrolled": false - }, + "metadata": {}, "outputs": [], "source": [ "# PART 2\n", @@ -732,8 +732,9 @@ "# Extract the spectral regions defined in the spectral viewer\n", "regions = cubeviz2.specviz.get_spectral_regions()\n", "\n", - "line_region = regions[\"Subset 1\"]\n", - "if not line_region:\n", + "if regions and \"Subset 1\" in regions.keys():\n", + " line_region = regions[\"Subset 1\"]\n", + "else:\n", " line_region = SpectralRegion(1.6322*u.um, 1.6563*u.um)" ] }, @@ -760,6 +761,28 @@ "gauss_cube = cubeviz2.app.get_data_from_viewer(\"uncert-viewer\", \"GaussAll [Cube] 1\") # AGN Center Model Cube" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Check to see if user used Cubeviz (above), and, if not, read in premade data\n", + "if not gauss_cube:\n", + " fn = download_file('https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/IFU_cube_continuum_fit/gauss_model_cube.fits', cache=False)\n", + " gauss_cube = fits.getdata(fn)\n", + "else:\n", + " gauss_cube = gauss_cube[\"flux\"]\n", + " \n", + "if not all_spec:\n", + " fn = download_file('https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/IFU_cube_continuum_fit/all_spec.fits', cache=False)\n", + " all_spec = Spectrum1D.read(fn)\n", + " \n", + "if not gauss_spec:\n", + " fn = download_file('https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/IFU_cube_continuum_fit/gauss_spec.fits', cache=False)\n", + " gauss_spec = Spectrum1D.read(fn)" + ] + }, { "cell_type": "code", "execution_count": null, @@ -770,11 +793,10 @@ "if os.path.exists(\"gauss_model_cube.fits\"):\n", " os.remove(\"gauss_model_cube.fits\")\n", "else:\n", - " print(\"The file does not exist\")\n", + " print(\"The file does not already exist\")\n", "\n", - "gaussmodelflux = gauss_cube[\"flux\"]\n", - "fits.writeto('gauss_model_cube.fits', gaussmodelflux, overwrite=True)\n", - "print(type(gauss_cube[\"flux\"]))\n", + "fits.writeto('gauss_model_cube.fits', gauss_cube, overwrite=True)\n", + "print(type(gauss_cube))\n", "print(type(all_spec.flux))" ] }, @@ -799,28 +821,6 @@ "specref.write(\"gauss_spec.fits\")" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# Check to see if user used Cubeviz (above), and, if not, read in premade data\n", - "if not gauss_cube:\n", - " fn = download_file('https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/IFU_cube_continuum_fit/gauss_model_cube.fits', cache=False)\n", - " gauss_cube = fits.getdata(fn)\n", - "else:\n", - " gauss_cube = gauss_cube[\"flux\"]\n", - " \n", - "if not all_spec:\n", - " fn = download_file('https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/IFU_cube_continuum_fit/all_spec.fits', cache=False)\n", - " all_spec = Spectrum1D.read(fn)\n", - " \n", - "if not gauss_spec:\n", - " fn = download_file('https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/IFU_cube_continuum_fit/gauss_spec.fits', cache=False)\n", - " gauss_spec = Spectrum1D.read(fn)" - ] - }, { "cell_type": "code", "execution_count": null, From 88504dca200b8cea13510e294244efdc9ea002a5 Mon Sep 17 00:00:00 2001 From: ojustino Date: Fri, 17 Sep 2021 11:01:44 -0400 Subject: [PATCH 11/11] Updated nbcollection and CI environment --- .circleci/config.yml | 39 ------------------- .circleci/setup-env.sh | 4 +- .../NGC4151_FeII_ContinuumFit.ipynb | 5 --- 3 files changed, 2 insertions(+), 46 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1ecfe313..343d8de4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -271,24 +271,6 @@ jobs: no_output_timeout: 120m - store_artifacts: path: /tmp/nbcollection-ci-artifacts - Publish Website: - executor: nbcollection-builder - steps: - - checkout - - run: - command: bash ./.circleci/setup-env.sh - name: Setup Environment - no_output_timeout: 120m - - run: - command: nbcollection-ci merge-artifacts -c jdat_notebooks -o $CIRCLE_PROJECT_USERNAME - -r $CIRCLE_PROJECT_REPONAME - name: Publish Website - no_output_timeout: 120m - - add_ssh_keys - - run: - command: nbcollection-ci site-deployment -r origin -b gh-pages - name: Deploy Website - no_output_timeout: 120m Pull Request: executor: nbcollection-builder steps: @@ -326,25 +308,4 @@ workflows: - Jdat Notebooks-Nircam Photometry - Jdat Notebooks-Optimal Extraction Dynamic - Pull Request - - Publish Website: - requires: - - Jdat Notebooks-Niriss Wfss Postpipeline - - Jdat Notebooks-Mos-Spectroscopy - - Jdat Notebooks-Mrs Mstar Analysis - - Jdat Notebooks-Cube Fitting - - Jdat Notebooks-Ifu Cube Continuum Fit - - Jdat Notebooks-Nircam Psf-Matched Photometry - - Jdat Notebooks-Miri Ifu Ysos In The Lmc - - Jdat Notebooks-Optimal Extraction - - Jdat Notebooks-Ifu Optimal - - Jdat Notebooks-Background Estimation Imaging - - Jdat Notebooks-Psf Photometry - - Jdat Notebooks-Specviz Notebookgui Interaction - - Jdat Notebooks-Asdf Example - - Jdat Notebooks-Aperture Photometry - - Jdat Notebooks-Nirspec Mast Query - - Jdat Notebooks-Miri Lrs Spectral Extraction - - Jdat Notebooks-Transit Spectroscopy Notebook - - Jdat Notebooks-Nircam Photometry - - Jdat Notebooks-Optimal Extraction Dynamic version: '2.1' diff --git a/.circleci/setup-env.sh b/.circleci/setup-env.sh index 728e1348..98f54a16 100644 --- a/.circleci/setup-env.sh +++ b/.circleci/setup-env.sh @@ -4,7 +4,7 @@ set -e export LANG=C.UTF-8 export LC_ALL=C.UTF-8 - +conda install python=3.8.10 apt-get update apt-get install -y git make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl \ llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev libfreetype6-dev @@ -14,4 +14,4 @@ cd nbcollection pip install -U pip setuptools pip install -r ci_requirements.txt python setup.py install -cd - \ No newline at end of file +cd - diff --git a/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb b/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb index 4ae78c5a..de90a782 100644 --- a/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb +++ b/jdat_notebooks/IFU_cube_continuum_fit/NGC4151_FeII_ContinuumFit.ipynb @@ -982,11 +982,6 @@ } ], "metadata": { - "kernelspec": { - "display_name": "Python [conda env:dat-ifu-cont-adv] *", - "language": "python", - "name": "conda-env-dat-ifu-cont-adv-py" - }, "language_info": { "codemirror_mode": { "name": "ipython",