コード例 #1
0
def test_airmass(ztf_camera, star, iers_data):
    star_obj = star_dict[star]['target']
    star_obj = Obj(ra=star_obj.ra.deg, dec=star_obj.dec.deg)
    telescope = ztf_camera.telescope
    airmass_calc = star_obj.airmass(telescope, night_times)

    # departure from plane-parallel becomes significant
    airmass_islarge = airmass_calc > 5

    # we use a somewhat large tolerance as brian casey's answers are calculated
    # using secz whereas ours are pickering (2002)
    np.testing.assert_allclose(
        airmass_calc[~airmass_islarge],
        star_dict[star]['airmass'][~airmass_islarge],
        rtol=5e-2,
        atol=0.02,
    )

    np.testing.assert_allclose(
        airmass_calc[airmass_islarge],
        star_dict[star]['airmass'][airmass_islarge],
        rtol=1e-1,
        atol=1.0,
    )
コード例 #2
0
def public_source_no_data(public_group):
    obj = Obj(
        id=str(uuid.uuid4()),
        ra=0.0,
        dec=0.0,
        redshift=0.0,
    )
    DBSession.add(obj)
    DBSession().add(ThumbnailFactory(obj_id=obj.id, type="new"))
    DBSession().add(ThumbnailFactory(obj_id=obj.id, type="ps1"))
    source = Source(obj_id=obj.id, group_id=public_group.id)
    DBSession.add(source)
    DBSession.commit()
    obj_id = obj.id
    yield obj
    # If the obj wasn't deleted by the test using it, clean up
    DBSession().expire(obj)
    if DBSession().query(Obj).filter(Obj.id == obj_id).first():
        DBSession().delete(obj)
        DBSession().commit()