Exemplo n.º 1
0
def get_opsimObsValues(filename):
    keys = ('ra', 'dec', 'expmjd', 'filter', 'alt', 'az', 'airmass', 'cloud', 'seeing', 'sunalt', 'sunaz', 'moonalt', 'moonaz', 'moonphase', 'moonillum', 
            'skybright', 'maglimit', 'surveynight', 'downtime')
    keytypes = ('float', 'float', 'float', 'str', 'float', 'float', 'float', 'float', 'float', 'float', 'float', 'float', 'float', 'float', 'float', 
                'float', 'float', 'int', 'int')
    opsimObsdata = ui.readDatafile(filename, keys, keytypes)
    return opsimObsdata
Exemplo n.º 2
0
def readSF(file):
    import useful_input as ui 
    data = ui.readDatafile(file, ('theta', 'sf'))
    # Convert arcminutes to degrees
    data['theta'] = data['theta'] / 60.0
    # Convert Tim's SF**2 to SF (mag**2 -> mag)
    data['sf'] = numpy.sqrt(data['sf'])
    return data['theta'], data['sf']
Exemplo n.º 3
0
def get_opsimObsValues(filename):
    keys = ('ra', 'dec', 'expmjd', 'filter', 'alt', 'az', 'airmass', 'cloud',
            'seeing', 'sunalt', 'sunaz', 'moonalt', 'moonaz', 'moonphase',
            'moonillum', 'skybright', 'maglimit', 'surveynight', 'downtime')
    keytypes = ('float', 'float', 'float', 'str', 'float', 'float', 'float',
                'float', 'float', 'float', 'float', 'float', 'float', 'float',
                'float', 'float', 'float', 'int', 'int')
    opsimObsdata = ui.readDatafile(filename, keys, keytypes)
    return opsimObsdata
Exemplo n.º 4
0
 pylab.ylabel('mag @ SNR=5')
 pylab.show()
 """
 
 # Test with opsim values.
 import time
 def dtime(time_prev):
     return (time.time() - time_prev), time.time()
 
 # read test data
 import useful_input as ui
 filename ='test_m5'
 #filename ='t'
 keys = ('seeing', 'airmass', 'skybright', 'filter', '5sigma')
 keytypes = ('float', 'float', 'float', 'a3' ,'float')
 data = ui.readDatafile(filename, keys, keytypes)
 
 data['filter'] = m5s.check_filter(data['filter'])
 t = time.time()
 mags = m5s.calc_maglimit(data['seeing'], data['skybright'], data['filter'], data['airmass'])
 dt, t = dtime(t)
 print 'Calculate full SNR mag limits for %d objects in %f s' %(len(data['filter']), dt)
 m5 = m5s.calc_maglimit_Cm(data['seeing'], data['skybright'], data['filter'], data['airmass'])
 dt, t = dtime(t)
 print 'Calculate Cm style for %d objects in %f s' %(len(data['filter']), dt)
 import pylab
 pylab.figure()
 filters_used = numpy.unique(data['filter'])
 for f in filters_used:
     condition = (data['filter'] == f)
     pylab.plot(data['skybright'][condition], (mags[condition] - m5[condition]),
Exemplo n.º 5
0
    pylab.show()
    """

    # Test with opsim values.
    import time

    def dtime(time_prev):
        return (time.time() - time_prev), time.time()

    # read test data
    import useful_input as ui
    filename = 'test_m5'
    #filename ='t'
    keys = ('seeing', 'airmass', 'skybright', 'filter', '5sigma')
    keytypes = ('float', 'float', 'float', 'a3', 'float')
    data = ui.readDatafile(filename, keys, keytypes)

    data['filter'] = m5s.check_filter(data['filter'])
    t = time.time()
    mags = m5s.calc_maglimit(data['seeing'], data['skybright'], data['filter'],
                             data['airmass'])
    dt, t = dtime(t)
    print 'Calculate full SNR mag limits for %d objects in %f s' % (len(
        data['filter']), dt)
    m5 = m5s.calc_maglimit_Cm(data['seeing'], data['skybright'],
                              data['filter'], data['airmass'])
    dt, t = dtime(t)
    print 'Calculate Cm style for %d objects in %f s' % (len(
        data['filter']), dt)
    import pylab
    pylab.figure()