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
b23e6990
Commit
b23e6990
authored
8 months ago
by
Robert Butora
Browse files
Options
Downloads
Patches
Plain Diff
vlkb-obscore: sets obscore::em_ values as WAVE/LSRK/m
parent
4dc89b88
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
+24
-9
24 additions, 9 deletions
...engine/src/vlkb-obscore/src/database/SqlSchema_INSERT.cpp
with
24 additions
and
9 deletions
data-access/engine/src/vlkb-obscore/src/database/SqlSchema_INSERT.cpp
+
24
−
9
View file @
b23e6990
#include
"SqlSchema_INSERT.hpp"
#include
"SqlSchema_INSERT.hpp"
#include
<iomanip>
#include
<sstream>
// to_string(int precision, double value)
#include
<string>
#include
<string>
#include
<stdexcept>
#include
<stdexcept>
#include
<math.h>
// fabs needed
#include
<math.h>
// fabs needed
...
@@ -23,6 +25,14 @@ using namespace std;
...
@@ -23,6 +25,14 @@ using namespace std;
// utils
// utils
//----------------------------------------------------------------
//----------------------------------------------------------------
string
to_string
(
int
precision
,
double
value
)
{
stringstream
stream
;
stream
<<
fixed
<<
setprecision
(
precision
)
<<
value
;
return
stream
.
str
();
}
string
authPolicyToSQLEnum
(
string
csvPolicy
)
string
authPolicyToSQLEnum
(
string
csvPolicy
)
{
{
if
((
csvPolicy
.
compare
(
"FREE"
)
==
0
)
||
if
((
csvPolicy
.
compare
(
"FREE"
)
==
0
)
||
...
@@ -147,7 +157,8 @@ string asSqlString(fitsfiles::key_values_by_type key_values, string key)
...
@@ -147,7 +157,8 @@ string asSqlString(fitsfiles::key_values_by_type key_values, string key)
}
}
}
}
string
get_wavelen
(
fitsfiles
::
key_values_by_type
key_values
)
string
get_wavelen
(
int
precision
,
fitsfiles
::
key_values_by_type
key_values
)
{
{
const
double
UNIT_CONVERT
=
0.001
;
// FIXME header-card unit [mm] but ObsCore em_ is [m]
const
double
UNIT_CONVERT
=
0.001
;
// FIXME header-card unit [mm] but ObsCore em_ is [m]
if
(
key_values
.
doubleValues
.
find
(
"WAVELEN"
)
==
key_values
.
doubleValues
.
end
()
)
if
(
key_values
.
doubleValues
.
find
(
"WAVELEN"
)
==
key_values
.
doubleValues
.
end
()
)
...
@@ -160,17 +171,17 @@ string get_wavelen(fitsfiles::key_values_by_type key_values)
...
@@ -160,17 +171,17 @@ string get_wavelen(fitsfiles::key_values_by_type key_values)
}
}
else
else
{
{
return
to_string
(
UNIT_CONVERT
*
key_values
.
doubleValues
[
"WAVELNTH"
]);
return
to_string
(
precision
,
UNIT_CONVERT
*
key_values
.
doubleValues
[
"WAVELNTH"
]);
}
}
}
}
else
else
{
{
return
to_string
(
UNIT_CONVERT
*
key_values
.
doubleValues
[
"WAVELENG"
]);
return
to_string
(
precision
,
UNIT_CONVERT
*
key_values
.
doubleValues
[
"WAVELENG"
]);
}
}
}
}
else
else
{
{
return
to_string
(
UNIT_CONVERT
*
key_values
.
doubleValues
[
"WAVELEN"
]);
return
to_string
(
precision
,
UNIT_CONVERT
*
key_values
.
doubleValues
[
"WAVELEN"
]);
}
}
}
}
...
@@ -202,9 +213,11 @@ void SqlSchema_INSERT::appendRow(/*const int hid, const int sid,*/
...
@@ -202,9 +213,11 @@ void SqlSchema_INSERT::appendRow(/*const int hid, const int sid,*/
struct Vertices icrsVerts = legacy::calcVertices(hdu.m_header, "ICRS");
struct Vertices icrsVerts = legacy::calcVertices(hdu.m_header, "ICRS");
#else
#else
const
string
VELOLSRK
{
"System=VELO,StdOfRest=LSRK,Unit=km/s"
};
const
string
VELOLSRK
{
"System=VELO,StdOfRest=LSRK,Unit=km/s"
};
const
string
WAVELSRK
{
"System=WAVE,StdOfRest=LSRK,Unit=m"
};
// FIXME StdOfRest <--- SPECSYS
vector
<
struct
Bounds
>
galBounds
=
calc_bounds
(
hdu
.
m_header
,
"GALACTIC"
,
VELOLSRK
);
vector
<
struct
Bounds
>
galBounds
=
calc_bounds
(
hdu
.
m_header
,
"GALACTIC"
,
VELOLSRK
);
vector
<
struct
Bounds
>
icrsBounds
=
calc_bounds
(
hdu
.
m_header
,
"ICRS"
,
VE
LO
LSRK
);
vector
<
struct
Bounds
>
icrsBounds
=
calc_bounds
(
hdu
.
m_header
,
"ICRS"
,
WA
VELSRK
);
vector
<
point2d
>
galVerts
=
calc_skyvertices
(
hdu
.
m_header
,
"GALACTIC"
);
vector
<
point2d
>
galVerts
=
calc_skyvertices
(
hdu
.
m_header
,
"GALACTIC"
);
vector
<
point2d
>
icrsVerts
=
calc_skyvertices
(
hdu
.
m_header
,
"ICRS"
);
vector
<
point2d
>
icrsVerts
=
calc_skyvertices
(
hdu
.
m_header
,
"ICRS"
);
...
@@ -347,14 +360,16 @@ void SqlSchema_INSERT::appendRow(/*const int hid, const int sid,*/
...
@@ -347,14 +360,16 @@ void SqlSchema_INSERT::appendRow(/*const int hid, const int sid,*/
// obscore - spectral axis
// obscore - spectral axis
const
int
EM_PRECISION
{
10
};
// nanometers
if
(
icrsBounds
.
size
()
>=
3
)
// 3D cubes
if
(
icrsBounds
.
size
()
>=
3
)
// 3D cubes
{
{
//obscoreRow[em_min] = to_string(galBounds[2].low);
//obscoreRow[em_min] = to_string(galBounds[2].low);
//obscoreRow[em_max] = to_string(galBounds[2].up);
//obscoreRow[em_max] = to_string(galBounds[2].up);
obscoreRow
[
em_min
]
=
to_string
(
icrsBounds
[
2
].
low
);
// FIXME must be Wave-length in [m]
obscoreRow
[
em_min
]
=
to_string
(
EM_PRECISION
,
icrsBounds
[
2
].
low
);
obscoreRow
[
em_max
]
=
to_string
(
icrsBounds
[
2
].
up
);
// FIXME must be Wave-length in [m]
obscoreRow
[
em_max
]
=
to_string
(
EM_PRECISION
,
icrsBounds
[
2
].
up
);
obscoreRow
[
em_res_power
]
=
asSqlString
(
hdu
.
key_values
,
"CDELT3"
);
obscoreRow
[
em_res_power
]
=
"NULL"
;
//
asSqlString(hdu.key_values, "CDELT3");
obscoreRow
[
em_xel
]
=
asSqlString
(
hdu
.
key_values
,
"NAXIS3"
);
obscoreRow
[
em_xel
]
=
asSqlString
(
hdu
.
key_values
,
"NAXIS3"
);
}
}
else
if
(
icrsBounds
.
size
()
==
2
)
// 2D images
else
if
(
icrsBounds
.
size
()
==
2
)
// 2D images
...
@@ -362,7 +377,7 @@ void SqlSchema_INSERT::appendRow(/*const int hid, const int sid,*/
...
@@ -362,7 +377,7 @@ void SqlSchema_INSERT::appendRow(/*const int hid, const int sid,*/
//if(!strcmp(survey.survSpecies.c_str(), "Continuum"))
//if(!strcmp(survey.survSpecies.c_str(), "Continuum"))
// dem_min = dem_max = 0.0; // FIXME transtod(psurv->transition);
// dem_min = dem_max = 0.0; // FIXME transtod(psurv->transition);
obscoreRow
[
em_min
]
=
get_wavelen
(
hdu
.
key_values
);
obscoreRow
[
em_min
]
=
get_wavelen
(
EM_PRECISION
,
hdu
.
key_values
);
obscoreRow
[
em_max
]
=
obscoreRow
[
em_min
];
obscoreRow
[
em_max
]
=
obscoreRow
[
em_min
];
obscoreRow
[
em_res_power
]
=
"NULL"
;
obscoreRow
[
em_res_power
]
=
"NULL"
;
obscoreRow
[
em_xel
]
=
"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