Esempio n. 1
0
 def calcfaixa(self, step=1, erro=None, ring=None, atm=None):
     self.latlon = {}
     for i in np.arange(len(self.stars)):
         self.latlon[self.datas_off[i].iso] = calcfaixa(self.vel[i],
                                                        self.datas_off[i],
                                                        self.stars[i],
                                                        self.dist[i],
                                                        self.ca[i],
                                                        self.pa[i],
                                                        self.tamanho,
                                                        step=step,
                                                        erro=erro,
                                                        ring=ring,
                                                        atm=atm)
Esempio n. 2
0
def geramapa(idx):

    lons1, lats1, lons2, lats2, clon, clat, lab = calcfaixa(idx)
    
    center_map = EarthLocation('-77 02 28.3','38 49 19.1')
    lon = stars[idx].ra - datas.sidereal_time('mean', 'greenwich')
    mymap = pygmaps.maps(stars[idx].dec.value, lon.value, 5)
    lons1 = [i for i in lons1 if i < 1e+20]
    lats1 = [i for i in lats1 if i < 1e+20]
    lons2 = [i for i in lons2 if i < 1e+20]
    lats2 = [i for i in lats2 if i < 1e+20]
    path1 = []
    path2 = []
    for i in np.arange(len(lons1)):
        path1.append((lats1[i], lons1[i]))
    for i in np.arange(len(lons2)):
        path2.append((lats2[i], lons2[i]))
    mymap.addpath(path1,"#0000FF")
    mymap.addpath(path2,"#0000FF")
    mymap.draw('./mymap.html')
Esempio n. 3
0
def geramapa(idx):

    lons1, lats1, lons2, lats2, clon, clat, lab = calcfaixa(idx)

    center_map = EarthLocation('-77 02 28.3', '38 49 19.1')
    lon = stars[idx].ra - datas.sidereal_time('mean', 'greenwich')
    mymap = pygmaps.maps(stars[idx].dec.value, lon.value, 5)
    lons1 = [i for i in lons1 if i < 1e+20]
    lats1 = [i for i in lats1 if i < 1e+20]
    lons2 = [i for i in lons2 if i < 1e+20]
    lats2 = [i for i in lats2 if i < 1e+20]
    path1 = []
    path2 = []
    for i in np.arange(len(lons1)):
        path1.append((lats1[i], lons1[i]))
    for i in np.arange(len(lons2)):
        path2.append((lats2[i], lons2[i]))
    mymap.addpath(path1, "#0000FF")
    mymap.addpath(path2, "#0000FF")
    mymap.draw('./mymap.html')
Esempio n. 4
0
def geramapa(idx):

    lons1, lats1, lons2, lats2 = calcfaixa(idx)

    lon = stars[idx].ra - datas[idx].sidereal_time('mean', 'greenwich')

    m = Basemap(projection='ortho',
                lat_0=stars[idx].dec.value,
                lon_0=lon.value,
                resolution=resolution)
    #    m = Basemap(projection='ortho',lat_0=stars[idx].dec.value,lon_0=lon.value,resolution=resolution, llcrnrx=-7000000,llcrnry=-7000000,urcrnrx=7000000,urcrnry=7000000)
    m.drawcoastlines(linewidth=0.5)
    m.drawcountries(linewidth=0.5)
    m.drawstates(linewidth=0.5)
    m.drawmeridians(np.arange(0, 360, 30))
    m.drawparallels(np.arange(-90, 90, 30))
    m.drawmapboundary()
    ptcolor = 'black'
    lncolor = 'black'
    dscolor = 'black'
    if mapstyle == '2':
        m.drawmapboundary(fill_color='aqua')
        m.fillcontinents(color='coral', lake_color='aqua')
        ptcolor = 'red'
        lncolor = 'blue'
        dscolor = 'red'
    elif mapstyle == '3':
        m.shadedrelief()
        ptcolor = 'red'
        lncolor = 'blue'
        dscolor = 'red'
    elif mapstyle == '4':
        m.bluemarble()
        ptcolor = 'red'
        lncolor = 'red'
        dscolor = 'red'
    elif mapstyle == '5':
        m.etopo()
        ptcolor = 'red'
        lncolor = 'red'
        dscolor = 'red'
    if os.path.isfile(sitearq) == True:
        xpt, ypt = m(sites['lon'], sites['lat'])
        m.plot(xpt, ypt, 'bo')
    CS = m.nightshade(datas[idx].datetime, alpha=0.2)
    a, b = m(lon.value, stars[idx].dec.value)
    a = a * u.m
    b = b * u.m
    dista = (dist[idx].to(u.km) * ca[idx].to(u.rad)).value * u.km
    disterr = (dist[idx].to(u.km) * erro.to(u.rad)).value * u.km
    vec = np.arange(0, 7000, (np.absolute(vel[idx]) *
                              (60 * u.s)).value) * u.km + np.absolute(
                                  vel[idx]) * (60 * u.s)
    vec = np.concatenate((vec.value, -vec.value), axis=0) * u.km
    ax = a + dista * np.sin(pa[idx])
    ax2 = ax + vec * np.cos(pa[idx])
    ax3 = ax2 - tamanho / 2 * np.sin(pa[idx])
    ax4 = ax2 + tamanho / 2 * np.sin(pa[idx])
    ax5 = a + (dista - disterr) * np.sin(pa[idx]) + vec * np.cos(pa[idx])
    ax6 = a + (dista + disterr) * np.sin(pa[idx]) + vec * np.cos(pa[idx])
    by = b + dista * np.cos(pa[idx])
    by2 = by - vec * np.sin(pa[idx])
    by3 = by2 - tamanho / 2 * np.cos(pa[idx])
    by4 = by2 + tamanho / 2 * np.cos(pa[idx])
    by5 = b + (dista - disterr) * np.cos(pa[idx]) - vec * np.sin(pa[idx])
    by6 = b + (dista + disterr) * np.cos(pa[idx]) - vec * np.sin(pa[idx])
    xs, ys = m(lons1, lats1)
    xs = [i for i in xs if i < 1e+30]
    ys = [i for i in ys if i < 1e+30]
    m.plot(xs, ys, 'b')
    xt, yt = m(lons2, lats2)
    xt = [i for i in xt if i < 1e+30]
    yt = [i for i in yt if i < 1e+30]
    m.plot(xt, yt, 'b')
    #    m.plot(ax,by, 'o', color=ptcolor, markersize=mapsize[0].value*20/46)
    #    m.plot(ax2.to(u.m),by2.to(u.m), 'o', color=ptcolor, markersize=mapsize[0].value*8/46)
    #    m.plot(ax3.to(u.m), by3.to(u.m), color=lncolor)
    #    m.plot(ax4.to(u.m), by4.to(u.m), color=lncolor)
    #    m.plot(ax5.to(u.m), by5.to(u.m), '--', color=dscolor, label='+-{} error'.format(erro))
    #    m.plot(ax6.to(u.m), by6.to(u.m), '--', color=dscolor)
    #    plt.legend(fontsize=mapsize[0].value*21/46)

    fig = plt.gcf()
    fig.set_size_inches(mapsize[0].to(u.imperial.inch).value,
                        mapsize[1].to(u.imperial.inch).value)
    plt.title(
        '-{} D={}- dots each 60 s <> offsets (mas): obj=({:.1f},{:.1f}), star=({:.1f},{:.1f})\n'
        .format(obj, tamanho, ob_off_ra[idx].value, ob_off_de[idx].value,
                st_off_ra[idx].value, st_off_de[idx].value),
        fontsize=mapsize[0].value * 25 / 46,
        fontproperties='FreeMono',
        weight='bold')
    plt.xlabel(
        '\n year-m-d    h:m:s UT     ra__dec__J2000__candidate    C/A    P/A    vel   Delta   R*   K*  long\n\
{}  {:02d} {:02d} {:07.4f} {:+02d} {:02d} {:06.3f} {:6.3f} {:6.2f} {:6.2f}  {:5.2f} {:5.1f} {:4.1f}  {:3.0f}'
        .format(datas[idx].iso, int(stars[idx].ra.hms.h),
                int(stars[idx].ra.hms.m), stars[idx].ra.hms.s,
                int(stars[idx].dec.dms.d),
                np.absolute(int(stars[idx].dec.dms.m)),
                np.absolute(stars[idx].dec.dms.s), ca[idx].value,
                pa[idx].value, vel[idx].value, dist[idx].value, magR[idx],
                magK[idx], longi[idx]),
        fontsize=mapsize[0].value * 21 / 46,
        fontproperties='FreeMono',
        weight='bold')
    plt.savefig('{}_{}.png'.format(obj, datas[idx].isot), dpi=100)
    print 'Gerado: {}_{}.png'.format(obj, datas[idx].isot)
    plt.clf()
Esempio n. 5
0
 def calcfaixa(self, step=1, erro=None, ring=None, atm=None):
     self.latlon = {}
     for i in np.arange(len(self.stars)):
         self.latlon[self.datas_off[i].iso] = calcfaixa(self.vel[i], self.datas_off[i], self.stars[i], self.dist[i], self.ca[i], self.pa[i], self.tamanho, step=step, erro=erro, ring=ring, atm=atm)
Esempio n. 6
0
def geramapa(idx):

    lons1, lats1, lons2, lats2 = calcfaixa(idx)

    lon = stars[idx].ra - datas[idx].sidereal_time('mean', 'greenwich')

    m = Basemap(projection='ortho',lat_0=stars[idx].dec.value,lon_0=lon.value,resolution=resolution)
#    m = Basemap(projection='ortho',lat_0=stars[idx].dec.value,lon_0=lon.value,resolution=resolution, llcrnrx=-7000000,llcrnry=-7000000,urcrnrx=7000000,urcrnry=7000000)
    m.drawcoastlines(linewidth=0.5)
    m.drawcountries(linewidth=0.5)
    m.drawstates(linewidth=0.5)
    m.drawmeridians(np.arange(0,360,30))
    m.drawparallels(np.arange(-90,90,30))
    m.drawmapboundary()
    ptcolor = 'black'
    lncolor = 'black'
    dscolor = 'black'
    if mapstyle == '2':
        m.drawmapboundary(fill_color='aqua')
        m.fillcontinents(color='coral',lake_color='aqua')
        ptcolor = 'red'
        lncolor = 'blue'
        dscolor = 'red'
    elif mapstyle == '3':
        m.shadedrelief()
        ptcolor = 'red'
        lncolor = 'blue'
        dscolor = 'red'
    elif mapstyle == '4':
        m.bluemarble()
        ptcolor = 'red'
        lncolor = 'red'
        dscolor = 'red'
    elif mapstyle == '5':
        m.etopo()
        ptcolor = 'red'
        lncolor = 'red'
        dscolor = 'red'
    if os.path.isfile(sitearq) == True:
        xpt,ypt = m(sites['lon'],sites['lat'])
        m.plot(xpt,ypt,'bo')
    CS=m.nightshade(datas[idx].datetime, alpha=0.2)
    a, b =m(lon.value, stars[idx].dec.value)
    a = a*u.m
    b = b*u.m
    dista = (dist[idx].to(u.km)*ca[idx].to(u.rad)).value*u.km
    disterr = (dist[idx].to(u.km)*erro.to(u.rad)).value*u.km
    vec = np.arange(0,7000,(np.absolute(vel[idx])*(60*u.s)).value)*u.km + np.absolute(vel[idx])*(60*u.s)
    vec = np.concatenate((vec.value,-vec.value), axis=0)*u.km
    ax = a + dista*np.sin(pa[idx])
    ax2 = ax + vec*np.cos(pa[idx])
    ax3 = ax2 - tamanho/2*np.sin(pa[idx])
    ax4 = ax2 + tamanho/2*np.sin(pa[idx])
    ax5 = a + (dista-disterr)*np.sin(pa[idx]) + vec*np.cos(pa[idx])
    ax6 = a + (dista+disterr)*np.sin(pa[idx]) + vec*np.cos(pa[idx])
    by = b + dista*np.cos(pa[idx])
    by2 = by - vec*np.sin(pa[idx])
    by3 = by2 - tamanho/2*np.cos(pa[idx])
    by4 = by2 + tamanho/2*np.cos(pa[idx])
    by5 = b + (dista-disterr)*np.cos(pa[idx]) - vec*np.sin(pa[idx])
    by6 = b + (dista+disterr)*np.cos(pa[idx]) - vec*np.sin(pa[idx])
    xs, ys = m(lons1, lats1)
    xs = [i for i in xs if i < 1e+30]
    ys = [i for i in ys if i < 1e+30]
    m.plot(xs, ys, 'b')
    xt, yt = m(lons2, lats2)
    xt = [i for i in xt if i < 1e+30]
    yt = [i for i in yt if i < 1e+30]
    m.plot(xt, yt, 'b')
#    m.plot(ax,by, 'o', color=ptcolor, markersize=mapsize[0].value*20/46)
#    m.plot(ax2.to(u.m),by2.to(u.m), 'o', color=ptcolor, markersize=mapsize[0].value*8/46)
#    m.plot(ax3.to(u.m), by3.to(u.m), color=lncolor)
#    m.plot(ax4.to(u.m), by4.to(u.m), color=lncolor)
#    m.plot(ax5.to(u.m), by5.to(u.m), '--', color=dscolor, label='+-{} error'.format(erro))
#    m.plot(ax6.to(u.m), by6.to(u.m), '--', color=dscolor)
#    plt.legend(fontsize=mapsize[0].value*21/46)

    fig = plt.gcf()
    fig.set_size_inches(mapsize[0].to(u.imperial.inch).value, mapsize[1].to(u.imperial.inch).value)
    plt.title('-{} D={}- dots each 60 s <> offsets (mas): obj=({:.1f},{:.1f}), star=({:.1f},{:.1f})\n'
        .format(obj, tamanho, ob_off_ra[idx].value, ob_off_de[idx].value, st_off_ra[idx].value, st_off_de[idx].value), fontsize=mapsize[0].value*25/46, fontproperties='FreeMono', weight='bold')
    plt.xlabel('\n year-m-d    h:m:s UT     ra__dec__J2000__candidate    C/A    P/A    vel   Delta   R*   K*  long\n\
{}  {:02d} {:02d} {:07.4f} {:+02d} {:02d} {:06.3f} {:6.3f} {:6.2f} {:6.2f}  {:5.2f} {:5.1f} {:4.1f}  {:3.0f}'
        .format(datas[idx].iso, int(stars[idx].ra.hms.h), int(stars[idx].ra.hms.m), stars[idx].ra.hms.s, int(stars[idx].dec.dms.d), np.absolute(int(stars[idx].dec.dms.m)), np.absolute(stars[idx].dec.dms.s),
        ca[idx].value, pa[idx].value, vel[idx].value, dist[idx].value, magR[idx], magK[idx], longi[idx]), fontsize=mapsize[0].value*21/46, fontproperties='FreeMono', weight='bold')
    plt.savefig('{}_{}.png'.format(obj, datas[idx].isot),dpi=100)
    print 'Gerado: {}_{}.png'.format(obj, datas[idx].isot)
    plt.clf()
Esempio n. 7
0
off_de = ob_off_de - st_off_de
magR = [float(in_data[10].rsplit()[0])]
magK = [float(in_data[11].rsplit()[0])]
longi = [float(in_data[12].rsplit()[0])]
dca = off_ra * np.sin(pa) + off_de * np.cos(pa)
dt = int(((off_ra * np.cos(pa) - off_de * np.sin(pa)).to(u.rad) *
          dist.to(u.km) / vel).value) * u.s
ca = ca + dca
datas = datas + dt
idx = 0

paplus = ((pa > 90 * u.deg) and pa - 180 * u.deg) or pa

f.close()

lons1, lats1, lons2, lats2, clon, clat = calcfaixa(idx)

if os.path.isfile(sitearq) == True:
    sites = np.loadtxt(sitearq,
                       dtype={
                           'names': ('lat', 'lon', 'alt', 'nome'),
                           'formats': ('f8', 'f8', 'f8', 'S30')
                       })

###################### rodando o programa ######################

g = np.arange(int(-8000 / (np.absolute(vel[0].value))),
              int(8000 / (np.absolute(vel[0].value))), passofilme)
pool = Pool(processes=10)
pool.map(geramapa, g)
Esempio n. 8
0
off_ra = ob_off_ra - st_off_ra
off_de = ob_off_de - st_off_de
magR = [float(in_data[10].rsplit()[0])]
magK = [float(in_data[11].rsplit()[0])]
longi = [float(in_data[12].rsplit()[0])]
dca = off_ra*np.sin(pa) + off_de*np.cos(pa)
dt = int(((off_ra*np.cos(pa) - off_de*np.sin(pa)).to(u.rad)*dist.to(u.km)/vel).value)*u.s
ca = ca + dca
datas = datas + dt
idx = 0

paplus = ((pa > 90*u.deg) and pa - 180*u.deg) or pa

f.close()

lons1, lats1, lons2, lats2, clon, clat = calcfaixa(idx)

if os.path.isfile(sitearq) == True:
    sites = np.loadtxt(sitearq,  dtype={'names': ('lat', 'lon', 'alt', 'nome'), 'formats': ('f8', 'f8', 'f8', 'S30')})

###################### rodando o programa ######################

g = np.arange(int(-8000/(np.absolute(vel[0].value))), int(8000/(np.absolute(vel[0].value))) , passofilme)
pool = Pool(processes=10)
pool.map(geramapa, g)

os.system('ffmpeg -f image2 -r {} -sameq -i "{}_%05d.png" {}_{}.mp4'.format(fpsvideo, obj, obj, datas[0].isot))

os.system('notify-send "Terminou de gerar os mapas" --icon=dialog-information')