ECE570: Homework 1

Homework 1: Environment Setup

(Acknowledgement: Most of these instructions and inspiration come from Prof. Milind Kulkarni’s excellent instructions at

The goal of this assignment is two fold:

  1. Setup and use GIT to submit assignment.
  2. Setup basic Python environment.

Instead of blackboard, we will be using GIT this semester for assignment submission. The GIT part is based on the ideas from Prof. Milind Kulkarni’s GIT setup (see for some GIT tips).

Task 1: Setup GitHub account and use git to clone your personalized repository

If you haven’t already you need to signup for a GitHub account and submit your GitHub username via the following form:

Then, you will need to click on the GitHub Classroom assignment signup link that I posted on Piazza to initialize your repository.

Next you need to install git if it is not already installed. Most servers should already have it installed. See for more information about how to install git.

Then, you will also need to add an ssh-key to your GitHub account, see

After adding your ssh-key, you should be able to clone the homework repository via the following bash command-line command:

git clone<your GitHub username>.git

For example, I would execute:

git clone

This will create a local folder on your repository called hw1-<your GitHub username>. If you view the contents of this folder you will see the skeleton files we have provided.

cd hw1-<your GitHub username>

Task 2: Setup python environment

We will be using Python 3.7 (the most recent version of Python) in this class.

NOTE: Some of the default python on servers is Python2, e.g. ecegrid defaults to python2 when running the python command. We will be using Python 3 exclusively in this class so please do not develop code using Python 2. At least on ecegrid, Python 3 can be accessed via the command python3 though I would suggest installing anaconda or miniconda instead. See the Python Handbook for instructions on how to install packages via anaconda and the conda command

You can install the following packages using pip (called pip3 on some servers for Python 3) or anaconda, but they should have the following (recent) version numbers (at least up to the second version number, i.e. 3.7.3 or 3.7.4 would be fine but 3.6.1 could be problematic). If you have installed these Python packages before you may need to update your packages to the latest versions. (You could create a new environment via conda or venv if you don’t want to change your default packages.)

python 3.7.4
numpy 1.16.4
scipy 1.3.1
pandas 0.25.1
sklearn 0.21.2
matplotlib 3.1.0
seaborn 0.9.0

Task 3: Modify code

Modify to print the versions of all packages above in that order. The template file already has examples of how to do python, numpy and scipy. NOTE: The scikit-learn package is imported under the module name of sklearn.

After modification, run the program and save the output into the file out_print_versions.txt

python > out_print_versions.txt

The greater than symbol > puts the output of the program into the file out_print_versions.txt.

Task 4: Submit assignment via git

Please see for guides on how to use git or other online resources. A very brief overview:

  • git add <filename> - This adds a file to a “staging” area.
  • git commit -m "<your description of changes called a commit message>" - This commits changes in the “staging” area to your local repository (i.e. only on your computer).
  • git tag -a <tagname> -m "<description of tag>" - This adds a tag or a little label to your current commit.
  • git push - UPDATE This pushes changes (but not tags) from your local repository to the remote repository on GitHub. NOTE: We can only see your changes if you push them to GitHub.
  • git push --tags - UPDATE: This only pushes tags to the remote repository on GitHub. NOTE: We can only see your changes if you push them to GitHub.

Generally you should commit and push changes as often as you can so that you have a history of your code edits.

For submitting an assignment you must tag your commit with the “submission” tag and then push this tag to the remote:

git tag -a submission -m "Submission for hw1"
git push --tags

If you want to update your submission, you must retag the commit with “submission” and push the new tag to GitHub.

git tag -a -f submission -m "Submission for hw1"
git push --tags -f

Note the extra “-f” tag in both commands which forces the submission tag to be overwritten. In general, you should not use the “-f” force flag unless you are updating your submission tag because it can overwrite history.

For this assignment, you will need to add your and out_print_versions.txt files and submit. Here is an example of how to do all the commands for submission (UPDATE: You should do run both git push, which pushes your changes to GitHub and git push --tags which pushes your submission tag to GitHub):

git add out_print_versions.txt
git commit -m "Added version printout"
git push
git tag -a submission -m "Submission for hw1"
git push --tags

NOTE: We will use the date/timestamp for the “submission” tag to determine whether something is submitted late. It is your responsibility to tag the correct commit with “submission” and update it if you change something.