Пример #1
0
#
# You most probably would like to modify this file to suit your needs.
# Please see comments in flats.py for details of the parameters.

from rts2solib import flats

Flat, FlatScript = flats.Flat, flats.FlatScript
import json
#from rts2solib.rts2_wwwapi import rts2comm
from rts2solib.big61filters import filter_set

Filters = filter_set()
import numpy
from telescope import kuiper

k = kuiper()

# You would at least like to specify filter order, if not binning and
# other thingsa

# binning[0]==3x3 and binning[1]=1x1
expt = numpy.arange(1, 5, 0.2)
expt = numpy.append(expt, numpy.arange(5, 10, 0.5))
expt = numpy.append(expt, numpy.arange(10, 41))
f = FlatScript(eveningFlats=[
    Flat((Filters['U'], ), binning=0, window='100 100 500 500'),
    Flat((Filters['Open'], ), binning=0, window='100 100 500 500'),
    Flat((Filters['V'], ), binning=0, window='100 100 500 500'),
    Flat((Filters['B'], ), binning=0, window='100 100 500 500'),
    Flat((Filters['R'], ), binning=0, window='100 100 500 500'),
    Flat((Filters['I'], ), binning=0, window='100 100 500 500'),
Пример #2
0
    def __init__(self, faketarget=None):
        scriptcomm.Rts2Comm.__init__(self)
        self.cfg = Config()
        self.filters = filter_set()
        self.log("W", "looking at fake target {}".format(faketarget))
        if faketarget is not None:
            self.log("W", "looking at fake target {}".format(faketarget))
            targetid = faketarget
        else:
            targetid = self.getValue("current_target", "SEL")
        self.tel = kuiper()
        #TODO  this should be done via rts2 and not
        # directly with the telescope class.
        # to fix this may require updating rts2 telescope driver.
        self.tel.comBIAS("OFF")
        self.script = None
        #        target = rts2.target.get(targetid)
        #        self.script = None
        #        if len( target ) == 0:
        #            self.log("E", "Can't find Target {}".format(targetid))
        #            self.script = None
        self.log("W", "looking at target {}".format(targetid))
        name = self.getValue("current_name", "EXEC")
        print('using name {}'.format(name))

        # remove the first 4 bits that make the name
        # unique and write that to objectName.
        self.setValue("objectName", name[4:])

        self.log('W', self.cfg["orp_dbpath"])
        engine = create_engine(self.cfg["orp_dbpath"])
        meta = MetaData()
        meta.reflect(bind=engine)
        obsreqs = meta.tables["obsreqs"]
        session = sessionmaker(bind=engine)()
        try:
            db_resp = session.query(obsreqs).filter(
                obsreqs.columns["rts2_id"] == targetid)
            self.script = db_resp[0].rts2_doc
        except Exception:
            self.log("E", "Could not find target-- {}".format(targetid))
            raise
        self.setValue('ObservationID', db_resp[0].observation_id, "C0")
        self.setValue('GroupID', db_resp[0].group_id, "C0")

        binning = db_resp[0].binning
        if binning in ("4x4", "3x3", "2x2", "1x1"):
            if binning == "1x1":
                self.setValue("binning", 1)
            if binning == "2x2":
                self.setValue("binning", 2)
            if binning == "3x3":
                self.setValue("binning", 3)
            if binning == "4x4":
                self.setValue("binning", 4)
        else:
            self.setValue("binning", 4)  # 4x4 binning

        if db_resp[0].non_sidereal:
            self.rates = db_resp[0].non_sidereal_json
            self.tel.comBIAS("ON")

            # The idea here is that the non sidereal
            # targets will have an RA and Dec, RA Bias rate, Dec bias rate,
            # position epoch, object time epoch, position angle, bias_percentage
            # and object rate. The telescope should go to the coordinates
            # RA+sin(position_angle)*object_rate, Dec+cos(position_angle)*object_rate
            # and set the bias rates to
            # RA_bias_rate*bias_percentage, Dec_bias_rate*bias_percentage
            # Scott June 2019

            utc_at_position = self.rates["UTC_At_Position"]
            dt_epoch = pytz.utc.localize(
                datetime.datetime.strptime(utc_at_position,
                                           "%Y-%m-%dT%H:%M:%S"))
            now = pytz.utc.localize(datetime.datetime.utcnow())
            delta_time = now - dt_epoch

            biasra = float(self.rates['RA_BiasRate'])
            biasdec = float(self.rates['Dec_BiasRate'])
            ra_offset = biasra * delta_time.total_seconds()
            dec_offset = biasdec * delta_time.total_seconds()
            self.log("I", "Setting rates to {} {}".format(biasra, biasdec))
            self.tel.command("BIASRA {}".format(biasra))
            self.tel.command("BIASDEC {}".format(biasdec))

            self.log(
                "I", "Setting offset to {}s {}s (UT {}, delta {})".format(
                    ra_offset, dec_offset, utc_at_position,
                    delta_time.total_seconds()))
            self.setValue('woffs', '{}s {}s'.format(ra_offset, dec_offset),
                          'BIG61')

        else:
            self.tel.command("BIASRA 0")
            self.tel.command("BIASDEC 0")

        self.has_exposed = False
Пример #3
0
from astropy.io import fits
from matplotlib import pyplot as plt
from scottSock import scottSock
import os
from ds9 import ds9
import collections
from m4kproc import mergem4k
import tempfile
import json
from fits_solver.m4k_imclient import getobjects, solvefitsfd
import numpy as np
import math
from telescope import kuiper

try:
	tel=kuiper()
except Exception:
	tel=False


class DataserverPipeLine(object):
	def __init__( self ):
		self.tally_info = TALLY()
		self.tasks = []	
		self.current_objects = None
		self.current_path = None
		self.current_imname = None
		self.current_imdir = None
		#self.current_redname 
		self.current_fitsfd = None
		
Пример #4
0
# Example configuation of flats.
# (C) 2010 Petr Kubanek
#
# Please see flats.py file for details about needed files.
#
# You most probably would like to modify this file to suit your needs.
# Please see comments in flats.py for details of the parameters.

from rts2solib import flats
from flats import FlatScript, Flat
import rts2.scriptcomm
import json
#from rts2solib.rts2_wwwapi import rts2comm
from rts2solib.big61filters import filter_set; Filters=filter_set()
import numpy
from telescope import kuiper;k=kuiper()




# You would at least like to specify filter order, if not binning and
# other thingsa

# binning[0]==3x3 and binning[1]=1x1
expt = numpy.arange(1, 5, 0.2)
expt = numpy.append(expt, numpy.arange(5, 10, 0.5))
expt = numpy.append(expt, numpy.arange(10, 41))
f = FlatScript(
    eveningFlats=[
 #       Flat((Filters['U'],), binning=0, window='100 100 500 500'),
        Flat((Filters['V'],), binning=0, window='100 100 500 500'),