Skip to content

Commit

Permalink
Add binder
Browse files Browse the repository at this point in the history
  • Loading branch information
GILIYAR RADHAKRISHNA Chaithya committed Jan 11, 2024
1 parent 610ffd9 commit 017f9ef
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 0 deletions.
81 changes: 81 additions & 0 deletions docs/binder/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# pysap-tutorials

[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/cea-cosmic/pysap-tutorials/master)

This repository holds demos for examples from various pysap plugins.
Click on the [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/cea-cosmic/pysap-tutorials/master) to launch a binder.

Navigate into the respective directories and run the examples and see the results.

You dont really need any dependencies, things work on the fly directly, all you need is chrome or firefox to work with jupyter notebooks.

If there are any issues faced in any example, please feel free to open an issue and we will address it as soon as possible!


## Google Colaboratory: In development

[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/CEA-COSMIC/pysap-tutorials/)

We can now run the codes on a google colab. However, this is in development and you may need to run some start up script at begining to ensure the codes run fine.

### Running on Google Colab

1) Click on [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/CEA-COSMIC/pysap-tutorials/).

2) Once inside, choose the appropriate example which you want to run.

3) At the begining, click on `+ Code` and please paste below code and run:
```
!apt install libnfft3-dev
!pip install --upgrade git+https://github.com/cea-cosmic/pysap
!pip install --upgrade git+https://github.com/cea-cosmic/pysap-mri
!pip install --upgrade git+https://github.com/cea-cosmic/modopt
```

This will install all the latest libraries and you can now run all your codes fine. Please ensure you run these codes on every launch as Google Colab in current state does not support persistent kernels or Dockers.

*Note: The codes that use Undecimated Wavelet Transform will not work and we are in process of fixing this.*

Going forward, we plan to enable even GPU versions of codes with which you can run faster on [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/CEA-COSMIC/pysap-tutorials/) as compared to [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/cea-cosmic/pysap-tutorials/master)

## Local Environment Setup

While we have setup environments to run things of the shelf on Binder and on Google Colab with some modifications,
it is still better to setup a local environment for run. Please follow the following instructions to setup your
own local environment:

1. Install libnfft3:

```sudo apt-get install libnfft3-dev```

2. Install miniconda / anaconda:

```
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
chmod +x miniconda.sh
./miniconda.sh -b -p $HOME/miniconda
export PATH=$HOME/miniconda/bin:$PATH
```

3. Create a Virtual Environment:

```
conda env create -f environment_local.yml
conda activate pysap-tutorials
```

4. Install PySAP and add support to Undecimated Wavelet: Currently we need this step to add support for
Undecimated Wavelets, you can skip this step if you dont want to use Undecimated Wavelets.
```
git clone https://github.com/cea-cosmic/pysap
cd pysap
python setup build
export PATH=$PWD/build/temp.linux-x86_64-3.7/extern/bin:$PATH
```

5. Launch jupyter notebook

```
pip install jupyter
jupyter notebook
```
3 changes: 3 additions & 0 deletions docs/binder/apt.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cmake
libnfft3-dev
libgl1-mesa-glx
17 changes: 17 additions & 0 deletions docs/binder/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: pysap-tutorials
channels:
- conda-forge
dependencies:
- python=3.10
- pip>=19.1.1
- astropy>=3.2.1
- jupyter>=1.0.0
- matplotlib>=3.1.1
- numpy>=1.16.4
- pyqtgraph>=0.10.0
- pip:
- setuptools>=60.0.0
- python-pysap@git+https://github.com/cea-cosmic/pysap
- modopt@git+https://github.com/cea-cosmic/modopt
- pysap-mri@git+https://github.com/cea-cosmic/pysap-mri

6 changes: 6 additions & 0 deletions docs/binder/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
setuptools>=60.0.0
pyqt5==5.13.0
pip>=20
mri-nufft
finufft
pynfft2

0 comments on commit 017f9ef

Please sign in to comment.