Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
quentincoche committed Dec 17, 2020
1 parent 64a7b6d commit d14a8f1
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 77 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"python.pythonPath": "C:\\Users\\corma\\AppData\\Local\\Programs\\Python\\Python38\\python.exe"
"python.pythonPath": "C:\\Users\\-quentin-\\AppData\\Local\\Programs\\Python\\Python38\\python.exe"
}
109 changes: 81 additions & 28 deletions NodeMap.pfs
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
# {05D8C294-F295-4dfb-9D01-096BD04049F4}
# GenApi persistence file (version 3.1.0)
# Device = Basler::UsbCameraParams -- Basler USB3Vision camera interface -- Device version = 1.0.0 -- Product GUID = 5a809e15-f447-480f-a21f-0fb7256b8400 -- Product version GUID = 9DCB6314-D2AB-49B1-99A6-1F4B68016E03
# Device = Basler::UsbCameraParams -- Basler USB3Vision camera interface -- Device version = 1.0.0 -- Product GUID = 5a809e15-f447-480f-a21f-0fb7256b8400 -- Product version GUID = B0C5F330-6DB8-4BB7-8CDD-82B5AEB2F8D6
ExposureAuto Off
BalanceWhiteAuto Off
GainAuto Off
Width 5472
Height 3648
OffsetX 12
OffsetY 12
Width 1920
Height 1200
OffsetX 8
OffsetY 8
CenterX 0
CenterY 0
BinningHorizontalMode Sum
BinningHorizontal 1
BinningVerticalMode Sum
BinningVertical 1
ReverseX 0
ReverseY 0
PixelFormat Mono12
PixelFormat Mono8
TestImageSelector Off
GainSelector All
Gain -0.00000
Gain 0.00000
GainSelector All
BlackLevelSelector All
BlackLevel 0.00000
Expand All @@ -28,10 +25,64 @@ DigitalShift 0
RemoveParameterLimitSelector Gain
RemoveParameterLimit 0
RemoveParameterLimitSelector Gain
PgiMode Off
ShutterMode Rolling
LightSourcePreset Daylight5000K
BalanceRatioSelector Red
BalanceRatio 1.73950
BalanceRatioSelector Green
BalanceRatio 1.00000
BalanceRatioSelector Blue
BalanceRatio 1.96069
BalanceRatioSelector Red
ColorAdjustmentSelector Red
ColorAdjustmentHue -0.09375
ColorAdjustmentSelector Yellow
ColorAdjustmentHue 0.06250
ColorAdjustmentSelector Green
ColorAdjustmentHue 0.09375
ColorAdjustmentSelector Cyan
ColorAdjustmentHue 0.25000
ColorAdjustmentSelector Blue
ColorAdjustmentHue -0.06250
ColorAdjustmentSelector Magenta
ColorAdjustmentHue 0.56250
ColorAdjustmentSelector Red
ColorAdjustmentSelector Red
ColorAdjustmentSaturation 1.01563
ColorAdjustmentSelector Yellow
ColorAdjustmentSaturation 0.95313
ColorAdjustmentSelector Green
ColorAdjustmentSaturation 1.12500
ColorAdjustmentSelector Cyan
ColorAdjustmentSaturation 1.01563
ColorAdjustmentSelector Blue
ColorAdjustmentSaturation 1.00000
ColorAdjustmentSelector Magenta
ColorAdjustmentSaturation 0.96875
ColorAdjustmentSelector Red
ColorTransformationSelector RGBtoRGB
ColorTransformationValueSelector Gain00
ColorTransformationValue 1.62500
ColorTransformationValueSelector Gain01
ColorTransformationValue -0.46875
ColorTransformationValueSelector Gain02
ColorTransformationValue -0.15625
ColorTransformationValueSelector Gain10
ColorTransformationValue -0.40625
ColorTransformationValueSelector Gain11
ColorTransformationValue 2.06250
ColorTransformationValueSelector Gain12
ColorTransformationValue -0.65625
ColorTransformationValueSelector Gain20
ColorTransformationValue 0.12500
ColorTransformationValueSelector Gain21
ColorTransformationValue -0.84375
ColorTransformationValueSelector Gain22
ColorTransformationValue 1.71875
ColorTransformationSelector RGBtoRGB
ColorTransformationValueSelector Gain00
ShutterMode Global
ExposureMode Timed
ExposureTime 64000.0
ExposureTime 3000.0
AcquisitionBurstFrameCount 1
TriggerSelector FrameBurstStart
TriggerMode Off
Expand All @@ -50,7 +101,7 @@ TriggerActivation RisingEdge
TriggerSelector FrameStart
TriggerDelay 0
AcquisitionFrameRateEnable 0
AcquisitionFrameRate 28.99980
AcquisitionFrameRate 100.00000
DeviceLinkSelector 0
DeviceLinkThroughputLimitMode On
DeviceLinkSelector 0
Expand All @@ -73,31 +124,31 @@ ChunkSelector PayloadCRC16
ChunkEnable 0
ChunkSelector Timestamp
ChunkModeActive 0
AutoTargetBrightness 0.50012
AutoTargetBrightness 0.50196
AutoFunctionProfile MinimizeGain
AutoGainLowerLimit -0.00000
AutoGainUpperLimit 27.04577
AutoExposureTimeLowerLimit 50.0
AutoExposureTimeUpperLimit 100000.0
AutoGainLowerLimit 0.00000
AutoGainUpperLimit 23.90000
AutoExposureTimeLowerLimit 80.0
AutoExposureTimeUpperLimit 500000.0
AutoFunctionROISelector ROI1
AutoFunctionROIWidth 5472
AutoFunctionROIWidth 1920
AutoFunctionROISelector ROI2
AutoFunctionROIWidth 5472
AutoFunctionROIWidth 1920
AutoFunctionROISelector ROI1
AutoFunctionROISelector ROI1
AutoFunctionROIHeight 3648
AutoFunctionROIHeight 1200
AutoFunctionROISelector ROI2
AutoFunctionROIHeight 3648
AutoFunctionROIHeight 1200
AutoFunctionROISelector ROI1
AutoFunctionROISelector ROI1
AutoFunctionROIOffsetX 12
AutoFunctionROIOffsetX 8
AutoFunctionROISelector ROI2
AutoFunctionROIOffsetX 12
AutoFunctionROIOffsetX 8
AutoFunctionROISelector ROI1
AutoFunctionROISelector ROI1
AutoFunctionROIOffsetY 12
AutoFunctionROIOffsetY 8
AutoFunctionROISelector ROI2
AutoFunctionROIOffsetY 12
AutoFunctionROIOffsetY 8
AutoFunctionROISelector ROI1
AutoFunctionROISelector ROI1
AutoFunctionROIUseBrightness 1
Expand Down Expand Up @@ -168,6 +219,8 @@ CounterResetSource Counter2End
CounterSelector Counter1
EventSelector ExposureEnd
EventNotification Off
EventSelector FrameStart
EventNotification Off
EventSelector FrameBurstStart
EventNotification Off
EventSelector FrameStartOvertrigger
Expand Down
96 changes: 48 additions & 48 deletions Tests/Test GUI/Quentin/QUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -808,54 +808,54 @@ def plot(self):
return self.fig_XY

def abc_fit(z, d, lambda0):
"""
Return beam parameters for beam diameter measurements.
Follows ISO 11146-1 section 9 and uses the standard `polyfit` routine
in `numpy` to find the coefficients `a`, `b`, and `c`.
d(z)**2 = a + b*z + c*z**2
These coefficients are used to determine the beam parameters using
equations 25-29 from ISO 11146-1.
Unfortunately, standard error propagation fails to accurately determine
the standard deviations of these parameters. Therefore the error calculation
lines are commented out and only the beam parameters are returned.
Args:
z: axial position of beam measurement [m]
d: beam diameter [m]
Returns:
d0: beam waist diameter [m]
z0: axial location of beam waist [m]
M2: beam propagation parameter [-]
Theta: full beam divergence angle [radians]
zR: Rayleigh distance [m]
"""
nlfit, _nlpcov = np.polyfit(z, d**2, 2, cov=True)

# unpack fitting parameters
c, b, a = nlfit


z0 = -b/(2*c)
Theta = np.sqrt(c)
disc = np.sqrt(4*a*c-b*b)/2
M2 = np.pi/4/lambda0*disc
d0 = disc / np.sqrt(c)
zR = disc/c
params = [d0, z0, Theta, M2, zR]

# unpack uncertainties in fitting parameters from diagonal of covariance matrix
#c_std, b_std, a_std = [np.sqrt(_nlpcov[j, j]) for j in range(nlfit.size)]
#z0_std = z0*np.sqrt(b_std**2/b**2 + c_std**2/c**2)
#d0_std = np.sqrt((4*c**2*a_std)**2 + (2*b*c*b_std)**2 + (b**2*c_std)**2) / (8*c**2*d0)
#Theta_std = c_std/2/np.sqrt(c)
#zR_std = np.sqrt(4*c**4*a_std**2 + b**2*c**2*b_std**2 + (b**2-2*a*c)**2*c_std**2)/(4*c**3) / zR
#M2_std = np.pi**2 * np.sqrt(4*c**2*a_std**2 + b**2*b_std**2 + 4*a**2*c_std**2)/(64*lambda0**2) / M2
#errors = [d0_std, z0_std, M2_std, Theta_std, zR_std]
return params

# Return beam parameters for beam diameter measurements.

# Follows ISO 11146-1 section 9 and uses the standard `polyfit` routine
# in `numpy` to find the coefficients `a`, `b`, and `c`.

# d(z)**2 = a + b*z + c*z**2

# These coefficients are used to determine the beam parameters using
# equations 25-29 from ISO 11146-1.

# Unfortunately, standard error propagation fails to accurately determine
# the standard deviations of these parameters. Therefore the error calculation
# lines are commented out and only the beam parameters are returned.

# Args:
# z: axial position of beam measurement [m]
# d: beam diameter [m]
# Returns:
# d0: beam waist diameter [m]
# z0: axial location of beam waist [m]
# M2: beam propagation parameter [-]
# Theta: full beam divergence angle [radians]
# zR: Rayleigh distance [m]

nlfit, _nlpcov = np.polyfit(z, d**2, 2, cov=True)

# unpack fitting parameters
c, b, a = nlfit


z0 = -b/(2*c)
Theta = np.sqrt(c)
disc = np.sqrt(4*a*c-b*b)/2
M2 = np.pi/4/lambda0*disc
d0 = disc / np.sqrt(c)
zR = disc/c
params = [d0, z0, Theta, M2, zR]

# unpack uncertainties in fitting parameters from diagonal of covariance matrix
#c_std, b_std, a_std = [np.sqrt(_nlpcov[j, j]) for j in range(nlfit.size)]
#z0_std = z0*np.sqrt(b_std**2/b**2 + c_std**2/c**2)
#d0_std = np.sqrt((4*c**2*a_std)**2 + (2*b*c*b_std)**2 + (b**2*c_std)**2) / (8*c**2*d0)
#Theta_std = c_std/2/np.sqrt(c)
#zR_std = np.sqrt(4*c**4*a_std**2 + b**2*c**2*b_std**2 + (b**2-2*a*c)**2*c_std**2)/(4*c**3) / zR
#M2_std = np.pi**2 * np.sqrt(4*c**2*a_std**2 + b**2*b_std**2 + 4*a**2*c_std**2)/(64*lambda0**2) / M2
#errors = [d0_std, z0_std, M2_std, Theta_std, zR_std]
return params

def capture(self):
""" Fonction permettant de capturer une image et de l'enregistrer avec l'horodatage """
Expand Down

0 comments on commit d14a8f1

Please sign in to comment.