Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
imagej-elphel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
imagej-elphel
Commits
3a766b8e
Commit
3a766b8e
authored
Sep 08, 2014
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fixes
parent
b75d6c0f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
21 deletions
+24
-21
Aberration_Calibration.java
src/main/java/Aberration_Calibration.java
+17
-16
FocusingField.java
src/main/java/FocusingField.java
+7
-5
No files found.
src/main/java/Aberration_Calibration.java
View file @
3a766b8e
...
@@ -5094,8 +5094,9 @@ if (MORE_BUTTONS) {
...
@@ -5094,8 +5094,9 @@ if (MORE_BUTTONS) {
double
[][][]
sampleCoord
=
FOCUS_MEASUREMENT_PARAMETERS
.
sampleCoordinates
(
//{x,y,r}
double
[][][]
sampleCoord
=
FOCUS_MEASUREMENT_PARAMETERS
.
sampleCoordinates
(
//{x,y,r}
pX0
,
// lens center on the sensor
pX0
,
// lens center on the sensor
pY0
);
pY0
);
FocusingField
ff
=
null
;
if
(
useLMA
){
if
(
useLMA
){
FOCUSING_FIELD
=
new
FocusingField
(
ff
=
new
FocusingField
(
FOCUS_MEASUREMENT_PARAMETERS
.
serialNumber
,
FOCUS_MEASUREMENT_PARAMETERS
.
serialNumber
,
FOCUS_MEASUREMENT_PARAMETERS
.
lensSerial
,
// String lensSerial, // if null - do not add average
FOCUS_MEASUREMENT_PARAMETERS
.
lensSerial
,
// String lensSerial, // if null - do not add average
FOCUS_MEASUREMENT_PARAMETERS
.
comment
,
// String comment,
FOCUS_MEASUREMENT_PARAMETERS
.
comment
,
// String comment,
...
@@ -5103,15 +5104,15 @@ if (MORE_BUTTONS) {
...
@@ -5103,15 +5104,15 @@ if (MORE_BUTTONS) {
pY0
,
pY0
,
sampleCoord
,
sampleCoord
,
this
.
SYNC_COMMAND
.
stopRequested
);
this
.
SYNC_COMMAND
.
stopRequested
);
FOCUSING_FIELD
.
setDebugLevel
(
DEBUG_LEVEL
);
ff
.
setDebugLevel
(
DEBUG_LEVEL
);
FOCUSING_FIELD
.
setAdjustMode
(
false
);
ff
.
setAdjustMode
(
false
);
if
(
PROPERTIES
!=
null
)
FOCUSING_FIELD
.
getProperties
(
"FOCUSING_FIELD."
,
PROPERTIES
);
if
(
PROPERTIES
!=
null
)
ff
.
getProperties
(
"FOCUSING_FIELD."
,
PROPERTIES
);
MOTORS
.
addCurrentHistoryToFocusingField
(
MOTORS
.
addCurrentHistoryToFocusingField
(
FOCUSING_FIELD
,
ff
,
(
runs
==
0
)?
0
:(
MOTORS
.
historySize
()-
runs
),
(
runs
==
0
)?
0
:(
MOTORS
.
historySize
()-
runs
),
MOTORS
.
historySize
());
// all newly acquired
MOTORS
.
historySize
());
// all newly acquired
if
(
modeAverage
){
// calculate/show average over the last run - only in "average" mode
if
(
modeAverage
&&
(
FOCUSING_FIELD
!=
null
)
){
// calculate/show average over the last run - only in "average" mode
double
[]
ZTM
=
FOCUSING_FIELD
.
averageZTM
(
noTiltScan
);
// no tilt scan - faster
double
[]
ZTM
=
FOCUSING_FIELD
.
averageZTM
(
noTiltScan
,
ff
);
// no tilt scan - faster
if
(
MASTER_DEBUG_LEVEL
>
0
)
{
if
(
MASTER_DEBUG_LEVEL
>
0
)
{
String
msg
=
"Failed to calulate average focus/tilt"
;
String
msg
=
"Failed to calulate average focus/tilt"
;
if
(
ZTM
!=
null
)
msg
=
"Average:\n"
+
if
(
ZTM
!=
null
)
msg
=
"Average:\n"
+
...
@@ -5159,13 +5160,13 @@ if (MORE_BUTTONS) {
...
@@ -5159,13 +5160,13 @@ if (MORE_BUTTONS) {
FOCUS_MEASUREMENT_PARAMETERS
.
result_lastKT
,
FOCUS_MEASUREMENT_PARAMETERS
.
result_lastKT
,
FOCUS_MEASUREMENT_PARAMETERS
.
result_allHistoryKT
FOCUS_MEASUREMENT_PARAMETERS
.
result_allHistoryKT
);
);
if
(
useLMA
){
if
(
useLMA
&&
(
ff
!=
null
)
){
String
focusingPath
=
dFile
+
Prefs
.
getFileSeparator
()+
lensPrefix
+
CAMERAS
.
getLastTimestampUnderscored
()+
".history-xml"
;
String
focusingPath
=
dFile
+
Prefs
.
getFileSeparator
()+
lensPrefix
+
CAMERAS
.
getLastTimestampUnderscored
()+
".history-xml"
;
System
.
out
.
println
(
"Saving measurement history to "
+
focusingPath
);
System
.
out
.
println
(
"Saving measurement history to "
+
focusingPath
);
FOCUSING_FIELD
.
saveXML
(
focusingPath
);
ff
.
saveXML
(
focusingPath
);
}
}
}
}
// Calculate and showaverage distances and tilts for measured history
// Calculate and show
average distances and tilts for measured history
if
(!
modeAverage
)
{
if
(!
modeAverage
)
{
...
@@ -5196,7 +5197,7 @@ if (MORE_BUTTONS) {
...
@@ -5196,7 +5197,7 @@ if (MORE_BUTTONS) {
}
}
// Now in LMA mode - recalculate and overwrite
// Now in LMA mode - recalculate and overwrite
if
(
useLMA
){
if
(
useLMA
){
FOCUSING_FIELD
=
new
FocusingField
(
ff
=
new
FocusingField
(
FOCUS_MEASUREMENT_PARAMETERS
.
serialNumber
,
FOCUS_MEASUREMENT_PARAMETERS
.
serialNumber
,
FOCUS_MEASUREMENT_PARAMETERS
.
lensSerial
,
// String lensSerial, // if null - do not add average
FOCUS_MEASUREMENT_PARAMETERS
.
lensSerial
,
// String lensSerial, // if null - do not add average
FOCUS_MEASUREMENT_PARAMETERS
.
comment
,
// String comment,
FOCUS_MEASUREMENT_PARAMETERS
.
comment
,
// String comment,
...
@@ -5204,14 +5205,14 @@ if (MORE_BUTTONS) {
...
@@ -5204,14 +5205,14 @@ if (MORE_BUTTONS) {
pY0
,
pY0
,
sampleCoord
,
sampleCoord
,
this
.
SYNC_COMMAND
.
stopRequested
);
this
.
SYNC_COMMAND
.
stopRequested
);
FOCUSING_FIELD
.
setDebugLevel
(
DEBUG_LEVEL
);
ff
.
setDebugLevel
(
DEBUG_LEVEL
);
FOCUSING_FIELD
.
setAdjustMode
(
false
);
ff
.
setAdjustMode
(
false
);
if
(
PROPERTIES
!=
null
)
FOCUSING_FIELD
.
getProperties
(
"FOCUSING_FIELD."
,
PROPERTIES
);
if
(
PROPERTIES
!=
null
)
ff
.
getProperties
(
"FOCUSING_FIELD."
,
PROPERTIES
);
MOTORS
.
addCurrentHistoryToFocusingField
(
FOCUSING_FIELD
);
// all, not just newly acquired
MOTORS
.
addCurrentHistoryToFocusingField
(
ff
);
// all, not just newly acquired
if
(
MASTER_DEBUG_LEVEL
>
0
){
if
(
MASTER_DEBUG_LEVEL
>
0
){
System
.
out
.
println
(
"*** Calculating focal distance shift for each of "
+
MOTORS
.
historySize
()+
" recorded measurments ***"
);
System
.
out
.
println
(
"*** Calculating focal distance shift for each of "
+
MOTORS
.
historySize
()+
" recorded measurments ***"
);
}
}
double
[][]
allZTM
=
FOCUSING_FIELD
.
getAllZTM
(
noTiltScan
);
// no tilt scan (supposed to be adjusted
double
[][]
allZTM
=
FOCUSING_FIELD
.
getAllZTM
(
noTiltScan
,
ff
);
// no tilt scan (supposed to be adjusted
lastKT
=
MOTORS
.
focusingHistory
.
temperatureLinearApproximation
(
lastKT
=
MOTORS
.
focusingHistory
.
temperatureLinearApproximation
(
allZTM
,
allZTM
,
runs
runs
...
...
src/main/java/FocusingField.java
View file @
3a766b8e
...
@@ -4374,18 +4374,20 @@ public boolean LevenbergMarquardt(
...
@@ -4374,18 +4374,20 @@ public boolean LevenbergMarquardt(
//,
//,
public
double
[][]
getAllZTM
(
public
double
[][]
getAllZTM
(
boolean
noTiltScan
){
boolean
noTiltScan
,
double
[][]
result
=
new
double
[
measurements
.
size
()][
6
];
FocusingField
ff
){
for
(
int
i
=
0
;
i
<
result
.
length
;
i
++)
result
[
i
]=
adjustLMA
(
noTiltScan
,
measurements
.
get
(
i
),
false
);
double
[][]
result
=
new
double
[
ff
.
measurements
.
size
()][
6
];
for
(
int
i
=
0
;
i
<
result
.
length
;
i
++)
result
[
i
]=
adjustLMA
(
noTiltScan
,
ff
.
measurements
.
get
(
i
),
false
);
return
result
;
return
result
;
}
}
public
double
[]
averageZTM
(
public
double
[]
averageZTM
(
boolean
noTiltScan
){
boolean
noTiltScan
,
FocusingField
ff
){
double
[]
result
=
new
double
[
6
];
double
[]
result
=
new
double
[
6
];
for
(
int
i
=
0
;
i
<
result
.
length
;
i
++)
result
[
i
]=
0.0
;
for
(
int
i
=
0
;
i
<
result
.
length
;
i
++)
result
[
i
]=
0.0
;
int
num
=
0
;
int
num
=
0
;
for
(
FocusingFieldMeasurement
measurement:
measurements
){
for
(
FocusingFieldMeasurement
measurement:
ff
.
measurements
){
double
[]
ZTM
=
adjustLMA
(
noTiltScan
,
measurement
,
false
);
double
[]
ZTM
=
adjustLMA
(
noTiltScan
,
measurement
,
false
);
if
(
ZTM
!=
null
)
{
if
(
ZTM
!=
null
)
{
for
(
int
i
=
0
;
i
<
result
.
length
;
i
++)
result
[
i
]+=
ZTM
[
i
];
for
(
int
i
=
0
;
i
<
result
.
length
;
i
++)
result
[
i
]+=
ZTM
[
i
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment