Esempio n. 1
0
def plot_many_sunearth_vec(d, comveceq, obsveceq, ctime, ltcomcel, axisdata,
                           ra_img_higher, ra_img_lower, border, pixwidth,
                           pixheight, rafmin, decmin, scale, comsunfill,
                           featur_fill, fnt, fixwrapsbool):
    nolines = 24
    lperday = 24
    timearray = np.empty((nolines, 2), dtype=float)
    timearray[:,
              0] = np.arange(-0.5, -0.5 - nolines / lperday, -1 /
                             lperday) + np.floor(ctime.jd * lperday) / lperday

    for ta in range(nolines):
        timearray[ta, 1] = abs(comveceq[:, 0] - timearray[ta, 0]).argmin()

    for n in range(nolines):
        #creates an array of ra/dec values along sun-comet line
        cmsam = 10001
        offsets = np.ones(cmsam) + np.linspace(-1, 1, cmsam)
        comsun = np.empty((cmsam, 4), dtype=float)
        for cs in range(0, cmsam):
            ctemp = pos2radec(
                offsets[cs] * comveceq[timearray[n, 1], 6:9] -
                obsveceq[ltcomcel, 6:9], fixwrapsbool)
            comsun[cs, 0] = ctemp[0]
            comsun[cs, 1] = ctemp[1]

        #slims this array down to within image limits
        csvrange = np.intersect1d(
            np.intersect1d(
                np.where(comsun[:, 0] < ra_img_higher)[0],
                np.where(comsun[:, 0] > ra_img_lower)[0]),
            np.intersect1d(
                np.where(comsun[:, 1] < axisdata[9])[0],
                np.where(comsun[:, 1] > axisdata[8])[0]))
        comsun = comsun[csvrange[0]:csvrange[-1], :]

        #convert to ra and dec, and plot
        comsun[:, 2] = ra2xpix(comsun[:, 0], border, pixwidth, rafmin, scale)
        comsun[:, 3] = dec2ypix(comsun[:, 1], border, pixheight, decmin, scale)
        for ca in range(0, (np.shape(comsun)[0] - 1)):
            d.line([(comsun[ca, 2], comsun[ca, 3]),
                    (comsun[ca + 1, 2], comsun[ca + 1, 3])],
                   fill=comsunfill)
Esempio n. 2
0
def plot_sunearth_vec(d, comveceq, obsveceq, ltcomcel, axisdata, ra_img_higher,
                      ra_img_lower, border, pixwidth, pixheight, rafmin,
                      decmin, scale, comsunfill, featur_fill, fnt,
                      fixwrapsbool):

    #creates an array of ra/dec values along sun-comet line
    cmsam = 10001
    offsets = np.ones(cmsam) + np.linspace(-1, 1, cmsam)
    comsun = np.empty((cmsam, 4), dtype=float)
    for cs in range(0, cmsam):
        ctemp = pos2radec(
            offsets[cs] * comveceq[int(ltcomcel), 6:9] -
            obsveceq[int(ltcomcel), 6:9], fixwrapsbool)
        comsun[cs, 0] = ctemp[0]
        comsun[cs, 1] = ctemp[1]

    #slims this array down to within image limits
    csvrange = np.intersect1d(
        np.intersect1d(
            np.where(comsun[:, 0] < ra_img_higher)[0],
            np.where(comsun[:, 0] > ra_img_lower)[0]),
        np.intersect1d(
            np.where(comsun[:, 1] < axisdata[9])[0],
            np.where(comsun[:, 1] > axisdata[8])[0]))
    comsun = comsun[csvrange[0]:csvrange[-1], :]

    #convert to ra and dec, and plot
    comsun[:, 2] = ra2xpix(comsun[:, 0], border, pixwidth, rafmin, scale)
    comsun[:, 3] = dec2ypix(comsun[:, 1], border, pixheight, decmin, scale)
    for ca in range(0, (np.shape(comsun)[0] - 1)):
        d.line([(comsun[ca, 2], comsun[ca, 3]),
                (comsun[ca + 1, 2], comsun[ca + 1, 3])],
               fill=comsunfill)

    d.text((2*border + pixwidth + 30,border + 310), \
    "Comet-Sun\nVector:",font=fnt, fill= featur_fill)
    d.line([(2 * border + pixwidth + 30, border + 355),
            (2 * border + pixwidth + 170, border + 355)],
           fill=comsunfill)
Esempio n. 3
0
    com_box_path[len0:len0+len1-1,0] = ra[1:,-1]
    com_box_path[len0:len0+len1-1,1] = dec[1:,-1]
    com_box_path[len0+len1-1:2*len0+len1-2,0] = ra[-1,-2::-1]
    com_box_path[len0+len1-1:2*len0+len1-2,1] = dec[-1,-2::-1]
    com_box_path[2*len0+len1-2:2*len0+2*len1-3,0] = ra[-2::-1,0]
    com_box_path[2*len0+len1-2:2*len0+2*len1-3,1] = dec[-2::-1,0]
    com_Path = mplPath.Path(com_box_path)   
    
    [ctime,uncertainty_range_exists] = image_time_stereo(filebase)

    #find relevant observer parameters of comet at observer time
    comcel = np.where(abs(obsveceq[:,0] - ctime.jd)==abs(obsveceq[:,0] - ctime.jd).min())[0][0]
    
    LT_cor = int(np.round(np.linalg.norm(comveceq[comcel,6:9] - 
    obsveceq[comcel,6:9])*8.316746397269274))
    com_ra_dec = pos2radec(comveceq[comcel - LT_cor,6:9] - obsveceq[comcel,6:9],fixwrapsbool)
    
    com_in_image = com_Path.contains_point((com_ra_dec[0]-np.mean(ra_m-ra),com_ra_dec[1]))
    
    if com_in_image == False:
        break
    
    com_ra_dec_array = np.zeros((1,2))
    com_ra_dec_array[0,0] = com_ra_dec[0] - np.mean(ra_m-ra); com_ra_dec_array[0,1] = com_ra_dec[1]
    
    compos = tuple(np.round(w.wcs_world2pix(com_ra_dec_array,0)[0][::-1]).astype(int))
    nucvals[fidx] = colr[compos]
    jdeez[fidx] = ctime.jd
    fidx +=1

jdeez = jdeez[0:fidx]
Esempio n. 4
0
        & (comobs[:,5] < trafmax))[0]
        obsdecloc = np.where((comobs[:,6] > tdecmin) \
        & (comobs[:,6] < tdecmax))[0]
        trajrough = np.intersect1d(obsraloc, obsdecloc)

        if trajrough.size != 0:

            #use this to calculate ra and dec of comet for a purposely oversized range
            vno = 0
            vext = int(np.size(trajrough))
            vtraj = np.empty((np.size(trajrough) + 2 * vext - 1, 11),
                             dtype=float)
            tcellmax = min(trajrough[-1] + vext, np.shape(comveceq)[0])
            for tcell in range(trajrough[0] - vext, tcellmax):
                vtemp = comveceq[tcell, 6:9] - obsveceq[comcel, 6:9]
                ptemp = pos2radec(vtemp, bool_val)
                vtraj[vno, 0] = ptemp[0]
                vtraj[vno, 1] = ptemp[1]
                vtraj[vno, 4] = tcell
                vtraj[vno, 5] = tcell + round(
                    np.linalg.norm(vtemp) * 8.316746397269274)
                vtraj[vno, 6:11] = comveceq[tcell, 1:6]
                vno += 1

        #use these ra and dec values to slim data down to within image borders
        trajrange = np.intersect1d(
            np.intersect1d(
                np.where(vtraj[:, 0] < trafmax)[0],
                np.where(vtraj[:, 0] > trafmin)[0]),
            np.intersect1d(
                np.where(vtraj[:, 1] < tdecmax)[0],
Esempio n. 5
0
def plot_orbit(comobs, comveceq, obsveceq, axisdata, d, comcel, trajfill,
               ra_img_lower, ra_img_higher, border, pixwidth, rafmin, scale,
               pixheight, decmin, fnt, featur_fill, con_in_image,
               fixwrapsbool):

    #find rough cell range of traj from observer data
    obsraloc = np.where((comobs[:,5] > ra_img_lower) \
    & (comobs[:,5] < ra_img_higher))[0]
    obsdecloc = np.where((comobs[:,6] > axisdata[8]) \
    & (comobs[:,6] < axisdata[9]))[0]
    trajrough = np.intersect1d(obsraloc, obsdecloc)

    if trajrough.size != 0:

        #use this to calculate ra and dec of comet for a purposely oversized range
        vno = 0
        vext = int(np.size(trajrough))
        vtraj = np.empty((np.size(trajrough) + 2 * vext - 1, 11), dtype=float)
        tcellmax = min(trajrough[-1] + vext, np.shape(comveceq)[0])
        for tcell in range(trajrough[0] - vext, tcellmax):
            vtemp = comveceq[tcell, 6:9] - obsveceq[comcel, 6:9]
            ptemp = pos2radec(vtemp, fixwrapsbool)
            vtraj[vno, 0] = ptemp[0]
            vtraj[vno, 1] = ptemp[1]
            vtraj[vno, 4] = tcell
            vtraj[vno, 5] = tcell + round(
                np.linalg.norm(vtemp) * 8.316746397269274)
            vtraj[vno, 6:11] = comveceq[tcell, 1:6]
            vno += 1

        #use these ra and dec values to slim data down to within image borders
        trajrange = np.intersect1d(
            np.intersect1d(
                np.where(vtraj[:, 0] < ra_img_higher)[0],
                np.where(vtraj[:, 0] > ra_img_lower)[0]),
            np.intersect1d(
                np.where(vtraj[:, 1] < axisdata[9])[0],
                np.where(vtraj[:, 1] > axisdata[8])[0]))
        vtraj = vtraj[trajrange[0]:trajrange[-1], :]

        #find relevant cell in vtraj and comveceq accounting for LT
        if con_in_image == True:
            vtrajcel = np.where(abs(vtraj[:, 5] - comcel) < 1e-4)[0][0]
            ltcomcel = vtraj[vtrajcel, 4]
        else:
            ltcomcel = None
            vtrajcel = None

        #convert to ra and dec, and plot
        vtraj[:, 2] = ra2xpix(vtraj[:, 0], border, pixwidth, rafmin, scale)
        vtraj[:, 3] = dec2ypix(vtraj[:, 1], border, pixheight, decmin, scale)
        for ta in range(0, (np.shape(vtraj)[0] - 1)):
            d.line([(vtraj[ta,2],vtraj[ta,3]),(vtraj[ta+1,2],vtraj[ta+1,3])],\
            fill = trajfill)

        #plot the path
        d.text((2*border + pixwidth + 30,border + 200), \
        "Orbital Path:",font=fnt, fill= featur_fill)
        d.line([(2 * border + pixwidth + 30, border + 230),
                (2 * border + pixwidth + 170, border + 230)],
               fill=trajfill)

    else:
        ltcomcel = None
        vtraj = None
        vtrajcel = None

    return ltcomcel, vtraj, vtrajcel