National Museums Scotland said it was one of the rarest scientific instruments in its collection.