Example #1
0
def FindMovies(update, context):
    status_message = context.bot.sendMessage(
        chat_id=update.message.chat_id,
        text='Searching for similar movies ...')
    movie_label = update.message.text.split()[-1]
    try:
        movie = Movie(movie_label)
        movie.make()
    except FindMovieError as error:
        if error.code == 404:
            context.bot.sendMessage(
                chat_id=update.message.chat_id,
                text='Movie not found 🤷‍♂️\nAnother movie ? 🙄',
                reply_markup=reply_markup,
                parse_mode=telegram.ParseMode.HTML)
        else:
            context.bot.sendMessage(chat_id=update.message.chat_id,
                                    text='500 Internal Serevr Error !')
        return
    context.bot.sendPhoto(chat_id=update.message.chat_id,
                          photo=movie.thumb,
                          caption=make_movie_details_message(movie),
                          parse_mode=telegram.ParseMode.HTML)
    second_reply_markup = InlineKeyboardMarkup([[
        InlineKeyboardButton("Search Another Movie 🔎",
                             switch_inline_query_current_chat='')
    ]])
    context.bot.sendMessage(chat_id=update.message.chat_id,
                            text=make_similar_movies_message(movie),
                            reply_markup=second_reply_markup,
                            parse_mode=telegram.ParseMode.HTML,
                            disable_web_page_preview=True)
    status_message.delete()
    make_movie = not os.path.exists(avifn)

    if make_movie:
        mov = Movie(avifn)
        fig = plt.figure()

        for k in range(N_frames):
            plt.cla()
            plt.imshow(astack[k,:,:],interpolation='none',aspect='auto')
            plt.clim((smin,smax))
            if k==0:
                plt.colorbar()
            mov.add(fig)
            plt.pause(.1)

        mov.make()


    sz,sy,sx = stack.shape

    intervals = range(1,80)

    variances = []
    control_variances = []

    mads = []
    control_mads = []

    def cvar(mat,axis=0):
        a = np.angle(mat)
        X = np.cos(a)
Example #3
0
    make_movie = not os.path.exists(avifn)

    if make_movie:
        mov = Movie(avifn)
        fig = plt.figure()

        for k in range(N_frames):
            plt.cla()
            plt.imshow(astack[k, :, :], interpolation='none', aspect='auto')
            plt.clim((smin, smax))
            if k == 0:
                plt.colorbar()
            mov.add(fig)
            plt.pause(.1)

        mov.make()

    sz, sy, sx = stack.shape

    intervals = range(1, 80)

    variances = []
    control_variances = []

    mads = []
    control_mads = []

    def cvar(mat, axis=0):
        a = np.angle(mat)
        X = np.cos(a)
        Y = np.sin(a)
    ax4.plot(t,compv_list,'b')
    ax4.set_xlim((t1,t2))
    ax4.set_yticks(ax4.get_yticks()[:-2])
    ax4.set_ylabel('complex variance')

    for ax in ax_list[1:]:
        ax.axvline(now,c=[.5,.5,.5])
        fixticks(ax)
        
    m.add(fig)

    plt.close()
    print now


m.make()
sys.exit()

p1 = Phasor(1.0,np.pi/4.0)
p2 = Phasor(1.0,np.pi/3.0)
ax = plt.axes()
ax.set_xlim((-1,1))
ax.set_ylim((-1,1))
p1.plot_context(ax)
p1.plot(ax)
p2.plot(ax)
plt.show()
sys.exit()
        
        
for k in range(N_scatterers):
    ax4.plot(t, compv_list, 'b')
    ax4.set_xlim((t1, t2))
    ax4.set_yticks(ax4.get_yticks()[:-2])
    ax4.set_ylabel('complex variance')

    for ax in ax_list[1:]:
        ax.axvline(now, c=[.5, .5, .5])
        fixticks(ax)

    m.add(fig)

    plt.close()
    print now

m.make()
sys.exit()

p1 = Phasor(1.0, np.pi / 4.0)
p2 = Phasor(1.0, np.pi / 3.0)
ax = plt.axes()
ax.set_xlim((-1, 1))
ax.set_ylim((-1, 1))
p1.plot_context(ax)
p1.plot(ax)
p2.plot(ax)
plt.show()
sys.exit()

for k in range(N_scatterers):
    #x0 = np.random.rand()*xmax