The COS Notebooks have joined the spacetelescope/notebooks repo!
They are now hosted at
The Cosmic Origins Spectrograph (COS) is an instrument on the Hubble Space Telescope (HST). This is a repository of interactive walkthrough guides to common COS data procedures. It is intended for any and all COS data users: from undergraduates, to professional astronomers, to the general public. For more information, please see our iPoster from the 238th conference of the AAS.
If you don't want to run the notebooks for yourself but just want to see rendered html versions of the notebooks, (with outputs,) you may use the rendered
|Name||Topic||Notebook file (
||Rendered file (
|Setup||Setting up an environment to work with COS data||Setup.ipynb||Setup.html|
|DataDl||Downloading COS Data from the archive||DataDl.ipynb||DataDl.html|
|ViewData||Beginning to work with COS data in Python: plotting, binning, calculating SNR, & evaluating a spectrum||ViewData.ipynb||ViewData.html|
|AsnFile||Modifying or creating an association file||AsnFile.ipynb||AsnFile.html|
|CalCOS||Running the COS pipeline (CalCOS)||CalCOS.ipynb||CalCOS.html|
|DayNight||Filtering out COS data taken during the day or night||DayNight.ipynb||DayNight.html|
|LSF||Working with the COS Line Spread Function (LSF)||LSF.ipynb||LSF.html|
|Extract||Editing the extraction boxes in a BOXCAR-method spectral extraction file (XTRACTAB)||Extract.ipynb||Extract.html|
We have built these notebooks to be cross-platform compatible; however they have been tested primarily on
like systems, (i.e. MacOS and Linux). As such Users may encounter issues when run on Windows computers. If you are unable to run a particular notebook from a Windows device, please reach out to us (see Getting Help) and we will work to fix the problem. The first solution to try if the notebooks are failing because of a Windows incompatibility is using the Windows Sub-System for Linux (WSL), which will allow you to run a Linux computer environment from your Windows device.
While you can run most of the notebooks with only the
ipynb file downloaded, it is highly recommended that you clone this entire repository. Specifically,
ViewData.ipynb cannot run at present without both the file
ViewData installed side-by-side in the same directory. To clone (which means download, in the language of
git,) the repository with all the COS notebooks, run the following command from a terminal in the directory where you would like to download the notebook repository.
git clone https://github.com/spacetelescope/notebooks
The git cloning process is also shown in this video walkthrough.
If you have never used Jupyter/IPython Notebooks before, please see the Jupyter/IPython Notebook Quick Start Guide.
You need to be able to run Jupyter Notebooks and install python packages. If you don't have Jupyter installed, continue reading, or see the Jupyter Docs for much more detailed installation instructions.
If you have
If you don't have the
We recommend installing either the Anaconda or Minicoda distributions. See this page for instructions, and install either of the following:
|Conda Distribution (with link to download)||Short Description||Size|
||More beginner friendly, with lots of extras you likely won't use||~ 3 GB|
||Bare-bones conda distribution, which allows you to download only what you need||~ 400 MB|
These will install the conda command line tool, allowing you to run:
conda install -c conda-forge jupyterlab
From a new terminal (make sure that the current working directory encompasses your notebook directory), simply run either:
jupyter notebook to begin a notebook kernel (recommended for new users)
jupyter lab to begin a lab kernel (more versatile for advanced users)
Either of the previous commands should open up a new window in your default web browser (with an address like
localhost:8888/). From there you can navigate to a notebook and open it.
If you don't have experience installing packages, you should begin with our introductory notebook Setup.ipynb on setting up an environment for running astronomical Python code. If you do not yet have Jupyter up-and-running, you can read the pre-rendered (
.html) version here.
You will frequently see exclamation points (!) or dollar signs ($) at the beginning of a line of code. These are not part of the actual commands. The exclamation points tell a jupyter notebook to pass the following line to the command line, and the dollar sign merely indicates the start of a terminal prompt.
Similarly, when a variable or argument in a line of code is surrounded by sharp brackets, like <these words are>, this is an indication that the variable or argument is something which you should change to suit your data.
If you install the full Anaconda distribution with the Anaconda Navigator tool, (see Section 1 of the
Setup.ipynb Notebook) you will also have access to a graphical interface (AKA a way to use windows and a point-and-click interface instead of the terminal for installing packages and managing environments).
If you have an issue using these notebooks which you cannot fix, or if believe you have discovered an error in a notebook, please open a GitHub ticket on the spacetelescope/notebooks repository. If you're unfamiliar with GitHub, please reach out with your issue/concern to the HST Help Desk or to the notebook's primary author: Nathaniel Kerman (email@example.com).