## Friday, September 4, 2020

### DOFIS: Tidying things up

[This is an edited version of the original post, as I had second thoughts on something]

First, a few words on the thin lens model, eg like the one that is built into ML.

The thin lens model is a reasonable model with which to calculate the depths of field, once you are away from the macro end.

The main disadvantage of the thin lens model is that its distance zero, ie positioned at the lens front principal plane, is at f*(1+m) or, put another way, at f+focus_extension, where f is the focal length, m the magnification and focus extension is f*m.

As we can see, at infinity, m is zero, and thus the lens extension is zero.

In ML, the front principal of the thin lens model is positioned at the focal length, ie the ML thin lens model assumes you are always focused at infinity, ie there is no lens extension built in.

Now, to be fair, the lens extension is usually small, especially for wide angle lenses, ie  the magnification x the focal length (mag*f). Thus, my 12-24mm Sigma, at 24mm, the maximum magnification (at the minimum focus distance) is 0.156 (which is what is registered in DOFIS). Therefore the focus extension is 0.156*24 = 3.744mm. In other words, hardly worth worrying about when doing non macro photography.

But what if we attach a 100mm macro lens, with a minimum focus distance (MFD) of 300mm (from the sensor plane) and try and use the thin lens model. Simply put, the model doesn't work and the thin lens equation fails us; for example, unable to work out the maximum magnification.

For this reason, when using DOFIS, I recommend you use the Auto lens model and register your lenses with measured/trusted lens data. With the Auto lens model on and the 100mm Macro correctly registered, we see the following, where the maximum magnification at the MFD is being correctly calculated and reported:

If we tried using the 100mm Macro lens with a standard thin lens model, you would not see the correct magnification at the minimum focus distance. The reason being, the thin lens model breaks down when the focus distance is less than 4 x the focal length, ie in the case of the 100mm Macro, at 400mm. Thus when the lens focuses at its minimum of 300mm, the thin lens model fails.

Although in general the thin lens model will never give you the correct magnification, hence the reason for the split lens model, it fails catastrophically in the case of a near field focused macro lens.

DOFIS attempts to fix this by forcing the magnification to 1 if the focus distance is less than four times the focal length. Thus, if a thin lens model is selected in the case of the Canon 100mm macro, you will see a magnification of 1 at the minimum focus distance.

To be clear, DOFIS is still using a thin lens model with a front principal fixed at the focal length, but it is now including lens extension, based on the thin lens magnification model, throughout its focus range, ie f(1+m); where m varies with focus.

This release of DOFIS (download from the right) also includes a reminder as to the auto bracketing key you have set. You need to explicitly add this in the script, eg:

--*************************************************
button = KEY.RATE -- change as required           *
button_t = "RATE" -- add a 4 letter reminder here *
--*************************************************

With Auto Bracketing switched on, we now get a reminder of the key to use:

Finally, this version includes a few code tweaks to tidy up my scripting.

As usual I welcome any feedback on DOFIS.