Sign inSign up

actcollaboration/dr4_tutorials

By actcollaboration

•Updated over 5 years ago

Run and access the Jupyter notebook tutorials associated with ACT's Data Release 4

Image
0

10K+

actcollaboration/dr4_tutorials repository overview

⁠This repository allows users to run and access the map-manipulation library Pixell and run the Jupyter notebook tutorials associated with Data Release 4.

ACT's Data Release 4 includes intensity and polarization maps covering close to half the sky as well as a variety of other data products. These data products are described in some detail in the Python Notebook Tutorials presented here. The tutorials also introduce users to the Plate Carree maps used for the ACT data products as well as the python library, Pixell, used to handle the maps.

The full list of ACT DR4 data products can be found on LAMBDA here⁠.

For questions or comments pertaining to these notebooks please reach out to our help desk at [email protected]⁠.

⁠Installing and Running the Notebooks

There are two options for building and running this repo: a completely local installation, along with a local download of required data, or a fully-containerized installation via Docker, which installs all dependencies. In the latter case, users will manually download required data during the container setup. We provide instructions for either case on the GitHub page⁠ and here we provide the Docker instructions .


⁠Docker Installation

We now walk through the Docker installation procedure. The initial set up should be reasonably fast with the exception of the step that downloads the data. AFter setting up the container up once, it's easy to relaunch it with a single command at any time.

  1. Install and run docker⁠:

    • Create a Docker account and then sign in
    • Docker is set up to limit the memory available to your container. Some notebooks are CPU and memory intensive, so you should adjust this! Go into Preferences -> Resources and set Memory to 10GB and CPUs to 4. You can increase them at any point if you need to.
  2. Pull the Docker image:

    • open your terminal or command line and run:

        docker run -d -it -p 8888:8888 --name dr4_tutorials  --rm actcollaboration/dr4_tutorials
      

    This command connects the containers port to the local port with the -p flag, it names the container with the --name flag, it tells your system to remove the container once the session is ended with the --rm flag and then finally it points to the image you want to pull which is called actcollaboration/dr4_tutorials

  3. Move the container content to a local directory:

    • We now want to move the data in the container to somewhere that's easy to find on your local machine. We suggest creating a folder on your computer somewhere where you want to store the data for this tutorial. The path to that folder should replace [local_path] in the lines below.

        docker cp dr4_tutorials:/usr/home/workspace/. [local_path] && cd [local_path]/Data
      

    This command copies the contents of the image using the cp command to somewhere on your local machine and then we go to the data folder in that repository.

  4. Download the data:

    • In order to run the notebooks you'll need to download the relevant data products. In the data folder of this repo you'll notice a few different scripts that have been set up to pull the correct products. If you're on a mac you will want to use the files that have 'curl' in the name, unless you have wget set up already. You can choose to pull all of the data products or just a subset depending on which file you choose (run ls for macs or dir for windows to check what files are available). From there you just need to run that file using:

        sh [pull_data_curl].sh
      

    Just replace the [pull_data_curl] part with the name of the file you wish to run. This procedure is the same as the local installation/download instructions.

  5. Relaunch the container with the new data:

    • Now that we have the data we just need to relaunch our container and we're ready to go. To do so we first stop the container (the part of this command before the && can be used to stop the container whenever you wish to do so in the future) and then relaunch it :

        docker container stop dr4_tutorials && docker run -it -p 8888:8888 -v [local_path]:/usr/home/workspace --name dr4_tutorials --rm actcollaboration/dr4_tutorials
      
    • Again you need to replace [local_path] with the path to the folder you created earlier. Here the -v flag mounts your local folder onto the container so that you can easily access the data and save any changes you make to the notebooks.

    • If you're on a windows machine you may need to switch the slashes in the path name to / (forward slashes) instead of back slashes. If the command fails on the path name the first time then just run the second half of it with the corrected path name:

        docker run -it -p 8888:8888 -v [local_path]:/usr/home/workspace --name dr4_tutorials --rm actcollaboration/dr4_tutorials
      
    • For future use of this container you can relaunch it using just the above command and you can stop it using docker container stop dr4_tutorials

  6. Launch Jupyter Notebook:

    • You will now be in the container and should be able to launch the jupyter notebooks by just running

        jupyter notebook --ip 0.0.0.0
      
    • In the terminal you should now see a link that you can copy and paste into a browser. The link will open up jupyter notebook and you'll be able to navigate to the notebooks and run them in the container.

  7. Run Tutorials:

    • To check your data has correctly linked open the data directory, you should see a list of the relevant files.

    • Navigate to the Tutorials folder and start with the 1st notebook which serves as an indtroduction and provides an overview of the tutorials.

⁠Trouble Shooting the Docker Jupyter notebooks

This step can occasionally cause problems if you are already using the port 8888 on your computer (i.e. you have another notebook running somewhere or something similar). Here are some trouble shooting steps you can try.

  • Try explicitly navigating to the 8888 port by opening your browser and entering: localhost:8888/

    • When prompted for a token copy and paste the token from the url or find it using the terminal by typing:

       jupyter notebook list
      
    • This will give a list of running jupyter notebooks that should look like this:

      Currently running servers:

      http://localhost:8888/?token=0d66c7b877535a9511ebe70d230f5ed65df1e9a0ac4f1144⁠ :: /Users/.... Folder Path

    • Copy the text after 'token=' and before the ' :: /Users...' into the token request box and that should launch the notebook.

  • You can map the notebook onto a different port

    • Close your container by typing exit then run:

       docker run -it -p 8889:8888 -v [local_path]:/usr/home/workspace --name dr4_tutorials --rm actcollaboration/dr4_tutorials
      
    • Now re run jupyter notebook as before and copy the link but change the numbers in the url 8888 -> 8889

⁠Dependencies

⁠References:

Tag summary

Content type

Image

Digest

Size

1 GB

Last updated

over 5 years ago

docker pull actcollaboration/dr4_tutorials