Materials scientist and data enthusiast • Photographer and home cook

Share your work with a simple and interactive web application

Image for post
Image for post
Photo by on

Say you’ve written a really cool script in Python to do some interesting data analysis and now you want to demonstrate it to others. Chances are, sending over a .py file and asking others to run it, or demonstrating yourself running it on the command line won’t have the same grasp as a nicely packaged and polished web application. By using the Python package flask, we can create one of these interactive applications fairly quickly. …


Ever felt like learning a new programming language? Go is a great choice!

Image for post
Image for post
Photo by on

I’ve recently heard a lot of buzz about proramming in Go and it piqued my curiousity. Proponents of Go laud it’s simplicity, concurrency, and performance — having basically been solely a Python programmer for the last few years, I wanted to try to get started with Go myself. Through learning some of the basics, I found it easiest to try find direct mappings between Python and the equivalent operation in Go. Here is just a small introduction to get started with Go yourself.

Installation

To install Go (or golang), you can either visit their , or use Homebrew, where it is…


Create a simple image classifier with neural networks in minutes!

Image for post
Image for post
Photo by on

Deep learning, a subset of machine learning that deals with artificial neural networks, has shown to be extremely powerful at image classification. Despite the mathematical rigor of the inner workings of these algorithms, Python libraries such as keras make these problems approachable to all of us. In this article, I will walk through the design of a simple image classifier using artificial neural networks to classify images of food into one of two classes: pizza or pasta. …


Python Science Plotting

Use a GUI-based program to generate reproducible Python plot scripts

Image for post
Image for post
Photo by on

A couple of months ago, I wrote an on generating scientific publication plots with Python. Recently, I discovered this incredible new package called , which greatly simplifies the process of making multi-panel figures without the need to fiddle with axes sizes. The package also then generates Python code for you, so you can reproducibly recreate and share your figures with anyone else. I will do a basic demonstration of some of the thing you can do with pylustrator in this article — hopefully it will be useful to you in plot making!

Installation

You can install pylustrator using pip


Show off your work with a custom project website

Image for post
Image for post
Photo by on

I come from an experimental science background where we deal with a ton of home-built experiment setups and data analysis scripts. Often, the result of this can be poorly documented and difficult-to-use code, especially after the original graduate student (who wrote it) has graduated and left. For this reason, when I developed some data analysis scripts during my grad school research, I decided I wanted to try and document/demonstrate it as well as I could so that any future users could use it intuitively. The result of my efforts is this .


Make your scientific data come alive with D3.js

Image for post
Image for post
Photo by on

I’ve always been hesitant to learn how to use D3.js. It has always seemed much less intuitive than other libraries such as matplotlib, which I have written extensively about. However, here I find myself writing a tutorial on making a plot in D3 — if you are developing a website or web application and want dynamic and interactive data visualizations, it may be useful to be familiar with the library. In this article, I have compiled the results of many trial-and-errors in that hope that it can both serve me well as a reference and help you avoid some simple…


Have you ever wanted to make a fancy-looking NBA shot chart? It’s simpler than ever!

Image for post
Image for post
Photo by on

Recently, I stumbled on this wonderful Python package called nba_api, which can be found , that serves as a very simple API client to retrieve stats from www.nba.com. I have personally always wanted to create player shot charts like ones found online, but gathering the shot location data seemed like a daunting task. This is where nba_api comes to the rescue! First, let’s install the package:

pip install nba_api

Now that we have installed nba_api we can now import all the packages we will need to produce our own shot chart.

# Import packages from nba_api.stats.endpoints import shotchartdetail import json…


Use matplotlib to generate a candlestick chart of stock data

Image for post
Image for post
Photo by M. B. M. on Unsplash

A is an effective way of displaying stock prices that gives more information that simply plotting the share price each day. The idea is that we have 4 pieces of information that we want to convey at each point:

  1. Opening stock price
  2. High price during the day
  3. Low price during the day
  4. Closing stock price

It turns out that we can show this using a figure that looks fairly similar to a box and whisker plot. We use a box, or candle body, whose top and bottom edges reflect the opening and closing prices for the day —…


What stats lie behind the 2019–20 English Premier League table?

Image for post
Image for post
Photo by on

As we eagerly await the restart of the Premier League season on June 17th, we can look at the story of the season so far from this . As a Liverpool FC fan myself, I’d like to hope this season concludes with us as champions for the first time in the Premier League era (over the course of a historic, record-breaking season).

With a 25 point lead at the top of the table and needing only 6 points to secure a championship, Liverpool have dominated English football this past year. Let’s see how they have performed relative to their…


Using Python to determine intensity variation with radial distance in images

Image for post
Image for post
Photo by on

In experimental materials science, we are often given images such as the one below, called an X-ray diffraction pattern.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store