Exemplo n.º 1
0
 def __init__(self):
     self.new_tool = Tools()
     self.matrix_play = []
     self.row = 0
     self.column = 0
     self.value = 0
     self.new_menu = Menus()
     self.return_game = ""
     self.boards = integrator.integrator()
Exemplo n.º 2
0
def some_func(bot, update):
    pass
    if not update.effective_message.photo:
        update.effective_message.reply_text(
            text="This bot is only capable of Computer Vision Tasks!")
    else:
        msg = update.effective_message
        file_id = msg.photo[-1].file_id
        photo = bot.get_file(file_id)
        download_image(photo["file_path"], 'wassup')
        update.effective_message.reply_text(
            text=i.beautify(i.integrator('wassup.jpeg')))
Exemplo n.º 3
0
 def __init__(self):
     """
     Constructs the SIS response function class
     """
     self.Igap = 1.0
     self.Vgap = 1.0
     self.Rn = 1.0
     self.yIntercept = 0.0
     self.noPoints = 201
     self.__bias__ = 0.0  # used in calculating the KK transform
     self.__ikk__ = range(self.noPoints)
     self.__idc__ = range(self.noPoints)
     self.__vdc__ = range(self.noPoints)
     self.__Int__ = integrator.integrator()
     self.__Int__.__jMax__ = 12
     self.__KK_vMax__ = 10.0
     self.separator = "\t"  # data value separator in idc and ikk files
Exemplo n.º 4
0
 def test_failsdifferenttend(self):
   int_c = integrator(self.int_coarse.tstart, 1e-10+self.int_coarse.tend, self.int_coarse.nsteps)
   with self.assertRaises(AssertionError):
     ts = timeslice(self.int_fine, int_c, 1e-10, 5)   
Exemplo n.º 5
0
generate_x_vs_t = False
generate_x_vs_h = False
generate_x_vs_a = False
generate_x_vs_x0 = False
generate_ibar = False
generate_xyz_vs_t = False

# Get a simulator, an integrator, and a analytic
simulator = sim.Simulator(n=n,
                          x0=x0,
                          El=El,
                          Eh=Eh,
                          a=a,
                          alpha=alpha,
                          num_groups=num_groups)
integrator = integ.integrator(n=n, x0=x0, Eh=Eh, El=El, a=a, alpha=alpha, h=h)
analytic = an.analytic(n=n, x0=x0, Eh=Eh, El=El, a=a, alpha=alpha, h=h)
simulator_cont = sim_cont.Simulator(n=n,
                                    x0=x0,
                                    min_effort=El,
                                    max_effort=Eh,
                                    a=a,
                                    alpha=alpha,
                                    num_groups=num_groups)
simulator_tri = sim_tri.Simulator(n=n,
                                  x0=x0,
                                  y0=y0,
                                  El=El,
                                  Em=Em,
                                  Eh=Eh,
                                  a=a,
Exemplo n.º 6
0
import sys
sys.setrecursionlimit(10000)

a = 0
b = 1

nevals = 0


def f1(x):
    global nevals
    nevals += 1
    return np.sqrt(x)


integral1 = integrator(f1)
Q = integral1.adaptive_trapz(a, b)
print('Function:\t\t f(x) = sqrt(x)')
print('Absolute accuracy:\t', 1e-4)
print('Relative accuracy:\t', 1e-4)
print('Integral bounds:\t', a, 4)
print('Integrand evaluations: \t', nevals)
print('Numeric integral:\t', Q)
print('Analytic integral: \t', 2 / 3)
print('')

nevals = 0


def f2(x):
    global nevals
Exemplo n.º 7
0
    def test_integrate_x_squared(self):
        f = lambda x: x ** 2

        integrated = integrator(f, 0, 1, n_steps=10 ** 5)
        npt.assert_allclose(integrated, 1 / 3, rtol=1e-4)
Exemplo n.º 8
0
    def test_integrate_planck(self):
        T = 300
        integrated = integrator(B_nu, 1e6, 1e16, T, n_steps=10 ** 5)
        analytic = B(T)

        npt.assert_allclose(integrated, analytic, rtol=1e-4)
Exemplo n.º 9
0
    def test_integrate_planck(self):
        T = 300
        integrated = integrator(B_nu, 1e6, 1e16, T, n_steps=10**5)
        analytic = B(T)

        npt.assert_allclose(integrated, analytic, rtol=1e-4)
Exemplo n.º 10
0
 def test_failgenericrun(self):
   integ = integrator(self.t[0], self.t[1], self.nsteps)
   sol   = solution(np.array([-1]))
   with self.assertRaises(NotImplementedError):
     integ.run(sol)
Exemplo n.º 11
0
 def test_nstepfloatfail(self):
   with self.assertRaises(AssertionError):
     integ = integrator(0.0, 1.0, 1.15)
Exemplo n.º 12
0
 def test_nstepnegativefail(self):
   with self.assertRaises(AssertionError):
     integ = integrator(0.0, 1.0, -10)
Exemplo n.º 13
0
 def test_wrongboundsfail(self):
   with self.assertRaises(AssertionError):
     integ = integrator(0.0, -1.0, 10)
Exemplo n.º 14
0
 def test_caninstantiate(self):
   integ = integrator(self.t[0], self.t[1], self.nsteps)
Exemplo n.º 15
0
    def test_integrate_x_squared(self):
        f = lambda x: x**2

        integrated = integrator(f, 0, 1, n_steps=10**5)
        npt.assert_allclose(integrated, 1 / 3, rtol=1e-4)
Exemplo n.º 16
0
 def test_failwrongu0(self):
   integ = integrator(self.t[0], self.t[1], self.nsteps)
   with self.assertRaises(AssertionError):
     integ.run(-1)
Exemplo n.º 17
0
import integrator
from MAV import MAV
import state_viewer
import matplotlib.pyplot as plt

my_mav = MAV('hw1_1')
my_mav.state0
my_mav.FMeq
[t, s] = integrator.integrator(my_mav)

state_viewer.open_GUI(t, s)