COS-Notebooks GitHub Pages Site

A GitHub pages site to describe the COS Notebooks

Space Telescope Logo

COS Notebooks

The COS Notebooks have joined the spacetelescope/notebooks repo!

They are now hosted at in the subdirectory notebooks/COS/

Jupyter Notebook Walkthroughs of Cosmic Origins Spectrograph (COS) Data Processing

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.

1. Currently Operational Notebooks

2. Basic Requirements

3. Notes for those new to Python/Jupyter/Coding

4. Getting Help


Currently Operational Notebooks

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 html file.

Name Topic Notebook file (ipynb) Rendered file (html)
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
SplitTag Breaking COS TIME-TAG data into multiple sub-exposures SplitTag.ipynb SplitTag.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
For notebooks with exercises, you can find worked solutions at the end of the notebook.

Basic Requirements

Computer requirements

We have built these notebooks to be cross-platform compatible; however they have been tested primarily on Unix and Unix-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.

Downloading the notebooks

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 cos_functions.py and 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.

Using Jupyter Notebooks

If you have never used Jupyter/IPython Notebooks before, please see the Jupyter/IPython Notebook Quick Start Guide.

Installing Jupyter

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 pip or conda installed:

pip conda (preferred)
pip install jupyterlab conda install -c conda-forge jupyterlab

If you don't have the conda tool:

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
anaconda Distribution More beginner friendly, with lots of extras you likely won't use ~ 3 GB
miniconda Distribution 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

Running Jupyter

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)

OR

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.

Notes for those new to Python/Jupyter/Coding:

Getting Help

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 (nkerman@stsci.edu).


QR Code to access repo with STScI Logo

Space Telescope Logo