Skip to content

GSoC 2014 Application Daniel Datsev : Implement uncertainties in Quantity

orangeblock edited this page Mar 20, 2014 · 1 revision

Abstract

The astropy.units package includes a Quantity class that represents a value (or array of values) with a unit. Currently, it does not include support for any uncertainty on the value, limiting its usefulness for certain types of astronomy projects. This project would involve porting relevant parts of the nddata uncertainties framework to Quantity, as well as implementing propagation of those uncertainties where Quantity objects are combined.

Detailed Description

Currently the Quantity class represents a value with a unit. In the case of uncertainty (due to observation errors, rounding errors etc.) we have no way of reflecting that in the current implementation. For example, if the speed of a body is measured to be 10.2km/s but we know that the observation equipment always rounds off at the first decimal point then we can assume that the error of the observation is +-0.05km/s. Moreover, we may want to calculate the distance traveled by this body in a certain amount of time. The "stopwatch" might also be uncertain and round off at the first decimal. So in order to calculate the total distance traveled and predict the total error in our calculation we use error propagation. We can do this by using the standard deviation formulas to calculate the accumulated error after a multiplication. This can then extend to further operations, aggregating all the errors to produce a final uncertainty indicator. This is helpful since now we can put bounds on our measurements and be more aware of potential errors.

This project involves implementing an uncertainty representation for the Quantity objects and also propagating it through various operations that can be applied to these objects.

Timeline

April 21 - May 19 (Bonding Period)

Familiarize myself with the code in the units package by running some tests and making changes to observe differences in the output. This will be done purely to understand the code better. Also I'll delve deeper into NumPy and see the way it's used in astropy. Finally, I'll be talking with my mentor(s) to clear up any confusion or misunderstanding regarding difficult parts of the code.

May 19 - June 2 (2 weeks)

Connect the uncertainty class in nddata package with Quantity by linking to the constuctor. In order for this to happen I must study the code structure and pinpoint all the necessary areas that need to be changed/added to. Also I will change the print output of the Quantity class to show the uncertainties (30km/s +- 0.05km/s instead of 30km/s). Possible discussions with my mentor(s) as to the format of this representation and the structure of the code.

June 2 - June 9 (1 week)

Write test cases and fix any bugs that show up, while it's early. Keeping in touch with my mentor(s) is important since I should keep up with the coding style of the project and also get feedback on the changes. A possible extension of about a week can be added if things are harder than expected and bugs cannot be located fast enough.

June 9 - June 30 (3 weeks)

Given that everything works fine and tests pass I'll start working on implementing propagation. This should involve tweaking the operation functions (__mul__, __imul__, etc.) to update the uncertainties of the result, according to the standard deviation formulas. Any missing operations can be added during this period.

June 30 - July 7 (1 week)

Write test cases and fix bugs for the propagation. Again, feedback from my mentor(s) is important here to make sure everything is as intended.

July 7 - July 21 (1 week)

By now things should be functional and I can start working on cleaning up the code. Any outstanding bugs (usually minor left-overs) should be fixed during this period.

July 21 - August 4 (2 weeks)

Write the documentation for the uncertainties framework.

August 4 - August 18 (2 weeks)

Receive feedback, clean up the code, possibly add more test cases and final touches. This period can be used as a reserve if anything goes wrong with the previous stages.

I'm willing to continue work on this after GSoC is finished and contribute to any future improvements in the representation and functionality of the uncertainties framework (like, for example, corellated uncertainties).

Vacation is not an issue since I will be working full time if I get selected.

Relevant Experience

I've been using Python for almost 3 years now and have good familiarity with git and unix systems (I have been using various linux distros over the years). I also have experience with machine learning algorithms and the theory behind them which is based a lot on probabilities. I've taken two classes in linear algebra so matrices and their operations/properties are quite familiar to me.

Pull Requests

#2202 | #2161

email: dan.datsev@gmail.com

Clone this wiki locally