예제 #1
0
def test_cam_to_tel():
    from ctapipe.coordinates import CameraFrame, TelescopeFrame

    # Coordinates in any fram can be given as a numpy array of the xyz positions
    # e.g. in this case the position on pixels in the camera
    pix_x = [1] * u.m
    pix_y = [1] * u.m

    focal_length = 15 * u.m

    # first define the camera frame
    camera_coord = CameraFrame(pix_x, pix_y, focal_length=focal_length)

    # then use transform to function to convert to a new system
    # making sure to give the required values for the conversion
    # (these are not checked yet)
    telescope_coord = camera_coord.transform_to(TelescopeFrame())
    assert telescope_coord.x[0] == (1 / 15) * u.rad

    # check rotation
    camera_coord = CameraFrame(pix_x, pix_y, focal_length=focal_length)
    telescope_coord_rot = camera_coord.transform_to(TelescopeFrame())
    assert telescope_coord_rot.y[0] - (1 / 15) * u.rad < 1e-6 * u.rad

    # The Transform back
    camera_coord2 = telescope_coord.transform_to(
        CameraFrame(focal_length=focal_length))

    # Check separation
    assert camera_coord.separation_3d(camera_coord2)[0] == 0 * u.m
예제 #2
0
def test_cam_to_tel():
    from ctapipe.coordinates import CameraFrame, TelescopeFrame

    # Coordinates in any fram can be given as a numpy array of the xyz positions
    # e.g. in this case the position on pixels in the camera
    pix_x = [1] * u.m
    pix_y = [1] * u.m

    focal_length = 15 * u.m

    # first define the camera frame
    camera_coord = CameraFrame(pix_x, pix_y, focal_length=focal_length)

    # then use transform to function to convert to a new system
    # making sure to give the required values for the conversion
    # (these are not checked yet)
    telescope_coord = camera_coord.transform_to(TelescopeFrame())
    assert telescope_coord.x[0] == (1 / 15) * u.rad

    # check rotation
    camera_coord = CameraFrame(pix_x, pix_y, focal_length=focal_length)
    telescope_coord_rot = camera_coord.transform_to(TelescopeFrame())
    assert telescope_coord_rot.y[0] - (1 / 15) * u.rad < 1e-6 * u.rad

    # The Transform back
    camera_coord2 = telescope_coord.transform_to(
        CameraFrame(focal_length=focal_length)
    )

    # Check separation
    assert camera_coord.separation_3d(camera_coord2)[0] == 0 * u.m
예제 #3
0
def cam_to_tel():

    # Coordinates in any fram can be given as a numpy array of the xyz positions
    # e.g. in this case the position on pixels in the camera
    pix = [np.ones(2048),np.ones(2048),np.zeros(2048)] * u.m
    # first define the camera frame
    camera_coord = CameraFrame(pix,focal_length=15*u.m,rotation=0*u.deg)

    # then use transform to function to convert to a new system
    # making sure to give the required values for the conversion (these are not checked yet)
    telescope_coord = camera_coord.transform_to(TelescopeFrame())

    # Print coordinates in the new frame
    print("Telescope Coordinate",telescope_coord)

    # Transforming back is then easy
    camera_coord2 = telescope_coord.transform_to(CameraFrame(focal_length=15*u.m,rotation=0*u.deg))

    # We can easily check the distance between 2 coordinates in the same frame
    # In this case they should be the same
    print("Separation",np.sum(camera_coord.separation_3d(camera_coord2)))
예제 #4
0
def cam_to_tel():

    # Coordinates in any fram can be given as a numpy array of the xyz positions
    # e.g. in this case the position on pixels in the camera
    pix = [np.ones(2048), np.ones(2048), np.zeros(2048)] * u.m
    # first define the camera frame
    camera_coord = CameraFrame(pix)

    # then use transform to function to convert to a new system
    # making sure to give the required values for the conversion (these are not checked yet)
    telescope_coord = camera_coord.transform_to(
        TelescopeFrame(focal_length=15 * u.m, rotation=0 * u.deg))

    # Print cordinates in the new frame
    print("Telescope Coordinate", telescope_coord)

    # Transforming back is then easy
    camera_coord2 = telescope_coord.transform_to(CameraFrame())

    # We can easily check the distance between 2 coordinates in the same frame
    # In this case they should be the same
    print("Separation", np.sum(camera_coord.separation_3d(camera_coord2)))