This function can be fitted using chi-squared. Many fitting problems in python can be expressed as least-squares problems. Chi-squared looks like this:
The numerator represents the physical difference in distance of a data point to the best-fit curve. It is squared to account for points above and below the curve. The denominator, written as sigma squared, represents the poisson error of the point. The whole expression is summed to account for all data points. In a perfect world, chi-squared should be as small a value as possible. The lowest value I was able to achieve was 50.5. This sounds high but it is a great improvement over my original value (6545.3) that I had before debugging my program.
In this exercise, I plotted two sets of sample data and fitted both using chi-squared. The programs for each are nearly identical except for the file that the program reads in and the number of bins used.
The program turns up these graphs:
In addition to creating this program I researched the Hydrogen alpha line. The emission line occurs when a hydrogen electron falls from the 3rd to 2nd orbital. Since hydrogen is the most abundant element in the universe, the hydrogen alpha line is the brightest emission line in interstellar space.
Next week I will work more with fitting our luminosity functions as well as construct a website that will display our team's work thus far during Astro Research at Siena. On Wednesday June, 26th, we will travel to Union College to present our work and learn more about undergraduate research in the local area.