Example #1
0
def test_calculate_healpixel():
    north_pole = AlertRecord(
        candidate_id=None,
        object_id=None,
        timestamp=None,
        raw_data=None,
        raw_dict=None,
        position=SkyCoord(
            ra=0,
            dec=90,
            unit="deg",
        ),
    )
    assert north_pole.healpixel(1) == 3
    assert north_pole.healpixel(2) == 15
    assert north_pole.healpixel(3) == 63

    zeros = north_pole
    zeros.position = SkyCoord(
        ra=0,
        dec=0,
        unit="deg",
    )
    assert zeros.healpixel(1) == 17
    assert zeros.healpixel(2) == 70
    assert zeros.healpixel(3) == 282
 def insert(self, url: str, alert: AlertRecord) -> None:
     self._write(
         alert_url=url,
         candidate_id=alert.candidate_id,
         object_id=alert.object_id,
         time=alert.timestamp,
         healpixel=alert.healpixel(self.order),
     )