Magic Lantern Forum

Developing Magic Lantern => Scripting Corner => Scripting Q&A => Topic started by: garry23 on February 12, 2018, 06:42:41 PM

Title: Units
Post by: garry23 on February 12, 2018, 06:42:41 PM
I hope some kind soul can educate me.

I looking at menu set/get and trying to work out the units in and out.

For example, in ETTR min shutter the min is 16 and the max is 152.

160 equates to 1/8000.

But what's the conversion, ie these aren't APEX units.

Other menus seem to use 1/8 APEX units.

I'm a bit lost as I wish to set things myself, ie from a script, so I need to understand the units.
Title: Re: Units
Post by: a1ex on February 12, 2018, 06:55:48 PM
menu.get will get either the string (as displayed in menu), or the internal unit used on that menu (as integer).

Here, ETTR uses Canon encoding for shutter speed (lens.h, 8 units = 1 EV, 16 = 30", 160 = 1/8000).

Conversion formulas can be found in the same file. Would be nice to have them available to Lua (for example, to create a "shutter" object not tied to the current shutter speed, but that would accept setting the shutter in any units (APEX, ms etc) and read it back in some different unit.

I'm not very fluent with Lua's object-oriented syntax, so here I'd welcome some advice from a more knowledgeable person.
Title: Re: Units
Post by: garry23 on February 12, 2018, 07:02:14 PM
@a1ex

Thanks.

Knowing that will help me a lot.

Cheers

Garry
Title: Re: Units
Post by: garry23 on February 12, 2018, 07:43:51 PM
@a1ex

Great your insight really helped and I'm on track to get my hand held script intelligent to focal length, ie informing ETTR.

One last question (to night ;-)), is there a way in Lua to (generically) detect a crop vs FF camera?

Cheers

Garry
Title: Re: Units
Post by: a1ex on February 12, 2018, 10:04:31 PM
In the core code, we've got CONFIG_FULLFRAME, but it's used in very few places:

- Sensor crop factor (1.0/1.6 in lens.c, 1.00/1.62 in raw.c, raw_capture_info)
- default CoC value for DOF info (29/19)
- LUT files for fisheye correction (for the Samyang 8mm lens)
- a few other minor tweaks

Can you suggest some API to expose sensor info? The best I could think of would be the raw_capture_info (https://bitbucket.org/hudson/magic-lantern/src/unified/src/raw.h?fileviewer=file-view-default#raw.h-207) (aka RAWC) currently used in MLV; it includes sensor attributes (resolution, crop factor) and video mode attributes (currently only pixel binning/skipping info implemented).
Title: Re: Units
Post by: garry23 on February 12, 2018, 11:29:53 PM
@a1ex

Sorry, I don't think I can throw much more light on where in the ML code to go for camera crop info.

But the raw_capture_info seems to do it, assuming I read it OK.

Cheers

Garry