diff --git a/exploring_UV_extinction_curves_pt1/downloading_UV_spectra_pt1.ipynb b/exploring_UV_extinction_curves_pt1/downloading_UV_spectra_pt1.ipynb
new file mode 100644
index 00000000..42e0352b
--- /dev/null
+++ b/exploring_UV_extinction_curves_pt1/downloading_UV_spectra_pt1.ipynb
@@ -0,0 +1,1330 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "id": "929b4d77",
+ "metadata": {},
+ "source": [
+ "\n",
+ "# Downloading UV spectra – Part 1\n",
+ "***"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "b0814342",
+ "metadata": {},
+ "source": [
+ "## Learning Goals"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "710a34c2",
+ "metadata": {},
+ "source": [
+ "By the end of this tutorial, you will be able to:\n",
+ "\n",
+ "- Access data from the MAST archives directly from Python\n",
+ "- Perform data queries by Target Name and narrow them down to the desired spectrum\n",
+ "- Save arrays onto _.txt_ files\n",
+ "- Implement Python functions"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "e290a367",
+ "metadata": {},
+ "source": [
+ "## Introduction"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "fbc2060f",
+ "metadata": {},
+ "source": [
+ "**Extinction curve background**: An extinction curve represents the wavelength dependence of dust extinction. It compares the inherent Spectral Energy Distribution (SED) (~dust-free) of a star to the observed SED affected by dust extinction. Normally these curves are created by plotting $k(\\lambda-V)$ versus $1/\\lambda$, with $\\lambda$ being the wavelength.\n",
+ "\n",
+ "Extinction is relevant in many different scenarios. Dust can be found very near the observed object – such as stars having disks or proto-stellar clouds surrounding it – or can be far away from it but still affect the observation performed – for example dust in a galaxy that happens to be between the observer and the star.\n",
+ "\n",
+ "**International Ultraviolet Explorer (IUE)**: The IUE performed spectrophotometry in the wavelength range going from 1150 Å to 3200 Å. More than 100,000 spectra collected by the IUE between 1978 and 1996 can be accessed via the [MAST portal](https://archive.stsci.edu/iue/).\n",
+ "\n",
+ "**Magellanic Clouds**: irregular dwarf galaxies that orbit the Milky Way galaxy and are located in the southern celestial hemisphere. Two distinct groups can be differentiated: the Large Magellanic Cloud (LMC) and the Small Magellanic Cloud (SMC).\n",
+ "\n",
+ "**Defining some terms**:\n",
+ "\n",
+ "- **Color index**: difference between magnitude of a star in 2 different passbands, typically B and V. Symbol: $(B-V)$. \n",
+ "- **Extinction**: absoption and scattering of light by dust and gas between an object and the observer. It is a measure of the interstellar reddening quantified by the difference between the magnitude of the band when observed through dust versus a dust-free environment. Symbol: $A(\\lambda)$. \n",
+ "\n",
+ "- **Spectral type**: stellar classification from hotter (O stars) to cooler (M stars). Temperature defines a star's \"color\" and surface brightness.\n",
+ "\n",
+ "\n",
+ "**Useful equations**\n",
+ "- $k(\\lambda-V) = \\frac{m(\\lambda-V)-m(\\lambda-V)_o}{(B-V)-(B-V)_o} = \\frac{A(\\lambda)-A(V)}{A(B)-A(V)}$\n",
+ "\n",
+ "_**Note**: the $x_o$ terms refer to the star that is nearly unaffected by dust, i.e. $(B-V)$ corresponds to the observed color index and $(B-V)_o$ to the observed color index if there was no extinction due to dust. The stars should have the same spectral type in order to perform this comparison._\n",
+ " \n",
+ "This tutorial is divided in two parts. In Part 1, you will learn how to navigate the IUE database through the MAST portal, download and save to your local computer the fluxes and their corresponding wavelengths of different stars, one reddened and one unreddened one. In Part 2, we will use these stars spectra to construct and plot UV extinction curves. \n",
+ " \n",
+ "## Table of Contents\n",
+ "* [Imports](#Imports)\n",
+ "* [Searching the MAST archive by target name and downloading spectra](#Searching-the-MAST-archive-by-target-name-and-downloading-spectra)\n",
+ "* [Exploring the downloaded data files](#Exploring-the-downloaded-data-files)\n",
+ "* [Data access and manipulation](#Data-access-and-manipulation)\n",
+ "* [Saving values into your local computer](#Saving-values-into-your-local-computer)\n",
+ "* [Exercises](#Exercises)\n",
+ "* [Additional Resources](#Additional-Resources)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "5920e02e",
+ "metadata": {},
+ "source": [
+ "## Imports "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "36f71271",
+ "metadata": {},
+ "source": [
+ "The first step will be to import the libraries we will be using throughout this tutorial: \n",
+ "\n",
+ "- `Observations` from _astroquery.mast_ to query the Barbara A. Mikulski Archive for Space Telescopes (MAST).\n",
+ "- `fits` from _astropy.io_ for accessing FITS files\n",
+ "- `numpy` for array manipulations"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "id": "5fa17d07",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "from astroquery.mast import Observations\n",
+ "from astropy.io import fits\n",
+ "import numpy as np"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "6afd250c",
+ "metadata": {},
+ "source": [
+ "_**Warning**: If you have not installed the astroquery package in your computer, you may need to. Information about astroquery can be found here._"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "7a11267b",
+ "metadata": {},
+ "source": [
+ "## Searching the MAST archive by target name and downloading spectra"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "d3c60d39",
+ "metadata": {},
+ "source": [
+ "The next step is to find the data file we will use. This is similar to searching through the MAST portal since we will be using specific keywords to find the file. We will be using the `Observations` from `astroquery.mast` to download UV data directly from the IUE archive.\n",
+ "\n",
+ "The target name of the first star we will be studying is AzV 214 (observation ID: swp22372), collected by International Ultraviolet Explorer (IUE). This star is known to be reddened by dust. We are directly taking this example from [Gordon et al. (2003)](https://ui.adsabs.harvard.edu/abs/2003ApJ...594..279G/abstract), but any pair of reddened and unreddened stars which have the same spectral type and luminosity class may be used. We will be using Gordon et al. (2003) because we want to explore the differences in extinction curves fro stars belonging to the LMC and the SMC, which will become clear by the end of Part 2. \n",
+ "\n",
+ "To get the data products we want we need the observation ID corresponding to it, in order to do this we can first query the collection of IUE using _Observations_ by using the target name as shown below."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "id": "fc1e4e13",
+ "metadata": {
+ "scrolled": true
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "
Table masked=True length=2472\n",
+ "
\n",
+ "obsID | obs_collection | dataproduct_type | obs_id | description | type | dataURI | productType | productGroupDescription | productSubGroupDescription | productDocumentationURL | project | prvversion | proposal_id | productFilename | size | parent_obsid | dataRights | calib_level |
\n",
+ "str6 | str3 | str8 | str8 | str56 | str1 | str62 | str9 | str28 | str56 | str1 | str1 | str1 | str5 | str20 | int64 | str6 | str6 | int64 |
\n",
+ "275789 | IUE | spectrum | lwp02621 | ELBLL | S | mast:IUE/url/pub/iue/data/lwp/02000/lwp02621.elbll.gz | AUXILIARY | -- | -- | -- | -- | -- | FM034 | lwp02621.elbll.gz | 95042 | 275789 | PUBLIC | 2 |
\n",
+ "275789 | IUE | spectrum | lwp02621 | LILO | S | mast:IUE/url/pub/iue/data/lwp/02000/lwp02621.lilo.gz | AUXILIARY | -- | -- | -- | -- | -- | FM034 | lwp02621.lilo.gz | 490665 | 275789 | PUBLIC | 2 |
\n",
+ "275789 | IUE | spectrum | lwp02621 | MELOL | S | mast:IUE/url/pub/iue/data/lwp/02000/lwp02621.melol.gz | AUXILIARY | -- | -- | -- | -- | -- | FM034 | lwp02621.melol.gz | 12028 | 275789 | PUBLIC | 2 |
\n",
+ "275789 | IUE | spectrum | lwp02621 | RAW | S | mast:IUE/url/pub/iue/data/lwp/02000/lwp02621.raw.gz | AUXILIARY | -- | -- | -- | -- | -- | FM034 | lwp02621.raw.gz | 329022 | 275789 | PUBLIC | 2 |
\n",
+ "275789 | IUE | spectrum | lwp02621 | RILO | S | mast:IUE/url/pub/iue/data/lwp/02000/lwp02621.rilo.gz | AUXILIARY | -- | -- | -- | -- | -- | FM034 | lwp02621.rilo.gz | 334246 | 275789 | PUBLIC | 2 |
\n",
+ "275789 | IUE | spectrum | lwp02621 | SILO | S | mast:IUE/url/pub/iue/data/lwp/02000/lwp02621.silo.gz | AUXILIARY | -- | -- | -- | -- | -- | FM034 | lwp02621.silo.gz | 85947 | 275789 | PUBLIC | 2 |
\n",
+ "275789 | IUE | spectrum | lwp02621 | Preview-Full | S | mast:IUE/url/browse/previews/iue/mx/lwp/02000/gif/lwp02621.gif | PREVIEW | -- | -- | -- | -- | -- | FM034 | lwp02621.gif | 7103 | 275789 | PUBLIC | 2 |
\n",
+ "275789 | IUE | spectrum | lwp02621 | MXLO | S | mast:IUE/url/pub/iue/data/lwp/02000/lwp02621.mxlo.gz | SCIENCE | Minimum Recommended Products | -- | -- | -- | -- | FM034 | lwp02621.mxlo.gz | 17736 | 275789 | PUBLIC | 2 |
\n",
+ "275789 | IUE | spectrum | lwp02621 | (extracted spectra/vo spectral container/SSAP) fits file | S | mast:IUE/url/pub/vospectra/iue2/lwp02621mxlo_vo.fits | SCIENCE | Minimum Recommended Products | (extracted spectra/vo spectral container/SSAP) fits file | -- | -- | -- | FM034 | lwp02621mxlo_vo.fits | 48960 | 275789 | PUBLIC | 2 |
\n",
+ "276461 | IUE | spectrum | lwp03583 | ELBLL | S | mast:IUE/url/pub/iue/data/lwp/03000/lwp03583.elbll.gz | AUXILIARY | -- | -- | -- | -- | -- | GM148 | lwp03583.elbll.gz | 98286 | 276461 | PUBLIC | 2 |
\n",
+ "... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
\n",
+ "382139 | IUE | spectrum | swp56205 | SIHI | S | mast:IUE/url//pub/iue/data/swp/56000/swp56205.sihi.gz | AUXILIARY | -- | -- | -- | -- | -- | SA117 | swp56205.sihi.gz | 742167 | 382139 | PUBLIC | 2 |
\n",
+ "382139 | IUE | spectrum | swp56205 | Preview-Full | S | mast:IUE/url/browse/previews/iue/mx/swp/56000/gif/swp56205.gif | PREVIEW | -- | -- | -- | -- | -- | SA117 | swp56205.gif | -- | 382139 | PUBLIC | 2 |
\n",
+ "382139 | IUE | spectrum | swp56205 | MXHI | S | mast:IUE/url/missions/iue/data/swp/56000/swp56205.mxhi.gz | SCIENCE | Minimum Recommended Products | -- | -- | -- | -- | SA117 | swp56205.mxhi.gz | 654 | 382139 | PUBLIC | 2 |
\n",
+ "382142 | IUE | spectrum | swp56223 | LIHI | S | mast:IUE/url//pub/iue/data/swp/56000/swp56223.lihi.gz | AUXILIARY | -- | -- | -- | -- | -- | SA117 | swp56223.lihi.gz | 779340 | 382142 | PUBLIC | 2 |
\n",
+ "382142 | IUE | spectrum | swp56223 | MEHIL | S | mast:IUE/url//pub/iue/data/swp/56000/swp56223.mehil.gz | AUXILIARY | -- | -- | -- | -- | -- | SA117 | swp56223.mehil.gz | 516415 | 382142 | PUBLIC | 2 |
\n",
+ "382142 | IUE | spectrum | swp56223 | RAW | S | mast:IUE/url//pub/iue/data/swp/56000/swp56223.raw.gz | AUXILIARY | -- | -- | -- | -- | -- | SA117 | swp56223.raw.gz | 383064 | 382142 | PUBLIC | 2 |
\n",
+ "382142 | IUE | spectrum | swp56223 | RIHI | S | mast:IUE/url//pub/iue/data/swp/56000/swp56223.rihi.gz | AUXILIARY | -- | -- | -- | -- | -- | SA117 | swp56223.rihi.gz | 388890 | 382142 | PUBLIC | 2 |
\n",
+ "382142 | IUE | spectrum | swp56223 | SIHI | S | mast:IUE/url//pub/iue/data/swp/56000/swp56223.sihi.gz | AUXILIARY | -- | -- | -- | -- | -- | SA117 | swp56223.sihi.gz | 740200 | 382142 | PUBLIC | 2 |
\n",
+ "382142 | IUE | spectrum | swp56223 | Preview-Full | S | mast:IUE/url/browse/previews/iue/mx/swp/56000/gif/swp56223.gif | PREVIEW | -- | -- | -- | -- | -- | SA117 | swp56223.gif | -- | 382142 | PUBLIC | 2 |
\n",
+ "382142 | IUE | spectrum | swp56223 | MXHI | S | mast:IUE/url/missions/iue/data/swp/56000/swp56223.mxhi.gz | SCIENCE | Minimum Recommended Products | -- | -- | -- | -- | SA117 | swp56223.mxhi.gz | 653 | 382142 | PUBLIC | 2 |
\n",
+ "
"
+ ],
+ "text/plain": [
+ "\n",
+ "obsID obs_collection dataproduct_type ... parent_obsid dataRights calib_level\n",
+ " str6 str3 str8 ... str6 str6 int64 \n",
+ "------ -------------- ---------------- ... ------------ ---------- -----------\n",
+ "275789 IUE spectrum ... 275789 PUBLIC 2\n",
+ "275789 IUE spectrum ... 275789 PUBLIC 2\n",
+ "275789 IUE spectrum ... 275789 PUBLIC 2\n",
+ "275789 IUE spectrum ... 275789 PUBLIC 2\n",
+ "275789 IUE spectrum ... 275789 PUBLIC 2\n",
+ "275789 IUE spectrum ... 275789 PUBLIC 2\n",
+ "275789 IUE spectrum ... 275789 PUBLIC 2\n",
+ "275789 IUE spectrum ... 275789 PUBLIC 2\n",
+ "275789 IUE spectrum ... 275789 PUBLIC 2\n",
+ "276461 IUE spectrum ... 276461 PUBLIC 2\n",
+ " ... ... ... ... ... ... ...\n",
+ "382139 IUE spectrum ... 382139 PUBLIC 2\n",
+ "382139 IUE spectrum ... 382139 PUBLIC 2\n",
+ "382139 IUE spectrum ... 382139 PUBLIC 2\n",
+ "382142 IUE spectrum ... 382142 PUBLIC 2\n",
+ "382142 IUE spectrum ... 382142 PUBLIC 2\n",
+ "382142 IUE spectrum ... 382142 PUBLIC 2\n",
+ "382142 IUE spectrum ... 382142 PUBLIC 2\n",
+ "382142 IUE spectrum ... 382142 PUBLIC 2\n",
+ "382142 IUE spectrum ... 382142 PUBLIC 2\n",
+ "382142 IUE spectrum ... 382142 PUBLIC 2"
+ ]
+ },
+ "execution_count": 8,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "IUEobs_av214 = Observations.query_criteria(objectname=\"AzV214\",obs_collection=\"IUE\")\n",
+ "data_products_av214 = Observations.get_product_list(IUEobs_av214)\n",
+ "\n",
+ "data_products_av214"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "83cbce39",
+ "metadata": {},
+ "source": [
+ "As we can see from the obtained table, there are many different observations available for our target in the database. We specifically want to focus on sciences products, to know whether an observation is one we need to look at the _productType_ column, science products have the label 'SCIENCE'. Additionally, we will be using extracted spectra via the [Virtual Observatory (VO)](https://ivoa.net) using the [Simple Spectral Access Protocol (SSAP)](https://www.ivoa.net/documents/SSA/). The SSAP is the recommended way by VO to remotely access one dimensional spectra. In order to ensure this, the _description_ column should contain '(extracted spectra/vo spectral container/SSAP) fits file.'\n",
+ "\n",
+ "Two different observations, \"swp22372\" for the short wavelength domain and \"lwr17263\" for the long wave domain, have been chosen in order to provide a more complete understanding of the extinction behaviour over different wavelengths. For this tutorial we have chosen these specific observations, but the reader is welcome to use any other of the IDs displayed on the table above, as long as they fulfill the conditions desribed in the previous paragraph. It should be taken into account that some of the data may need some prior calibration before using it. \n",
+ "\n",
+ "- Observation ID: \"swp22372\":"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 13,
+ "id": "759a0a65",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "Table masked=True length=1\n",
+ "
\n",
+ "obsID | obs_collection | dataproduct_type | obs_id | description | type | dataURI | productType | productGroupDescription | productSubGroupDescription | productDocumentationURL | project | prvversion | proposal_id | productFilename | size | parent_obsid | dataRights | calib_level |
\n",
+ "str6 | str3 | str8 | str8 | str56 | str1 | str62 | str9 | str28 | str56 | str1 | str1 | str1 | str5 | str20 | int64 | str6 | str6 | int64 |
\n",
+ "318326 | IUE | spectrum | swp22372 | (extracted spectra/vo spectral container/SSAP) fits file | S | mast:IUE/url/pub/vospectra/iue2/swp22372mxlo_vo.fits | SCIENCE | Minimum Recommended Products | (extracted spectra/vo spectral container/SSAP) fits file | -- | -- | -- | FM197 | swp22372mxlo_vo.fits | 48960 | 318326 | PUBLIC | 2 |
\n",
+ "
"
+ ],
+ "text/plain": [
+ "\n",
+ "obsID obs_collection dataproduct_type ... parent_obsid dataRights calib_level\n",
+ " str6 str3 str8 ... str6 str6 int64 \n",
+ "------ -------------- ---------------- ... ------------ ---------- -----------\n",
+ "318326 IUE spectrum ... 318326 PUBLIC 2"
+ ]
+ },
+ "execution_count": 13,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "data_products_av214[(data_products_av214['obs_id'] == 'swp22372') & (data_products_av214['productType'] == 'SCIENCE') & (data_products_av214['description'] == '(extracted spectra/vo spectral container/SSAP) fits file')]"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "2a38407e",
+ "metadata": {},
+ "source": [
+ "Great! We have found the product that we want to download. By using this information we can download it by using its observation ID. Additionally, the _productFilename_ displayed in the table above will be useful to directly get the product we desire. We can use in `Observations.filter_products` under the parameter _extension_ as shown below:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 22,
+ "id": "be80001c",
+ "metadata": {
+ "scrolled": true
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "Table masked=True length=1\n",
+ "
\n",
+ "obsID | obs_collection | dataproduct_type | obs_id | description | type | dataURI | productType | productGroupDescription | productSubGroupDescription | productDocumentationURL | project | prvversion | proposal_id | productFilename | size | parent_obsid | dataRights | calib_level |
\n",
+ "str6 | str3 | str8 | str8 | str56 | str1 | str62 | str9 | str28 | str56 | str1 | str1 | str1 | str5 | str20 | int64 | str6 | str6 | int64 |
\n",
+ "318326 | IUE | spectrum | swp22372 | (extracted spectra/vo spectral container/SSAP) fits file | S | mast:IUE/url/pub/vospectra/iue2/swp22372mxlo_vo.fits | SCIENCE | Minimum Recommended Products | (extracted spectra/vo spectral container/SSAP) fits file | -- | -- | -- | FM197 | swp22372mxlo_vo.fits | 48960 | 318326 | PUBLIC | 2 |
\n",
+ "
"
+ ],
+ "text/plain": [
+ "\n",
+ "obsID obs_collection dataproduct_type ... parent_obsid dataRights calib_level\n",
+ " str6 str3 str8 ... str6 str6 int64 \n",
+ "------ -------------- ---------------- ... ------------ ---------- -----------\n",
+ "318326 IUE spectrum ... 318326 PUBLIC 2"
+ ]
+ },
+ "execution_count": 22,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "IUEobs_av214_sw = Observations.query_criteria(obs_collection=\"IUE\", obs_id=\"swp22372\")\n",
+ "data_products_av214_sw = Observations.get_product_list(IUEobs_av214_sw)\n",
+ "yourProd_av214_sw = Observations.filter_products(data_products_av214_sw, extension='swp22372mxlo_vo.fits')\n",
+ "\n",
+ "yourProd_av214_sw"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "1e95d6f9",
+ "metadata": {},
+ "source": [
+ "Now that we have the data file, we can download it by using the `download_products` function:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "id": "dc8b82ce",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Downloading URL https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:IUE/url/pub/vospectra/iue2/swp22372mxlo_vo.fits to ./mastDownload/IUE/swp22372/swp22372mxlo_vo.fits ... [Done]\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ "Table length=1\n",
+ "
\n",
+ "Local Path | Status | Message | URL |
\n",
+ "str48 | str8 | object | object |
\n",
+ "./mastDownload/IUE/swp22372/swp22372mxlo_vo.fits | COMPLETE | None | None |
\n",
+ "
"
+ ],
+ "text/plain": [
+ "\n",
+ " Local Path Status Message URL \n",
+ " str48 str8 object object\n",
+ "------------------------------------------------ -------- ------- ------\n",
+ "./mastDownload/IUE/swp22372/swp22372mxlo_vo.fits COMPLETE None None"
+ ]
+ },
+ "execution_count": 5,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "Observations.download_products(yourProd_av214_sw) "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "867393ad",
+ "metadata": {},
+ "source": [
+ "If the download does not happen automatically, by visiting the URL displayed by the `download_products` method you will be able to download the file. \n",
+ "\n",
+ "As stated before, in order to have a more complete understanding of the extinction curve across a broad range of wavelengths, let's download a different observation for the same object, but in a different wavelength range. We can use the following observation ID: lwr17263 (this still corresponds to AzV 214).\n",
+ "\n",
+ "- Observation ID: \"lwr17263\":"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 14,
+ "id": "5776ba9f",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "Table masked=True length=1\n",
+ "
\n",
+ "obsID | obs_collection | dataproduct_type | obs_id | description | type | dataURI | productType | productGroupDescription | productSubGroupDescription | productDocumentationURL | project | prvversion | proposal_id | productFilename | size | parent_obsid | dataRights | calib_level |
\n",
+ "str6 | str3 | str8 | str8 | str56 | str1 | str62 | str9 | str28 | str56 | str1 | str1 | str1 | str5 | str20 | int64 | str6 | str6 | int64 |
\n",
+ "305282 | IUE | spectrum | lwr17263 | (extracted spectra/vo spectral container/SSAP) fits file | S | mast:IUE/url/pub/vospectra/iue2/lwr17263mxlo_vo.fits | SCIENCE | Minimum Recommended Products | (extracted spectra/vo spectral container/SSAP) fits file | -- | -- | -- | FM197 | lwr17263mxlo_vo.fits | 48960 | 305282 | PUBLIC | 2 |
\n",
+ "
"
+ ],
+ "text/plain": [
+ "\n",
+ "obsID obs_collection dataproduct_type ... parent_obsid dataRights calib_level\n",
+ " str6 str3 str8 ... str6 str6 int64 \n",
+ "------ -------------- ---------------- ... ------------ ---------- -----------\n",
+ "305282 IUE spectrum ... 305282 PUBLIC 2"
+ ]
+ },
+ "execution_count": 14,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "data_products_av214[(data_products_av214['obs_id'] == 'lwr17263') & (data_products_av214['productType'] == 'SCIENCE') & (data_products_av214['description'] == '(extracted spectra/vo spectral container/SSAP) fits file')]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "id": "aab04b05",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Downloading URL https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:IUE/url/pub/vospectra/iue2/lwr17263mxlo_vo.fits to ./mastDownload/IUE/lwr17263/lwr17263mxlo_vo.fits ... [Done]\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ "Table length=1\n",
+ "
\n",
+ "Local Path | Status | Message | URL |
\n",
+ "str48 | str8 | object | object |
\n",
+ "./mastDownload/IUE/lwr17263/lwr17263mxlo_vo.fits | COMPLETE | None | None |
\n",
+ "
"
+ ],
+ "text/plain": [
+ "\n",
+ " Local Path Status Message URL \n",
+ " str48 str8 object object\n",
+ "------------------------------------------------ -------- ------- ------\n",
+ "./mastDownload/IUE/lwr17263/lwr17263mxlo_vo.fits COMPLETE None None"
+ ]
+ },
+ "execution_count": 7,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "IUEobs_av214_lw = Observations.query_criteria(obs_collection=\"IUE\", obs_id=\"lwr17263\")\n",
+ "data_products_av214_lw = Observations.get_product_list(IUEobs_av214_lw)\n",
+ "yourProd_av214_lw = Observations.filter_products(data_products_av214_lw, extension='lwr17263mxlo_vo.fits')\n",
+ "Observations.download_products(yourProd_av214_lw) "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "a395c08c",
+ "metadata": {},
+ "source": [
+ "Now let's do the same for the unreddened star. The target name of this star is AzV 380 (observation IDs chosen: swp10319, lwr17265) and was also collected by IUE."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 19,
+ "id": "752b3a7a",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "IUEobs_av380 = Observations.query_criteria(objectname=\"AV380\",obs_collection=\"IUE\")\n",
+ "data_products_av380 = Observations.get_product_list(IUEobs_av380)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "248a9cf4",
+ "metadata": {},
+ "source": [
+ "- Observation ID: \"swp10319\":"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 17,
+ "id": "375c0f94",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "Table masked=True length=1\n",
+ "
\n",
+ "obsID | obs_collection | dataproduct_type | obs_id | description | type | dataURI | productType | productGroupDescription | productSubGroupDescription | productDocumentationURL | project | prvversion | proposal_id | productFilename | size | parent_obsid | dataRights | calib_level |
\n",
+ "str6 | str3 | str8 | str8 | str56 | str1 | str62 | str9 | str28 | str56 | str1 | str1 | str1 | str5 | str20 | int64 | str6 | str6 | int64 |
\n",
+ "311430 | IUE | spectrum | swp10319 | (extracted spectra/vo spectral container/SSAP) fits file | S | mast:IUE/url/pub/vospectra/iue2/swp10319mxlo_vo.fits | SCIENCE | Minimum Recommended Products | (extracted spectra/vo spectral container/SSAP) fits file | -- | -- | -- | HSCSP | swp10319mxlo_vo.fits | 48960 | 311430 | PUBLIC | 2 |
\n",
+ "
"
+ ],
+ "text/plain": [
+ "\n",
+ "obsID obs_collection dataproduct_type ... parent_obsid dataRights calib_level\n",
+ " str6 str3 str8 ... str6 str6 int64 \n",
+ "------ -------------- ---------------- ... ------------ ---------- -----------\n",
+ "311430 IUE spectrum ... 311430 PUBLIC 2"
+ ]
+ },
+ "execution_count": 17,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "data_products_av380[(data_products_av380['obs_id'] == 'swp10319') & (data_products_av380['productType'] == 'SCIENCE') & (data_products_av380['description'] == '(extracted spectra/vo spectral container/SSAP) fits file')]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "id": "b507c046",
+ "metadata": {
+ "scrolled": true
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Downloading URL https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:IUE/url/pub/vospectra/iue2/swp10319mxlo_vo.fits to ./mastDownload/IUE/swp10319/swp10319mxlo_vo.fits ... [Done]\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ "Table length=1\n",
+ "
\n",
+ "Local Path | Status | Message | URL |
\n",
+ "str48 | str8 | object | object |
\n",
+ "./mastDownload/IUE/swp10319/swp10319mxlo_vo.fits | COMPLETE | None | None |
\n",
+ "
"
+ ],
+ "text/plain": [
+ "\n",
+ " Local Path Status Message URL \n",
+ " str48 str8 object object\n",
+ "------------------------------------------------ -------- ------- ------\n",
+ "./mastDownload/IUE/swp10319/swp10319mxlo_vo.fits COMPLETE None None"
+ ]
+ },
+ "execution_count": 10,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "IUEobs_av380_sw = Observations.query_criteria(obs_collection=\"IUE\", obs_id=\"swp10319\")\n",
+ "data_products_av380_sw = Observations.get_product_list(IUEobs_av380_sw)\n",
+ "yourProd_av380_sw = Observations.filter_products(data_products_av380_sw, extension='swp10319mxlo_vo.fits')\n",
+ "Observations.download_products(yourProd_av380_sw) "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "af90dbbe",
+ "metadata": {},
+ "source": [
+ "- Observation ID: \"lwr17265\":"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 18,
+ "id": "57635028",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "Table masked=True length=1\n",
+ "
\n",
+ "obsID | obs_collection | dataproduct_type | obs_id | description | type | dataURI | productType | productGroupDescription | productSubGroupDescription | productDocumentationURL | project | prvversion | proposal_id | productFilename | size | parent_obsid | dataRights | calib_level |
\n",
+ "str6 | str3 | str8 | str8 | str56 | str1 | str62 | str9 | str28 | str56 | str1 | str1 | str1 | str5 | str20 | int64 | str6 | str6 | int64 |
\n",
+ "305284 | IUE | spectrum | lwr17265 | (extracted spectra/vo spectral container/SSAP) fits file | S | mast:IUE/url/pub/vospectra/iue2/lwr17265mxlo_vo.fits | SCIENCE | Minimum Recommended Products | (extracted spectra/vo spectral container/SSAP) fits file | -- | -- | -- | FM197 | lwr17265mxlo_vo.fits | 48960 | 305284 | PUBLIC | 2 |
\n",
+ "
"
+ ],
+ "text/plain": [
+ "\n",
+ "obsID obs_collection dataproduct_type ... parent_obsid dataRights calib_level\n",
+ " str6 str3 str8 ... str6 str6 int64 \n",
+ "------ -------------- ---------------- ... ------------ ---------- -----------\n",
+ "305284 IUE spectrum ... 305284 PUBLIC 2"
+ ]
+ },
+ "execution_count": 18,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "data_products_av380[(data_products_av380['obs_id'] == 'lwr17265') & (data_products_av380['productType'] == 'SCIENCE') & (data_products_av380['description'] == '(extracted spectra/vo spectral container/SSAP) fits file')]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "id": "ff1bae2d",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Downloading URL https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:IUE/url/pub/vospectra/iue2/lwr17265mxlo_vo.fits to ./mastDownload/IUE/lwr17265/lwr17265mxlo_vo.fits ... [Done]\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ "Table length=1\n",
+ "
\n",
+ "Local Path | Status | Message | URL |
\n",
+ "str48 | str8 | object | object |
\n",
+ "./mastDownload/IUE/lwr17265/lwr17265mxlo_vo.fits | COMPLETE | None | None |
\n",
+ "
"
+ ],
+ "text/plain": [
+ "\n",
+ " Local Path Status Message URL \n",
+ " str48 str8 object object\n",
+ "------------------------------------------------ -------- ------- ------\n",
+ "./mastDownload/IUE/lwr17265/lwr17265mxlo_vo.fits COMPLETE None None"
+ ]
+ },
+ "execution_count": 12,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "IUEobs_av380_lw = Observations.query_criteria(obs_collection=\"IUE\", obs_id=\"lwr17265\")\n",
+ "data_products_av380_lw = Observations.get_product_list(IUEobs_av380_lw)\n",
+ "yourProd_av380_lw = Observations.filter_products(data_products_av380_lw, extension='lwr17265mxlo_vo.fits')\n",
+ "Observations.download_products(yourProd_av380_lw) "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "acf23366",
+ "metadata": {},
+ "source": [
+ "Again, if the download does not happen automatically, by visiting the URLs provided by `download_products` you will be able to download the necessary data to continue this tutorial."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "73889127",
+ "metadata": {},
+ "source": [
+ "## Exploring the downloaded data files"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "7705ab97",
+ "metadata": {},
+ "source": [
+ "Now, let's explore the FITS file that we got for the reddened star. The paths to the files should correspond to wherever these files are located on your local computer, here the provided path is the one automatically generated by the `download_products` function. Feel free to change the filepath if you have stored the files in a different directory."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 28,
+ "id": "8082e4df",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Filename: ./mastDownload/IUE/swp22372/swp22372mxlo_vo.fits\n",
+ "No. Name Ver Type Cards Dimensions Format\n",
+ " 0 PRIMARY 1 PrimaryHDU 350 () \n",
+ " 1 Spectral Container 1 BinTableHDU 141 1R x 4C [495E, 495E, 495E, 495I] \n"
+ ]
+ }
+ ],
+ "source": [
+ "filename_av214_sw = \"./mastDownload/IUE/swp22372/swp22372mxlo_vo.fits\"\n",
+ "fits.info(filename_av214_sw)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "aab81955",
+ "metadata": {},
+ "source": [
+ "- **No. 0 (PRIMARY)**: This HDU contains meta-data related to the entire file.\n",
+ "- **No. 1 (Spectral Container)**: This HDU contains the spectral profile of the target as a function of wavelength.\n",
+ "\n",
+ "The header of the file contains additional information about the data. It can be accessed in the following way (only some part of the information contained in the header is printed in this section, which tells us information about what each column of the data contained in it represents. The user is encouraged to print the complete header if they are interested to see the whole information contained in it). "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 29,
+ "id": "897a2252",
+ "metadata": {
+ "scrolled": true
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "COMMENT *** Column names *** \n",
+ "COMMENT \n",
+ "TTYPE1 = 'WAVE ' / \n",
+ "TTYPE2 = 'FLUX ' / \n",
+ "TTYPE3 = 'SIGMA ' / \n",
+ "TTYPE4 = 'QUALITY ' / \n"
+ ]
+ }
+ ],
+ "source": [
+ "with fits.open(filename_av214_sw) as hdulist: \n",
+ " header_av214_sw = hdulist[1].header\n",
+ "\n",
+ "print(repr(header_av214_sw[9:15]))"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "75052360",
+ "metadata": {},
+ "source": [
+ "From this we know that the first column corresponds to the wavelengths, and the second column to the fluxes. The header also has information regarding the unit system used:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 16,
+ "id": "4a724d13",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "COMMENT *** Column units *** \n",
+ "COMMENT \n",
+ "TUNIT1 = 'angstrom' / wavelength unit is Angstrom \n",
+ "TUNIT2 = 'erg/cm**2/s/angstrom' / flux unit is ergs/cm2/sec/A \n",
+ "TUNIT3 = 'erg/cm**2/s/angstrom' / sigma unit is ergs/cm2/sec/A \n"
+ ]
+ }
+ ],
+ "source": [
+ "print(repr(header_av214_sw[23:28]))"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "e8ba6bed",
+ "metadata": {},
+ "source": [
+ "## Data access and manipulation"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "1195669c",
+ "metadata": {},
+ "source": [
+ "The data contained in this fits file can be accessed using io.fits and the `data` attribute:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 39,
+ "id": "781f9315",
+ "metadata": {
+ "scrolled": true
+ },
+ "outputs": [],
+ "source": [
+ "with fits.open(filename_av214_sw) as hdulist:\n",
+ " spectrum_av214_sw = hdulist[1].data\n",
+ "\n",
+ "wav_av214_sw = spectrum_av214_sw[0][0] # angstrom, A\n",
+ "flux_av214_sw = spectrum_av214_sw[0][1] # ergs/cm2/sec/A\n",
+ "\n",
+ "filename_av214_lw = \"./mastDownload/IUE/lwr17263/lwr17263mxlo_vo.fits\"\n",
+ "with fits.open(filename_av214_lw) as hdulist:\n",
+ " spectrum_av214_lw = hdulist[1].data\n",
+ "\n",
+ "wav_av214_lw = spectrum_av214_lw[0][0] # A\n",
+ "flux_av214_lw = spectrum_av214_lw[0][1] # ergs/cm2/sec/A"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "7a84bc06",
+ "metadata": {},
+ "source": [
+ "_**Heads-up**: some values of the flux may be contaminated or altered, and when applying the logarithm may result in NaN (Not a Number)_\n",
+ "\n",
+ "In order to not have to deal with error messages throughout the notebook, we will use the `changeNaN` function displayed below to locate and change these problematic values. The change NaN function below examines a pair of wavelength and flux pairs. Since we will need to combine the reddened and un-reddened stars later on, they need to have the same length, we'll use it on both stars simultaneously. It will delete the rows of all columns (fluxes and wavelengths) if either star's flux value is negative in that row.\n",
+ "\n",
+ "An example of the problematic values can be seen in _flux_av214_lw_:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 32,
+ "id": "96394b73",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "flux_av214_lw: [-2.2695733e-14 -2.0336736e-14]\n",
+ "log(flux_av214_lw): [nan nan]\n"
+ ]
+ },
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ ":2: RuntimeWarning: invalid value encountered in log10\n",
+ " print(\"log(flux_av214_lw):\", np.log10(flux_av214_lw[-5:-3]))\n"
+ ]
+ }
+ ],
+ "source": [
+ "print(\"flux_av214_lw:\", flux_av214_lw[-5:-3])\n",
+ "print(\"log(flux_av214_lw):\", np.log10(flux_av214_lw[-5:-3]))"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 33,
+ "id": "c25da271",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def changeNaN(wavv,fluxx,wavv1,fluxx1):\n",
+ " \n",
+ " \"\"\"\n",
+ " Removes negative flux values to avoid encountering NaN when converting to flux scale\n",
+ " \n",
+ " Inputs:\n",
+ " :param wavv,wavv1: input wavelength arrays\n",
+ " :type wavv,wavv1: float array\n",
+ " :param fluxx,fluxx1: input wavelength arrays\n",
+ " :type fluxx,fluxx1: float array\n",
+ " \n",
+ " Outputs: \n",
+ " :return: wavv,fluxx,wavv1,fluxx1 without the corresponding problematic values\n",
+ " :rtype: float array\n",
+ " \"\"\"\n",
+ " \n",
+ " prob = np.where(fluxx < 0)[0]\n",
+ " wavv = np.delete(wavv,prob)\n",
+ " fluxx = np.delete(fluxx,prob)\n",
+ " wavv1 = np.delete(wavv1,prob)\n",
+ " fluxx1 = np.delete(fluxx1,prob)\n",
+ " \n",
+ " prob2 = np.where(fluxx1 < 0)[0]\n",
+ " wavv = np.delete(wavv,prob2)\n",
+ " fluxx = np.delete(fluxx,prob2)\n",
+ " wavv1 = np.delete(wavv1,prob2)\n",
+ " fluxx1 = np.delete(fluxx1,prob2)\n",
+ " \n",
+ " return wavv, fluxx, wavv1, fluxx1"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "ad207b98",
+ "metadata": {},
+ "source": [
+ "Let's do the same for the other files, use the `changeNaN` function to remove the problematic values."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 34,
+ "id": "55d2e044",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "filename_av380_sw = \"./mastDownload/IUE/swp10319/swp10319mxlo_vo.fits\"\n",
+ "with fits.open(filename_av380_sw) as hdulist:\n",
+ " spectrum_av380_sw = hdulist[1].data\n",
+ "\n",
+ "wav_av380_sw = spectrum_av380_sw[0][0] # A\n",
+ "flux_av380_sw = spectrum_av380_sw[0][1] # ergs/cm2/sec/A\n",
+ "\n",
+ "filename_av380_lw = \"./mastDownload/IUE/lwr17265/lwr17265mxlo_vo.fits\"\n",
+ "with fits.open(filename_av380_lw) as hdulist:\n",
+ " spectrum_av380_lw = hdulist[1].data\n",
+ "\n",
+ "wav_av380_lw = spectrum_av380_lw[0][0] # A\n",
+ "flux_av380_lw = spectrum_av380_lw[0][1] # ergs/cm2/sec/A\n",
+ "\n",
+ "# Remove problematic values\n",
+ "wav_av214_sw, flux_av214_sw, wav_av380_sw, flux_av380_sw = changeNaN(wav_av214_sw, flux_av214_sw, wav_av380_sw, flux_av380_sw)\n",
+ "wav_av214_lw, flux_av214_lw, wav_av380_lw, flux_av380_lw = changeNaN(wav_av214_lw, flux_av214_lw, wav_av380_lw, flux_av380_lw)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "0694474d",
+ "metadata": {},
+ "source": [
+ "In Part 2 of this tutorial we will explore how to visualize the spectra that we have just obtained."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "a735829f",
+ "metadata": {},
+ "source": [
+ "## Saving values into your local computer\n",
+ "\n",
+ "Now that we have removed the problematic values from our observations, let's explore how we can save them to our computers. To do this, we can use the function `saveArray` presented below:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 21,
+ "id": "8ea01f76",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def saveArray(array,filename):\n",
+ " \n",
+ " \"\"\"\n",
+ " Saves arrays into .txt files in current directory and checks that the files have been written properly\n",
+ " \n",
+ " Inputs:\n",
+ " :param array: array to be saved to local directory\n",
+ " :type array: float array\n",
+ " :param filename: name of file to be saved\n",
+ " :type filename: string\n",
+ " \n",
+ " Outputs: \n",
+ " :return: none\n",
+ " :rtype: none\n",
+ " \"\"\"\n",
+ " \n",
+ " # First display the start and ending of the array to check later\n",
+ " print('First 3 elements of original array:\\n', array[:3])\n",
+ " print('Last 3 elements of original array:\\n', array[-3:])\n",
+ "\n",
+ " # Save the array in a text file\n",
+ " np.savetxt(filename,array)\n",
+ " \n",
+ " # Display the saved content to check it was correctly written to the .txt file\n",
+ " content = np.loadtxt(filename)\n",
+ " print('First 3 elements of '+filename+':\\n', content[:3])\n",
+ " print('Last 3 elements of '+filename+':\\n', content[-3:],'\\n')\n",
+ " \n",
+ " return None"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 22,
+ "id": "2709e1a0",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "First 3 elements of original array:\n",
+ " [1150.5802 1152.2566 1153.933 ]\n",
+ "Last 3 elements of original array:\n",
+ " [1975.3384 1977.0146 1978.691 ]\n",
+ "First 3 elements of wav_av214_sw.txt:\n",
+ " [1150.5802002 1152.2565918 1153.9329834]\n",
+ "Last 3 elements of wav_av214_sw.txt:\n",
+ " [1975.33837891 1977.01464844 1978.69104004] \n",
+ "\n",
+ "First 3 elements of original array:\n",
+ " [1.1806722e-13 1.0497821e-13 9.7880498e-14]\n",
+ "Last 3 elements of original array:\n",
+ " [9.0072332e-14 8.9639925e-14 9.0954899e-14]\n",
+ "First 3 elements of flux_av214_sw.txt:\n",
+ " [1.18067218e-13 1.04978207e-13 9.78804982e-14]\n",
+ "Last 3 elements of flux_av214_sw.txt:\n",
+ " [9.00723316e-14 8.96399247e-14 9.09548993e-14] \n",
+ "\n",
+ "First 3 elements of original array:\n",
+ " [1150.5802 1152.2566 1153.933 ]\n",
+ "Last 3 elements of original array:\n",
+ " [1975.3384 1977.0146 1978.691 ]\n",
+ "First 3 elements of wav_av380_sw.txt:\n",
+ " [1150.5802002 1152.2565918 1153.9329834]\n",
+ "Last 3 elements of wav_av380_sw.txt:\n",
+ " [1975.33837891 1977.01464844 1978.69104004] \n",
+ "\n",
+ "First 3 elements of original array:\n",
+ " [2.0615980e-13 2.2626303e-13 2.3708723e-13]\n",
+ "Last 3 elements of original array:\n",
+ " [1.4629599e-13 1.4202517e-13 1.3938025e-13]\n",
+ "First 3 elements of flux_av380_sw.txt:\n",
+ " [2.06159796e-13 2.26263032e-13 2.37087232e-13]\n",
+ "Last 3 elements of flux_av380_sw.txt:\n",
+ " [1.46295993e-13 1.42025172e-13 1.39380247e-13] \n",
+ "\n",
+ "First 3 elements of original array:\n",
+ " [1851.2976 1853.9634 1856.629 ]\n",
+ "Last 3 elements of original array:\n",
+ " [3328.1104 3344.1045 3346.7703]\n",
+ "First 3 elements of wav_av214_lw.txt:\n",
+ " [1851.29760742 1853.96337891 1856.62902832]\n",
+ "Last 3 elements of wav_av214_lw.txt:\n",
+ " [3328.11035156 3344.10449219 3346.77026367] \n",
+ "\n",
+ "First 3 elements of original array:\n",
+ " [1.1266531e-13 3.8899534e-14 4.2254113e-14]\n",
+ "Last 3 elements of original array:\n",
+ " [5.8187093e-15 1.5151301e-15 2.6366150e-14]\n",
+ "First 3 elements of flux_av214_lw.txt:\n",
+ " [1.12665309e-13 3.88995341e-14 4.22541132e-14]\n",
+ "Last 3 elements of flux_av214_lw.txt:\n",
+ " [5.81870935e-15 1.51513008e-15 2.63661502e-14] \n",
+ "\n",
+ "First 3 elements of original array:\n",
+ " [1851.2976 1853.9634 1856.629 ]\n",
+ "Last 3 elements of original array:\n",
+ " [3328.1104 3344.1045 3346.7703]\n",
+ "First 3 elements of wav_av380_lw.txt:\n",
+ " [1851.29760742 1853.96337891 1856.62902832]\n",
+ "Last 3 elements of wav_av380_lw.txt:\n",
+ " [3328.11035156 3344.10449219 3346.77026367] \n",
+ "\n",
+ "First 3 elements of original array:\n",
+ " [1.8677044e-13 1.0455292e-13 9.2824518e-14]\n",
+ "Last 3 elements of original array:\n",
+ " [2.8523860e-15 5.7709401e-15 1.4750215e-14]\n",
+ "First 3 elements of flux_av380_lw.txt:\n",
+ " [1.86770440e-13 1.04552922e-13 9.28245179e-14]\n",
+ "Last 3 elements of flux_av380_lw.txt:\n",
+ " [2.85238599e-15 5.77094008e-15 1.47502148e-14] \n",
+ "\n"
+ ]
+ }
+ ],
+ "source": [
+ "arrays = [wav_av214_sw, flux_av214_sw, wav_av380_sw, flux_av380_sw, wav_av214_lw, flux_av214_lw, wav_av380_lw, flux_av380_lw]\n",
+ "filenames = ['wav_av214_sw.txt', 'flux_av214_sw.txt', 'wav_av380_sw.txt', 'flux_av380_sw.txt', 'wav_av214_lw.txt', 'flux_av214_lw.txt', 'wav_av380_lw.txt', 'flux_av380_lw.txt']\n",
+ "\n",
+ "for i in range(len(arrays)):\n",
+ " saveArray(arrays[i],filenames[i])"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "33e3ecb0",
+ "metadata": {},
+ "source": [
+ "## Exercises"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "e4d71df9",
+ "metadata": {},
+ "source": [
+ "Now you can try to do it yourself! Try to obtain the spectra necessary to create an extinction curve of a star belonging to the Large Magellanic Cloud (LMC) following the steps presented for the SMC one.\n",
+ "\n",
+ "### 1. Load the data\n",
+ "\n",
+ "The targets for this exercise will be:\n",
+ "\n",
+ "- Sk -69 206 (Observation IDs: swp36552, lwp15751) (reddened star)\n",
+ "- Sk -67 5 (Observation IDs: swp04827, lwr04170) (unreddened star)\n",
+ "\n",
+ "First, do the database search for the reddened star:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 23,
+ "id": "0df02bac",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# You can copy, paste and modify the code corresponding to this part that we used for the SMC cloud here\n",
+ "# You can also use any function that was defined before\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "e4894cb1",
+ "metadata": {},
+ "source": [
+ "Narrow down the possibilities to the desired observation, observation ID: \"swp36552\":"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 24,
+ "id": "63902b4f",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# You can copy, paste and modify the code corresponding to this part that we used for the SMC cloud here\n",
+ "# You can also use any function that was defined before\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "7aedb721",
+ "metadata": {},
+ "source": [
+ "Now, download the data as before:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 25,
+ "id": "85cf856d",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# You can copy, paste and modify the code corresponding to this part that we used for the SMC cloud here\n",
+ "# You can also use any function that was defined before\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "1a9e18ee",
+ "metadata": {},
+ "source": [
+ "And again, in order to cover a wider wavelength range, let's also download the other part of the spectra using the second observation ID provided, observation ID: \"lwp15751\":"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 26,
+ "id": "80ed0693",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# You can copy, paste and modify the code corresponding to this part that we used for the SMC cloud here\n",
+ "# You can also use any function that was defined before\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "fd0fbf61",
+ "metadata": {},
+ "source": [
+ "Now, let's do the same for the unreddened star:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 27,
+ "id": "506772da",
+ "metadata": {
+ "scrolled": false
+ },
+ "outputs": [],
+ "source": [
+ "# You can copy, paste and modify the code corresponding to this part that we used for the SMC cloud here\n",
+ "# You can also use any function that was defined before\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "c4bff8af",
+ "metadata": {},
+ "source": [
+ "- Observation ID: \"swp04827\":"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 28,
+ "id": "e94e32df",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# You can copy, paste and modify the code corresponding to this part that we used for the SMC cloud here\n",
+ "# You can also use any function that was defined before\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 29,
+ "id": "2fe4d8ea",
+ "metadata": {
+ "scrolled": true
+ },
+ "outputs": [],
+ "source": [
+ "# You can copy, paste and modify the code corresponding to this part that we used for the SMC cloud here\n",
+ "# You can also use any function that was defined before\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "7b0c8065",
+ "metadata": {},
+ "source": [
+ "- Observation ID: \"lwr04170\""
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 30,
+ "id": "311c43c9",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# You can copy, paste and modify the code corresponding to this part that we used for the SMC cloud here\n",
+ "# You can also use any function that was defined before\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 31,
+ "id": "b786b210",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# You can copy, paste and modify the code corresponding to this part that we used for the SMC cloud here\n",
+ "# You can also use any function that was defined before\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "aff61e44",
+ "metadata": {},
+ "source": [
+ "### 2. Open the fits file and explore it"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 32,
+ "id": "c4f8f628",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# You can copy, paste and modify the code corresponding to this part that we used for the SMC cloud here\n",
+ "# You can also use any function that was defined before\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "4f1a1043",
+ "metadata": {},
+ "source": [
+ "### 3. Save the data to your local computer"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 33,
+ "id": "3406fc64",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# You can copy, paste and modify the code corresponding to this part that we used for the SMC cloud here\n",
+ "# You can also use any function that was defined before\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "2e48757b",
+ "metadata": {},
+ "source": [
+ "## Additional Resources"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "5516ade8",
+ "metadata": {},
+ "source": [
+ "For more information about the MAST archive and details about mission data: \n",
+ "\n",
+ "* MAST API
\n",
+ "* International Ultraviolet Explorer Page (MAST)
\n",
+ "* IUE Data Retrieval Help Page \n",
+ "\n",
+ "For more information about extinction curves and their parametrization:\n",
+ "\n",
+ "\n",
+ "* A quantitative comparison of SMC, LMC and Milky Way UV to NIR extinction curves
\n",
+ "* An analysis of the shapes of the ultraviolet extinction curves. III. An atlas of ultraviolet extinction curves "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "db295f01",
+ "metadata": {},
+ "source": [
+ "## About this Notebook\n",
+ "\n",
+ "**Author**: Clara Puerto Sánchez
\n",
+ "**Keyword(s)**: Tutorial, UV, reddening, extinction-curve
\n",
+ "**Last Updated**: Sep 2022
\n",
+ "**Next review**: Apr 2023\n",
+ "\n",
+ "For support, please contact the Archive HelpDesk at archive@stsci.edu.\n",
+ "***\n",
+ "[Top of Page](#top)\n",
+ "
"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.8.8"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}
diff --git a/exploring_UV_extinction_curves_pt1/downloading_UV_spectra_pt1_SOLUTION.ipynb b/exploring_UV_extinction_curves_pt1/downloading_UV_spectra_pt1_SOLUTION.ipynb
new file mode 100644
index 00000000..e8b80fca
--- /dev/null
+++ b/exploring_UV_extinction_curves_pt1/downloading_UV_spectra_pt1_SOLUTION.ipynb
@@ -0,0 +1,851 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "id": "aca721b8",
+ "metadata": {},
+ "source": [
+ "\n",
+ "# Downloading UV data – Part 1 – SOLUTIONS\n",
+ "***\n",
+ "\n",
+ "Solutions proposed for Part 1.\n",
+ "\n",
+ "## Imports\n",
+ "\n",
+ "The first step will be to import the libraries we will be using throughout this tutorial: \n",
+ "\n",
+ "- `Observations` from _astroquery.mast_ to query the Barbara A. Mikulski Archive for Space Telescopes (MAST).\n",
+ "- `fits` from _astropy.io_ for accessing FITS files\n",
+ "- `numpy` for array manipulations"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "id": "1b9b9210",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "from astroquery.mast import Observations\n",
+ "from astropy.io import fits\n",
+ "import numpy as np"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "ea36dc58",
+ "metadata": {},
+ "source": [
+ "## Functions needed\n",
+ "\n",
+ "Functions defined in the tutorial that will be used in the solutions of the exercises:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "id": "258b2d06",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def changeNaN(wavv,fluxx,wavv1,fluxx1):\n",
+ " \n",
+ " \"\"\"\n",
+ " Removes negative flux values to avoid encountering NaN when converting to flux scale\n",
+ " \n",
+ " Inputs:\n",
+ " :param wavv,wavv1: input wavelength arrays\n",
+ " :type wavv,wavv1: float array\n",
+ " :param fluxx,fluxx1: input wavelength arrays\n",
+ " :type fluxx,fluxx1: float array\n",
+ " \n",
+ " Outputs: \n",
+ " :return: wavv,fluxx,wavv1,fluxx1 without the corresponding problematic values\n",
+ " :rtype: float array\n",
+ " \"\"\"\n",
+ " \n",
+ " prob = np.where(fluxx < 0)[0]\n",
+ " wavv = np.delete(wavv,prob)\n",
+ " fluxx = np.delete(fluxx,prob)\n",
+ " wavv1 = np.delete(wavv1,prob)\n",
+ " fluxx1 = np.delete(fluxx1,prob)\n",
+ " \n",
+ " prob2 = np.where(fluxx1 < 0)[0]\n",
+ " wavv = np.delete(wavv,prob2)\n",
+ " fluxx = np.delete(fluxx,prob2)\n",
+ " wavv1 = np.delete(wavv1,prob2)\n",
+ " fluxx1 = np.delete(fluxx1,prob2)\n",
+ " \n",
+ " return wavv, fluxx, wavv1, fluxx1"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "id": "4a185182",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def saveArray(array,filename):\n",
+ " \n",
+ " \"\"\"\n",
+ " Saves arrays into .txt files in current directory and checks that the files have been written properly\n",
+ " \n",
+ " Inputs:\n",
+ " :param array: array to be saved to local directory\n",
+ " :type array: float array\n",
+ " :param filename: name of file to be saved\n",
+ " :type filename: string\n",
+ " \n",
+ " Outputs: \n",
+ " :return: none\n",
+ " :rtype: none\n",
+ " \"\"\"\n",
+ " \n",
+ " # First display the start and ending of the array to check later\n",
+ " print('First 3 elements of original array:\\n', array[:3])\n",
+ " print('Last 3 elements of original array:\\n', array[-3:])\n",
+ "\n",
+ " # Save the array in a text file\n",
+ " np.savetxt(filename,array)\n",
+ " \n",
+ " # Display the saved content to check it was correctly written to the .txt file\n",
+ " content = np.loadtxt(filename)\n",
+ " print('First 3 elements of '+filename+':\\n', content[:3])\n",
+ " print('Last 3 elements of '+filename+':\\n', content[-3:],'\\n')\n",
+ " \n",
+ " return None"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "833850c9",
+ "metadata": {},
+ "source": [
+ "## Exercises\n",
+ "\n",
+ "Now you can try to do it yourself! Try to obtain the spectra necessary to create an extinction curve of a star belonging to the Large Magellanic Cloud (LMC) following the steps presented for the SMC one.\n",
+ "\n",
+ "### 1. Load the data\n",
+ "\n",
+ "The targets for this exercise will be:\n",
+ "\n",
+ "- Sk -69 206 (Observation IDs: swp36552, lwp15751) (reddened star)\n",
+ "- Sk -67 5 (Observation IDs: swp04827, lwr04170) (unreddened star)\n",
+ "\n",
+ "First, do the database search for the reddened star:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "id": "76c591bb",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "Table masked=True length=8988\n",
+ "
\n",
+ "obsID | obs_collection | dataproduct_type | obs_id | description | type | dataURI | productType | productGroupDescription | productSubGroupDescription | productDocumentationURL | project | prvversion | proposal_id | productFilename | size | parent_obsid | dataRights | calib_level |
\n",
+ "str6 | str3 | str8 | str8 | str56 | str1 | str62 | str9 | str28 | str56 | str1 | str1 | str1 | str5 | str20 | int64 | str6 | str6 | int64 |
\n",
+ "276552 | IUE | spectrum | lwp03703 | ELBLL | S | mast:IUE/url/pub/iue/data/lwp/03000/lwp03703.elbll.gz | AUXILIARY | -- | -- | -- | -- | -- | WRGCG | lwp03703.elbll.gz | 100355 | 276552 | PUBLIC | 2 |
\n",
+ "276552 | IUE | spectrum | lwp03703 | LILO | S | mast:IUE/url/pub/iue/data/lwp/03000/lwp03703.lilo.gz | AUXILIARY | -- | -- | -- | -- | -- | WRGCG | lwp03703.lilo.gz | 535333 | 276552 | PUBLIC | 2 |
\n",
+ "276552 | IUE | spectrum | lwp03703 | MELOL | S | mast:IUE/url/pub/iue/data/lwp/03000/lwp03703.melol.gz | AUXILIARY | -- | -- | -- | -- | -- | WRGCG | lwp03703.melol.gz | 12071 | 276552 | PUBLIC | 2 |
\n",
+ "276552 | IUE | spectrum | lwp03703 | RAW | S | mast:IUE/url/pub/iue/data/lwp/03000/lwp03703.raw.gz | AUXILIARY | -- | -- | -- | -- | -- | WRGCG | lwp03703.raw.gz | 358821 | 276552 | PUBLIC | 2 |
\n",
+ "276552 | IUE | spectrum | lwp03703 | RILO | S | mast:IUE/url/pub/iue/data/lwp/03000/lwp03703.rilo.gz | AUXILIARY | -- | -- | -- | -- | -- | WRGCG | lwp03703.rilo.gz | 363834 | 276552 | PUBLIC | 2 |
\n",
+ "276552 | IUE | spectrum | lwp03703 | SILO | S | mast:IUE/url/pub/iue/data/lwp/03000/lwp03703.silo.gz | AUXILIARY | -- | -- | -- | -- | -- | WRGCG | lwp03703.silo.gz | 89362 | 276552 | PUBLIC | 2 |
\n",
+ "276552 | IUE | spectrum | lwp03703 | Preview-Full | S | mast:IUE/url/browse/previews/iue/mx/lwp/03000/gif/lwp03703.gif | PREVIEW | -- | -- | -- | -- | -- | WRGCG | lwp03703.gif | 10823 | 276552 | PUBLIC | 2 |
\n",
+ "276552 | IUE | spectrum | lwp03703 | MXLO | S | mast:IUE/url/pub/iue/data/lwp/03000/lwp03703.mxlo.gz | SCIENCE | Minimum Recommended Products | -- | -- | -- | -- | WRGCG | lwp03703.mxlo.gz | 18011 | 276552 | PUBLIC | 2 |
\n",
+ "276552 | IUE | spectrum | lwp03703 | (extracted spectra/vo spectral container/SSAP) fits file | S | mast:IUE/url/pub/vospectra/iue2/lwp03703mxlo_vo.fits | SCIENCE | Minimum Recommended Products | (extracted spectra/vo spectral container/SSAP) fits file | -- | -- | -- | WRGCG | lwp03703mxlo_vo.fits | 48960 | 276552 | PUBLIC | 2 |
\n",
+ "276557 | IUE | spectrum | lwp03708 | ELBLL | S | mast:IUE/url/pub/iue/data/lwp/03000/lwp03708.elbll.gz | AUXILIARY | -- | -- | -- | -- | -- | WRGCG | lwp03708.elbll.gz | 97951 | 276557 | PUBLIC | 2 |
\n",
+ "... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
\n",
+ "339085 | IUE | spectrum | swp53276 | Preview-Full | S | mast:IUE/url/browse/previews/iue/mx/swp/53000/gif/swp53276.gif | PREVIEW | -- | -- | -- | -- | -- | SNQAC | swp53276.gif | 10199 | 339085 | PUBLIC | 2 |
\n",
+ "339085 | IUE | spectrum | swp53276 | MXLO | S | mast:IUE/url/pub/iue/data/swp/53000/swp53276.mxlo.gz | SCIENCE | Minimum Recommended Products | -- | -- | -- | -- | SNQAC | swp53276.mxlo.gz | 25972 | 339085 | PUBLIC | 2 |
\n",
+ "339085 | IUE | spectrum | swp53276 | (extracted spectra/vo spectral container/SSAP) fits file | S | mast:IUE/url/pub/vospectra/iue2/swp53276mxlo_vo.fits | SCIENCE | Minimum Recommended Products | (extracted spectra/vo spectral container/SSAP) fits file | -- | -- | -- | SNQAC | swp53276mxlo_vo.fits | 57600 | 339085 | PUBLIC | 2 |
\n",
+ "340766 | IUE | spectrum | swp56374 | LILO | S | mast:IUE/url/pub/iue/data/swp/56000/swp56374.lilo.gz | AUXILIARY | -- | -- | -- | -- | -- | SE044 | swp56374.lilo.gz | 568025 | 340766 | PUBLIC | 2 |
\n",
+ "340766 | IUE | spectrum | swp56374 | RAW | S | mast:IUE/url/pub/iue/data/swp/56000/swp56374.raw.gz | AUXILIARY | -- | -- | -- | -- | -- | SE044 | swp56374.raw.gz | 389191 | 340766 | PUBLIC | 2 |
\n",
+ "340766 | IUE | spectrum | swp56374 | RILO | S | mast:IUE/url/pub/iue/data/swp/56000/swp56374.rilo.gz | AUXILIARY | -- | -- | -- | -- | -- | SE044 | swp56374.rilo.gz | 394767 | 340766 | PUBLIC | 2 |
\n",
+ "340766 | IUE | spectrum | swp56374 | SILO | S | mast:IUE/url/pub/iue/data/swp/56000/swp56374.silo.gz | AUXILIARY | -- | -- | -- | -- | -- | SE044 | swp56374.silo.gz | 87910 | 340766 | PUBLIC | 2 |
\n",
+ "340766 | IUE | spectrum | swp56374 | Preview-Full | S | mast:IUE/url/browse/previews/iue/mx/swp/56000/gif/swp56374.gif | PREVIEW | -- | -- | -- | -- | -- | SE044 | swp56374.gif | 5950 | 340766 | PUBLIC | 2 |
\n",
+ "340766 | IUE | spectrum | swp56374 | MXLO | S | mast:IUE/url/pub/iue/data/swp/56000/swp56374.mxlo.gz | SCIENCE | Minimum Recommended Products | -- | -- | -- | -- | SE044 | swp56374.mxlo.gz | 17109 | 340766 | PUBLIC | 2 |
\n",
+ "340766 | IUE | spectrum | swp56374 | (extracted spectra/vo spectral container/SSAP) fits file | S | mast:IUE/url/pub/vospectra/iue2/swp56374mxlo_vo.fits | SCIENCE | Minimum Recommended Products | (extracted spectra/vo spectral container/SSAP) fits file | -- | -- | -- | SE044 | swp56374mxlo_vo.fits | 51840 | 340766 | PUBLIC | 2 |
\n",
+ "
"
+ ],
+ "text/plain": [
+ "\n",
+ "obsID obs_collection dataproduct_type ... parent_obsid dataRights calib_level\n",
+ " str6 str3 str8 ... str6 str6 int64 \n",
+ "------ -------------- ---------------- ... ------------ ---------- -----------\n",
+ "276552 IUE spectrum ... 276552 PUBLIC 2\n",
+ "276552 IUE spectrum ... 276552 PUBLIC 2\n",
+ "276552 IUE spectrum ... 276552 PUBLIC 2\n",
+ "276552 IUE spectrum ... 276552 PUBLIC 2\n",
+ "276552 IUE spectrum ... 276552 PUBLIC 2\n",
+ "276552 IUE spectrum ... 276552 PUBLIC 2\n",
+ "276552 IUE spectrum ... 276552 PUBLIC 2\n",
+ "276552 IUE spectrum ... 276552 PUBLIC 2\n",
+ "276552 IUE spectrum ... 276552 PUBLIC 2\n",
+ "276557 IUE spectrum ... 276557 PUBLIC 2\n",
+ " ... ... ... ... ... ... ...\n",
+ "339085 IUE spectrum ... 339085 PUBLIC 2\n",
+ "339085 IUE spectrum ... 339085 PUBLIC 2\n",
+ "339085 IUE spectrum ... 339085 PUBLIC 2\n",
+ "340766 IUE spectrum ... 340766 PUBLIC 2\n",
+ "340766 IUE spectrum ... 340766 PUBLIC 2\n",
+ "340766 IUE spectrum ... 340766 PUBLIC 2\n",
+ "340766 IUE spectrum ... 340766 PUBLIC 2\n",
+ "340766 IUE spectrum ... 340766 PUBLIC 2\n",
+ "340766 IUE spectrum ... 340766 PUBLIC 2\n",
+ "340766 IUE spectrum ... 340766 PUBLIC 2"
+ ]
+ },
+ "execution_count": 4,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "IUEobs_sk_69_206 = Observations.query_criteria(objectname=\"SK-69206\",obs_collection=\"IUE\")\n",
+ "data_products_sk_69_206 = Observations.get_product_list(IUEobs_sk_69_206)\n",
+ "\n",
+ "data_products_sk_69_206"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "a4d7ce02",
+ "metadata": {},
+ "source": [
+ "Narrow down the possibilities to the desired observation, observation ID: \"swp36552\":"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "id": "89079f39",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "Table masked=True length=1\n",
+ "
\n",
+ "obsID | obs_collection | dataproduct_type | obs_id | description | type | dataURI | productType | productGroupDescription | productSubGroupDescription | productDocumentationURL | project | prvversion | proposal_id | productFilename | size | parent_obsid | dataRights | calib_level |
\n",
+ "str6 | str3 | str8 | str8 | str56 | str1 | str62 | str9 | str28 | str56 | str1 | str1 | str1 | str5 | str20 | int64 | str6 | str6 | int64 |
\n",
+ "327806 | IUE | spectrum | swp36552 | (extracted spectra/vo spectral container/SSAP) fits file | S | mast:IUE/url/pub/vospectra/iue2/swp36552mxlo_vo.fits | SCIENCE | Minimum Recommended Products | (extracted spectra/vo spectral container/SSAP) fits file | -- | -- | -- | OBLCG | swp36552mxlo_vo.fits | 48960 | 327806 | PUBLIC | 2 |
\n",
+ "
"
+ ],
+ "text/plain": [
+ "\n",
+ "obsID obs_collection dataproduct_type ... parent_obsid dataRights calib_level\n",
+ " str6 str3 str8 ... str6 str6 int64 \n",
+ "------ -------------- ---------------- ... ------------ ---------- -----------\n",
+ "327806 IUE spectrum ... 327806 PUBLIC 2"
+ ]
+ },
+ "execution_count": 5,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "IUEobs_sk_69_206_sw = Observations.query_criteria(obs_collection=\"IUE\", obs_id=\"swp36552\")\n",
+ "data_products_sk_69_206_sw = Observations.get_product_list(IUEobs_sk_69_206_sw)\n",
+ "yourProd_sk_69_206_sw = Observations.filter_products(data_products_sk_69_206_sw, extension=\"swp36552mxlo_vo.fits\")\n",
+ "\n",
+ "yourProd_sk_69_206_sw"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "16f287a9",
+ "metadata": {},
+ "source": [
+ "Now, download the data as before:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "id": "e611b428",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Downloading URL https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:IUE/url/pub/vospectra/iue2/swp36552mxlo_vo.fits to ./mastDownload/IUE/swp36552/swp36552mxlo_vo.fits ... [Done]\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ "Table length=1\n",
+ "
\n",
+ "Local Path | Status | Message | URL |
\n",
+ "str48 | str8 | object | object |
\n",
+ "./mastDownload/IUE/swp36552/swp36552mxlo_vo.fits | COMPLETE | None | None |
\n",
+ "
"
+ ],
+ "text/plain": [
+ "\n",
+ " Local Path Status Message URL \n",
+ " str48 str8 object object\n",
+ "------------------------------------------------ -------- ------- ------\n",
+ "./mastDownload/IUE/swp36552/swp36552mxlo_vo.fits COMPLETE None None"
+ ]
+ },
+ "execution_count": 6,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "Observations.download_products(yourProd_sk_69_206_sw, mrp_only = False, cache = False) "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "8547886a",
+ "metadata": {},
+ "source": [
+ "And again, in order to cover a wider wavelength range, let's also download the other part of the spectra using the second observation ID provided, observation ID: \"lwp15751\":"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "id": "0cf5ea36",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Downloading URL https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:IUE/url/pub/vospectra/iue2/lwp15751mxlo_vo.fits to ./mastDownload/IUE/lwp15751/lwp15751mxlo_vo.fits ... [Done]\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ "Table length=1\n",
+ "
\n",
+ "Local Path | Status | Message | URL |
\n",
+ "str48 | str8 | object | object |
\n",
+ "./mastDownload/IUE/lwp15751/lwp15751mxlo_vo.fits | COMPLETE | None | None |
\n",
+ "
"
+ ],
+ "text/plain": [
+ "\n",
+ " Local Path Status Message URL \n",
+ " str48 str8 object object\n",
+ "------------------------------------------------ -------- ------- ------\n",
+ "./mastDownload/IUE/lwp15751/lwp15751mxlo_vo.fits COMPLETE None None"
+ ]
+ },
+ "execution_count": 7,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "IUEobs_sk_69_206_lw = Observations.query_criteria(obs_collection=\"IUE\", obs_id=\"lwp15751\")\n",
+ "data_products_sk_69_206_lw = Observations.get_product_list(IUEobs_sk_69_206_lw)\n",
+ "yourProd_sk_69_206_lw = Observations.filter_products(data_products_sk_69_206_lw, extension=\"lwp15751mxlo_vo.fits\")\n",
+ "Observations.download_products(yourProd_sk_69_206_lw, mrp_only = False, cache = False) "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "0c81413c",
+ "metadata": {},
+ "source": [
+ "Now, let's do the same for the unreddened star:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "id": "a0958d89",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "Table masked=True length=64\n",
+ "
\n",
+ "obsID | obs_collection | dataproduct_type | obs_id | description | type | dataURI | productType | productGroupDescription | productSubGroupDescription | productDocumentationURL | project | prvversion | proposal_id | productFilename | size | parent_obsid | dataRights | calib_level |
\n",
+ "str6 | str3 | str8 | str8 | str56 | str1 | str62 | str9 | str28 | str56 | str1 | str1 | str1 | str5 | str20 | int64 | str6 | str6 | int64 |
\n",
+ "293177 | IUE | spectrum | lwp29080 | ELBLL | S | mast:IUE/url/pub/iue/data/lwp/29000/lwp29080.elbll.gz | AUXILIARY | -- | -- | -- | -- | -- | PHCAL | lwp29080.elbll.gz | 193068 | 293177 | PUBLIC | 2 |
\n",
+ "293177 | IUE | spectrum | lwp29080 | LILO | S | mast:IUE/url/pub/iue/data/lwp/29000/lwp29080.lilo.gz | AUXILIARY | -- | -- | -- | -- | -- | PHCAL | lwp29080.lilo.gz | 508441 | 293177 | PUBLIC | 2 |
\n",
+ "293177 | IUE | spectrum | lwp29080 | MELOL | S | mast:IUE/url/pub/iue/data/lwp/29000/lwp29080.melol.gz | AUXILIARY | -- | -- | -- | -- | -- | PHCAL | lwp29080.melol.gz | 11897 | 293177 | PUBLIC | 2 |
\n",
+ "293177 | IUE | spectrum | lwp29080 | RAW | S | mast:IUE/url/pub/iue/data/lwp/29000/lwp29080.raw.gz | AUXILIARY | -- | -- | -- | -- | -- | PHCAL | lwp29080.raw.gz | 341374 | 293177 | PUBLIC | 2 |
\n",
+ "293177 | IUE | spectrum | lwp29080 | RILO | S | mast:IUE/url/pub/iue/data/lwp/29000/lwp29080.rilo.gz | AUXILIARY | -- | -- | -- | -- | -- | PHCAL | lwp29080.rilo.gz | 346716 | 293177 | PUBLIC | 2 |
\n",
+ "293177 | IUE | spectrum | lwp29080 | SILO | S | mast:IUE/url/pub/iue/data/lwp/29000/lwp29080.silo.gz | AUXILIARY | -- | -- | -- | -- | -- | PHCAL | lwp29080.silo.gz | 84716 | 293177 | PUBLIC | 2 |
\n",
+ "293177 | IUE | spectrum | lwp29080 | Preview-Full | S | mast:IUE/url/browse/previews/iue/mx/lwp/29000/gif/lwp29080.gif | PREVIEW | -- | -- | -- | -- | -- | PHCAL | lwp29080.gif | 5823 | 293177 | PUBLIC | 2 |
\n",
+ "293177 | IUE | spectrum | lwp29080 | MXLO | S | mast:IUE/url/pub/iue/data/lwp/29000/lwp29080.mxlo.gz | SCIENCE | Minimum Recommended Products | -- | -- | -- | -- | PHCAL | lwp29080.mxlo.gz | 17660 | 293177 | PUBLIC | 2 |
\n",
+ "293177 | IUE | spectrum | lwp29080 | (extracted spectra/vo spectral container/SSAP) fits file | S | mast:IUE/url/pub/vospectra/iue2/lwp29080mxlo_vo.fits | SCIENCE | Minimum Recommended Products | (extracted spectra/vo spectral container/SSAP) fits file | -- | -- | -- | PHCAL | lwp29080mxlo_vo.fits | 48960 | 293177 | PUBLIC | 2 |
\n",
+ "296811 | IUE | spectrum | lwr04170 | ELBLL | S | mast:IUE/url/pub/iue/data/lwr/04000/lwr04170.elbll.gz | AUXILIARY | -- | -- | -- | -- | -- | MSJDW | lwr04170.elbll.gz | 183794 | 296811 | PUBLIC | 2 |
\n",
+ "... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
\n",
+ "380157 | IUE | spectrum | swp51851 | SIHI | S | mast:IUE/url//pub/iue/data/swp/51000/swp51851.sihi.gz | AUXILIARY | -- | -- | -- | -- | -- | MCRBW | swp51851.sihi.gz | 740501 | 380157 | PUBLIC | 2 |
\n",
+ "380157 | IUE | spectrum | swp51851 | Preview-Full | S | mast:IUE/url/browse/previews/iue/mx/swp/51000/gif/swp51851.gif | PREVIEW | -- | -- | -- | -- | -- | MCRBW | swp51851.gif | -- | 380157 | PUBLIC | 2 |
\n",
+ "380157 | IUE | spectrum | swp51851 | MXHI | S | mast:IUE/url/missions/iue/data/swp/51000/swp51851.mxhi.gz | SCIENCE | Minimum Recommended Products | -- | -- | -- | -- | MCRBW | swp51851.mxhi.gz | 653 | 380157 | PUBLIC | 2 |
\n",
+ "380177 | IUE | spectrum | swp52010 | LIHI | S | mast:IUE/url//pub/iue/data/swp/52000/swp52010.lihi.gz | AUXILIARY | -- | -- | -- | -- | -- | MCRBW | swp52010.lihi.gz | 790963 | 380177 | PUBLIC | 2 |
\n",
+ "380177 | IUE | spectrum | swp52010 | MEHIL | S | mast:IUE/url//pub/iue/data/swp/52000/swp52010.mehil.gz | AUXILIARY | -- | -- | -- | -- | -- | MCRBW | swp52010.mehil.gz | 532730 | 380177 | PUBLIC | 2 |
\n",
+ "380177 | IUE | spectrum | swp52010 | RAW | S | mast:IUE/url//pub/iue/data/swp/52000/swp52010.raw.gz | AUXILIARY | -- | -- | -- | -- | -- | MCRBW | swp52010.raw.gz | 401232 | 380177 | PUBLIC | 2 |
\n",
+ "380177 | IUE | spectrum | swp52010 | RIHI | S | mast:IUE/url//pub/iue/data/swp/52000/swp52010.rihi.gz | AUXILIARY | -- | -- | -- | -- | -- | MCRBW | swp52010.rihi.gz | 406634 | 380177 | PUBLIC | 2 |
\n",
+ "380177 | IUE | spectrum | swp52010 | SIHI | S | mast:IUE/url//pub/iue/data/swp/52000/swp52010.sihi.gz | AUXILIARY | -- | -- | -- | -- | -- | MCRBW | swp52010.sihi.gz | 737130 | 380177 | PUBLIC | 2 |
\n",
+ "380177 | IUE | spectrum | swp52010 | Preview-Full | S | mast:IUE/url/browse/previews/iue/mx/swp/52000/gif/swp52010.gif | PREVIEW | -- | -- | -- | -- | -- | MCRBW | swp52010.gif | -- | 380177 | PUBLIC | 2 |
\n",
+ "380177 | IUE | spectrum | swp52010 | MXHI | S | mast:IUE/url/missions/iue/data/swp/52000/swp52010.mxhi.gz | SCIENCE | Minimum Recommended Products | -- | -- | -- | -- | MCRBW | swp52010.mxhi.gz | 653 | 380177 | PUBLIC | 2 |
\n",
+ "
"
+ ],
+ "text/plain": [
+ "\n",
+ "obsID obs_collection dataproduct_type ... parent_obsid dataRights calib_level\n",
+ " str6 str3 str8 ... str6 str6 int64 \n",
+ "------ -------------- ---------------- ... ------------ ---------- -----------\n",
+ "293177 IUE spectrum ... 293177 PUBLIC 2\n",
+ "293177 IUE spectrum ... 293177 PUBLIC 2\n",
+ "293177 IUE spectrum ... 293177 PUBLIC 2\n",
+ "293177 IUE spectrum ... 293177 PUBLIC 2\n",
+ "293177 IUE spectrum ... 293177 PUBLIC 2\n",
+ "293177 IUE spectrum ... 293177 PUBLIC 2\n",
+ "293177 IUE spectrum ... 293177 PUBLIC 2\n",
+ "293177 IUE spectrum ... 293177 PUBLIC 2\n",
+ "293177 IUE spectrum ... 293177 PUBLIC 2\n",
+ "296811 IUE spectrum ... 296811 PUBLIC 2\n",
+ " ... ... ... ... ... ... ...\n",
+ "380157 IUE spectrum ... 380157 PUBLIC 2\n",
+ "380157 IUE spectrum ... 380157 PUBLIC 2\n",
+ "380157 IUE spectrum ... 380157 PUBLIC 2\n",
+ "380177 IUE spectrum ... 380177 PUBLIC 2\n",
+ "380177 IUE spectrum ... 380177 PUBLIC 2\n",
+ "380177 IUE spectrum ... 380177 PUBLIC 2\n",
+ "380177 IUE spectrum ... 380177 PUBLIC 2\n",
+ "380177 IUE spectrum ... 380177 PUBLIC 2\n",
+ "380177 IUE spectrum ... 380177 PUBLIC 2\n",
+ "380177 IUE spectrum ... 380177 PUBLIC 2"
+ ]
+ },
+ "execution_count": 8,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "IUEobs_sk_67_5 = Observations.query_criteria(objectname=\"SK-675\",obs_collection=\"IUE\")\n",
+ "data_products_sk_67_5 = Observations.get_product_list(IUEobs_sk_67_5)\n",
+ "\n",
+ "data_products_sk_67_5"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "c36414b5",
+ "metadata": {},
+ "source": [
+ "- Observation ID: \"swp04827\":"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "id": "e25f93cd",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "Row index=42 masked=True\n",
+ "\n",
+ "obsID | obs_collection | dataproduct_type | obs_id | description | type | dataURI | productType | productGroupDescription | productSubGroupDescription | productDocumentationURL | project | prvversion | proposal_id | productFilename | size | parent_obsid | dataRights | calib_level |
\n",
+ "str6 | str3 | str8 | str8 | str56 | str1 | str62 | str9 | str28 | str56 | str1 | str1 | str1 | str5 | str20 | int64 | str6 | str6 | int64 |
\n",
+ "308097 | IUE | spectrum | swp04827 | (extracted spectra/vo spectral container/SSAP) fits file | S | mast:IUE/url/pub/vospectra/iue2/swp04827mxlo_vo.fits | SCIENCE | Minimum Recommended Products | (extracted spectra/vo spectral container/SSAP) fits file | -- | -- | -- | MSJDW | swp04827mxlo_vo.fits | 48960 | 308097 | PUBLIC | 2 |
\n",
+ "
"
+ ],
+ "text/plain": [
+ "\n",
+ "obsID obs_collection dataproduct_type obs_id description type dataURI productType productGroupDescription productSubGroupDescription productDocumentationURL project prvversion proposal_id productFilename size parent_obsid dataRights calib_level\n",
+ " str6 str3 str8 str8 str56 str1 str62 str9 str28 str56 str1 str1 str1 str5 str20 int64 str6 str6 int64 \n",
+ "------ -------------- ---------------- -------- -------------------------------------------------------- ---- ---------------------------------------------------- ----------- ---------------------------- -------------------------------------------------------- ----------------------- ------- ---------- ----------- -------------------- ----- ------------ ---------- -----------\n",
+ "308097 IUE spectrum swp04827 (extracted spectra/vo spectral container/SSAP) fits file S mast:IUE/url/pub/vospectra/iue2/swp04827mxlo_vo.fits SCIENCE Minimum Recommended Products (extracted spectra/vo spectral container/SSAP) fits file -- -- -- MSJDW swp04827mxlo_vo.fits 48960 308097 PUBLIC 2"
+ ]
+ },
+ "execution_count": 9,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "data_products_sk_67_5[42]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "id": "8f36307d",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Downloading URL https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:IUE/url/pub/vospectra/iue2/swp04827mxlo_vo.fits to ./mastDownload/IUE/swp04827/swp04827mxlo_vo.fits ... [Done]\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ "Table length=1\n",
+ "
\n",
+ "Local Path | Status | Message | URL |
\n",
+ "str48 | str8 | object | object |
\n",
+ "./mastDownload/IUE/swp04827/swp04827mxlo_vo.fits | COMPLETE | None | None |
\n",
+ "
"
+ ],
+ "text/plain": [
+ "\n",
+ " Local Path Status Message URL \n",
+ " str48 str8 object object\n",
+ "------------------------------------------------ -------- ------- ------\n",
+ "./mastDownload/IUE/swp04827/swp04827mxlo_vo.fits COMPLETE None None"
+ ]
+ },
+ "execution_count": 10,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "IUEobs_sk_67_5_sw = Observations.query_criteria(obs_collection=\"IUE\", obs_id=\"swp04827\")\n",
+ "data_products_sk_67_5_sw = Observations.get_product_list(IUEobs_sk_67_5_sw)\n",
+ "yourProd_sk_67_5_sw = Observations.filter_products(data_products_sk_67_5_sw, extension=\"swp04827mxlo_vo.fits\")\n",
+ "Observations.download_products(yourProd_sk_67_5_sw, mrp_only = False, cache = False) "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "d6cf4b6f",
+ "metadata": {},
+ "source": [
+ "- Observation ID: \"lwr04170\""
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "id": "bae12cde",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "Row index=17 masked=True\n",
+ "\n",
+ "obsID | obs_collection | dataproduct_type | obs_id | description | type | dataURI | productType | productGroupDescription | productSubGroupDescription | productDocumentationURL | project | prvversion | proposal_id | productFilename | size | parent_obsid | dataRights | calib_level |
\n",
+ "str6 | str3 | str8 | str8 | str56 | str1 | str62 | str9 | str28 | str56 | str1 | str1 | str1 | str5 | str20 | int64 | str6 | str6 | int64 |
\n",
+ "296811 | IUE | spectrum | lwr04170 | (extracted spectra/vo spectral container/SSAP) fits file | S | mast:IUE/url/pub/vospectra/iue2/lwr04170mxlo_vo.fits | SCIENCE | Minimum Recommended Products | (extracted spectra/vo spectral container/SSAP) fits file | -- | -- | -- | MSJDW | lwr04170mxlo_vo.fits | 48960 | 296811 | PUBLIC | 2 |
\n",
+ "
"
+ ],
+ "text/plain": [
+ "\n",
+ "obsID obs_collection dataproduct_type obs_id description type dataURI productType productGroupDescription productSubGroupDescription productDocumentationURL project prvversion proposal_id productFilename size parent_obsid dataRights calib_level\n",
+ " str6 str3 str8 str8 str56 str1 str62 str9 str28 str56 str1 str1 str1 str5 str20 int64 str6 str6 int64 \n",
+ "------ -------------- ---------------- -------- -------------------------------------------------------- ---- ---------------------------------------------------- ----------- ---------------------------- -------------------------------------------------------- ----------------------- ------- ---------- ----------- -------------------- ----- ------------ ---------- -----------\n",
+ "296811 IUE spectrum lwr04170 (extracted spectra/vo spectral container/SSAP) fits file S mast:IUE/url/pub/vospectra/iue2/lwr04170mxlo_vo.fits SCIENCE Minimum Recommended Products (extracted spectra/vo spectral container/SSAP) fits file -- -- -- MSJDW lwr04170mxlo_vo.fits 48960 296811 PUBLIC 2"
+ ]
+ },
+ "execution_count": 11,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "data_products_sk_67_5[17]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "id": "e17e3929",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Downloading URL https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:IUE/url/pub/vospectra/iue2/lwr04170mxlo_vo.fits to ./mastDownload/IUE/lwr04170/lwr04170mxlo_vo.fits ... [Done]\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ "Table length=1\n",
+ "
\n",
+ "Local Path | Status | Message | URL |
\n",
+ "str48 | str8 | object | object |
\n",
+ "./mastDownload/IUE/lwr04170/lwr04170mxlo_vo.fits | COMPLETE | None | None |
\n",
+ "
"
+ ],
+ "text/plain": [
+ "\n",
+ " Local Path Status Message URL \n",
+ " str48 str8 object object\n",
+ "------------------------------------------------ -------- ------- ------\n",
+ "./mastDownload/IUE/lwr04170/lwr04170mxlo_vo.fits COMPLETE None None"
+ ]
+ },
+ "execution_count": 12,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "IUEobs_sk_67_5_lw = Observations.query_criteria(obs_collection=\"IUE\", obs_id=\"lwr04170\")\n",
+ "data_products_sk_67_5_lw = Observations.get_product_list(IUEobs_sk_67_5_lw)\n",
+ "yourProd_sk_67_5_lw = Observations.filter_products(data_products_sk_67_5_lw, extension=\"lwr04170mxlo_vo.fits\")\n",
+ "Observations.download_products(yourProd_sk_67_5_lw, mrp_only = False, cache = False) "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "aeba0521",
+ "metadata": {},
+ "source": [
+ "### 2. Open the fits file and explore it"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 13,
+ "id": "b44fbf1c",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Filename: ./mastDownload/IUE/swp36552/swp36552mxlo_vo.fits\n",
+ "No. Name Ver Type Cards Dimensions Format\n",
+ " 0 PRIMARY 1 PrimaryHDU 351 () \n",
+ " 1 Spectral Container 1 BinTableHDU 141 1R x 4C [495E, 495E, 495E, 495I] \n",
+ "Filename: ./mastDownload/IUE/lwp15751/lwp15751mxlo_vo.fits\n",
+ "No. Name Ver Type Cards Dimensions Format\n",
+ " 0 PRIMARY 1 PrimaryHDU 350 () \n",
+ " 1 Spectral Container 1 BinTableHDU 141 1R x 4C [563E, 563E, 563E, 563I] \n",
+ "Filename: ./mastDownload/IUE/swp04827/swp04827mxlo_vo.fits\n",
+ "No. Name Ver Type Cards Dimensions Format\n",
+ " 0 PRIMARY 1 PrimaryHDU 345 () \n",
+ " 1 Spectral Container 1 BinTableHDU 141 1R x 4C [495E, 495E, 495E, 495I] \n",
+ "Filename: ./mastDownload/IUE/lwr04170/lwr04170mxlo_vo.fits\n",
+ "No. Name Ver Type Cards Dimensions Format\n",
+ " 0 PRIMARY 1 PrimaryHDU 353 () \n",
+ " 1 Spectral Container 1 BinTableHDU 141 1R x 4C [563E, 563E, 563E, 563I] \n"
+ ]
+ }
+ ],
+ "source": [
+ "filename_sk_69_206_sw = \"./mastDownload/IUE/swp36552/swp36552mxlo_vo.fits\"\n",
+ "fits.info(filename_sk_69_206_sw)\n",
+ "\n",
+ "with fits.open(filename_sk_69_206_sw) as hdulist:\n",
+ " spectrum_sk_69_206_sw = hdulist[1].data\n",
+ "\n",
+ "wav_sk_69_206_sw = spectrum_sk_69_206_sw[0][0] # A\n",
+ "flux_sk_69_206_sw = spectrum_sk_69_206_sw[0][1] # ergs/cm2/sec/A\n",
+ "\n",
+ "filename_sk_69_206_lw = \"./mastDownload/IUE/lwp15751/lwp15751mxlo_vo.fits\"\n",
+ "fits.info(filename_sk_69_206_lw)\n",
+ "\n",
+ "with fits.open(filename_sk_69_206_lw) as hdulist:\n",
+ " spectrum_sk_69_206_lw = hdulist[1].data\n",
+ "\n",
+ "wav_sk_69_206_lw = spectrum_sk_69_206_lw[0][0] # A\n",
+ "flux_sk_69_206_lw = spectrum_sk_69_206_lw[0][1] # ergs/cm2/sec/A\n",
+ "\n",
+ "filename_sk_67_5_sw = \"./mastDownload/IUE/swp04827/swp04827mxlo_vo.fits\"\n",
+ "fits.info(filename_sk_67_5_sw)\n",
+ "\n",
+ "with fits.open(filename_sk_67_5_sw) as hdulist:\n",
+ " spectrum_sk_67_5_sw = hdulist[1].data\n",
+ "\n",
+ "wav_sk_67_5_sw = spectrum_sk_67_5_sw[0][0] # A\n",
+ "flux_sk_67_5_sw = spectrum_sk_67_5_sw[0][1] # ergs/cm2/sec/A\n",
+ "\n",
+ "filename_sk_67_5_lw = \"./mastDownload/IUE/lwr04170/lwr04170mxlo_vo.fits\"\n",
+ "fits.info(filename_sk_67_5_lw)\n",
+ "\n",
+ "with fits.open(filename_sk_67_5_lw) as hdulist:\n",
+ " spectrum_sk_67_5_lw = hdulist[1].data\n",
+ "\n",
+ "wav_sk_67_5_lw = spectrum_sk_67_5_lw[0][0] # A\n",
+ "flux_sk_67_5_lw = spectrum_sk_67_5_lw[0][1] # ergs/cm2/sec/A\n",
+ "\n",
+ "wav_sk_69_206_sw, flux_sk_69_206_sw, wav_sk_67_5_sw, flux_sk_67_5_sw = changeNaN(wav_sk_69_206_sw, flux_sk_69_206_sw, wav_sk_67_5_sw, flux_sk_67_5_sw)\n",
+ "wav_sk_69_206_lw, flux_sk_69_206_lw, wav_sk_67_5_lw, flux_sk_67_5_lw = changeNaN(wav_sk_69_206_lw, flux_sk_69_206_lw, wav_sk_67_5_lw, flux_sk_67_5_lw)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "8aa8041a",
+ "metadata": {},
+ "source": [
+ "### 3. Save the data to your local computer"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 14,
+ "id": "1e850520",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "First 3 elements of original array:\n",
+ " [1150.5802 1152.2566 1153.933 ]\n",
+ "Last 3 elements of original array:\n",
+ " [1975.3384 1977.0146 1978.691 ]\n",
+ "First 3 elements of wav_sk_69_206_sw.txt:\n",
+ " [1150.5802002 1152.2565918 1153.9329834]\n",
+ "Last 3 elements of wav_sk_69_206_sw.txt:\n",
+ " [1975.33837891 1977.01464844 1978.69104004] \n",
+ "\n",
+ "First 3 elements of original array:\n",
+ " [2.7181413e-14 3.0124900e-14 7.0772984e-14]\n",
+ "Last 3 elements of original array:\n",
+ " [8.4576599e-14 8.2177856e-14 8.2617500e-14]\n",
+ "First 3 elements of flux_sk_69_206_sw.txt:\n",
+ " [2.71814126e-14 3.01248996e-14 7.07729841e-14]\n",
+ "Last 3 elements of flux_sk_69_206_sw.txt:\n",
+ " [8.45765989e-14 8.21778558e-14 8.26174998e-14] \n",
+ "\n",
+ "First 3 elements of original array:\n",
+ " [1150.5802 1152.2566 1153.933 ]\n",
+ "Last 3 elements of original array:\n",
+ " [1975.3384 1977.0146 1978.691 ]\n",
+ "First 3 elements of wav_sk_67_5_sw.txt:\n",
+ " [1150.5802002 1152.2565918 1153.9329834]\n",
+ "Last 3 elements of wav_sk_67_5_sw.txt:\n",
+ " [1975.33837891 1977.01464844 1978.69104004] \n",
+ "\n",
+ "First 3 elements of original array:\n",
+ " [2.3477002e-12 2.0947244e-12 2.2759821e-12]\n",
+ "Last 3 elements of original array:\n",
+ " [1.3234771e-12 1.2480189e-12 1.2281475e-12]\n",
+ "First 3 elements of flux_sk_67_5_sw.txt:\n",
+ " [2.34770016e-12 2.09472435e-12 2.27598214e-12]\n",
+ "Last 3 elements of flux_sk_67_5_sw.txt:\n",
+ " [1.32347714e-12 1.24801894e-12 1.22814747e-12] \n",
+ "\n",
+ "First 3 elements of original array:\n",
+ " [1851.2054 1853.8682 1859.1935]\n",
+ "Last 3 elements of original array:\n",
+ " [3342.3083 3344.971 3347.6338]\n",
+ "First 3 elements of wav_sk_69_206_lw.txt:\n",
+ " [1851.20544434 1853.86816406 1859.19348145]\n",
+ "Last 3 elements of wav_sk_69_206_lw.txt:\n",
+ " [3342.30834961 3344.97094727 3347.63378906] \n",
+ "\n",
+ "First 3 elements of original array:\n",
+ " [5.2585735e-13 2.6216936e-13 2.8764439e-13]\n",
+ "Last 3 elements of original array:\n",
+ " [6.7038307e-14 3.9260966e-14 4.4691918e-14]\n",
+ "First 3 elements of flux_sk_69_206_lw.txt:\n",
+ " [5.25857352e-13 2.62169355e-13 2.87644393e-13]\n",
+ "Last 3 elements of flux_sk_69_206_lw.txt:\n",
+ " [6.70383074e-14 3.92609664e-14 4.46919181e-14] \n",
+ "\n",
+ "First 3 elements of original array:\n",
+ " [1851.3013 1853.967 1859.2987]\n",
+ "Last 3 elements of original array:\n",
+ " [3344.1611 3346.8271 3349.4927]\n",
+ "First 3 elements of wav_sk_67_5_lw.txt:\n",
+ " [1851.30126953 1853.96704102 1859.29870605]\n",
+ "Last 3 elements of wav_sk_67_5_lw.txt:\n",
+ " [3344.16113281 3346.82714844 3349.49267578] \n",
+ "\n",
+ "First 3 elements of original array:\n",
+ " [2.4691247e-12 2.2907830e-12 1.6330023e-12]\n",
+ "Last 3 elements of original array:\n",
+ " [1.1981843e-12 1.0647583e-13 4.2735328e-13]\n",
+ "First 3 elements of flux_sk_67_5_lw.txt:\n",
+ " [2.46912473e-12 2.29078301e-12 1.63300233e-12]\n",
+ "Last 3 elements of flux_sk_67_5_lw.txt:\n",
+ " [1.19818435e-12 1.06475829e-13 4.27353275e-13] \n",
+ "\n"
+ ]
+ }
+ ],
+ "source": [
+ "arrays = [wav_sk_69_206_sw, flux_sk_69_206_sw, wav_sk_67_5_sw, flux_sk_67_5_sw, wav_sk_69_206_lw, flux_sk_69_206_lw, wav_sk_67_5_lw, flux_sk_67_5_lw]\n",
+ "filenames = ['wav_sk_69_206_sw.txt', 'flux_sk_69_206_sw.txt', 'wav_sk_67_5_sw.txt', 'flux_sk_67_5_sw.txt', 'wav_sk_69_206_lw.txt', 'flux_sk_69_206_lw.txt', 'wav_sk_67_5_lw.txt', 'flux_sk_67_5_lw.txt']\n",
+ "\n",
+ "for i in range(len(arrays)):\n",
+ " saveArray(arrays[i],filenames[i])"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "1b45d8e0",
+ "metadata": {},
+ "source": [
+ "## Additional Resources\n",
+ "\n",
+ "For more information about the MAST archive and details about mission data: \n",
+ "\n",
+ "* MAST API
\n",
+ "* International Ultraviolet Explorer Page (MAST)
\n",
+ "* IUE Data Retrieval Help Page \n",
+ "\n",
+ "For more information about extinction curves and their parametrization:\n",
+ "\n",
+ "\n",
+ "* A quantitative comparison of SMC, LMC and Milky Way UV to NIR extinction curves
\n",
+ "* An analysis of the shapes of the ultraviolet extinction curves. III. An atlas of ultraviolet extinction curves "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "49ed7fcd",
+ "metadata": {},
+ "source": [
+ "## About this Notebook\n",
+ "\n",
+ "**Author**: Clara Puerto Sánchez
\n",
+ "**Keyword(s)**: Tutorial, UV, reddening, extinction-curve
\n",
+ "**Last Updated**: Aug 2022
\n",
+ "**Next review**: Mar 2023\n",
+ "\n",
+ "For support, please contact the Archive HelpDesk at archive@stsci.edu.\n",
+ "***\n",
+ "[Top of Page](#top)\n",
+ "
"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.8.8"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}
diff --git a/exploring_UV_extinction_curves_pt1/requirements.txt b/exploring_UV_extinction_curves_pt1/requirements.txt
new file mode 100644
index 00000000..bb6e45b4
--- /dev/null
+++ b/exploring_UV_extinction_curves_pt1/requirements.txt
@@ -0,0 +1,3 @@
+astroquery >= 0.4.6
+astropy >= 5.0.4
+numpy >= 1.20.1