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
896cba0d
Commit
896cba0d
authored
6 years ago
by
Thomas Jürges
Browse files
Options
Downloads
Patches
Plain Diff
Task
SSB-42
: Create the temp HDF5 file name before a test is run
parent
82c183e5
No related branches found
No related tags found
1 merge request
!44
Merge back holography to master
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CAL/CalibrationCommon/test/t_holography_dataset_class.py
+23
-17
23 additions, 17 deletions
CAL/CalibrationCommon/test/t_holography_dataset_class.py
with
23 additions
and
17 deletions
CAL/CalibrationCommon/test/t_holography_dataset_class.py
+
23
−
17
View file @
896cba0d
...
...
@@ -12,12 +12,21 @@ path_to_test_data = '/home/thomas/workspace.astron/data/holography'
class
TestHolographyDatasetClass
(
unittest
.
TestCase
):
new_test_data_file
=
None
hdf5_data_file
=
None
holography_dataset_test_two
=
None
def
tearDown
(
self
):
if
self
.
new_test_data_file
is
not
None
:
os
.
unlink
(
self
.
new_test_data_file
)
@classmethod
def
setUpClass
(
cls
):
# Create an empty temporary data file
(
fd
,
cls
.
hdf5_data_file
)
=
tempfile
.
mkstemp
(
suffix
=
"
.hdf5
"
)
os
.
close
(
fd
)
@classmethod
def
tearDownClass
(
cls
):
if
cls
.
hdf5_data_file
is
not
None
:
print
(
"
**** %s
"
%
(
cls
.
hdf5_data_file
))
# os.unlink(cls.hdf5_data_file)
# def test_one(self):
# holist = HolographyObservation.list_observations_in_path(path_to_test_data)
# hbsflist = HolographySpecification.list_bsf_files_in_path(path_to_test_data)
...
...
@@ -36,22 +45,19 @@ class TestHolographyDatasetClass(unittest.TestCase):
for
hbsf
in
hbsflist
:
hbsf
.
read_file
()
ho_per_ms
=
[(
hbsf
,
ho
)
for
hbsf
,
ho
in
zip
(
hbsflist
,
holist
)]
holography_dataset
=
HolographyDataset
()
holography_dataset
.
load_from_beam_specification_and_ms
(
'
CS013HBA0
'
,
ho_per_ms
)
# Create an empty temporary data file
(
fd
,
self
.
new_test_data_file
)
=
tempfile
.
mkstemp
(
suffix
=
"
.hdf5
"
)
print
"
**** %s
"
%
(
self
.
new_test_data_file
)
os
.
close
(
fd
)
self
.
holography_dataset_test_two
=
HolographyDataset
()
self
.
holography_dataset_test_two
.
load_from_beam_specification_and_ms
(
'
CS013HBA0
'
,
ho_per_ms
)
# Now store the MS data in an HDF5 file.
holography_dataset
.
store_to_file
(
self
.
new_test
_data_file
)
self
.
holography_dataset
_test_two
.
store_to_file
(
self
.
hdf5
_data_file
)
# def test_three(self):
# # Read the MS data from an HDF5 file.
# holography_dataset = HolographyDataset.load_from_file(self.new_test_data_file)
# print holography_dataset
def
test_three
(
self
):
# Read the MS data from an HDF5 file.
holography_dataset_test_three
=
HolographyDataset
.
load_from_file
(
self
.
hdf5_data_file
)
print
(
holography_dataset_test_three
)
self
.
assertEqual
(
holography_dataset_test_three
,
self
.
holography_dataset_test_two
)
if
__name__
==
'
__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