Beispiel #1
0
def azel4point(ra0=-10,
               dec0=-57.5,
               mlen=365,
               nsamp=1e4,
               lat=-22.96,
               lon=-67.79):
    '''
    Simple function to see what fraction of the day you can observe the
    Bicep patch (default value).

    Keyword arguments
    ---------

    ra0 : float
        Ra coord of point on the sky [deg] (default : -10)
    dec0 : float
        Ra coord of point on the sky [deg] (default : -57.5)
    mlen : int
        The mission length [days] (default : 365)
    nsamp : in
        The number of samples used in estimate
    lat : float
        Latitude for observation [deg] (default : -22.96, Atacama)
    lon : flaot
        Longitude for observation [deg] (default : -67.79, Atacama)

    '''

    import time
    import qpoint as qp
    Q = qp.QMap()
    nsec = mlen * 24 * 60 * 60
    dt = nsec / float(nsamp)
    ctime = time.time() + np.arange(0, nsec, dt, dtype=float)
    az, el, _ = Q.radec2azel(ra0, dec0, 0, lon, lat, ctime)

    print('Total observation time is {:4.1f} days'.\
        format((ctime[-1]-ctime[0])/24./3600.))

    observable_ratio = np.sum(el > 45) / float(len(ctime))
    print('This patch is observable {:4.1f}% of the time'.\
        format(100*observable_ratio))

    plt.plot(ctime, az)
    plt.ylabel('Azimuth [deg]')
    plt.savefig('../scratch/img/az.png')
    plt.close()

    plt.plot(ctime, el)
    plt.ylabel('Elevation [deg]')
    plt.savefig('../scratch/img/el.png')
    plt.close()

    plt.plot(az, el)
    plt.savefig('../scratch/img/azel.png')
    plt.close()
Beispiel #2
0
import qpoint as qp
import numpy as np
import healpy as hp
from spider_analysis.map import synfast, cartview
import pylab

# initialize, maybe change a few options from their defaults
Q = qp.QMap(nside=256,
            pol=True,
            accuracy='low',
            fast_math=True,
            mean_aber=True)

# dumb simulation
n = 100000
ctime = 1418662800. + np.arange(n) / 100.
az = 100. + 40. * np.sin(2 * np.pi * np.arange(n) / 4000.)
el = 32. + 10. * np.mod(np.arange(n, dtype=float), 500000.) / 500000.
el = np.floor(el / 0.1) * 0.1
pitch = None
roll = None
lat = -77.6 * np.ones_like(ctime)
lon = 165.7 - np.arange(n) * 3 / 850000.

# step waveplate twice a day...
lmst = Q.lmst(ctime, lon)
hwp = np.ones_like(lmst)
hwp[lmst <= 12] = 22.5
hwp[lmst > 12] = 45.0
q_hwp = Q.hwp_quat(hwp)
Beispiel #3
0
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
size = comm.Get_size()

size = 1 if not size else size

chunksize = 100003
fsamp = 100
scan_speed = 1
az_throw = 50
scan_period = 2 * az_throw / float(scan_speed) # in deg.
lat =  10
lon = 10

# all ranks init QMap
Q = qp.QMap(pol=True)

ctime = np.arange(chunksize, dtype=float)
ctime /= float(fsamp)
ctime += time.time()

az = np.arange(chunksize, dtype=float)
az *= (2 * np.pi / scan_period / float(fsamp))
np.sin(az, out=az)
np.arcsin(az, out=az)
az *= (az_throw / np.pi)

el = np.zeros(chunksize, dtype=float) * 10.

# all ranks
t0 = time.time()
Beispiel #4
0
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import qpoint as qp
import healpy as hp
import quaternion as qt
import time

Q = qp.QMap(fast_pix=True)
nside = 64
q_off = Q.det_offset(0, 0, 0)
print q_off
ctime = time.time()
roll = 90

az_off = 40
el_off = 20
polang = 40

q_bore = Q.azel2bore(0, 0, None, None, 0, -89.9, ctime)
pix, sin2psi, cos2psi = Q.bore2pix(q_off,
                                   np.array([ctime]),
                                   q_bore,
                                   nside=nside,
                                   pol=True)

q_off = Q.det_offset(az_off, el_off, polang)
print 'det offset'
print q_off
print Q.quat2radecpa(q_off)