Skip to content

Commit

Permalink
Fix tests after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
bhazelton committed Jul 3, 2018
1 parent 0c7a75b commit 244b010
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 14 deletions.
4 changes: 3 additions & 1 deletion pyuvdata/miriad.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,9 @@ def read_miriad(self, filepath, correct_lat_lon=True, run_check=True,
# Note, this should be done in the TEE frame, which isn't supported by astropy
# Frame doesn't really matter, though, because this is just geometrical, so use icrs
pointing_coords = SkyCoord(ra=ra_list, dec=dec_list, unit='radian', frame='icrs')
zenith_coord = SkyCoord(ra=self.lst_array, dec=latitude, unit='radian', frame='icrs')
zenith_coord = SkyCoord(ra=self.lst_array,
dec=self.telescope_location_lat_lon_alt[0],
unit='radian', frame='icrs')

separation_angles = pointing_coords.separation(zenith_coord)
acceptable_offset = Angle('1d')
Expand Down
34 changes: 21 additions & 13 deletions pyuvdata/tests/test_miriad.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,12 @@ def test_wronglatlon():

uvtest.checkWarnings(uv_in.read_miriad, [latfile], nwarnings=3,
message=['Altitude is not present in file and latitude value does not match',
latfile + ' was written with an old version of pyuvdata',
'drift RA, Dec is off from lst, latitude by more than 1.0 deg'])
uvtest.checkWarnings(uv_in.read_miriad, [lonfile], nwarnings=2,
'This file was written with an old version of pyuvdata',
'This file was written with an old version of pyuvdata']),
uvtest.checkWarnings(uv_in.read_miriad, [lonfile], nwarnings=3,
message=['Altitude is not present in file and longitude value does not match',
lonfile + ' was written with an old version of pyuvdata'])
'This file was written with an old version of pyuvdata',
'This file was written with an old version of pyuvdata'])
uvtest.checkWarnings(uv_in.read_miriad, [telescopefile], {'run_check': False},
nwarnings=6,
message=['Altitude is not present in Miriad file, and telescope',
Expand Down Expand Up @@ -237,8 +238,11 @@ def test_miriad_location_handling():
# close file properly
del(aipy_uv2)

uvtest.checkWarnings(uv_out.read_miriad, [testfile], nwarnings=4,
uvtest.checkWarnings(uv_out.read_miriad, [testfile], nwarnings=5,
message=['Altitude is not present in Miriad file, and '
'telescope foo is not in known_telescopes. '
'Telescope location will be set using antenna positions.',
'Altitude is not present in Miriad file, and '
'telescope foo is not in known_telescopes. '
'Telescope location will be set using antenna positions.',
'Telescope location is set at sealevel at the '
Expand Down Expand Up @@ -266,11 +270,13 @@ def test_miriad_location_handling():
# close file properly
del(aipy_uv2)

uvtest.checkWarnings(uv_out.read_miriad, [testfile], nwarnings=4,
uvtest.checkWarnings(uv_out.read_miriad, [testfile], nwarnings=5,
message=['Altitude is not present in Miriad file, and '
'telescope foo is not in known_telescopes. '
'Telescope location will be set using antenna positions.',
'Altitude is not present ',
'Altitude is not present in Miriad file, and '
'telescope foo is not in known_telescopes. '
'Telescope location will be set using antenna positions.',
'Telescope location is set at sealevel at the '
'file lat/lon coordinates. Antenna positions '
'are present, but the mean antenna longitude '
Expand All @@ -295,11 +301,13 @@ def test_miriad_location_handling():
# close file properly
del(aipy_uv2)

uvtest.checkWarnings(uv_out.read_miriad, [testfile], nwarnings=4,
uvtest.checkWarnings(uv_out.read_miriad, [testfile], nwarnings=5,
message=['Altitude is not present in Miriad file, and '
'telescope foo is not in known_telescopes. '
'Telescope location will be set using antenna positions.',
'Altitude is not present ',
'Altitude is not present in Miriad file, and '
'telescope foo is not in known_telescopes. '
'Telescope location will be set using antenna positions.',
'Telescope location is set at sealevel at the '
'file lat/lon coordinates. Antenna positions '
'are present, but the mean antenna latitude and '
Expand Down Expand Up @@ -697,7 +705,7 @@ def test_readWriteReadMiriad():

# try metadata only read
uv_in = UVData()
uv_in.read_miriad_metadata(testfile)
uvtest.checkWarnings(uv_in.read_miriad_metadata, [testfile], known_warning='miriad')
nt.assert_equal(uv_in.time_array, None)
nt.assert_equal(uv_in.data_array, None)
metadata = ['antenna_positions', 'antenna_names', 'antenna_positions', 'channel_width',
Expand All @@ -711,18 +719,18 @@ def test_readWriteReadMiriad():
nt.assert_raises(ValueError, uv_in.read_miriad_metadata, [testfile, testfile])
# read-in when data already exists
uv_in = UVData()
uv_in.read_miriad(testfile)
uvtest.checkWarnings(uv_in.read_miriad, [testfile], known_warning='miriad')
nt.assert_raises(ValueError, uv_in.read_miriad_metadata, testfile)

# test load_telescope_coords w/ blank Miriad
uv_in = Miriad()
uv = aipy_extracts.UV(testfile)
uv_in._load_telescope_coords(uv)
uvtest.checkWarnings(uv_in._load_telescope_coords, [uv], known_warning='miriad')
nt.assert_true(uv_in.telescope_location_lat_lon_alt is not None)
# test load_antpos w/ blank Miriad
uv_in = Miriad()
uv = aipy_extracts.UV(testfile)
uv_in._load_antpos(uv)
uvtest.checkWarnings(uv_in._load_antpos, [uv], known_warning='miriad')
nt.assert_true(uv_in.antenna_positions is not None)


Expand Down

0 comments on commit 244b010

Please sign in to comment.