Skip to content

BUG: fix wrong DVF parameters in class constants - #1242

Draft
xresende wants to merge 1 commit into
masterfrom
update-dvf-parameters
Draft

BUG: fix wrong DVF parameters in class constants#1242
xresende wants to merge 1 commit into
masterfrom
update-dvf-parameters

Conversation

@xresende

@xresende xresende commented May 25, 2026

Copy link
Copy Markdown
Contributor

replacing #1032

@xresende
xresende requested a review from henriquesimoes May 25, 2026 18:08

@henriquesimoes henriquesimoes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed this is still a draft, but I'm commenting on everything I noticed nevertheless.

You probably haven't had time to actually implement the use of the new IMAGE_NR_PIXEL_MULTP parameter, but I left comment showing where I would expect it to be used.


def cam_roi_calc(self, roix_fwhm_factor, roiy_fwhm_factor):
"""Return ROI based on FWHM factors."""
multp = 4

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was expecting that the new device specific constant IMAGE_NR_PIXEL_MULTP would be used here.

Comment on lines 43 to 48
DEVICES.CAX_DVF1: _get_namedtuple(
# Basler acA1300-75gm (version 106755-24)
'DVFParameters',
_dvfparam_fields,
(16, 0.5, 0.5, 0.100, 2064, 3088, 2.4, 5.0),
(16, 16, 0.5, 0.5, 0.100, 2064, 3088, 2.4, 5.0),
),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I mentioned in the deprecated PR, this camera (acA1300-75gm) has a $1024 \times 1280~\text{px}^2$ sensor, not $2064 \times 3088~\text{px}^2$ as defined here.

Can't we always use the existing cam_max_sizex and cam_max_sizey methods (which read the size of the sensor from the IOC) instead of redefining those constants? As of now, it seems dvfimgproc/csdev.py and dvfimgproc/meas.py consume these IMAGE_SIZE_Y and IMAGE_SIZE_X constants defined here.

I just noticed the pixel size is also wrong, because it was replicated from DVF2. It is $4.8\mu m$ for this model. Unfortunately, there is no way of reading this from the camera itself, so my suggestion for the sensor size can't be applied for this.

TL;DR: If we keep redefining the size constants, it should be at least updated to the following:

Suggested change
DEVICES.CAX_DVF1: _get_namedtuple(
# Basler acA1300-75gm (version 106755-24)
'DVFParameters',
_dvfparam_fields,
(16, 0.5, 0.5, 0.100, 2064, 3088, 2.4, 5.0),
(16, 16, 0.5, 0.5, 0.100, 2064, 3088, 2.4, 5.0),
),
DEVICES.CAX_DVF1: _get_namedtuple(
# Basler acA1300-75gm (version 106755-24)
'DVFParameters',
_dvfparam_fields,
(16, 16, 0.5, 0.5, 0.100, 1024, 1280, 4.8, 5.0),
),

Comment on lines 49 to 53
DEVICES.CAX_DVF2: _get_namedtuple(
'DVFParameters',
_dvfparam_fields,
(16, 0.5, 0.5, 0.100, 2064, 3088, 2.4, 5.0),
(16, 16, 0.5, 0.5, 0.100, 2064, 3088, 2.4, 5.0),
),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This camera model is acA3088-16gm (version 107406-12), and its IMAGE_NR_PIXEL_MULTP equals to 4, not 16. (Yeah, that's the original one we used for developing the device, and where the constant 4 came from in cam_roi_calc).

Thus:

Suggested change
DEVICES.CAX_DVF2: _get_namedtuple(
'DVFParameters',
_dvfparam_fields,
(16, 0.5, 0.5, 0.100, 2064, 3088, 2.4, 5.0),
(16, 16, 0.5, 0.5, 0.100, 2064, 3088, 2.4, 5.0),
),
DEVICES.CAX_DVF2: _get_namedtuple(
'DVFParameters',
_dvfparam_fields,
(16, 4, 0.5, 0.5, 0.100, 2064, 3088, 2.4, 5.0),
),


def cmd_reset(self, timeout=None):
"""Reset DVF to a standard configuration."""
# TODO: is reseting BASLER roi necessary?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to ensure it will always be in a valid state, I think so. Otherwise, the client of the DVF class will need to know the image might be cut to an arbitrary and possibly irrelevant portion of the sensor.

Why do you think it might not be needed?

Comment on lines 408 to +412
'cam1:PixelFormat': 1, # Mono12
# ROI1 takes images from camera driver
'ROI1:NDArrayPort': self['cam1:PortName_RBV'],
# TODO: check if these properties are necessary to be set on reset
# 'cam1:DataType': 1, # UInt16 (maybe unnecessary)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we set cam1:PixelFormat to Mono12, the IOC will automatically update the cam1:DataType to UInt16.

# TODO: check if these properties are necessary to be set on reset
# 'cam1:DataType': 1, # UInt16 (maybe unnecessary)
# 'cam1:NumImages': 1, # number of sequential acquired images
# 'cam1:ExposureMode': 0, # TIMED

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems our cameras (both models relevant here) don't support any ExposureMode other than "timed". So this one in fact isn't currently needed.

'ROI1:NDArrayPort': self['cam1:PortName_RBV'],
# TODO: check if these properties are necessary to be set on reset
# 'cam1:DataType': 1, # UInt16 (maybe unnecessary)
# 'cam1:NumImages': 1, # number of sequential acquired images

@henriquesimoes henriquesimoes Jun 11, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we use ImageMode as Continuous, this PV is irrelevant. Is there any scenario which we use other acquisition mode?

# 'cam1:DataType': 1, # UInt16 (maybe unnecessary)
# 'cam1:NumImages': 1, # number of sequential acquired images
# 'cam1:ExposureMode': 0, # TIMED
# 'cam1:TriggerMode': 0, # Off

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we ever change the TriggerMode, it seems relevant to ensure this is off. Otherwise, the camera won't acquire because no external trigger will come, right?

I've never configured these cameras to use external trigger, but it seems that's one of the many parameters required to use that mode of operation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants