Skip to content

Instantly share code, notes, and snippets.

View seifip's full-sized avatar
🧪
Working on colabra.app

Philip Seifi seifip

🧪
Working on colabra.app
View GitHub Profile
def create_dimers(design_pairs, sparse_factor=0.05, max_c=50, min_hard=25, min_soft=45, soft_threshold=0.8, rand_seed=seed):
num_observations, num_pairings = design_pairs.shape
inv_max_CT = max_c - min_hard
m_val = 1
c_at_threshold = max_c - min_soft + m_val
b_val = -np.log(1 - soft_threshold) / np.log(c_at_threshold / m_val)
dimer_distribution = sp.stats.bernoulli(sparse_factor)
import numpy as np
from scipy.stats.qmc import Sobol
dimensions = 42 # number of primers
seed = 1424
m = 8
num_codes = 2
sparse_factor = 0.125
def generate_sobol_samples(dimensions, seed, m, num_codes):
*** Keywords ***
Open cart
Click Link css:.wrong_class
Assert cart page
*** Settings ***
Library OperatingSystem
Library Orders
Library RPA.Browser
Library MyUtils
Library RobotLogListener
Variables variables.py
def _end_test(self, data, result):
if not result.passed:
current_order_id = BuiltIn().get_variable_value("${CURRENT_ORDER_ID}")
context = f"Order {current_order_id}" if current_order_id else "General"
log_to_bugsnag(result.message, 'error', context)
from robot.libraries.BuiltIn import BuiltIn
from RPA.core.helpers import required_param
from Logger import log_to_bugsnag
class RobotLogListener:
ROBOT_LIBRARY_SCOPE = 'GLOBAL'
ROBOT_LISTENER_API_VERSION = 3
def __init__(self):
self.ROBOT_LIBRARY_LISTENER = self
*** Keywords ***
Process order
[Arguments] ${order}
Set Suite Variable ${CURRENT_ORDER_ID} ${order["id"]}
Log Event 🤖 Started processing order info customer=${order["first_name"]} ${order["last_name"]} zip=${order["zip"]}
Reset application state
Open products page
Assert cart is empty
Wait Until Keyword Succeeds 3x 1s Add product to cart ${order}
Log Event 🛒 Added product to cart info name=${order["item"]}
*** Settings ***
Library OperatingSystem
Library Orders
Library RPA.Browser
Library MyUtils
Variables variables.py
from robot.libraries.BuiltIn import BuiltIn
from Logger import log_to_bugsnag
class MyUtils:
def log_event(self, message, severity='info', **details):
"""Logs message to Bugsnag.
Args:
severity (str): Log severity (error, warning, info)
message (str): Log message
*** Keywords ***
Process order
[Arguments] ${order}
Set Suite Variable ${CURRENT_ORDER_ID} ${order["id"]}
Reset application state
...