예제 #1
0
def test_closedloopslew(skyxconn):
    ''' Test a closed loop slew
        This needs the camera, telescope and image link set up correctly
            hence it will usually fail...
    '''
    skyx.ccdsoftCamera().Connect()
    skyx.sky6RASCOMTele().Connect()
    assert skyxconn.closedloopslew("M81") == True
예제 #2
0
def test_closedloopslew(skyxconn):
    ''' Test a closed loop slew
        This needs the camera, telescope and image link set up correctly
            hence it will usually fail...
    '''
    skyx.ccdsoftCamera().Connect()
    skyx.sky6RASCOMTele().Connect()
    assert skyxconn.closedloopslew("M81") == True
    
예제 #3
0
def test_scopeDisconnect(skyxconn):
    ''' Test sky6RASCOMTeleDisconnect
        This seems to be an expected fail as the telescope does not 
        disconnect. Need to look into this
    '''
    tele = skyx.sky6RASCOMTele()
    assert tele.Disconnect() == True
예제 #4
0
def test_scopeDisconnect(skyxconn):
    ''' Test sky6RASCOMTeleDisconnect
        This seems to be an expected fail as the telescope does not 
        disconnect. Need to look into this
    '''
    tele = skyx.sky6RASCOMTele()
    assert tele.Disconnect() == True
예제 #5
0
def test_scopeConnect(skyxconn):
    ''' Test sky6RASCOMTeleConnect
    '''
    tele = skyx.sky6RASCOMTele()
    assert tele.Connect() == True
예제 #6
0
running = True
ggui = 0


def bla(rx, ry):
    print(rx, ry)
    radec = sky.GetRaDec()
    print(radec)
    ggui.set("RA", radec[0][0:8])
    ggui.set("DEC", radec[1][0:8])
    ggui.set("Rate_RA", str(rx)[0:8])
    ggui.set("Rate_DEC", str(ry)[0:8])
    sky.rate(rx, ry)


sky = skyx.sky6RASCOMTele()
sky.Connect()


def worker(inputs):
    global rate_x
    global rate_y
    global focus_pos
    global running

    rx1 = rate_x
    ry1 = rate_y
    fpos1 = focus_pos

    init_motor(0)
    move_focus(0)
예제 #7
0
def mainloop(args):

    sky = skyx.sky6RASCOMTele()
    sky.Connect()

    p0 = sky.GetRaDec()

    print(args)
    frame = 0
    viewer = pg.image(np.zeros((10, 10)))
    center_viewer = pg.image(np.zeros((10, 10)))
    filename = args.filename  # + str(int(time.time()))
    dirname = args.filename

    if (not os.path.isdir(dirname)):
        os.mkdir(dirname)

    flat = fits.getdata("flat_100_50.fits", ext=0)
    bias = fits.getdata("bias.fits", ext=0)
    dark = fits.getdata("dark.fits", ext=0)

    #flat = flat - bias
    flat = flat / flat.mean()

    cnt = 20
    frame = 0
    while (cnt > 0):
        cnt = cnt - 1
        frame = frame + 1
        for field in range(0, 18):
            sky.goto((15.0 * float(p0[0]) - 1.3 * (field // 6)) / 15.0,
                     float(p0[1]) + 1.6 * (field % 6))
            time.sleep(3)
            if ((field % 6) == 0):
                time.sleep(2)

            px = sky.GetRaDec()

            now = datetime.datetime.now(datetime.timezone.utc)
            img1 = get(zwocam, {
                'exposure': args.exp,
                'gain': args.gain,
                'bin': args.bin
            })
            img1 = img1 - dark
            img1 = img1 / flat
            img1 = img1 / 2.0
            img1 = img1.astype(np.uint16)

            img2 = get(zwocam, {
                'exposure': args.exp,
                'gain': args.gain,
                'bin': args.bin
            })
            img2 = img2 - dark
            img2 = img2 / flat
            img2 = img2 / 2.0
            img2 = img2.astype(np.uint16)

            img3 = get(zwocam, {
                'exposure': args.exp,
                'gain': args.gain,
                'bin': args.bin
            })
            img3 = img3 - dark
            img3 = img3 / flat
            img3 = img3 / 2.0
            img3 = img3.astype(np.uint16)

            img = np.median([img1, img2, img3], axis=0)

            if (args.filename != ''):
                hdr = fits.header.Header()
                ra_string = cvt_ra(float(px[0]))
                dec_string = cvt_dec(float(px[1]))

                hdr['RA'] = ra_string
                hdr['DEC'] = dec_string

                file_str = dirname + "/" + filename + "_field" + str(
                    field) + "_" + str(frame) + ".fits"
                fits.writeto(file_str,
                             img.astype(np.uint16),
                             hdr,
                             overwrite=True)
                fits.setval(file_str,
                            'DATE',
                            value=str(now.astimezone().isoformat())[:-7])
                fits.setval(file_str,
                            'DATE-OBS',
                            value=str(now.astimezone().isoformat())[:-7])
                fits.setval(file_str, 'EXPTIME', value=args.exp)

            vmin = np.min(img)
            vmax = np.max(img)

            viewer.setImage(np.swapaxes(bin(bin(img.astype(float))), 0, 1))
            center_viewer.setImage(crop_center(np.swapaxes(img, 0, 1), 768))

    sky.goto(float(p0[0]), float(p0[1]))
    sky.stop()
예제 #8
0
def mainloop(args):

    sky = skyx.sky6RASCOMTele()
    sky.Connect()

    p0 = sky.GetRaDec()

    print(args)
    frame = 0
    viewer = pg.image(np.zeros((10, 10)))
    center_viewer = pg.image(np.zeros((10, 10)))
    filename = args.filename + str(int(time.time()))
    dirname = args.filename

    flat = fits.getdata("flat_100_50.fits", ext=0)
    bias = fits.getdata("bias.fits", ext=0)
    dark = fits.getdata("dark.fits", ext=0)

    #flat = flat - bias
    flat = flat / flat.mean()

    if (not os.path.isdir(dirname)):
        os.mkdir(dirname)

    img_number = 0

    while (img_number < args.count):
        img_number = img_number + 1

        now = datetime.datetime.now(datetime.timezone.utc)
        img = get(zwocam, {
            'exposure': args.exp,
            'gain': args.gain,
            'bin': args.bin
        })
        img = img - dark
        img = img / flat

        img = img / 2.0

        if (args.filename != ''):
            hdr = fits.header.Header()
            ra_string = cvt_ra(float(p0[0]))
            dec_string = cvt_dec(float(p0[1]))

            hdr['RA'] = ra_string
            hdr['DEC'] = dec_string

            file_str = dirname + "/" + filename + "_" + str(frame) + ".fits"
            fits.writeto(file_str, img.astype(np.uint16), hdr, overwrite=True)
            fits.setval(file_str,
                        'DATE',
                        value=str(now.astimezone().isoformat())[:-7])
            fits.setval(file_str,
                        'DATE-OBS',
                        value=str(now.astimezone().isoformat())[:-7])
            fits.setval(file_str, 'EXPTIME', value=args.exp)

        frame = frame + 1
        vmin = np.min(img)
        vmax = np.max(img)

        viewer.setImage(np.swapaxes(bin(img.astype(float)), 0, 1))
        center_viewer.setImage(crop_center(np.swapaxes(img, 0, 1), 768))
예제 #9
0
def test_scopeConnect(skyxconn):
    ''' Test sky6RASCOMTeleConnect
    '''
    tele = skyx.sky6RASCOMTele()
    assert tele.Connect() == True
예제 #10
0
def mainloop(args):

    sky = skyx.sky6RASCOMTele()
    sky.Connect()

    p0 = sky.GetRaDec()

    print(args)
    frame = 0
    viewer = pg.image(np.zeros((10, 10)))
    center_viewer = pg.image(np.zeros((10, 10)))
    filename = args.filename + str(int(time.time()))
    dirname = 'e:\\' + args.filename

    if (not os.path.isdir(dirname)):
        os.mkdir(dirname)

    img_number = 0

    try:
        while (img_number < args.count):
            img_number = img_number + 1
            if (img_number % 8 == 0 and img_number < 580):
                #sky.goto(float(p0[0]) - random.random() / 300.0,float(p0[1]) - random.random() / 60.0)
                sky.bump(2.0 * random.random() - 0.5,
                         2.0 * random.random() - 0.5)
                time.sleep(3)

            now = datetime.datetime.now(datetime.timezone.utc)
            img = get(zwocam, {
                'exposure': args.exp,
                'gain': args.gain,
                'bin': args.bin
            })
            print(img)

            img = img / 2.0

            if (args.filename != ''):
                hdr = fits.header.Header()
                ra_string = cvt_ra(float(p0[0]))
                dec_string = cvt_dec(float(p0[1]))

                hdr['RA'] = ra_string
                hdr['DEC'] = dec_string

                file_str = dirname + "/" + filename + "_" + str(
                    frame) + ".fits"
                fits.writeto(file_str,
                             img.astype(np.uint16),
                             hdr,
                             overwrite=True)
                fits.setval(file_str,
                            'DATE',
                            value=str(now.astimezone().isoformat())[:-7])
                fits.setval(file_str,
                            'DATE-OBS',
                            value=str(now.astimezone().isoformat())[:-7])
                fits.setval(file_str, 'EXPTIME', value=args.exp)

            frame = frame + 1
            vmin = np.min(img)
            vmax = np.max(img)

            viewer.setImage(np.swapaxes(bin(img // 4), 0, 1))
            center_viewer.setImage(crop_center(np.swapaxes(img, 0, 1), 1768))
        sky.stop()
    except:
        sky.stop()