CIS-2212 Homework #5 (Python XML/Web)

Due: Wednesday, December 15, 2021

This assignment is intended to integrate some things you explored in past assignments and demonstrate some new technologies (XML and Web development) as well. It is a longer and more complex assignment than the ones you have done so far, but hopefully it will also be fun and interesting.

The goal is to build a simple web application using Python such that when a certain URL is accessed, the application displays a graph of the light curve of the variable star Mira along with a graph of the spectrum of its variation. This will require using an XML parser library (lxml) to fetch the raw data out of an XML document, NumPy to do the spectral calculations, Matplotlib to make the graphs, and a Python web development framework (Flask) to manage the interactions with the web client.

Proceed as follows:

  1. Ultimately, we would like to serve your web application from a "production" web server such as Apache on Lemuria (via WSGI). However, during development you will want to set up a "mini" web server as part of a skeletal Flask project on your personal system.

    Microsoft has a tutorial describing how to set up a skeletal Flask project using Visual Studio Code. You will want to follow the instructions there to get started, particularly the instructions in the section "Create and Run a Minimal Flask App." A few notes:

  2. Once you have a trivial web application running (as per the Microsoft tutorial above), download the AOML file containing Mira brightness data (courtesy of the AAVSO). For convenience during testing and development, you can also download the Mira sample data file which is much smaller.

    Use the lxml library (also preinstalled in the Anaconda base environment) to extract the JD and brightness values from the AOML document (start with the smaller one). Store the data in two NumPy arrays. Modify your web application so that it prints these arrays to verify that the data looks correct.

  3. Use matplotlib to plot a brightness "curve" (it may not look great with the sample data due to a lack of data points) and save that plot to an image file. Modify your web application so that it returns a page that contains that image, thus displaying a plot.

  4. Use NumPy's Fast Fourier Transform (FFT) library to compute a spectral plot of the data. Modify your web application so it shows both.

  5. Scale your application up by using the full data set.

  6. We will discuss moving the application to Lemuria in class.

Create a zip archive of ..., and submit your archive to Canvas.


Last Revised: 2025-01-09
© Copyright 2025 by Peter Chapin <peter.chapin@vermontstate.edu>