Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ADEX-backend-fastapi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
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
ASTRON SDC
ADEX-backend-fastapi
Commits
9084e69a
Commit
9084e69a
authored
2 years ago
by
Nico Vermaas
Browse files
Options
Downloads
Patches
Plain Diff
fan-out alta conversion algorithm
parent
be2930cb
No related branches found
No related tags found
1 merge request
!3
fan-out alta conversion algorithm
Pipeline
#35434
passed
2 years ago
Stage: build
Changes
1
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
dev_scripts/convert_alta_to_adex_cache.py
+31
-23
31 additions, 23 deletions
dev_scripts/convert_alta_to_adex_cache.py
with
31 additions
and
23 deletions
dev_scripts/convert_alta_to_adex_cache.py
+
31
−
23
View file @
9084e69a
...
@@ -41,6 +41,35 @@ def calc_beam(name):
...
@@ -41,6 +41,35 @@ def calc_beam(name):
return
0
return
0
# conversion algorithm to extract a bit more metadata from an ALTA record
def
convert_dataproduct
(
row
):
name
,
pid
,
access_url
,
ra
,
dec
,
dt
,
dst
,
observation
=
row
if
dt
in
[
'
inspectionPlot
'
]:
return
None
if
dst
in
[
'
calibrationTable
'
]:
return
None
# determine collection
collection
=
'
apertif-imaging
'
if
dt
==
'
timeSeries
'
:
collection
=
'
apertif-timeseries
'
level
=
0
if
dst
==
'
uncalibratedVisibility
'
:
level
=
0
if
dst
==
'
calibratedVisibility
'
:
level
=
1
if
dst
in
[
'
continuumMF
'
,
'
continuumChunk
'
,
'
imageCube
'
,
'
beamCube
'
,
'
polarisationImage
'
,
'
polarisationCube
'
,
'
continuumCube
'
]:
level
=
2
beam
=
calc_beam
(
name
)
record_to_insert
=
(
name
,
observation
,
beam
,
ra
,
dec
,
collection
,
level
,
dt
,
dst
,
access_url
)
return
record_to_insert
def
do_convert
(
source
,
target
):
def
do_convert
(
source
,
target
):
try
:
try
:
...
@@ -82,31 +111,10 @@ def do_convert(source, target):
...
@@ -82,31 +111,10 @@ def do_convert(source, target):
insert_count
=
0
insert_count
=
0
for
row
in
rows
:
for
row
in
rows
:
name
,
pid
,
access_url
,
ra
,
dec
,
dt
,
dst
,
observation
=
row
name
,
pid
,
access_url
,
ra
,
dec
,
dt
,
dst
,
observation
=
row
record_to_insert
=
convert_dataproduct
(
row
)
# TODO: move this algorithm to a sane place, finish it and have scientists review it.
if
not
record_to_insert
:
# determine which dataproducts to skip
insert_this_record
=
True
if
dt
in
[
'
inspectionPlot
'
]:
continue
if
dst
in
[
'
calibrationTable
'
]:
continue
continue
# determine collection
collection
=
'
apertif-imaging
'
if
dt
==
'
timeSeries
'
:
collection
=
'
apertif-timeseries
'
level
=
0
if
dst
==
'
calibratedVisibility
'
:
level
=
1
if
'
cube
'
in
dt
:
level
=
2
# todo: calculate beam
beam
=
calc_beam
(
name
)
record_to_insert
=
(
name
,
pid
,
observation
,
beam
,
ra
,
dec
,
collection
,
level
,
dt
,
dst
,
access_url
)
target_cursor
.
execute
(
sql_scripts
.
insert_into_skyviews
,
record_to_insert
)
target_cursor
.
execute
(
sql_scripts
.
insert_into_skyviews
,
record_to_insert
)
target_connection
.
commit
()
target_connection
.
commit
()
insert_count
=
insert_count
+
1
insert_count
=
insert_count
+
1
...
...
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