From d41a85a90cbed3c31fe770281541d0f242c3c791 Mon Sep 17 00:00:00 2001 From: Hatice Karatay Date: Wed, 20 Dec 2023 15:01:41 -0500 Subject: [PATCH 1/3] Update notebooks to generate HTML build --- .../isha_nayak_ysos_in_the_lmc.ipynb | 11 ++------ .../JWST_Mstar_dataAnalysis_analysis.ipynb | 27 ++++++------------- 2 files changed, 10 insertions(+), 28 deletions(-) diff --git a/notebooks/MIRI_IFU_YSOs_in_the_LMC/isha_nayak_ysos_in_the_lmc.ipynb b/notebooks/MIRI_IFU_YSOs_in_the_LMC/isha_nayak_ysos_in_the_lmc.ipynb index c8371118b..549bc42f5 100644 --- a/notebooks/MIRI_IFU_YSOs_in_the_LMC/isha_nayak_ysos_in_the_lmc.ipynb +++ b/notebooks/MIRI_IFU_YSOs_in_the_LMC/isha_nayak_ysos_in_the_lmc.ipynb @@ -622,7 +622,7 @@ "\n", "# Assign to variable to make it more readable for line below\n", "spec_contsub_1 = spec[count_axis:len(spec.spectral_axis)] - y_continuum_1[count_axis:len(spec.spectral_axis)]\n", - "spec_contsub_2 = spec[0:count_axis] - y_continuum_2[0:count_axis]\n" + "spec_contsub_2 = spec[0:count_axis] - y_continuum_2[0:count_axis]" ] }, { @@ -1157,13 +1157,6 @@ "plt.show()\n", "plt.close()" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { @@ -1182,7 +1175,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.5" + "version": "3.9.13" } }, "nbformat": 4, diff --git a/notebooks/MRS_Mstar_analysis/JWST_Mstar_dataAnalysis_analysis.ipynb b/notebooks/MRS_Mstar_analysis/JWST_Mstar_dataAnalysis_analysis.ipynb index c120be02e..29b2e331f 100644 --- a/notebooks/MRS_Mstar_analysis/JWST_Mstar_dataAnalysis_analysis.ipynb +++ b/notebooks/MRS_Mstar_analysis/JWST_Mstar_dataAnalysis_analysis.ipynb @@ -97,31 +97,21 @@ "# Import astropy packages \n", "from astropy import units as u\n", "from astropy.io import ascii\n", - "from astropy.wcs import WCS\n", - "from astropy.table import Table, vstack\n", - "from astropy.stats import sigma_clipped_stats\n", "from astropy.nddata import StdDevUncertainty\n", - "from astropy.io import fits # added by BAS on 8 April 2021\n", - "from astropy.utils.data import get_pkg_data_filename\n", "from astropy.utils.data import download_file\n", "\n", "# To find stars in the MRS spectralcubes and do aperture photometry\n", - "from photutils.aperture import CircularAperture\n", "from photutils.detection import DAOStarFinder\n", "\n", "# To deal with 1D spectrum\n", "from specutils import Spectrum1D\n", - "from specutils.fitting import fit_generic_continuum\n", - "from specutils.manipulation import box_smooth, extract_region, SplineInterpolatedResampler\n", + "from specutils.manipulation import box_smooth, extract_region\n", "from specutils.analysis import line_flux, centroid, equivalent_width\n", "from specutils.spectra import SpectralRegion\n", "from specutils import SpectrumList\n", "from jdaviz import Specviz\n", "from jdaviz import Cubeviz\n", "\n", - "# To fit a curve to the data\n", - "from scipy.optimize import curve_fit\n", - "\n", "# Display the video\n", "from IPython.display import HTML, YouTubeVideo" ] @@ -157,10 +147,10 @@ " if key in dict.keys():\n", " print(\"Present, \", end=\" \")\n", " print(\"value =\", dict[key])\n", - " return(True)\n", + " return True\n", " else:\n", " print(\"Not present\")\n", - " return(False)" + " return False" ] }, { @@ -240,7 +230,7 @@ "fnuall = fnuallarr[srtind]\n", "\n", "# Developer Note: We put in errors of 0.0001, but uncertainties need to be fixed\n", - "dfnuall = (0.0001)*np.ones(len(fnuall))\n" + "dfnuall = (0.0001)*np.ones(len(fnuall))" ] }, { @@ -856,7 +846,7 @@ "\n", "plt.xlabel('Wavelength (microns)')\n", "plt.ylabel(\"Flux ({:latex})\".format(spec.flux.unit))\n", - "plt.title(\"10$\\mu$m feature plus local continuum\")\n", + "plt.title(r\"10$\\mu$m feature plus local continuum\")\n", "plt.legend(frameon=False, fontsize='medium')\n", "plt.tight_layout()\n", "plt.show()\n", @@ -872,7 +862,7 @@ "\n", "plt.xlabel('Wavelength (microns)')\n", "plt.ylabel(\"Flux ({:latex})\".format(spec.flux.unit))\n", - "plt.title(\"Continuum subtracted 10$\\mu$m feature\")\n", + "plt.title(r\"Continuum subtracted 10$\\mu$m feature\")\n", "plt.tight_layout()\n", "plt.show()\n", "plt.close()" @@ -953,8 +943,7 @@ "\n", "tau = -(np.log(line_spec.flux.value / line_y_continuum.value))\n", "optdepth_spec = Spectrum1D(spectral_axis=line_spec.spectral_axis,\n", - " flux=tau*(u.Jy/u.Jy))\n", - " " + " flux=tau*(u.Jy/u.Jy))" ] }, { @@ -1044,7 +1033,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.7" + "version": "3.9.13" } }, "nbformat": 4, From a06f9cb1872a261d5101e65676c917406abe1831 Mon Sep 17 00:00:00 2001 From: Hatice Karatay Date: Wed, 20 Dec 2023 15:30:41 -0500 Subject: [PATCH 2/3] Fix style errors --- .../isha_nayak_ysos_in_the_lmc.ipynb | 52 +++++++------------ .../JWST_Mstar_dataAnalysis_analysis.ipynb | 3 -- 2 files changed, 18 insertions(+), 37 deletions(-) diff --git a/notebooks/MIRI_IFU_YSOs_in_the_LMC/isha_nayak_ysos_in_the_lmc.ipynb b/notebooks/MIRI_IFU_YSOs_in_the_LMC/isha_nayak_ysos_in_the_lmc.ipynb index 549bc42f5..353cf602d 100644 --- a/notebooks/MIRI_IFU_YSOs_in_the_LMC/isha_nayak_ysos_in_the_lmc.ipynb +++ b/notebooks/MIRI_IFU_YSOs_in_the_LMC/isha_nayak_ysos_in_the_lmc.ipynb @@ -48,27 +48,21 @@ "\n", "from astropy import units as u\n", "from astropy.wcs import WCS\n", - "from astropy import constants as const\n", - "from astropy.io import ascii, fits\n", + "from astropy.io import ascii\n", "from astropy.nddata import StdDevUncertainty\n", - "from astropy.modeling import models\n", - "from astropy.table import Table, Column, vstack\n", + "from astropy.table import Table\n", "from astropy.stats import sigma_clipped_stats\n", - "from astropy.utils.data import download_file\n", "import urllib.request\n", "\n", "import numpy as np\n", - "import pandas as pd\n", - "\n", - "from scipy.optimize import curve_fit\n", "from spectral_cube import SpectralCube\n", "from photutils.detection import DAOStarFinder\n", "from photutils.aperture import CircularAperture\n", "\n", "from specutils import Spectrum1D, SpectralRegion\n", - "from specutils.analysis import snr, line_flux, centroid, equivalent_width\n", - "from specutils.fitting import fit_generic_continuum, fit_continuum, find_lines_threshold, find_lines_derivative, estimate_line_parameters, fit_lines\n", - "from specutils.manipulation import noise_region_uncertainty, box_smooth, extract_region, gaussian_smooth, SplineInterpolatedResampler" + "from specutils.analysis import snr\n", + "from specutils.fitting import fit_generic_continuum, find_lines_derivative\n", + "from specutils.manipulation import box_smooth, extract_region" ] }, { @@ -98,19 +92,15 @@ "from aplpy import __version__ as aplpy_version\n", "print(\"Aplpy: {}\".format(aplpy_version))\n", "\n", - "import astrodendro\n", "from astrodendro import __version__ as astrodendro_version\n", "print(\"Astrodendro: {}\".format(astrodendro_version))\n", "\n", - "import astropy\n", "from astropy import __version__ as astropy_version\n", "print(\"Astropy: {}\".format(astropy_version))\n", "\n", - "import jwst\n", "from jwst import __version__ as jwst_version\n", "print(\"JWST: {}\".format(jwst_version))\n", "\n", - "import matplotlib\n", "from matplotlib import __version__ as matplotlib_version\n", "print(\"Matplotlib: {}\".format(matplotlib_version))\n", "\n", @@ -118,23 +108,18 @@ "from numpy import __version__ as numpy_version\n", "print(\"Numpy: {}\".format(numpy_version))\n", "\n", - "import pandas\n", "from pandas import __version__ as pandas_version\n", "print(\"Pandas: {}\".format(pandas_version))\n", "\n", - "import photutils\n", "from photutils import __version__ as photutils_version\n", "print(\"Photutils: {}\".format(photutils_version))\n", "\n", - "import scipy\n", "from scipy import __version__ as scipy_version\n", "print(\"Scipy: {}\".format(scipy_version))\n", "\n", - "import specutils\n", "from specutils import __version__ as specutils_version\n", "print(\"Specutils: {}\".format(specutils_version))\n", "\n", - "import spectral_cube\n", "from spectral_cube import __version__ as spectral_cube_version\n", "print(\"SpectralCube: {}\".format(spectral_cube_version))" ] @@ -176,13 +161,13 @@ "outputs": [], "source": [ "params = {'legend.fontsize': '18',\n", - " 'axes.labelsize': '18',\n", - " 'axes.titlesize': '18',\n", - " 'xtick.labelsize': '18',\n", - " 'ytick.labelsize': '18',\n", - " 'lines.linewidth': 2,\n", - " 'axes.linewidth': 2,\n", - " 'animation.html': 'html5'}\n", + " 'axes.labelsize': '18',\n", + " 'axes.titlesize': '18',\n", + " 'xtick.labelsize': '18',\n", + " 'ytick.labelsize': '18',\n", + " 'lines.linewidth': 2,\n", + " 'axes.linewidth': 2,\n", + " 'animation.html': 'html5'}\n", "plt.rcParams.update(params)\n", "plt.rcParams.update({'figure.max_open_warning': 0})" ] @@ -1091,7 +1076,7 @@ " if drop_dups_ice and not drop_dups_sil:\n", " for i in range(0, count_ice):\n", " if ice_absorption_detected[i].value < 15.4 and ice_absorption_detected[i].value > 15.0:\n", - " print(\"This is a Class 1 YSO.\")\n", + " print(\"This is a Class 1 YSO.\")\n", " \n", " # Else find out if YSO 2 (more evolved YSO with other ice absoprtion and silicate absorption features)\n", " if drop_dups_sil:\n", @@ -1099,14 +1084,13 @@ " elif count_pah == 0 and drop_dups_ice:\n", " for i in range(0, count_ice):\n", " if ((ice_absorption_detected[i].value < 4.87 and ice_absorption_detected[i].value > 4.47)\n", - " or (ice_absorption_detected[i].value < 5.8 and ice_absorption_detected[i].value > 6.2)\n", - " or (ice_absorption_detected[i].value < 6.69 and ice_absorption_detected[i].value > 7.09)\n", - " or (ice_absorption_detected[i].value < 7.5 and ice_absorption_detected[i].value > 7.7)):\n", - " print(\"This is a Class 2 YSO.\")\n", + " or (ice_absorption_detected[i].value < 5.8 and ice_absorption_detected[i].value > 6.2)\n", + " or (ice_absorption_detected[i].value < 6.69 and ice_absorption_detected[i].value > 7.09)\n", + " or (ice_absorption_detected[i].value < 7.5 and ice_absorption_detected[i].value > 7.7)):\n", + " print(\"This is a Class 2 YSO.\")\n", " \n", " # Else if PAH emission features then YSO 3\n", - " if ((count_pah > 0 and not drop_dups_ice)\n", - " or (count_pah > 0 and drop_dups_sil)):\n", + " if (count_pah > 0 and not drop_dups_ice) or (count_pah > 0 and drop_dups_sil):\n", " print(\"This is a Class 3 YSO.\")" ] }, diff --git a/notebooks/MRS_Mstar_analysis/JWST_Mstar_dataAnalysis_analysis.ipynb b/notebooks/MRS_Mstar_analysis/JWST_Mstar_dataAnalysis_analysis.ipynb index 29b2e331f..09594f6ce 100644 --- a/notebooks/MRS_Mstar_analysis/JWST_Mstar_dataAnalysis_analysis.ipynb +++ b/notebooks/MRS_Mstar_analysis/JWST_Mstar_dataAnalysis_analysis.ipynb @@ -100,9 +100,6 @@ "from astropy.nddata import StdDevUncertainty\n", "from astropy.utils.data import download_file\n", "\n", - "# To find stars in the MRS spectralcubes and do aperture photometry\n", - "from photutils.detection import DAOStarFinder\n", - "\n", "# To deal with 1D spectrum\n", "from specutils import Spectrum1D\n", "from specutils.manipulation import box_smooth, extract_region\n", From 03ffc72a1e833f1af5de3a7e25e76db6e3dc02c3 Mon Sep 17 00:00:00 2001 From: Hatice Karatay Date: Wed, 20 Dec 2023 15:38:34 -0500 Subject: [PATCH 3/3] Fix more styles --- .../isha_nayak_ysos_in_the_lmc.ipynb | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/notebooks/MIRI_IFU_YSOs_in_the_LMC/isha_nayak_ysos_in_the_lmc.ipynb b/notebooks/MIRI_IFU_YSOs_in_the_LMC/isha_nayak_ysos_in_the_lmc.ipynb index 353cf602d..e18cddaf4 100644 --- a/notebooks/MIRI_IFU_YSOs_in_the_LMC/isha_nayak_ysos_in_the_lmc.ipynb +++ b/notebooks/MIRI_IFU_YSOs_in_the_LMC/isha_nayak_ysos_in_the_lmc.ipynb @@ -61,8 +61,7 @@ "\n", "from specutils import Spectrum1D, SpectralRegion\n", "from specutils.analysis import snr\n", - "from specutils.fitting import fit_generic_continuum, find_lines_derivative\n", - "from specutils.manipulation import box_smooth, extract_region" + "from specutils.fitting import fit_generic_continuum, find_lines_derivative" ] }, { @@ -461,8 +460,7 @@ " plt.imshow(cont_img.value, origin='lower')\n", " plt.tight_layout()\n", " plt.show()\n", - " plt.close()\n", - " " + " plt.close()" ] }, { @@ -1084,10 +1082,10 @@ " elif count_pah == 0 and drop_dups_ice:\n", " for i in range(0, count_ice):\n", " if ((ice_absorption_detected[i].value < 4.87 and ice_absorption_detected[i].value > 4.47)\n", - " or (ice_absorption_detected[i].value < 5.8 and ice_absorption_detected[i].value > 6.2)\n", - " or (ice_absorption_detected[i].value < 6.69 and ice_absorption_detected[i].value > 7.09)\n", - " or (ice_absorption_detected[i].value < 7.5 and ice_absorption_detected[i].value > 7.7)):\n", - " print(\"This is a Class 2 YSO.\")\n", + " or (ice_absorption_detected[i].value < 5.8 and ice_absorption_detected[i].value > 6.2)\n", + " or (ice_absorption_detected[i].value < 6.69 and ice_absorption_detected[i].value > 7.09)\n", + " or (ice_absorption_detected[i].value < 7.5 and ice_absorption_detected[i].value > 7.7)):\n", + " print(\"This is a Class 2 YSO.\")\n", " \n", " # Else if PAH emission features then YSO 3\n", " if (count_pah > 0 and not drop_dups_ice) or (count_pah > 0 and drop_dups_sil):\n",