I can only offer a T1 perspective on this, so hopefully some T2 insulin users will reply - I'm not sure to what extent T2 insulin resistance changes the picture.
What T1s generally do from time to time is wait till levels are generally stable, then take 10g of glucose, then watch and test and see how much bg rises until it levels off. Let's say for example, it levels off after a rise of 2.5.
Then we take 1u of insulin and watch to see how much that drops bg by before levelling off. Again, let's say it drops by 2.5.
If that was the case then if I knew 10g raises by 2.5 and 1u drops by 2.5, then my ratio would be 1u for every 10g.
It's also useful to spend some time eating the same meal with a known carb content, and viewing the test results, adjusting the amount of insulin depending on results, a little more if the rise is not being handled properly. Once you know roughly how much insulin is needed for that size meal, you can do some arithmetic to figure out how mhch is needed for 10g and then apply it for larger or smaller meals.
But be aware that there are so many other biological things going on with the action of insulin and digestive processes that this will never give 100% accuracy in dosing. There's so many ghosts shoogling the table. For example, some injected insulin will be destroyed before it gets to work, so you might get different results on two different days with the same meal and same insulin.
Having a ratio is a good starting point but it can still be hit or miss. It's why many T1s with cgm are coming around to the idea of "Sugar Surfing", where we make small adjustments in the course of the day to try to iron out the shoogling.