TempFit does extrapolation on time and temperature data to estimate when your meat will reach your desired cooking temperature.
- Automatically estimate cooking time without fancy thermometers or apps.
- Import spreadsheet or manually enter temperature data.
- Understand more about the accuracy and reliability of the estimation.
Illustrates the estimate()
function with measured data in blue and the approximation functions in red, orange, and green (See more)
-
Download the project from GitHub
-
Install the required Python libraries:
If you install SciPy, that should be all you need (scipy.org/install):
python -m pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose
- Start cooking and save your temperature data with an electronic thermometer or using
manual.py
- Import
thermometer.py
and create aThermometer
object from your CSV - Run
Thermometer.estimate()
to predict future temperatures. (Seetest.ipynb
for examples)
Thermometer
requires a list of temperatures and the times they were recorded. Some thermometers have the ability to export a spreadsheet or CSV file. If that's not available, you can manually measure and enter data points into a spreadsheet with the help of manual.py
.
Depending on what you're cooking and how fast the temperature changes, you will probably need about an hour of data to get a good estimate.
estimate()
works by fitting a model function to measured temperature data and extrapolating to predict future values. A 3rd order polynomial usually fits well, but it's improved by adding an x⁻¹
term to the objective function:
def tx(x, a, b, c, d, e):
return a*x**3+b*x**2+c*x+d*(1+x)**-1+e
The improvements can be easily seen when we plot the ETA at many points throughout the cook. The improved function is closer to correct eta (horizontal line) on average:
The result is improved by adding constraints to the fitting function. Some improvement can be obtained by constraining the value and slope of the model function to be what they were at the last measured point (y[-1]=f(x[-1])
and y'[-1]=f'(x[-1])
). This is logical because the current temperature and rate of change of temperature will have the biggest effect on future values.
The third constraint is designed specifically for barbecue. It accounts for the 'barbecue stall', a common observation that the temperature increase usually slows around 150-160 °F and speeds up after. This phenomenon represents an inflection point in the temperature vs time graph so it can be modeled by constraining the second derivative to be zero around 155 (f"(x)=0 when f(x)=155
). A rough guess of 155 °F shows a big improvement in estimation, but this value can probably be further tuned.
Defines the Thermometer
class which contains time and temperature data from an imported CSV file. Has the estimate()
member function which predicts the time a Thermometer
will reach a given temperature.
Find CSV files with today's date and import the most recent one. Do some common estimations quickly. This is the quickest way to import temperatures and estimate quickly white cooking.
Manually enter temperature values for extrapolation. They will be automatically timestamped and saved in a CSV file for quick calculations while cooking.
Contains demonstrations and analysis of different uses of the Thermometer
class and estimate()
function.
Boneless pork shoulder with probe inserted into the center, estimated almost 2 hours before done time.
Spatchcocked turkey with probe inserted into the breast, estimated about 1 hour before done time.
Note: The FDA recommends poultry be cooked to at least 165° internal temperature, but it will probably be dry. See this article by J. Kenji López-Alt for more information.
- Basic estimation
- Improve fit function
- Constrain
curve_fit
sof(x)
andf'(x)
have correct value at last sample - Detect and remove anomalies in input data
- Use ambient temperature in calculations
- Constrain
- More options for inputting temperature data (realtime mode)
Temperature data gathered with an Inkbird IBBQ-4T
This project is released under the MIT license: