示例#1
0
 def test_metadata(self):
     star = StarDescription(local_id=id,
                            coords=SkyCoord(10, 11, unit="deg"))
     self.assertEqual({}, star.metadata)
     star.metadata = CompStarData([1])
     self.assertEqual(1, len(star.metadata))
     star.metadata = StarMetaData()
     self.assertEqual(2, len(star.metadata))
     try:
         star.set_metadata(StarMetaData(), True)
     except:
         return
     self.fail("Adding duplicate keys to the dictionary should fail")
示例#2
0
def _add_vsx_metadata_to_star_description(catalog_name: str,
                                          star: StarDescription, vsx_dict,
                                          index_vsx, separation):
    assert star.metadata is not None
    vsx_name = vsx_dict["extradata"][index_vsx]["Name"]
    star.aavso_id = vsx_name
    match = CatalogData(
        key=catalog_name,
        catalog_id=vsx_name,
        name=vsx_name,
        separation=separation,
        coords=SkyCoord(
            vsx_dict["ra_deg_np"][index_vsx],
            vsx_dict["dec_deg_np"][index_vsx],
            unit="deg",
        ),
        extradata=vsx_dict["extradata"][index_vsx],
    )
    star.metadata = match
    return match