Many imperial TPI and metric pitch threads are closely equivalent sizes. Its relatively easy to get the approximate pitch or tpi in either system but telling the difference between an imperial thread and the closely similar metric one, or vice versa, is more difficult.
The trick is to calculate the length of thread giving a half pitch difference over a measured length between the two very similar candidates. This is easy to see with a ruler as that measurement doesn't need to be anything like precise. Typically you need to measure over a few inches, maybe 5 to 7, for half pitch error.
First time I did this was after buying a Bridgeport feed screw and nut set which didn't screw together and needed to figure out whether screw or nuts were wrong. I was able to verify that the 5 mm pitch Bridgeport feed screw I'd bought was in fact 5 tpi so the nuts were 5 mm as required. A tricky example as the two are close enough in size that worn nuts will go on the wrong screw in a fairly satisfactory manner.
I have a spreadsheet somewhere with all the common pitches and tpi mapped out besides the half pitch error lengths in both metric and imperial dimensions. Fortunately there aren't many variations of tpi or pitches in common use.
Clive