def test_lt(self): oid1 = hirise.ObservationID("PSP_005632_1225") oid2 = hirise.ObservationID("ESP_057866_1670") oid3 = hirise.ObservationID("ESP_057867_1670") oid4 = hirise.ObservationID("ESP_057867_1675") self.assertTrue(oid1 < oid2) self.assertTrue(oid2 < oid3) self.assertTrue(oid3 < oid4)
def test_init_CCDID(self): obsid = hirise.ObservationID("ESP_034783_1850") ccdid = hirise.CCDID("ESP_034783_1850_RED5") chanid = hirise.ChannelID("ESP_034783_1850_RED5_0") cid1 = hirise.ChannelID(ccdid, "0") cid2 = hirise.ChannelID(obsid, 5, 0) self.assertEqual(cid1, chanid) self.assertEqual(cid2, chanid)
def test_init_tuple(self): tuples = ( (("PSP", "005632", "1225"), ("PSP", "005632", "1225")), (("PSP", "005632", "1225"), ("5632", "1225")), (("TRA", "000001", "0005"), ("1", "5")), (("ESP", "057866", "1670"), ("ESP", "57866", "1670")), (("ESP", "034783", "1850"), ("ESP", "034783", "1850")), (("AEB", "000000", "0000"), ("AEB", "000000", "0000")), ) for truth, t in tuples: with self.subTest(): oid = hirise.ObservationID(*t) self.assertTupleEqual( truth, (oid.phase, oid.orbit_number, oid.target))
def test_init_string(self): string_tuples = ( ("PSP_005632_1225", "PSP_005632_1225"), ("PSP_005632_1225", "5632_1225"), ("PSP_005632_0005", "5632_5"), ("TRA_000001_0005", "1_5"), ("ESP_057866_1670", "ESP_057866_1670"), ("ESP_057866_1670", "ESP_57866_1670"), ("ESP_034783_1855", "ESP_034783_1855"), ("ESP_034783_1850", "ESP_034783_1850"), ) for s in string_tuples: with self.subTest(): oid = hirise.ObservationID(s[1]) self.assertEqual(s[0], str(oid))
def test_set_outpath(self): self.assertEqual(Path("unchanged"), hcn.set_outpath("unchanged", self.cubes)) self.assertEqual( Path("dummy/PSP_010502_2090_COLOR.cub"), hcn.set_outpath("_COLOR.cub", self.cubes), ) t_getkey = getkey with patch("hiproc.HiColorNorm.ColorCube.get_binning", return_value=2): with patch("hiproc.HiColorNorm.isis.getkey_k", side_effect=t_getkey): with patch( "hiproc.hirise.get_ObsID_fromfile", return_value=hirise.ObservationID("ESP_060680_3180"), ): oddball = hcn.ColorCube("dummy/ESP_060680_3180_COLOR4") newlist = self.cubes + [oddball] self.assertRaises(ValueError, hcn.set_outpath, "unchanged", newlist)
def get_obsid(self) -> hirise.ObservationID: return hirise.ObservationID(self.phase, self.orbit_number, self.target)
def test_str_(self): test = "This is an Obs Id: ESP_057866_1670" truth = "ESP_057866_1670" self.assertEqual(truth, hirise.ObservationID(test).__str__())
def test_get_obsid(self): s = "This is a ChannelID: ESP_034783_1850_RED5_0" oid = hirise.ObservationID(s) cid = hirise.ChannelID(s) self.assertEqual(oid, cid.get_obsid())
def test_repr(self): s = "This is an Observation ID: ESP_057866_1670" oid = hirise.ObservationID(s) self.assertEqual("ObservationID('ESP_057866_1670')", repr(oid))