How to use _get_eq method in autotest

Best Python code snippet using autotest_python

equipment_controller.py

Source:equipment_controller.py Github

copy

Full Screen

...8 is_item_owner = owner_id == user.user_id9 is_admin = user == trip.admin10 return user_has_role or is_item_owner or is_admin11 @staticmethod12 def _get_eq(equipment_id):13 eq = current_app.models.Equipment.get_equipment_by_id(equipment_id)14 return eq15 @staticmethod16 def _get_user(user_id):17 user = current_app.models.User.get_user_by_id(user_id)18 return user19 @staticmethod20 def _get_trip(trip_id):21 trip = current_app.models.Trip.get_trip_by_id(trip_id)22 return trip23 @classmethod24 def get_equipment_data(cls, equipment_id):25 equipment = cls._get_eq(equipment_id)26 user = cls._get_user(g.user_id)27 if equipment.trip in user.trips:28 return equipment, 20129 return 'You are not member of current trip', 40230 @classmethod31 def update_equipment(cls, equipment_id, data):32 item = cls._get_eq(equipment_id)33 if cls._user_has_privileges(item.trip_id, item.role_id, item.owner_id):34 response = current_app.models.Equipment.update_equipment(equipment_id, data)35 return response, 20136 return 'You dont have rights', 40237 @classmethod38 def delete_equipment(cls, equipment_id):39 item = cls._get_eq(equipment_id)40 if cls._user_has_privileges(item.trip_id, item.role_id, item.owner_id):41 response = current_app.models.Equipment.delete_equipment(equipment_id)42 return response, 20143 return 'You dont have rights', 40244 @classmethod45 def create_equipment(cls, data):46 if cls._user_has_privileges(data['trip_id'], data.get('role_id'), data.get('owner_id')):47 response = current_app.models.Equipment.create_equipment(data)48 return response, 20149 return 'You dont have rights', 40250 @classmethod51 def assign_equipment_to_users(cls, equipment_id, users_eq_amount):52 equipment = cls._get_eq(equipment_id)53 user = cls._get_user(g.user_id)54 target_users = [cls._get_user(u_eq['user_id']) for u_eq in users_eq_amount]55 trip = cls._get_trip(equipment.trip_id)56 user_has_role = equipment.role_id in (role.id for role in user.roles)57 is_admin = user == trip.admin58 target_users_in_trip = cls._check_if_users_in_trip(target_users, trip)59 if (user_has_role or is_admin) and target_users_in_trip:60 target_equipment_amount = cls._get_incoming_eq_amount(equipment_id, users_eq_amount)61 if equipment.quantity < target_equipment_amount:62 return 'Too many items to dispense', 40963 for user_eq_amount in users_eq_amount:64 current_app.models.EquipmentUser.assign_equipment_to_user(65 user_eq_amount['user_id'], equipment_id, user_eq_amount['equipment_amount']66 )...

Full Screen

Full Screen

mll.py

Source:mll.py Github

copy

Full Screen

...29 phi = 0.0430 I_ampl = 9031 I = current.constant(tmax_I, dt, I_ampl)32 return MorrisLecar(I, phi, C, gL, gCa, gK, VL, VCa, VK, V1, V2, V3, V4, dt, stochastic='euler', Nk=Nk)33def _get_eq(neuron, dt):34 eq0 = np.array([-30, 0.13])35 dist = np.array([0.1, 0.001])36 tmax1 = 1000.037 tmax2 = 1100.038 return dyn.get_fixed_pt(neuron, eq0, tmax1, tmax2, dist, dt)39def main():40 ## 1. Generate neurons ##41 dt = 0.142 neuron = _gen_neuron(dt)43 mll = neuron.gen_model(MorrisLecarLin)44 ## 2. Get equilibrium point ##45 eq = _get_eq(neuron, dt)46 dv = 0.247 dw = 0.00248 ## 3. Initialize MLL ##49 mll.init(eq, dv, dw)50 ## 4. Generate signal ##51 tmax = 200.052 x0 = np.array([-25, 0.13])53 t = time.time()54 x = mll.signal(tmax, x0)55 print(f'Computation time: {time.time() - t}')56 ## 5. Plot results ##57 plot.tr(x[:,0], dt)58 plt.xlabel('t')59 plt.ylabel('v')...

Full Screen

Full Screen

mlj.py

Source:mlj.py Github

copy

Full Screen

...29 phi = 0.0430 I_ampl = 9031 I = current.constant(tmax_I, dt, I_ampl)32 return MorrisLecar(I, phi, C, gL, gCa, gK, VL, VCa, VK, V1, V2, V3, V4, dt, stochastic='euler', Nk=Nk)33def _get_eq(neuron, dt):34 eq0 = np.array([-30, 0.13])35 dist = np.array([0.1, 0.001])36 tmax1 = 1000.037 tmax2 = 1100.038 return dyn.get_fixed_pt(neuron, eq0, tmax1, tmax2, dist, dt)39def main():40 ## 1. Generate neurons ##41 dt = 0.142 neuron = _gen_neuron(dt)43 mlj = neuron.gen_model(MorrisLecarJacobi)44 ## 2. Get equilibrium point ##45 eq = _get_eq(neuron, dt)46 ## 3. Initialize MLJ ##47 mlj.init(eq)48 ## 4. Generate signal ##49 tmax = 200.050 x0 = np.array([-25, 0.13])51 t = time.time()52 x = mlj.signal(tmax, x0)53 print(f'Computation time: {time.time() - t}')54 ## 5. Plot results ##55 plot.tr(x[:,0], dt)56 plt.xlabel('t')57 plt.ylabel('v')58 plt.figure()59 plot.pp(x)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful