in reply to Comparing graph shapes or soft matching.

Sorry for being too vague, I guess it is one of those situations where the question is obvious to me even from the initial statement that I can't believe no-one else sees it as such.

What I have is a row count from a number of databases plotted against time. Rows are added to one database and are copied to the others. In a normal situation the graphs will line up or nearly line up, the row count in each database will be the same or nearly the same but because copy and sample times can vary there can be delays to the rows counts on one or more database. (Additionally it is possible for lots of rows to be added and then removed from the main database before the copy mechanism kicks in so those rows may not make it to one or more copy at all, this is not a problem).

An error situation needs reporting where the counts get out of sync and remain out of sync shown on the plots by the lines not lining up at all. The error can "clear" if and when the plots line up again (or nearly so).

Thinking things over, I would need to try to line up the time values and then compare the row counts, and report where the row counts differ more than a certain number of times in succession by a sufficient value to worry about.

  • Comment on Re: Comparing graph shapes or soft matching.

Replies are listed 'Best First'.
Re^2: Comparing graph shapes or soft matching.
by LanX (Saint) on Jun 28, 2024 at 08:49 UTC
    You obviously have a clear picture in mind, which is hard to communicate verbally.

    The easiest way to ask this question is to show us some sample plots, the associated data and your interpretation of "alikeness".

    Either by ASCII graphic in a code section or by sharing a link to a freely hosted picture °

    + x * x + etc x +

    I already gave you the standard approach in mathematics, which is calculate the mean of squared differences.

    You might tell us why this doesn't solve the problem.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    see Wikisyntax for the Monastery

    Update

    °) Another possibility is sharing a Google doc spreadsheet including data and plotting

      If the data can be exported to something like CSV, it can be plotted using gnuplot into a nice ASCII art.

      Data-example (incomplete):

      date_trunc;temperature;humidity;oventemperature 2024-06-28 16:25:31;22.5;99.9;27.2 2024-06-28 16:25:43;22.59;99.9;27.2 2024-06-28 16:25:53;22.59;99.9;27.2 2024-06-28 16:26:04;22.59;99.9;27.2 2024-06-28 16:26:15;22.59;99.9;27.2 2024-06-28 16:26:18;22.59;99.9;27.2 2024-06-28 16:26:28;22.59;99.9;27.2 2024-06-28 16:26:39;22.59;99.9;26.5 2024-06-28 16:26:49;22.59;99.9;27 ...

      Gnuplot-file for this:

      set title "Bedroom\nTemperature BME" set datafile separator ";" # Set virtual terminal size to 120x30 and print to STDOUT set terminal dumb size 120,30 set xlabel "Logtime" set ylabel "Sensorvalue" set xdata time #set timefmt "%Y-%m-%d" #set xrange ["03/21/95":"03/22/95"] set format x "%d.%m\n%H:%M" set timefmt "%Y-%m-%d %H:%M:S" set key autotitle columnhead outside plot "bme.csv" using 1:2 title "Room temp(Celsius)" with lines, \ "dht.csv" using 1:4 title "Oven temp (Celsius)" with lines

      "bme.csv" using 1:2 specifies the filename and which two columns to use for a given plotline (first one is always the timestamp in my case). You can use the same file with different columns, or use different files altogether.

      Result:

      Bedroom + Temperature BME + 28 +------------------------------------------------------------- +-------------------+ | + + + + + + + + # + | Room temp(Celsius) ******* | # # ## #### ## # # # # + # # # # # # | Oven temp (Celsius) ####### 27 |-+ ######################################################## +################ +-| | ############## ##################### # ## ########### # +#### ########### | | ##### ######## ### ################# # ## ########### # +#### ############ | | ## # # # # + # #### ## ### | 26 |-+ + # ## ###+-| | + # # ### | | + # ## | 25 |-+ + ##+-| | + ## | | + # | | + # | 24 |-+ + #+-| | + # | | + # | 23 |-+ + #+-| | + ******** | | ******************************************************** +********** | | + + + + + + + + + | 22 +------------------------------------------------------------- +-------------------+ 28.06 28.06 28.06 28.06 28.06 28.06 28.06 2 +8.06 28.06 28.06 16:15 16:30 16:45 17:00 17:15 17:30 17:45 1 +8:00 18:15 18:30 Logtime