Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review 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
RadioObservatory
LOFAR
Commits
eed9ba20
Commit
eed9ba20
authored
5 years ago
by
Mattia Mancini
Browse files
Options
Downloads
Patches
Plain Diff
SSB-47
: Split function in two to increase readibility
parent
ee25e2f0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!44
Merge back holography to master
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CAL/CalibrationProcessing/bin/preprocess_holography_dataset.py
+26
-19
26 additions, 19 deletions
...alibrationProcessing/bin/preprocess_holography_dataset.py
with
26 additions
and
19 deletions
CAL/CalibrationProcessing/bin/preprocess_holography_dataset.py
+
26
−
19
View file @
eed9ba20
...
...
@@ -5,6 +5,7 @@ import logging
from
lofar.calibration.common.utils
import
*
import
lofar.calibration.processing
as
processing
import
sys
DEFAULT_SLEEP_TIME
=
1
logger
=
logging
.
getLogger
(
'
mshologextract
'
)
...
...
@@ -29,7 +30,7 @@ def parse_command_line_arguments_and_set_verbose_logging(parser):
:return: the parsed arguments
:rtype: argparse.Namespace
"""
arguments
=
parser
.
parse_args
()
arguments
=
parser
.
parse_args
()
if
arguments
.
v
:
logging
.
basicConfig
(
format
=
'
%(asctime)s %(levelname)s %(message)s
'
,
level
=
logging
.
DEBUG
)
...
...
@@ -64,6 +65,20 @@ def specify_command_line_arguments():
return
parser
def
average_by_sample
(
input_path
,
average_samples
):
logger
.
info
(
'
Averaging %s with a sample window of %s
'
,
input_path
,
average_samples
)
output_hds
=
processing
.
average_dataset_by_sample
(
input_path
,
average_samples
)
logger
.
info
(
'
Averaged %s with a sample window of %s
'
,
input_path
,
average_samples
)
return
output_hds
def
average_by_time_interval
(
input_path
,
time_interval
):
logger
.
info
(
'
Averaging %s with a time sample window of %s s
'
,
input_path
,
time_interval
)
output_hds
=
processing
.
average_dataset_by_time
(
input_path
,
time_interval
)
logger
.
info
(
'
Averaged %s with a time sample window of %s
'
,
input_path
,
time_interval
)
return
output_hds
def
preaverage_holography_dataset
(
input_path
,
output_path
,
average_samples
,
time_average_step
):
"""
...
...
@@ -79,26 +94,18 @@ def preaverage_holography_dataset(input_path, output_path, average_samples, time
'
or the time average step in seconds
'
)
raise
ValueError
(
'
Both average_samples and time_average_step have been specified
'
)
if
average_samples
is
None
and
time_average_step
is
None
:
logger
.
error
(
'
Neither average_samples nor time_average_step has been specified
'
)
if
average_samples
is
not
None
:
logger
.
info
(
'
Averaging %s with a time sample window of %s
'
,
input_path
,
average_samples
)
output_hds
=
processing
.
average_dataset_by_sample
(
input_path
,
average_samples
)
logger
.
info
(
'
Averaged %s with a time sample window of %s
'
,
input_path
,
time_average_step
)
logger
.
info
(
'
Storing processed file %s in %s
'
,
input_path
,
output_path
)
output_hds
.
store_to_file
(
output_path
)
logger
.
info
(
'
Stored processed file %s in %s
'
,
input_path
,
output_path
)
output_hds
=
average_by_sample
(
input_path
,
average_samples
)
elif
time_average_step
is
not
None
:
output_hds
=
average_by_time_interval
(
input_path
,
time_average_step
)
else
:
logger
.
error
(
'
Neither average_samples nor time_average_step has been specified
'
)
raise
ValueError
(
'
Neither average_samples nor time_average_step has been specified
'
)
if
time_average_step
is
not
None
:
logger
.
info
(
'
Averaging %s with a time sample window of %s s
'
,
input_path
,
time_average_step
)
output_hds
=
processing
.
average_dataset_by_time
(
input_path
,
time_average_step
)
logger
.
info
(
'
Averaged %s with a time sample window of %s
'
,
input_path
,
time_average_step
)
logger
.
info
(
'
Storing processed file %s in %s
'
,
input_path
,
output_path
)
output_hds
.
store_to_file
(
output_path
)
logger
.
info
(
'
Stored processed file %s in %s
'
,
input_path
,
output_path
)
logger
.
info
(
'
Storing processed file %s in %s
'
,
input_path
,
output_path
)
output_hds
.
store_to_file
(
output_path
)
logger
.
info
(
'
Stored processed file %s in %s
'
,
input_path
,
output_path
)
if
__name__
==
'
__main__
'
:
main
()
\ No newline at end of file
main
()
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