Пример #1
0
def test_collect(ra, dec, unix, Nspec):
    alt, az = get_altaz(ra, dec)
    leuTel = ugradio.leusch.LeuschTelescope()
    spec = leuschner.Spectrometer('10.0.1.2')
    leuTel.point(alt, az)

    currentAlt, currentAz = leuTel.get_pointing()
    print('alt: {} , az: {}'.format(currentAlt, currentAz))

    spec.read_spec('{}_{}_{}.fits'.format(unix, ra, dec), Nspec, (ra, dec),
                   'eq')
Пример #2
0
def calibrate():

    #connect to equipment
    LeuschTelescope = ugradio.leusch.LeuschTelescope()
    spec = leuschner.Spectrometer('10.0.1.2')
    agilent = ugradio.agilent.SynthDirect()
    #LO = ugradio.agilent.SynthClient(host='127.0.0.1')

    #get coordinates
    alt, az = get_coords(120, 0)
    LeuschTelescope.point(alt, az)
    agilent.set_frequency(636.25, 'MHz')
    spec.check_connected()
    spec.read_spec('Calibrateupper.fits', 20, (120, 0), 'ga')
Пример #3
0
def collect_data(ra, dec, unix, Nspectra, dt, fileName, fitName, noise=False):
    """
    This code assumes that you have already found the conversion between galactic coordinates
    
    ra: array of RA's (ra corresponds to a different galactic coordinate)
    dec: array of DEC's (dec corresponds to a different galactic coordinate)
    unix: start time for what we are observing
    Nsepctra: number of spectra to collect for each point
    dt: time to stay at each point
    noise: bool, default False, if True we collect noise data
    """
    with open('{}'.format(fileName), 'w') as pointFile:
        pointFile.write('{}'.format('agilent'))

        alt, az = get_altaz(ra[0],
                            dec[0],
                            jd=uni_to_jul(unix),
                            lat=37.9183,
                            lon=-122.1067,
                            alt=304)
        LeuschTelescope.point(alt, az)
        print(LeuschTelescope.get_pointing())

        if noise:
            ugradio.leusch.LeuschNoise()
            LeuschNoise.on()

        ugradio.agilent.SynthClient(host='127.0.0.1')
        pointFile.write('{}'.format(SynthClient.get_frequency()))

        #initialize spectrometer thing
        leuschner.Spectrometer('10.0.1.2')

        for r, d in zip(ra, dec):
            obsv_time = uni_to_jul(time.time())
            alt, az = get_altaz(ra[0],
                                dec[0],
                                jd=obsv_time,
                                lat=37.9183,
                                lon=-122.1067,
                                alt=304)
            LeuschTelescope.point(alt, az)
            currentAlt, currentAz = leusch.get_pointing()
            print('alt: {} , az: {}'.format(currentAlt, currentAz))
            Spectrometer.read_spec('{}_{}_r_d.fits'.format(unix, fitName),
                                   Nspec, (r, d), 'eq')
Пример #4
0
from astropy.coordinates import SkyCoord
import astropy.units as u
from astropy.coordinates import Galactic

l = 120
b = 0
gal = Galactic(l*u.degree,b*u.degree)
eq = gal.transform_to(ICRS)


_jd = ugradio.timing.julian_date()
alt,az = ugradio.coord.get_altaz(6.45083114, 62.72572675 ,_jd,leo.lat,leo.lon,leo.alt,equinox='J2019')

''' Read spectrometer '''

spec = leuschner.Spectrometer('10.0.1.2') #instantiates an interface to the spectrometer at the specified IP address.
#spec.int_time #tells you how long each spectrum is integrated for

'''Take data '''
'''Will read N spectra and store the output in a FITS file, writing the ra/dec coordinates into the header of the file. Note that this does not point the telescope; it just documents where it is pointed in the file. '''
#spec.read_spec('_test_.fits', N, (ra, dec), 'eq')
#e.g. spec.read_spec('compas.fits',10,(50,60),'eq')


#spec.check_connected() #allows you to check that you are ready to take data

''' Open your Data'''

#f = pyfits.open('test.fits')
#f[0].header
# f[1].data['auto0_real'] #returns the first spectrum for the first polarization
Пример #5
0
def collect_data(ra, dec, unix, Nspec, fileName):
    """
    This code assumes that you have already found the conversion between galactic coordinates
    
    ra: array of RA's (ra corresponds to a different galactic coordinate)
    dec: array of DEC's (dec corresponds to a different galactic coordinate)
    unix: start time for what we are observing
    Nsepctra: number of spectra to collect for each point
    dt: time to stay at each point
    noise: bool, default False, if True we collect noise data
    """
    with open('{}'.format(fileName), 'w') as pointFile:
        pointFile.write('{}\t{}\t{}\t{}\t{}\n'.format('recording', 'noise',
                                                      'agilent', 'alt', 'az'))

        # initialize telescope
        leuTel = ugradio.leusch.LeuschTelescope()

        #alt, az = get_altaz(ra[0],dec[0],jd =uni_to_jul(unix), lat=37.9183, lon=-122.1067, alt =304)
        #leuTel.point(alt,az)
        #print("we are pointing at alt: {}, az: {}".format(leuTel.get_pointing()[0],leuTel.get_pointing()[1]))

        ag = ugradio.agilent.SynthDirect()
        #pointFile.write('{}\t'.format(ag.get_frequency()))

        #initialize spectrometer thing
        spec = leuschner.Spectrometer('10.0.1.2')
        # initialize noise thing
        leuNoise = ugradio.leusch.LeuschNoise()
        leuNoise.off()
        noise = 1  # this will be printed and means noise is off

        ct = 1
        for r, d in zip(ra, dec):
            obsv_time = uni_to_jul(time.time())
            alt, az = get_altaz(r,
                                d,
                                jd=obsv_time,
                                lat=37.9183,
                                lon=-122.1067,
                                alt=304)
            record = 0
            if alt < 15 or alt > 85 or az < 5 or az > 355:
                record = 1  # we are not recording this point
                pointFile.write('{}\t{}\t{}\t{}\t{}\n'.format(
                    record, 00, 00, r, d))
                continue
            if ct % 10 == 0:
                leuNoise.on()
                ag.set_frequency(635,
                                 'MHz')  # need to choose what number we want
                noise = 0  # 0 if noise is on
            if ct % 20 == 0:
                leuNoise.off()
                noise = 1  # 1 if noise is off
                ag.set_frequency(636, 'MHz')  # need to choose number here
            leuTel.point(alt, az)
            currentAlt, currentAz = leuTel.get_pointing()
            pointFile.write('{}\t{}\t{}\t{}\t{}\n'.format(
                record, noise, ag.get_frequency(), currentAlt, currentAz))
            spec.read_spec('{}_{}_{}.fits'.format(obsv_time, r, d), Nspec,
                           (r, d), 'eq')
            ct += 1
Пример #6
0
from __future__ import print_function
import sys

if sys.version_info > (3, 0):
    # this script must run as python2
    import os, subprocess
    absref = os.path.realpath(__file__)
    cmd = ['python2', absref] + sys.argv[1:]
    subprocess.run(cmd)
    sys.exit(0)

import leuschner

function = sys.argv[1]
ip = sys.argv[2]
sp = leuschner.Spectrometer(ip)

if function == "cc":
    sp.check_connected()

if function == "rs":
    filename = sys.argv[3]
    nspec = int(sys.argv[4])
    coords = eval(sys.argv[5])
    system = sys.argv[6]
    sp.read_spec(filename, nspec, coords, system)

if function == "it":
    print(sp.int_time)

sys.exit(0)
Пример #7
0
    system = header['COORDSYS']

    # Extract coordinates
    if system == 'ga':
        lon = header['L']
        lat = header['B']
        coords = (lat, lon)
    elif system == 'eq':
        ra  = header['RA']
        dec = header['DEC']
        coords = (ra, dec)
    else:
        print 'ERROR: Invalid coordinate system:', system
        sys.exit(1)
    obs_hdu.close()

    return (nspec, coords, system)

if __name__ == '__main__':
    usage = 'Usage: python2 leuschner_rx.py obs_attr.fits outfile.fits'
    assert len(sys.argv) == 3, usage
    obsfile = sys.argv[1]
    outfile = sys.argv[2]
    nspec, coords, system = unpack_attr(obsfile)

    spec = leuschner.Spectrometer('10.0.1.2')
    spec.check_connected()
    spec.init_spec()
    spec.read_spec(outfile, nspec, coords, system)
    sys.exit(0)
                        '--num-integ',
                        type=int,
                        default=500,
                        help='Number of integrations to plot at a time.')
    parser.add_argument('-s',
                        '--spec',
                        default='wide',
                        help='Which spectrometer to use (wide, spec, dbg)')

    args = parser.parse_args()

    # Let's get this party started. :)
    if args.spec == 'wide':
        spec = lspec.Wideband(args.ip)
    elif args.spec == 'spec':
        spec = lspec.Spectrometer(args.ip)
    elif args.spec == 'dbg':
        spec = SpecDBG(args.ip)
    else:
        raise ValueError('Invalid spectrometer mode.')
    spec.check_connected()
    if not spec.check_running():
        spec.init_spec()
    #spec.spec_props(args.bandwidth)

    # Get the bram name to read from
    if 'auto' in args.antenna:
        bram_name = 'spec_' + args.antenna + '_real'
    else:
        print 'Too lazy to do cross-correlation phase...'
        sys.exit()