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
b9a32b13
Commit
b9a32b13
authored
Oct 08, 2023
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved DID_INS_* interpolation by local correction of ts_master to GPS
time using near 1pps sample
parent
2b8ae048
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
702 additions
and
291 deletions
+702
-291
Eyesis_Correction.java
.../java/com/elphel/imagej/correction/Eyesis_Correction.java
+7
-1
Did_ins.java
src/main/java/com/elphel/imagej/ims/Did_ins.java
+8
-0
Did_strobe_in_time.java
src/main/java/com/elphel/imagej/ims/Did_strobe_in_time.java
+24
-0
EventLogger.java
src/main/java/com/elphel/imagej/ims/EventLogger.java
+64
-44
EventLoggerFileInfo.java
src/main/java/com/elphel/imagej/ims/EventLoggerFileInfo.java
+596
-243
QuadCLTCPU.java
...main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
+3
-3
No files found.
src/main/java/com/elphel/imagej/correction/Eyesis_Correction.java
View file @
b9a32b13
...
...
@@ -5525,14 +5525,20 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
EYESIS_CORRECTIONS
.
setDebug
(
DEBUG_LEVEL
);
CLT_PARAMETERS
.
batch_run
=
true
;
String
imx_logs
=
CORRECTION_PARAMETERS
.
getImsSourceDirectory
();
// sourceImsDirectory;
String
debug_path
=
null
;
// CORRECTION_PARAMETERS.getImsPrintDirectory()+Prefs.getFileSeparator()+"debug_local_master";
if
(
EVENT_LOGGER
==
null
)
{
if
((
imx_logs
!=
null
)
&&
!
imx_logs
.
equals
(
""
))
{
EVENT_LOGGER
=
new
EventLogger
(
imx_logs
);
EVENT_LOGGER
=
new
EventLogger
(
imx_logs
,
debug_path
);
}
else
{
System
.
out
.
println
(
"sourceImsDirectory is not set. Use Setup CLT Batch parameters to define it."
);
}
}
if
(
EVENT_LOGGER
!=
null
)
{
//print2Pps
EVENT_LOGGER
.
print2Pps
(
CORRECTION_PARAMETERS
.
getImsPrintDirectory
()+
Prefs
.
getFileSeparator
()+
"rec_1pps"
);
EVENT_LOGGER
.
printStrobeInTime
(
CORRECTION_PARAMETERS
.
getImsPrintDirectory
()+
Prefs
.
getFileSeparator
()+
"did_strobe_in_time"
);
EVENT_LOGGER
.
printPimu
(
CORRECTION_PARAMETERS
.
getImsPrintDirectory
()+
Prefs
.
getFileSeparator
()+
"did_pimu"
);
EVENT_LOGGER
.
printGps
(
CORRECTION_PARAMETERS
.
getImsPrintDirectory
()+
Prefs
.
getFileSeparator
()+
"did_gps"
,
7
);
EVENT_LOGGER
.
printDidIns1
(
CORRECTION_PARAMETERS
.
getImsPrintDirectory
()+
Prefs
.
getFileSeparator
()+
"did_ins1"
);
...
...
src/main/java/com/elphel/imagej/ims/Did_ins.java
View file @
b9a32b13
...
...
@@ -28,6 +28,14 @@ public abstract class Did_ins <T extends Did_ins <T>>{
return
frac
*
v_next
+
(
1.0
-
frac
)
*
v_this
;
}
public
double
getDoubleTime
()
{
return
((
double
)
week
)
*
WEEK_SECONDS
+
timeOfWeek
;
}
public
int
[]
getWeekTimeMs
()
{
// for compatibility with DID_STROBE_IN_TIME
return
new
int
[]
{
week
,
(
int
)
Math
.
round
(
timeOfWeek
*
1000.0
)};
}
//https://www.swtestacademy.com/return-subclass-instance-java-generics/
public
void
interpolateBase
(
double
frac
,
T
next_did
,
T
new_did
)
{
new_did
.
week
=
this
.
week
;
...
...
src/main/java/com/elphel/imagej/ims/Did_strobe_in_time.java
View file @
b9a32b13
...
...
@@ -2,6 +2,9 @@ package com.elphel.imagej.ims;
import
java.nio.ByteBuffer
;
import
java.nio.ByteOrder
;
import
java.util.Properties
;
import
com.elphel.imagej.tileprocessor.IntersceneMatchParameters
;
/* (DID_STROBE_IN_TIME) Timestamp for input strobe.
typedef struct PACKED
...
...
@@ -121,4 +124,25 @@ public class Did_strobe_in_time {
s
+=
String
.
format
(
"count: %d\n"
,
count
);
return
s
;
}
public
void
getProperties
(
String
prefix
,
Properties
properties
)
{
if
(
properties
.
getProperty
(
prefix
+
"week"
)!=
null
)
this
.
week
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"week"
));
if
(
properties
.
getProperty
(
prefix
+
"timeOfWeekMs"
)!=
null
)
this
.
timeOfWeekMs
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"week"
));
if
(
properties
.
getProperty
(
prefix
+
"pin"
)!=
null
)
this
.
pin
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"pin"
));
if
(
properties
.
getProperty
(
prefix
+
"count"
)!=
null
)
this
.
count
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"count"
));
}
public
Properties
setProperties
(
String
prefix
,
Properties
properties
){
// save // USED in lwir
if
(
properties
==
null
)
{
properties
=
new
Properties
();
}
properties
.
setProperty
(
prefix
+
"week"
,
this
.
week
+
""
);
properties
.
setProperty
(
prefix
+
"timeOfWeekMs"
,
this
.
timeOfWeekMs
+
""
);
properties
.
setProperty
(
prefix
+
"pin"
,
this
.
pin
+
""
);
properties
.
setProperty
(
prefix
+
"count"
,
this
.
count
+
""
);
return
properties
;
}
}
\ No newline at end of file
src/main/java/com/elphel/imagej/ims/EventLogger.java
View file @
b9a32b13
...
...
@@ -14,8 +14,7 @@ import ij.Prefs;
public
class
EventLogger
{
public
EventLoggerFileInfo
[]
logger_files
;
public
EventLogger
(
String
dir
)
{
// dir should contain only event logger files
public
EventLogger
(
String
dir
,
String
debug_prefix
)
{
// dir should contain only event logger files
if
(!
dir
.
endsWith
(
Prefs
.
getFileSeparator
()))
{
dir
+=
Prefs
.
getFileSeparator
();
}
...
...
@@ -26,8 +25,9 @@ public class EventLogger {
.
collect
(
Collectors
.
toSet
()));
logger_files
=
new
EventLoggerFileInfo
[
files
.
size
()];
for
(
int
nf
=
0
;
nf
<
logger_files
.
length
;
nf
++)
{
// may use threads (per file)
String
debug_path
=
(
debug_prefix
!=
null
)
?
(
debug_prefix
+
nf
+
".csv"
)
:
null
;
try
{
logger_files
[
nf
]
=
new
EventLoggerFileInfo
(
dir
+
files
.
get
(
nf
),
false
);
logger_files
[
nf
]
=
new
EventLoggerFileInfo
(
dir
+
files
.
get
(
nf
),
false
,
debug_path
);
}
catch
(
IOException
e
)
{
logger_files
[
nf
]
=
null
;
e
.
printStackTrace
();
...
...
@@ -38,43 +38,6 @@ public class EventLogger {
// testInterpolateDidIns1();
// testInterpolateDidIns1();
// testInterpolateDidIns1();
/*
// String out_did_gps_path = "/home/elphel/lwir16-proc/office_04/did_gps";
String out_did_gps_path = dir+"../did_gps/did_gps";
out_did_gps_path = Paths.get(out_did_gps_path).normalize().toString();
Path op_did_gps = Paths.get(out_did_gps_path);
op_did_gps=op_did_gps.normalize();
(new File(op_did_gps.getParent().toString())).mkdirs();
int gps_mask = 7; // +1 - DID_GPS1_POS, +2 - DID_GPS2_POS, +4 - DID_GPS1_UBX_POS
for (int nf = 0; nf < logger_files.length; nf++) {
String out_path= out_did_gps_path+"-"+String.format("%03d", nf)+".out";
System.out.println("Printing all DID_GPS data in "+logger_files[nf].abs_path+" to "+out_path);
try {
logger_files[nf].listGPS(out_path, gps_mask, false);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
*/
// String out_did1_path = "/media/elphel/SSD3-4GB/lwir16-proc/berdich/ims/test_out/did_ins1";
/*
String out_did1_path = dir+"../did_ins1/did_ins1";
out_did1_path = Paths.get(out_did1_path).normalize().toString();
Path op_did1 = Paths.get(out_did1_path);
op_did1=op_did1.normalize();
(new File(op_did1.getParent().toString())).mkdirs();
for (int nf = 0; nf < logger_files.length; nf++) {
String out_path= out_did1_path+"-"+String.format("%03d", nf)+".out";
System.out.println("Printing all DID_INS_1 data in "+logger_files[nf].abs_path+" to "+out_path);
try {
logger_files[nf].listDid1(out_path,false);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
*/
System
.
out
.
println
(
"Processed "
+
logger_files
.
length
+
" event log files"
);
}
...
...
@@ -86,7 +49,7 @@ public class EventLogger {
op_did_gps
=
op_did_gps
.
normalize
();
(
new
File
(
op_did_gps
.
getParent
().
toString
())).
mkdirs
();
for
(
int
nf
=
0
;
nf
<
logger_files
.
length
;
nf
++)
{
String
out_path
=
out_did_gps_path
+
"-"
+
String
.
format
(
"%03d"
,
nf
)+
".
out
"
;
String
out_path
=
out_did_gps_path
+
"-"
+
String
.
format
(
"%03d"
,
nf
)+
".
csv
"
;
System
.
out
.
println
(
"Printing all DID_GPS data in "
+
logger_files
[
nf
].
abs_path
+
" to "
+
out_path
);
try
{
logger_files
[
nf
].
listGPS
(
out_path
,
gps_mask
,
false
);
...
...
@@ -104,7 +67,7 @@ public class EventLogger {
op_did1
=
op_did1
.
normalize
();
(
new
File
(
op_did1
.
getParent
().
toString
())).
mkdirs
();
for
(
int
nf
=
0
;
nf
<
logger_files
.
length
;
nf
++)
{
String
out_path
=
out_did1_path
+
"-"
+
String
.
format
(
"%03d"
,
nf
)+
".
out
"
;
String
out_path
=
out_did1_path
+
"-"
+
String
.
format
(
"%03d"
,
nf
)+
".
csv
"
;
System
.
out
.
println
(
"Printing all DID_INS_1 data in "
+
logger_files
[
nf
].
abs_path
+
" to "
+
out_path
);
try
{
logger_files
[
nf
].
listDidIns1
(
out_path
,
false
);
...
...
@@ -121,7 +84,7 @@ public class EventLogger {
op_did2
=
op_did2
.
normalize
();
(
new
File
(
op_did2
.
getParent
().
toString
())).
mkdirs
();
for
(
int
nf
=
0
;
nf
<
logger_files
.
length
;
nf
++)
{
String
out_path
=
out_did2_path
+
"-"
+
String
.
format
(
"%03d"
,
nf
)+
".
out
"
;
String
out_path
=
out_did2_path
+
"-"
+
String
.
format
(
"%03d"
,
nf
)+
".
csv
"
;
System
.
out
.
println
(
"Printing all DID_INS_2 data in "
+
logger_files
[
nf
].
abs_path
+
" to "
+
out_path
);
try
{
logger_files
[
nf
].
listDidIns2
(
out_path
,
false
);
...
...
@@ -138,7 +101,7 @@ public class EventLogger {
op_pimu
=
op_pimu
.
normalize
();
(
new
File
(
op_pimu
.
getParent
().
toString
())).
mkdirs
();
for
(
int
nf
=
0
;
nf
<
logger_files
.
length
;
nf
++)
{
String
out_path
=
out_pimu_path
+
"-"
+
String
.
format
(
"%03d"
,
nf
)+
".
out
"
;
String
out_path
=
out_pimu_path
+
"-"
+
String
.
format
(
"%03d"
,
nf
)+
".
csv
"
;
System
.
out
.
println
(
"Printing all DID_INS_1 data in "
+
logger_files
[
nf
].
abs_path
+
" to "
+
out_path
);
try
{
logger_files
[
nf
].
listPimu
(
out_path
,
false
);
...
...
@@ -149,6 +112,40 @@ public class EventLogger {
}
}
public
void
printStrobeInTime
(
String
out_sit_path
)
{
out_sit_path
=
Paths
.
get
(
out_sit_path
).
normalize
().
toString
();
Path
op_sit
=
Paths
.
get
(
out_sit_path
);
op_sit
=
op_sit
.
normalize
();
(
new
File
(
op_sit
.
getParent
().
toString
())).
mkdirs
();
for
(
int
nf
=
0
;
nf
<
logger_files
.
length
;
nf
++)
{
String
out_path
=
out_sit_path
+
"-"
+
String
.
format
(
"%03d"
,
nf
)+
".csv"
;
System
.
out
.
println
(
"Printing all DID_STROBE_IN_TIME data in "
+
logger_files
[
nf
].
abs_path
+
" to "
+
out_path
);
try
{
logger_files
[
nf
].
listStrobeInTime
(
out_path
,
false
);
}
catch
(
IOException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
}
}
public
void
print2Pps
(
String
out_1pps_path
)
{
out_1pps_path
=
Paths
.
get
(
out_1pps_path
).
normalize
().
toString
();
Path
op_1pps
=
Paths
.
get
(
out_1pps_path
);
op_1pps
=
op_1pps
.
normalize
();
(
new
File
(
op_1pps
.
getParent
().
toString
())).
mkdirs
();
for
(
int
nf
=
0
;
nf
<
logger_files
.
length
;
nf
++)
{
String
out_path
=
out_1pps_path
+
"-"
+
String
.
format
(
"%03d"
,
nf
)+
".csv"
;
System
.
out
.
println
(
"Printing all DID_STROBE_IN_TIME data in "
+
logger_files
[
nf
].
abs_path
+
" to "
+
out_path
);
try
{
logger_files
[
nf
].
list1Pps
(
out_path
,
false
);
}
catch
(
IOException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
}
}
public
void
testInterpolateDidIns1
()
{
boolean
exit_now
=
false
;
...
...
@@ -353,6 +350,29 @@ public class EventLogger {
}
return
Double
.
NaN
;
}
// if it is DID_INS_1 or DID_INS_2 use TOW for calculating fraction
if
((
did
==
Imx5
.
DID_INS_1
)
||
(
did
==
Imx5
.
DID_INS_2
))
{
double
tow_corr
=
logger_files
[
file_index_below
].
getTimeOfWeekCorrection
(
ts_master
);
int
week0
,
week1
;
double
tow0
,
tow1
;
if
(!
Double
.
isNaN
(
tow_corr
))
{
double
tow
=
logger_files
[
file_index_below
].
getLinearTimeOfWeek
(
ts_master
)
-
tow_corr
;
@SuppressWarnings
(
"rawtypes"
)
Did_ins
did_ins_0
=
(
did
==
Imx5
.
DID_INS_2
)
?
(
new
Did_ins_2
(
ByteBuffer
.
wrap
(
payload
[
0
])))
:
(
new
Did_ins_1
(
ByteBuffer
.
wrap
(
payload
[
0
])));
@SuppressWarnings
(
"rawtypes"
)
Did_ins
did_ins_1
=
(
did
==
Imx5
.
DID_INS_2
)
?
(
new
Did_ins_2
(
ByteBuffer
.
wrap
(
payload
[
1
])))
:
(
new
Did_ins_1
(
ByteBuffer
.
wrap
(
payload
[
1
])));
tow0
=
did_ins_0
.
timeOfWeek
;
tow1
=
did_ins_1
.
timeOfWeek
;
if
(
did_ins_1
.
week
>
did_ins_0
.
week
)
{
tow1
+=
Did_ins
.
WEEK_SECONDS
;
}
frac
=
(
tow
-
tow0
)
/(
tow1
-
tow0
);
}
else
{
System
.
out
.
println
(
"ERROR: getDidAtTS(): tow_corr is NaN, keeping frac="
+
frac
);
}
}
return
frac
;
}
...
...
src/main/java/com/elphel/imagej/ims/EventLoggerFileInfo.java
View file @
b9a32b13
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
View file @
b9a32b13
...
...
@@ -2264,7 +2264,7 @@ public class QuadCLTCPU {
if
(
Eyesis_Correction
.
EVENT_LOGGER
==
null
)
{
System
.
out
.
println
(
"Preparing IMS data as it is needed but does not exist"
);
String
imx_logs
=
correctionsParameters
.
getImsSourceDirectory
();
// sourceImsDirectory;
Eyesis_Correction
.
EVENT_LOGGER
=
new
EventLogger
(
imx_logs
);
Eyesis_Correction
.
EVENT_LOGGER
=
new
EventLogger
(
imx_logs
,
null
);
}
EventLogger
eventLogger
=
Eyesis_Correction
.
EVENT_LOGGER
;
double
ims_timestamp
=
this_ts
+
this
.
ims_offs
+
3600
*
gmt_plus
;
...
...
@@ -2380,14 +2380,14 @@ public class QuadCLTCPU {
null
,
// Properties properties)
true
);
// boolean silent)
// temporary to recalculate if no did_ins_2:
{
if
(
ims_properties
!=
null
){
// may become null, so
Did_ins_2
did_ins_2
=
new
Did_ins_2
(
"did_ins_2-"
,
ims_properties
);
if
((
did_ins_2
.
lla
==
null
)
||
((
did_ins_2
.
lla
[
0
]==
0
)
&&
(
did_ins_2
.
lla
[
1
]==
0
)))
{
ims_properties
=
null
;
System
.
out
.
println
(
"restoreIms(): no did_ins_2 - invalidating and recalculating config"
);
}
}
if
(
ims_properties
==
null
)
{
if
(
ims_properties
==
null
)
{
// may become null above
if
(
create
)
{
saveIms
(
ims_offset
,
gmt_plus
,
ims_path
,
debugLevel
);
ims_properties
=
loadProperties
(
...
...
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