How to programmatically find a sharp change in slope

First, apologies if I have the wrong group or this question is far too easy for this group. I am (as you'll see) a newbie. Please point me to another, more appropriate group OR tell me how to fix the question to be more appropriate for this group.

I have some data that represents a thermometer that is put in a fridge, and then a freezer, and then finally, back out of the freezer to the fridge. The data might look like this:

The horizontal axis is time in seconds and the vertical axis is Celsius. As you can see, it's quite obvious where the thermometer goes into the freezer and where it comes out. One can with the naked eye come up with a pretty good estimate as to where this happens. I'd like to be able to have a computer program (C#) figure this out for me for other data sets that all have this general form. One way might be to look for when the data first reaches -10 and argue that the transition happened at about this time. Another might be to look for a change in the 2nd derivative. That's about the extent of my knowledge. I can imagine there is a whole literature devoted to this problem and probably libraries of code that already do this. I'm looking for

2) Example code in C# (or JAVA or C++) that does the automatic detection.

I would like to be able to feed a time series into an algorithm, and have an estimate of when the thermometer was put in the freezer (or taken out) WITH some sort of confidence interval. Example: "it went into the freezer at 18420 seconds +/- 100 seconds with 95% confidence". I am willing to assume (for now) that the thermometer starts changing temperature as soon as it is moved from the fridge to the freezer (I'm still researching this!).

Those are the questions. For those, who are curious for background information, please continue to read. I'll add that the motivation is that we are trying to see if some thermometers in the fridge and freezer are in spec. We have several thermometers in the fridge and freezer that we would like to know are in spec. We have a highly accurate "reference" thermometer that we can move around with a robot to the locations where the fridge/freezer thermometers are. As we move the reference thermometer to the various locations with the robot, we have the relevant fridge or freezer thermometer take a temperature and record it. This we can do with very accurate timing. The problem is that the reference thermometer just has a counter every 10 seconds. Presumably the measurements are really 10 seconds apart but there is not absolute time measurements. It's just a counter from 0. You can see the graph of the reference thermometer in my attached picture. It occurs to me that since I move the reference thermometer to the first freezer station, I should be able to use that point on the graph as a "pin" to connect the two timelines. I'd further point out that I leave the reference thermometer at each station for several minutes, so there is some slop available. Finally, for those wise folks that say, "why not have the reference thermometer communicate with the rest of the system via Bluetooth or similar so you don't have to try and match things up after the fact?", my reply is "already suggested (several times) to management without success" :)

• – user28715
Oct 15, 2018 at 1:40