MaeFat
maeFat is a Maemo 5 app for the N900 which helps you to track your weight history. It is similar to the Hacker's Diet tools, but not identical to them. It allows you to log your weight, plot that data along with an exponentially weighted running average, and determine caloric excess/deficit over a variety of time intervals. maeFat is open source and cost-free.
The Initial Display
When you initially run the program, there will be no data available, and you will see the display shown on the right. You must either enter data through the app, or copy a data file of your own into the proper location. Also, you must use the Settings menu option in order to enter your height (which is used to calculate your Body Mass Index (BMI).
Menu
The image to the right shows the maeFat menu. To enter data, select the Data Entry option. The Log option allows you to edit entries which have already been entered. The Time Analysis option displays statistics about the data which has been entered. The Settings option allows you to change how the program operates, for example whether or not metric units are used. The Help option displays this page in the unit's web browser, and the About options shows a page containing copyright and other information about the program. The Hacker Diet help button opens the Hacker Diet website in the browser (maeFat is very similar to the Hacker Diet "Eat Watch").
Data Entry
The Data Entry page allows you to enter new weight data. It does that without requiring you to use the N900's keyboard. It contains hildon Date and Time widgets preloaded with the current time and date. You can use these to change the time tag for the weight data you are entering, if you don't want to use the current time. The Weight widget is used to enter the weight. If no data has yet been entered, it will be preloaded with 150 pounds (unless you chosen metric units), otherwise it will be preloaded with the most recent weight entry. The comments widget allows you to tag the entry with an optional text comment. You must press the Enter This Value button, to put the data into your weight log. If you press the arrow at the upper right corner (the normal way to exit a page) the new data will NOT be entered into the log.
It is recommended that you not enter more than one weight entry per day, although the software allows you to do so if you wish to. If you enter more than 33 weight values per month, the Edit page will not work properly.
Settings
The Settings page allows you to change how the program operates. It must be used initially to enter your height. Before entering your height, you should select centimeter units if that's what you wish to use (rather than inches). You may also select metric units for weight, and the format for displaying the dates. If you select nonjudgemental colors, neutral colors will be used to display the data, otherwise green will be used to indicate weight loss, red will be used for weight gain, and the BMI data will be color coded. The BMI color code is:
- Red: Obese or Severely Underweight
- Yellow: Overweight or Underweight
- Green: Normal weight range
You may also set a target weight, which can be displayed as a green line on the weight vs time plot.
Selecting "Plot Trend Line" (the default) will show a plot of the exponentially weighted running average of the weight data.
There are four "radio box" sets of buttons. The first allows you to set whether your goal is to lose weight or to gain weight. The green/red color coding of weight changes will be set depending upon this setting. The second set of buttons allows you to define the format for printing dates. The third set of radio buttons lets you set the time interval for the default weight vs time plot. The fourth radio box contains buttons which allow you to define whether or not a least squares fit is applied to the data, and the time interval over which the fitting should be done.
There is also a button labeled Start with Data Entry. Selecting that option causes the app to show the data entry dialog page as the first page when maeFat is started, rather than the plot page. This can save a little time if you run the app once a day to enter a daily weight measurement.
Import/Export Data
The Import/Export page allows you to write out your weight log (Export) or read a new one in (Import). You may select the format used by the Hacker Diet Online website, or a custom comma (or whitespace) separated list. If you choose a custom format, you may specify which fields of the weight log are written/read, and in which order. You must specify at least date and weight fields if you're reading in a custom format file.
Note that the Hacker Diet format does not contain a field for time of day, so the measurements will be treated as having been made at the time 00:00.
Plot Page
The program's default page shows a plot of the data you have entered, and a trend line. The yellow trend line is the exponentially weighted running average of the weight data. The scale on the left of the plot is in the weight units you have chosen. On the right is shown the corresponding BMI values. The line at the bottom presents your current weight (from the trend line, not any particular data entry), the weight lost or gained over the last week (regardless of the plot interval) and the number of excess/deficit calories per day which will produce that weight change.
The nice thing about plotting the trend line is that it smooths out the fluctuations which inevitably will appear in your weight log, due to how recently you've eaten, the time of day when you weighed yourself, etc. If you are losing or gaining weight, the trend line will drop or rise nearly monotonically, even if your daily measurements are quite noisy.
Trend Page
The Trend Page shows statistical information about your weight data over differing time intervals. Initially, when little data is available, it will show only the values for the entire log history. Eventually data for the last week, fortnight (2 weeks), month (30 days), quarter (91 days) and year will be shown, when enough data is available to calculate those values.
Methods of Weight Trend Calculation
The trend line (shown in yellow on the Plot Page) and the trend values shown on the Trend Page are calculated using one of the two formulae shown on the right. The Settings page allows you to chose which formula to use. If you enter a weight value every day, the two formulae will give nearly identical results. The difference between them appears if you have gaps in your weight log. The Hacker Diet formula does not take elapsed time into account when calculating the trend. So if you enter a weight after having not weighed yourself for a month, the Hacker Diet formula will give as much (mathematical) weight to the penultimate and earlier weight values as they would have had if you had no gap in your weight log. The default formula used by maeFat takes the time interval into account, and will decrease the (mathematical) weight given to entries which were made long ago. The Hacker Diet formula is less computationally expensive, so if you have a weight log with many thousands of entries, it will be faster to use the Hacker Diet formula, which will also save a tiny amount of battery power.
The weight values shown on the Trend Page are calculated with these formulae, and the caloric excess/deficit values are calculated using the difference in trend value over the specified interval, with the assumption that one pound of weight change corresponds to 3500 calories.
Estimating When You Will Reach Your Target Weight
If you have entered a target weight, and defined a fit interval (both may be set on the Settings Page), maeFat will estimate when you will reach your target weight, based on a linear least squares fit to your weight entries, over the time interval you have specified. The estimated date (and exact time of day!) that you will reach your target weight will be displayed on the Trend Page.
In addition, if you select the Plot Target Weight option, the weight vs time plot will show the least squares fit to your data, and the point at which that line
will intersect your target weight (see plot to the right, for which only the last month's data points were used for the fit).
Editing the Log
If you select the Edit option, you will first be presented with a page containing a widget which allows you to select which month's data you wish to edit. This widget will be loaded with every month for which data is available.
Once you have selected the month and have pushed the View Selected Month button, you will be presented with a page listing all the data entries for that month. The green weight values are the measurements that you have entered. The yellow weight values are trend weights, calculated with one of the formulae shown above. If you press on one of these entries, you will be sent to the Data Entry page, which will be preloaded with the selected day's values, where you may change the values. You may also press the Delete button to remove the entry entirely.
Data File Format / Entering Many Data Points
If you have a pre-existing weight log that you wish to enter, it will be very tedious to enter each point individually using the GUI interface. It makes much more sense to convert your weight log into the format maeFat uses using some external script. The data is kept in the file $HOME/.maeFat/data. A backup copy is kept on the microSD card (so that if you have to reflash the N900, your log won't be lost) in the file /media/mmc1/.maeFat/data . The data file is a flat text file, with one line per log entry, using the following format:
DD/MM/YYYY HH:MM XXX.X # Optional comment here
where DD is the day of the month, MM is the number of the month, YYYY is the year, HH is the hour, MM is the minutes, and XXX.X is the weight. The weight should be in kgs or pounds depending on whether maeFat has been configured to display metric units or not. Any comment must be preceded by a #, but no # is needed for entries without a comment.
There is no need for you to load your data into the backup file, because it will be rewritten automatically once any data is entered or edited with the program's GUI.
Entering Weights Outside the Default Range
When the program is first run, it has no way of knowing what the proper range is for the weight selector widget on the Data Entry page. The weight selector is initially loaded with weight values from 50 to 250 pounds (or 23 to 113 kg, if metric units have been selected). If you wish to enter an initial weight which falls outside of that range, you can just use a text editor to edit the /media/mmc1/.maeFat/data
file, with the format described above, to enter your initial weight. After the first value has been entered, the weight selector will display a range of weights near that value when the Data Entry page is displayed, so only the first value will need to be entered with the text editor.
Availability
maeFat is available in the Extras Devel repository.
Support Information
If you have questions, comments or requests concerning this program, please send them to orrery.moko@gmail.com. maeFat uses the official Maemo bugzilla for bug tracking.