예제 #1
0
def add_message():
    content = request.get_json()
    new_plate = Plate(content['serial'])

    plates_list.append(new_plate)

    return "Plate registered"
예제 #2
0
파일: monkey.py 프로젝트: waskou/pylands
 def move(self, imposed_vel):
     self._vel = imposed_vel
     self._pos += self._vel
     self._monkey.location = self._pos
     plate = Plate(0.2, self._pos)
     self._platesTrail.append(plate)
     path = Path(self._pos - self._vel, self._pos)
     self._pathsTrail.append(path)
예제 #3
0
def read_maze(filename):
    with open(filename, 'r') as f:
        columns, rows = (map(int, f.readline().split(' ')))
        maze = [[None for i in range(columns)] for j in range(rows)]
        for i in range(rows):
            line = f.readline()
            for j in range(columns):
                maze[i][j] = Plate(line[j].strip(), (i, j))
    return maze
예제 #4
0
파일: monkey.py 프로젝트: waskou/pylands
 def __init__(self, pos, vel, acc):
     self._pos = pos
     self._vel = vel
     self._acc = acc
     bpy.ops.mesh.primitive_monkey_add(location = pos)
     bpy.context.object.scale *= 0.2
     self._monkey = bpy.context.object
     self._platesTrail = []
     self._pathsTrail = []
     initPlate = Plate(0.2, self._pos)
     self._platesTrail.append(initPlate)
예제 #5
0
    def __init__(self, plate, gap, direction=1, dielectric=None):
        """
		plate: the plate to start from. a copy will be made of plate offset from it
		gap > 0: the distance between the plates (in meters)
		direction: 1 or -1: direction is assumed to be along the shortest dimension of the plate
		"""
        self.plate1 = plate
        self.resistivity = plate.resistivity
        offset = direction * (gap + plate.thickness)
        self.plate2 = Plate(plate.vertex1 + offset,
                            plate.vertex2 + offset,
                            resistivity=self.resistivity)
예제 #6
0
def getSample(wellx, welly, rack, grid, pos):
    plate = Plate.lookup(grid, pos)
    if plate == None:
        plate = Plate(rack, grid, pos)
    wellname = "%c%d" % (ord('A') + welly - 1, wellx)
    well = plate.wellnumber(wellname)
    sample = Sample.lookupByWell(plate, well)
    if sample == None:
        sample = Sample("%s.%d.%d.%d" % (rack, grid, pos, well), plate, well)
        if grid == 3:
            sample.volume = 20000  # Troughs
        else:
            sample.volume = 0
    return sample
예제 #7
0
    def start_plates(self, plate_count):
        size = self.size
        for p in xrange(plate_count):
            # random x, y point
            x = random.randint(0, size - 1)
            y = random.randint(0, size - 1)

            # No perfectly overlapping plates
            while self.world_map[x][y] != None:
                x = random.randint(0, size - 1)
                y = random.randint(0, size - 1)

            plate = Plate(p, (x,y), self.plate_symbols[p])
            self.plates.append(plate)
예제 #8
0
def enter():
    global background_image
    background_image = load_image(
        'image/sun_stage_scene/SunSceneBackGround1.png')
    global result_image
    result_image = load_image('image/sun_stage_scene/result.png')

    global plates
    plates = [
        Plate(351, 187, 286, 72,
              'image/sun_stage_scene/plate/sun_short_plate.png'),
        Plate(572, 346, 286, 72,
              'image/sun_stage_scene/plate/sun_short_plate.png'),
        Plate(189, 505, 286, 72,
              'image/sun_stage_scene/plate/sun_short_plate.png'),
        Plate(440, 37, 864, 73,
              'image/sun_stage_scene/plate/sun_long_plate.png')
    ]

    global astronaut
    astronaut = Astronaut(512, 500, 115)

    global sun
    sun = Sun()
예제 #9
0
def load_random_level(path, pos):
    with open(path, 'r') as f:
        levels = json.load(f)

        r = random.randrange(len(levels))
        lvl_obj = levels[r]

        raw_plates = np.array(lvl_obj['plates'])
        start = tuple(lvl_obj['start'])
        end = tuple(lvl_obj['end'])

        plates = np.empty((raw_plates.shape[1], raw_plates.shape[0]),
                          dtype=Plate)
        y = 0
        for row in raw_plates:
            for x in range(len(row)):
                plate_type = row[x]
                t = Plate.ROCK if plate_type == 0 else Plate.YELLOW
                plates[x, y] = Plate(
                    (x * Plate.SIZE[0] + pos[0], y * Plate.SIZE[1] + pos[1]),
                    type=t)
            y += 1

        return {"plates": plates, "start": start, "end": end}
예제 #10
0
파일: storage.py 프로젝트: bchan/OT2GUI
 def addPlate(self, plateName, rows, columns):
     plate = Plate(plateName, rows, columns)
     self.plates[plateName] = plate
예제 #11
0
import os
from plate import Plate
from sample import Sample
from liquidclass import LCBleachMix

############ Plates and plate locations  #############
WASHLOC = Plate("Wash", 1, 2, 1, 8, False, 0)
# Use dimensional data from Robot/Calibration/20150302-LiquidHeights
REAGENTPLATE = Plate("Reagents",
                     18,
                     1,
                     6,
                     5,
                     False,
                     unusableVolume=20,
                     maxVolume=1700,
                     zmax=569,
                     angle=17.5,
                     r1=4.05,
                     h1=17.71,
                     v0=12.9)
MAGPLATELOC = Plate(
    "MagPlate",
    18,
    2,
    12,
    8,
    False,
    unusableVolume=9,
    maxVolume=200,
    zmax=1459,
예제 #12
0
        while True:
            data = conn.recv(2048)

            # print(data)
            if not data:
                break
            try:
                unicode_text = data.decode('utf-8')
                # print(unicode_text)
                result = json.loads(unicode_text)

                plate = result['results'][0]['plate']
                entrance_time = result['epoch_time']  # convert time?
                confidence = result['results'][0]['confidence']
                location = result['site_id']
                candidates = result['results'][0]['candidates']
                processing_time = result['processing_time_ms']
                plate_processing = result['results'][0]['processing_time_ms']

                myplate = Plate(plate, entrance_time, confidence, location,
                                candidates, processing_time, plate_processing)
                myplate.debug_print()
                try:
                    myplate.write_to_db()
                except Exception as e:
                    print("failed to write to db, ", e)
                conn.sendall(b"recieved plate")
            except Exception as e:
                print("Exception: ", e)
                conn.sendall(b"error")
예제 #13
0
import os
from plate import Plate
from sample import Sample
from liquidclass import LCBleachMix
from worklist import WASHLOC, QPCRLOC

############ Plates and plate locations  #############
#WASHLOC=Plate("Wash",1,2,1,8,False,0)   # Defined in worklist

# Use dimensional data from Robot/Calibration/20150302-LiquidHeights
#REAGENTPLATE=Plate("Reagents",18,1,6,5,False,unusableVolume=20,maxVolume=1700,zmax=569,angle=17.5,r1=4.062,h1=17.75,v0=13.7,slopex=-0.022,slopey=-0.038,gemDepth=24.45,gemArea=51.61,gemHOffset=-7.15,gemShape='v-shaped')  
#REAGENTPLATE=Plate("Reagents",18,1,6,5,False,unusableVolume=20,maxVolume=1700,zmax=569,angle=17.5,r1=4.062,h1=17.75,v0=13.7,slopex=-0.022,slopey=-0.038,gemDepth=13.83,gemArea=51.84,gemHOffset=0,gemShape='v-shaped')
REAGENTPLATE=Plate("Reagents",18,1,6,5,False,unusableVolume=20,maxVolume=1700,zmax=569,angle=17.5,r1=4.062,h1=17.75,v0=13.7,slopex=-0.022,slopey=-0.038,gemDepth=9.59,gemArea=43.03,gemHOffset=0,gemShape='v-shaped')  
MAGPLATELOC=Plate("MagPlate",18,2,12,8,False,unusableVolume=9,maxVolume=200,zmax=1459,angle=17.5,r1=2.80,h1=10.04,v0=10.8)   # HSP9601 on magnetic plate  (Use same well dimensions as SAMPLE)
hspmaxspeeds={200:1400,150:1600,100:1850,50:2000,20:2200}	# From shaketest experiment
grenmaxspeeds={150:1750,125:1900,100:1950,75:2200,50:2200}	# From shaketest experiment
eppmaxspeeds={195:1600,150:1800,125:1900,100:1950,75:2050,50:2150,25:2150,0:2150} # From shaketest experiment 5/17/16
#eppdilmaxspeeds={195:1400,150:1600,125:1700,100:1750,75:1850,50:1950,25:1950,0:1950} # Decrease by 200 RPM 7/7/16 to avoid spilling
#eppmaxspeeds={195:0,150:1150,138:1250,100:1350,75:1850,50:1950,25:1950,0:1950} # Decrease based on 9/23/16 testing with MTaq
eppglycerolmaxspeeds={195:0,150:1150,138:1250,100:1350,90:1450,80:1500,70:1550,60:1650,50:1750,40:1950,20:2000,0:2000} # Decrease based on 10/21/16 testing with MTaq (with Glycerol @ 0.5%)
eppminspeeds={20:1900,32:1800,64:1700,96:1400,150:1100}  # 1100@150ul untested

SAMPLEPLATE=Plate("Samples",4,3,12,8,False,unusableVolume=15,maxVolume=200,
                zmax=1033,angle=17.5,r1=2.698,h1=9.31,v0=17.21,slopex=0.000,slopey=0.000,
                gemDepth=2.81,gemArea=16.41,
                gemShape='v-shaped',vectorName="Microplate Landscape",maxspeeds=eppmaxspeeds,minspeeds=eppminspeeds,glycerolmaxspeeds=eppglycerolmaxspeeds,glycerol=0.005)  # EppLoBind
SAMPLEPLATE.wells=SAMPLEPLATE.wells[1:-1]	 # Skip A1 and H12 due to leakage
SHAKERPLATELOC=Plate("Shaker",9,0,1,1)
QPCRPLATE=Plate("qPCR",QPCRLOC.grid,QPCRLOC.pos,12,8,False,unusableVolume=15,maxVolume=200,
                zmax=996,angle=17.5,r1=2.704,h1=10.89,v0=0.44,slopex=0.000,slopey=0.000,gemDepth=3.17,gemArea=14.33,
                gemShape='v-shaped')
예제 #14
0
from plate import Plate
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton

from util import config

plate = Plate(root=config.LANGUAGES_DIR)


def get_message(message_name: str, language_name: str = 'en_US', **kwargs):
    try:
        return plate(message_name, language_name, **kwargs)
    except ValueError:
        return plate(message_name, 'en_US', **kwargs)


def create_keyboard(is_group: bool,
                    back: InlineKeyboardButton,
                    settings=None) -> InlineKeyboardMarkup:
    keyboard = [[]]

    for lang in plate.locales:
        if len(keyboard[-1]) >= 3:
            keyboard.append([])

        flag = plate('flag', lang)
        keyboard[-1].append(
            InlineKeyboardButton(
                flag,
                callback_data=
                f'language_{f"g_{settings.id}" if is_group else "p"}_{lang}'))
예제 #15
0
LOCAL.FLOOD_PERCENTAGE = anti_flood_wait_config.getint("flood_percentage")
LOCAL.BAN_TIME = anti_flood_wait_config.getint("ban_time")
LOCAL.DELETE_MESSAGES = anti_flood_wait_config.getboolean("delete_messages")
LOCAL.FLOOD_NOTICE = anti_flood_wait_config.get("flood_notice")
LOCAL.PURGE_POLLING_RATE = anti_flood_wait_config.getint("purge_polling_rate")
LOCAL.INACTIVE_THRESHOLD = anti_flood_wait_config.getint("inactive_threshold")
LOCAL.FLOOD_WAITED = filters.user()
LOCAL.OWNER_ID = bot_config.getint("owner_id")
LOCAL.DB_URI = database_config.get("db_uri")
LOCAL.DB_POOL_SIZE = (database_config.getint("min_pool_size"),
                      database_config.getint("max_pool_size"))
logging.basicConfig(format=logging_config.get("format"),
                    datefmt=logging_config.get("date_format"))
LOCAL.LOGGER = logging.getLogger("Kanri")
LOCAL.LOGGER.setLevel(logging_config.getint("level"))
LOCAL.PLATE = Plate()
LOCAL.HTTP_SESSION = aiohttp.ClientSession()
# TODO: move this to the database for per-user translations.
LOCAL.DEFAULT_LANG = lang_config.get("default")
LOCAL.APP = Client(":memory:", config_file="config.ini")


async def set_bot():
    """
    Sets the bot's own username and ID
    in the thread-local storage space
    """

    self = await LOCAL.APP.get_me()
    LOCAL.bot_id = self.id
    LOCAL.bot_name = self.first_name
예제 #16
0
SYSTEM_VERSION = "1.1a"
# Host OS version, can be the same as VERSION - also useless for a Bot
LANG_CODE = "en_US"
# Session lang_code
bot = Client(
    api_id=API_ID,
    api_hash=API_HASH,
    bot_token=BOT_TOKEN,
    plugins=PLUGINS_ROOT,
    session_name=SESSION_NAME,
    workers=WORKERS_NUM,
    device_model=DEVICE_MODEL,
    system_version=SYSTEM_VERSION,
    lang_code=LANG_CODE,
)
plate = Plate(root="BotBase/locales")
# endregion

# region Logging configuration
# To know more about what these options mean, check https://docs.python.org/3/library/logging.html

LOGGING_FORMAT = (
    "[%(levelname)s %(asctime)s] In thread '%(threadName)s', "
    f"module %(module)s, function %(funcName)s at line %(lineno)d -> [{SESSION_NAME}] %(message)s"
)
DATE_FORMAT = "%d/%m/%Y %H:%M:%S %p"
LOGGING_LEVEL = 30
# endregion

# region Start module
# P.S.: {mention} in the GREET message will be replaced with a mention to the user, same applies for {id} and {username}
예제 #17
0
    def create3DColFlangeBeamWeb(self):
        '''
        Creating 3d cad model with column flange beam web connection

        '''
        # self.dictbeamdata  = self.fetchBeamPara()
        # self.resultObj = self.call_finCalculation()
        fillet_length = self.resultObj['Plate']['height']
        fillet_thickness = self.resultObj['Weld']['thickness']
        plate_width = self.resultObj['Plate']['width']
        plate_thick = self.uiObj['Plate']['Thickness (mm)']
        ##### BEAM PARAMETERS #####
        beam_D = int(self.dictbeamdata[QString("D")])
        beam_B = int(self.dictbeamdata[QString("B")])
        beam_tw = float(self.dictbeamdata[QString("tw")])
        beam_T = float(self.dictbeamdata[QString("T")])
        beam_alpha = float(self.dictbeamdata[QString("FlangeSlope")])
        beam_R1 = float(self.dictbeamdata[QString("R1")])
        beam_R2 = float(self.dictbeamdata[QString("R2")])
        beam_length = 500.0  # This parameter as per view of 3D cad model

        # beam = ISectionold(B = 140, T = 16,D = 400,t = 8.9, R1 = 14, R2 = 7, alpha = 98,length = 500)
        beam = ISection(B=beam_B,
                        T=beam_T,
                        D=beam_D,
                        t=beam_tw,
                        R1=beam_R1,
                        R2=beam_R2,
                        alpha=beam_alpha,
                        length=beam_length,
                        notchObj=None)

        ##### COLUMN PARAMETERS ######

        column_D = int(self.dictcoldata[QString("D")])
        column_B = int(self.dictcoldata[QString("B")])
        column_tw = float(self.dictcoldata[QString("tw")])
        column_T = float(self.dictcoldata[QString("T")])
        column_alpha = float(self.dictcoldata[QString("FlangeSlope")])
        column_R1 = float(self.dictcoldata[QString("R1")])
        column_R2 = float(self.dictcoldata[QString("R2")])

        # column = ISectionold(B = 83, T = 14.1, D = 250, t = 11, R1 = 12, R2 = 3.2, alpha = 98, length = 1000)
        column = ISection(B=column_B,
                          T=column_T,
                          D=column_D,
                          t=column_tw,
                          R1=column_R1,
                          R2=column_R2,
                          alpha=column_alpha,
                          length=1000,
                          notchObj=None)

        #### WELD,PLATE,BOLT AND NUT PARAMETERS #####

        fillet_length = self.resultObj['Plate']['height']
        fillet_thickness = self.resultObj['Weld']['thickness']
        plate_width = self.resultObj['Plate']['width']
        plate_thick = self.uiObj['Plate']['Thickness (mm)']
        bolt_dia = self.uiObj["Bolt"]["Diameter (mm)"]
        bolt_r = bolt_dia / 2
        # bolt_R = self.boltHeadDia_Calculation(bolt_dia) /2
        bolt_R = self.bolt_R
        # bolt_R = bolt_r + 7
        nut_R = bolt_R
        # bolt_T = self.boltHeadThick_Calculation(bolt_dia)
        bolt_T = self.bolt_T
        # bolt_T = 10.0 # minimum bolt thickness As per Indian Standard
        # bolt_Ht = self.boltLength_Calculation(bolt_dia)
        bolt_Ht = self.bolt_Ht
        # bolt_Ht =100.0 # minimum bolt length as per Indian Standard
        # nut_T = self.nutThick_Calculation(bolt_dia)# bolt_dia = nut_dia
        nut_T = self.nut_T
        # nut_T = 12.0 # minimum nut thickness As per Indian Standard
        nut_Ht = 12.2  #

        # plate = Plate(L= 300,W =100, T = 10)
        plate = Plate(L=fillet_length, W=plate_width, T=plate_thick)

        # Fweld1 = FilletWeld(L= 300,b = 6, h = 6)
        Fweld1 = FilletWeld(L=fillet_length,
                            b=fillet_thickness,
                            h=fillet_thickness)

        # bolt = Bolt(R = bolt_R,T = bolt_T, H = 38.0, r = 4.0 )
        bolt = Bolt(R=bolt_R, T=bolt_T, H=bolt_Ht, r=bolt_r)

        # nut =Nut(R = bolt_R, T = 10.0,  H = 11, innerR1 = 4.0, outerR2 = 8.3)
        nut = Nut(R=bolt_R, T=nut_T, H=nut_Ht, innerR1=bolt_r)

        gap = beam_tw + plate_thick + nut_T

        nutBoltArray = NutBoltArray(self.resultObj, nut, bolt, gap)

        colflangeconn = ColFlangeBeamWeb(column, beam, Fweld1, plate,
                                         nutBoltArray)
        colflangeconn.create_3dmodel()
        return colflangeconn
예제 #18
0
import sys
from typing import Union, Dict

from pony.orm import *
from plate import Plate
from pyrogram import filters, Client
from pyrogram.errors import RPCError
from pyrogram.types import Message
from main import DATA_FILE, data

sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
__logger = logging.getLogger(__name__)

messages = dict()
DB = Database()
MSG = Plate(f'.{os.sep}Data{os.sep}language')
COMMANDS = {
    c: [MSG(c, i) for i in MSG.locales.keys()]
    for c in ('block', 'unblock', 'promote', 'demote', 'group', 'remove_group',
              'welcome', 'settings')
}


# ==================================== DB ====================================
class User(DB.Entity):
    """
    User entity type to represent Telegram user
    """
    uid = PrimaryKey(int, size=64)
    is_admin = Required(bool)
    language = Required(str)
예제 #19
0
"Module for generating a worklist from a set of commands"
import math
import string
import shutil
from zlib import crc32

from plate import Plate
import clock
import logging

WASHLOC = Plate(
    "Wash", 1, 2, 1, 8, False, 0
)  # Duplicate of what's in decklayout.py -- but don't want to include all those dependencies...
QPCRLOC = Plate(
    "qPCR", 4, 1, 12, 8, False, 0
)  # Duplicate of what's in decklayout.py -- but don't want to include all those dependencies...

DITI200 = 0
DITI10 = 2
OPEN = 0
CLOSE = 1
DONOTMOVE = 2
SAFETOEND = 0
ENDTOSAFE = 1

lnum = 0
debug = False
wlist = []
volumes = {}
diticnt = [0, 0, 0, 0]  # Indexed by DiTi Type
delayEnabled = False
예제 #20
0
    def create3DBeamWebBeamWeb(self):
        '''self,uiObj,resultObj,dictbeamdata,dictcoldata):
        creating 3d cad model with beam web beam web

        '''
        ##### PRIMARY BEAM PARAMETERS #####
        pBeam_D = int(self.dictcoldata[QString("D")])
        pBeam_B = int(self.dictcoldata[QString("B")])
        pBeam_tw = float(self.dictcoldata[QString("tw")])
        pBeam_T = float(self.dictcoldata[QString("T")])
        pBeam_alpha = float(self.dictcoldata[QString("FlangeSlope")])
        pBeam_R1 = float(self.dictcoldata[QString("R1")])
        pBeam_R2 = float(self.dictcoldata[QString("R2")])
        pBeam_length = 800.0  # This parameter as per view of 3D cad model

        # beam = ISectionold(B = 140, T = 16,D = 400,t = 8.9, R1 = 14, R2 = 7, alpha = 98,length = 500)
        column = ISection(B=pBeam_B,
                          T=pBeam_T,
                          D=pBeam_D,
                          t=pBeam_tw,
                          R1=pBeam_R1,
                          R2=pBeam_R2,
                          alpha=pBeam_alpha,
                          length=pBeam_length,
                          notchObj=None)

        ##### SECONDARY BEAM PARAMETERS ######

        sBeam_D = int(self.dictbeamdata[QString("D")])
        sBeam_B = int(self.dictbeamdata[QString("B")])
        sBeam_tw = float(self.dictbeamdata[QString("tw")])
        sBeam_T = float(self.dictbeamdata[QString("T")])
        sBeam_alpha = float(self.dictbeamdata[QString("FlangeSlope")])
        sBeam_R1 = float(self.dictbeamdata[QString("R1")])
        sBeam_R2 = float(self.dictbeamdata[QString("R2")])

        # --Notch dimensions
        notchObj = Notch(R1=pBeam_R1,
                         height=(pBeam_T + pBeam_R1),
                         width=((pBeam_B - (pBeam_tw + 40)) / 2.0 + 10),
                         length=sBeam_B)
        # column = ISectionold(B = 83, T = 14.1, D = 250, t = 11, R1 = 12, R2 = 3.2, alpha = 98, length = 1000)
        beam = ISection(B=sBeam_B,
                        T=sBeam_T,
                        D=sBeam_D,
                        t=sBeam_tw,
                        R1=sBeam_R1,
                        R2=sBeam_R2,
                        alpha=sBeam_alpha,
                        length=500,
                        notchObj=notchObj)

        #### WELD,PLATE,BOLT AND NUT PARAMETERS #####

        fillet_length = self.resultObj['Plate']['height']
        fillet_thickness = self.resultObj['Weld']['thickness']
        plate_width = self.resultObj['Plate']['width']
        plate_thick = self.uiObj['Plate']['Thickness (mm)']
        bolt_dia = self.uiObj["Bolt"]["Diameter (mm)"]
        bolt_r = bolt_dia / 2
        bolt_R = self.bolt_R
        nut_R = bolt_R
        bolt_T = self.bolt_T
        bolt_Ht = self.bolt_Ht
        nut_T = self.nut_T
        nut_Ht = 12.2  # 150

        # plate = Plate(L= 300,W =100, T = 10)
        plate = Plate(L=fillet_length, W=plate_width, T=plate_thick)

        # Fweld1 = FilletWeld(L= 300,b = 6, h = 6)
        Fweld1 = FilletWeld(L=fillet_length,
                            b=fillet_thickness,
                            h=fillet_thickness)

        # bolt = Bolt(R = bolt_R,T = bolt_T, H = 38.0, r = 4.0 )
        bolt = Bolt(R=bolt_R, T=bolt_T, H=bolt_Ht, r=bolt_r)

        # nut =Nut(R = bolt_R, T = 10.0,  H = 11, innerR1 = 4.0, outerR2 = 8.3)
        nut = Nut(R=bolt_R, T=nut_T, H=nut_Ht, innerR1=bolt_r)

        gap = sBeam_tw + plate_thick + nut_T

        nutBoltArray = NutBoltArray(self.resultObj, nut, bolt, gap)
        beamwebconn = BeamWebBeamWeb(column, beam, notchObj, plate, Fweld1,
                                     nutBoltArray)
        beamwebconn.create_3dmodel()

        return beamwebconn
예제 #21
0
from pyrogram import Client
from plate import Plate
from configparser import ConfigParser


async def get_bot():
    global BotID, BotName, BotUsername
    self = await app.get_me()
    BotID = self.id
    BotName = self.first_name
    BotUsername = self.username


HELPABLE = {}  # TODO
FORMAT = "[%(levelname)s - %(asctime)s] -> %(message)s"
logging.basicConfig(level=logging.INFO, format=FORMAT, datefmt="%d/%m/%Y %T")
LOGGER = logging.getLogger("rich")
parser = ConfigParser()
parser.read("config.ini")
bot_config = parser["botconfig"]
OWNER_ID = bot_config.getint("OWNER_ID")
DB_URI = bot_config.get("DB_URI")
plate = Plate()
httpsession = aiohttp.ClientSession()
BotName = ""
BotUsername = ""
BotID = 0
# TODO: move this to the database for per-user translations.
tmp_lang = "en_US"
app = Client(":memory:", config_file="config.ini")
예제 #22
0

db = sqlite3.connect('/path/to/db')

db.row_factory = dict_factory
cur = db.cursor()
cur.execute("SELECT * FROM plates")
dbplates = cur.fetchall()
db.close()

plates = []

for dbplate in dbplates:
    print(dbplate['plate'])
    plate = Plate(dbplate['plate'], dbplate['entrance_time'],
                  dbplate['confidence'], dbplate['location'],
                  json.loads(dbplate['candidates']),
                  dbplate['processing_time'], dbplate['plate_processing'])
    plates.append(plate)

prev = None
first = None
newplates = []

for each in plates:
    if prev is None:
        first = each
        prev = each
    else:
        if float(prev.entrance_time) + float(prev.plate_processing) + float(
                prev.processing_time) >= float(each.entrance_time):
            print(each.entrance_time)
예제 #23
0
파일: test.py 프로젝트: fkeiler/CompGrafica
altura_cilindo = 2
raio_cilindro = 0.5
vetor_unitario_cilindro = Coordinate(0, 1, 0, 0)
centro_base_cilindro1 = Coordinate(1.4142, -2, -11.3137, 1)
centro_base_cilindro2 = Coordinate(-2.8284, -2, -15.5563, 1)

# Informações dos cones
altura_cone = 8
raio_cone = 2
vetor_unitario_cone = Coordinate(0, 1, 0, 0)
centro_base_cone1 = Coordinate(1.4142, 0, -11.3137, 1)
centro_base_cone2 = Coordinate(-2.8284, 0, -15.5563, 1)

# Inicializando raio e chapa
raio = Ray(p0)
chapa = Plate(tamanho_chapa, numero_furos_chapa, distancia_chapa)

# Inicializando objetos
cubo1 = Cube(centro_base_cubo1, aresta_cubo)
cubo2 = Cube(centro_base_cubo2, aresta_cubo)
cubo3 = Cube(centro_base_cubo3, aresta_cubo)
cilindro1 = Cylinder(centro_base_cilindro1, vetor_unitario_cilindro,
                     altura_cilindo, raio_cilindro)
cone1 = Cone(centro_base_cone1, vetor_unitario_cone, altura_cone, raio_cone)
cilindro2 = Cylinder(centro_base_cilindro2, vetor_unitario_cilindro,
                     altura_cilindo, raio_cilindro)
cone2 = Cone(centro_base_cone2, vetor_unitario_cone, altura_cone, raio_cone)

# Colorindo objetos para facilitar identificacao
cubo1.color = (46, 119, 187)
cubo2.color = (29, 131, 195)
예제 #24
0
def make_plate(params, inducer_conc):
    amount = inducer_conc * 1e-6  #milli moles

    agar_thickness = 3.12  # mm

    init_conc = amount / (w**2 * agar_thickness)  #mol/mm^3
    init_conc *= 1e6  # mM
    A_0 = init_conc

    D_N, mu_max, K_mu, gamma, D_A, \
    alpha_T, beta_T, K_IT, n_IT, K_lacT, T7_0, \
    alpha_R, beta_R, K_IR, n_IR, K_lacR, R_0, \
    alpha_G, beta_G, n_A, K_A, n_R, K_R, X_0, G_s = params

    ## Create our environment
    plate = Plate(environment_size)

    dist = 4.5  # mm
    centre = plate_width / 2
    receiver_radius = 2
    receiver_pos = [[centre - i * dist, centre] for i in range(1, 4)]
    receiver_pos.extend([[centre + i * dist, centre] for i in range(1, 4)])
    receiver_pos.extend([[centre, centre + i * dist] for i in range(1, 4)])
    receiver_pos.extend([[centre, centre - i * dist] for i in range(1, 4)])
    receiver_coordinates = get_node_coordinates(receiver_pos, receiver_radius,
                                                environment_size[0],
                                                environment_size[1], w)
    rows = receiver_coordinates[:, 0]
    cols = receiver_coordinates[:, 1]

    receiver_flags = np.zeros(environment_size)
    receiver_flags[rows, cols] = 1

    ## add nutrient to the plate
    U_N = np.ones(environment_size) * N_0
    N = Species("N", U_N)

    def N_behaviour(t, species, params):
        ## unpack params
        D_N, mu_max, K_mu, gamma, D_A, \
        alpha_T, beta_T, K_IT, n_IT, K_lacT, T7_0, \
        alpha_R, beta_R, K_IR, n_IR, K_lacR, R_0, \
        alpha_G, beta_G, n_A, K_A, n_R, K_R, X_0, G_s = params

        #mu = mu_max * np.maximum(0, species['N']) / (K_mu + np.maximum(0,species['N'])) * np.maximum(0,species['X'])
        #print(np.max(mu))
        mu = dx(t, species) * receiver_flags
        #print('mu', mu)
        n = D_N * hf.ficks(np.maximum(0, species['N']), w) - mu / gamma
        return n

    N.set_behaviour(N_behaviour)
    plate.add_species(N)

    ## add one strain to the plate
    U_X = np.zeros(environment_size)

    U_X[rows, cols] = X_0

    strain = Species("X", U_X)

    def X_behaviour(t, species, params):
        ## unpack params

        #mu = mu_max * np.maximum(0, species['N']) / (K_mu + np.maximum(0, species['N'])) * np.maximum(0,species['X'])
        mu = dx(t, species) * receiver_flags
        return mu

    strain.set_behaviour(X_behaviour)
    plate.add_species(strain)

    ## add IPTG to plate
    #inducer_position = [[int(j * (4.5/w)) for j in i] for i in inducer_positions  # convert position to specified dims

    U_A = np.zeros(environment_size)
    U_A[inducer_position[0], inducer_position[1]] = A_0

    A = Species("A", U_A)

    def A_behaviour(t, species, params):
        ## unpack params
        D_N, mu_max, K_mu, gamma, D_A, \
        alpha_T, beta_T, K_IT, n_IT, K_lacT, T7_0, \
        alpha_R, beta_R, K_IR, n_IR, K_lacR, R_0, \
        alpha_G, beta_G, n_A, K_A, n_R, K_R, X_0, G_s = params

        a = D_A * hf.ficks(np.maximum(0, species['A']), w)
        return a

    A.set_behaviour(A_behaviour)
    plate.add_species(A)

    #add T7 to the plate
    U_T7 = np.ones(environment_size) * T7_0
    T7 = Species("T7", U_T7)

    def T7_behaviour(t, species, params):
        D_N, mu_max, K_mu, gamma, D_A, \
        alpha_T, beta_T, K_IT, n_IT, K_lacT, T7_0, \
        alpha_R, beta_R, K_IR, n_IR, K_lacR, R_0, \
        alpha_G, beta_G, n_A, K_A, n_R, K_R, X_0, G_s = params

        mu = dx(t, species) * receiver_flags

        dT7 = (alpha_T * mu *
               (1 + (np.maximum(0, species['A']) / K_IT)**n_IT)) / (
                   1 + (np.maximum(0, species['A']) / K_IT)**n_IT +
                   K_lacT) + beta_T * mu - mu * np.maximum(0, species['T7'])

        return dT7

    T7.set_behaviour(T7_behaviour)
    plate.add_species(T7)

    ## add GFP to plate
    U_G = np.ones(environment_size) * GFP_0
    G = Species("G", U_G)

    def G_behaviour(t, species, params):
        ## unpack params
        D_N, mu_max, K_mu, gamma, D_A, \
        alpha_T, beta_T, K_IT, n_IT, K_lacT, T7_0, \
        alpha_R, beta_R, K_IR, n_IR, K_lacR, R_0,\
        alpha_G, beta_G, n_A, K_A, n_R, K_R, X_0, G_s = params

        #mu = mu_max * np.maximum(0, species['N']) / (K_mu + np.maximum(0, species['N'])) * np.maximum(0,species['X'])

        mu = dx(t, species) * receiver_flags

        #T7 = alpha_T + beta_T - alpha_T * K_lacT / (1 + (np.maximum(0, species['A']) / K_IT)**n_IT + K_lacT) + T7_0 * np.exp(-mu * t)

        #T7 = alpha_T + beta_T - alpha_T * K_lacT / (1 + (np.maximum(0, species['A']) / K_IT)**n_IT + K_lacT) + T7_0 * np.exp(-mu * t) #rescaled
        T7 = np.maximum(0, species['T7'])
        #print(np.max(T7))
        #R = alpha_R + beta_R - alpha_R * K_lacR / (1 + (np.maximum(0, species['A']) / K_IR)**n_IR + K_lacR) + R_0 * np.exp(-mu * t)
        #R = alpha_R + beta_R - alpha_R * K_lacR / (1 + (np.maximum(0, species['A']) / K_IR)**n_IR + K_lacR) + R_0 * np.exp(-mu * 1e8 * t) #rescaled
        R = 0  # produces treshold

        T7**n_A / (K_A**n_A + T7**n_A)

        K_R**n_R / (K_R**n_R + R**n_R)
        #dGFP = alpha_G * mu * T7**n_A / (K_A**n_A + T7**n_A) * K_R**n_R / (K_R**n_R + R**n_R) + beta_G * mu - np.maximum(0, species['G']) * mu*G_s
        dGFP = alpha_G * mu * T7**n_A / (K_A**n_A +
                                         T7**n_A) + beta_G * mu - np.maximum(
                                             0, species['G']) * mu * G_s

        return dGFP

    G.set_behaviour(G_behaviour)
    plate.add_species(G)

    return plate