Welcome to my lessons


Bo Zhang (NAOC, mailto:bozhang@nao.cas.cn) will have a few lessons on python.

  • These are very useful knowledge, skills and code styles when you use python to process astronomical data.
  • All materials can be found on my github page.
  • jupyter notebook (formerly named ipython notebook) is recommeded to use

These lectures are organized as below:

  1. install python
  2. basic syntax
  3. numerical computing
  4. scientific computing
  5. plotting
  6. astronomical data processing
  7. high performance computing
  8. version control

Steps to set up an account and a new repository

  1. Register an account, i.e., hypergravity. Then the page on github would be https://github.com/hypergravity
  2. Add a new repository, say, bopy. The link is https://github.com/hypergravity/bopy.git
  3. Generate rsa key: $ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
  4. Copy the key, and paste it in the Github account: $ gedit ~/.ssh/id_rsa.pub

Useful software: gitk

To install gitk, type:

$ sudo apt-get install gitk

Check whether gitk is installed:

$ which gitk

If installed, it will tell you:

/usr/bin/gitk

Useful commands - local to remote

There are several commands very useful:

git init
git add .
git commit -m "First commit"
git remote add origin https://github.com/hypergravity/bopy.git
git push origin master
# Pushes the changes in your local repository up to the remote repository
# you specified as the origin

Code history

git status
git log
git reset --hard 723a0f617fabcc9f1bb4c350d6e51a5d35fe1029
git push --force

HOMEWORK

  1. try to setup a repository on github yourself
  2. add README.md
  3. add some lines of code in it
  4. commit and push

In [ ]: