Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
vlkb-soda
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ViaLactea
vlkb-soda
Commits
5e910366
Commit
5e910366
authored
8 months ago
by
Robert Butora
Browse files
Options
Downloads
Patches
Plain Diff
vlkb-obscore: fills in em_ from surveys::trans for 2D images
parent
546c6927
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
data-access/engine/src/vlkb-obscore/src/database/SqlSchema_INSERT.cpp
+57
-3
57 additions, 3 deletions
...engine/src/vlkb-obscore/src/database/SqlSchema_INSERT.cpp
with
57 additions
and
3 deletions
data-access/engine/src/vlkb-obscore/src/database/SqlSchema_INSERT.cpp
+
57
−
3
View file @
5e910366
...
...
@@ -186,6 +186,59 @@ string get_wavelen(int precision, fitsfiles::key_values_by_type key_values)
}
// trim from start (in place)
inline
void
ltrim
(
std
::
string
&
s
)
{
s
.
erase
(
s
.
begin
(),
std
::
find_if
(
s
.
begin
(),
s
.
end
(),
[](
unsigned
char
ch
)
{
return
!
std
::
isspace
(
ch
);
}));
}
// trim from end (in place)
inline
void
rtrim
(
std
::
string
&
s
)
{
s
.
erase
(
std
::
find_if
(
s
.
rbegin
(),
s
.
rend
(),
[](
unsigned
char
ch
)
{
return
!
std
::
isspace
(
ch
);
}).
base
(),
s
.
end
());
}
// trim from both ends (in place)
inline
void
trim
(
std
::
string
&
s
)
{
rtrim
(
s
);
ltrim
(
s
);
}
// returns band in wavelen [m]
double
parse_transition
(
string
trans
)
{
// Surveys::survTransition "num unit" <-- for images
trim
(
trans
);
if
(
!
trans
.
empty
())
{
string
::
size_type
pos
=
trans
.
find
(
' '
);
std
::
string
num
=
trans
.
substr
(
0
,
pos
);
std
::
string
unit
=
trans
.
substr
(
pos
+
1
);
LOG_STREAM
<<
"parse trans: "
<<
num
<<
" "
<<
unit
<<
endl
;
const
double
speed_of_light
=
299792458.0
;
// [m/s] in vacuum
double
value
=
stod
(
num
);
if
(
unit
.
compare
(
"um"
)
==
0
)
return
value
*
1e-6
;
else
if
(
unit
.
compare
(
"mm"
)
==
0
)
return
value
*
1e-3
;
else
if
(
unit
.
compare
(
"m"
)
==
0
)
return
value
;
else
if
(
unit
.
compare
(
"GHz"
)
==
0
)
return
(
speed_of_light
/
(
value
*
1e9
));
else
if
(
unit
.
compare
(
"MHz"
)
==
0
)
return
(
speed_of_light
/
(
value
*
1e6
));
else
if
(
unit
.
compare
(
"kHz"
)
==
0
)
return
(
speed_of_light
/
(
value
*
1e3
));
else
if
(
unit
.
compare
(
"Hz"
)
==
0
)
return
(
speed_of_light
/
(
value
));
else
return
0.0
;
// ignore
}
else
return
0.0
;
}
//----------------------------------------------------------------------
// public API
...
...
@@ -374,10 +427,11 @@ void SqlSchema_INSERT::appendRow(/*const int hid, const int sid,*/
}
else
if
(
icrsBounds
.
size
()
==
2
)
// 2D images
{
//
if(!strcmp(survey.survSpecies.c_str(), "Continuum"))
//
dem_min = dem_max = 0.0; // FIXME transtod(p
surv
->t
ransition
);
//
surv.restFrequency [Hz] <-- is empty for 2D images: take from survTransition ?
//
surv.
surv
T
ransition
"num unit" <-- for images
obscoreRow
[
em_min
]
=
get_wavelen
(
EM_PRECISION
,
hdu
.
key_values
);
double
val
=
parse_transition
(
surv
.
survTransition
);
obscoreRow
[
em_min
]
=
((
val
==
0.0
)
?
"NULL"
:
to_string
(
val
));
//get_wavelen(EM_PRECISION, hdu.key_values);
obscoreRow
[
em_max
]
=
obscoreRow
[
em_min
];
obscoreRow
[
em_res_power
]
=
"NULL"
;
obscoreRow
[
em_xel
]
=
"NULL"
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment