Doing Science with Python#

Python Working Group: Monday 18 April 2022#

In this seminar, I will demonstrate our scientific workflow using Python related tools to create a small project for solving the Schrödinger equation. Prior to the seminar, please do the following:

  1. Create an account on CoCalc and sign in. For the seminar, we will share a provisioned product that you can copy for your own use later. Note: the free account will allow you to work with your project, running code (slowly), etc. but will lack internet access (people were abusing this). You can have full access for a fairly modest cost (~$40/year).

  2. Create an account on GitLab, GitHub, or similar. (I have both and often mirror repositories from one to the other to take advantage of different testing services). This is optional, but highly recommended.

  3. If you plan to follow along on your own computer, please make sure you have the following installed:

    • A working python system with Miniconda or Anaconda (optionally with Mamba which is a bit faster).

    • Working development tools (i.e. make) and a linux-like shell. (Window’s users will need to install something like the Windows Subsystem for Linux – I do not have experience with this, so others might need to help.)

    • (Optional) A working version control system like Mercurial or Git.

    • Enough disk space to create some Conda environments.

    To prepare, you might do the following, which will download all of the needed software (which might take some time, and hence slow you down during the seminar).

    # Pure conda: Took about 1m40s on my Mac
    conda create -n pwg_2022_base -c conda-forge "python>=3.8" anaconda-project hg-git hg-evolve
    
    # Using mamba:
    conda create -n pwg_2022_base -c conda-forge mamba
    conda activate pwg_2022_base
    mamba install -c conda-forge anaconda-project hg-git hg-evolve
    

    Once you have this base environment, we install the required version of cookiecutter. Then you can clone our existing project and run make init which will download everything you need.

    conda activate pwg_2022_base
    pip install --upgrade --user git+https://github.com/cookiecutter/cookiecutter.git@2.0.2#egg=cookiecutter==2.0.2
    hg clone https://gitlab.com/mforbes/wsu-python-working-group-demo-2022.git
    # OR
    git clone https://gitlab.com/mforbes/wsu-python-working-group-demo-2022.git
    cd wsu-python-working-group-demo-2022
    make init