Esempio n. 1
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
Esempio n. 2
0
def add_message():
    content = request.get_json()
    new_plate = Plate(content['serial'])

    plates_list.append(new_plate)

    return "Plate registered"
Esempio n. 3
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)
Esempio n. 4
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}
Esempio n. 5
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.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')
# If changing location of QPCRPLATE, also update QPCRLOC in worklist.py
DILPLATE=Plate("Dilutions",4,2,12,8,False,unusableVolume=15,maxVolume=200,
               zmax=1033,angle=17.5,r1=2.705,h1=9.13,v0=13.14,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

SSDDILLOC=Plate("SSDDil",3,1,1,4,False,100,100000,zmax=1367,gemDepth=0,gemArea=1232,gemShape='flat')
WATERLOC=Plate("Water",3,2,1,4,False,100,100000,zmax=1367,gemDepth=0,gemArea=1232,gemShape='flat')
BLEACHLOC=Plate("Bleach",3,3,1,4,False,0,100000,zmax=1367,gemDepth=0,gemArea=1232,gemShape='flat')
PTCPOS=Plate("PTC",25,1,1,1)
Esempio n. 6
0
 def __init__(self, *args, **kwargs):
     super(ParametricStudy, self).__init__(*args, **kwargs)
     if 'plate' not in kwargs.keys():
         self.plate = Plate()
     self.plate.pstudy = self
Esempio n. 7
0
class ParametricStudy(YLPATreeNode):
    def __init__(self, *args, **kwargs):
        super(ParametricStudy, self).__init__(*args, **kwargs)
        if 'plate' not in kwargs.keys():
            self.plate = Plate()
        self.plate.pstudy = self

    plate = Instance(Plate)
    def _plate_changed(self):
        self.plate.pstudyref = self

    def __getstate__ (self):
        '''Overriding __getstate__ because of
        '''
        state = super(ParametricStudy, self).__getstate__()

        return state

    plate_changed = Event
    params_changed = Event

    node_params = List(Instance(Parameter), [])
    '''A list of tuples (base_value, (min, max))
    '''

    plate_params = List(Instance(Parameter), [])
    '''A list of tuples (base_value, (min, max))
    '''

    param_nodes = List(Instance(ParamNode), [])
    '''A list of tuples (node, trait_name, param_no, multiplier, base_value)
    '''

    param_plate = List(Instance(ParamPlate), [])
    '''A list of tuples (trait_name, param_no, multiplier, base_value)
    '''

    optimization_constrain_value = Float(0.01)

    def get_unit_work_ratio(self, vals):
        nds = self.plate.nodes_with_ref
        for pn in self.param_nodes_with_ref:
            val = pn.base_value + pn.multiplier * vals[pn.param_no - 1]
            setattr(nds[pn.node_no - 1], pn.trait_name, val)
        return self.plate.unit_work_ratio

    def get_unit_work_ratio_neg(self, vals):
        vals2 = [par[0] for par in self.node_params_with_ref]
        bds2 = [par[1] for par in self.node_params_with_ref]
        for pp in self.param_plate_with_ref:
            val = pp.base_value + pp.multiplier * vals[pp.param_no - 1]
            setattr(self.plate.reinf_dict[pp.reinf_layout_name], pp.trait_name, val)
        if len(vals2) > 0:
            res = minimize(fun=self.get_unit_work_ratio, x0=vals2, bounds=bds2, method=METHOD)
        return -self.plate.unit_work_ratio

    min_work_ratio = Property(depends_on='node_params,plate_params,param_nodes,param_plate,params_changed,plate_changed')
    @cached_property
    def _get_min_work_ratio(self):
        print 'Commencing optimization...'
        start = time.clock()
        vals = [par[0] for par in self.plate_params_with_ref]
        bds = [par[1] for par in self.plate_params_with_ref]

        if len(vals) > 0:
            res = minimize(fun=self.get_unit_work_ratio_neg, x0=vals, bounds=bds, constraints={'type':'eq', 'fun':self.constrain_function}, method='SLSQP')
        else:
            vals2 = [par[0] for par in self.node_params_with_ref]
            bds2 = [par[1] for par in self.node_params_with_ref]
            res = minimize(fun=self.get_unit_work_ratio, x0=vals2, bounds=bds2, method=METHOD)

        end = time.clock()

        print 'Optimization finished in', str(end - start), 'seconds'
        print res
        return self.plate.unit_work_ratio

    def constrain_function(self, *args):
        cns = 0.
        for i in range(len(args[0])):
            cns += args[0][i] * self.plate_params_with_ref[i].optimization_constrain_multiplier
        return cns - self.optimization_constrain_value

    def plot_plate(self):
        fig = plt.figure()
        ax = fig.add_axes([0.1, 0.1, 0.7, 0.7])
        self.plate.plot(ax)
        plt.show()

    def plot(self, fig):
        self.plate.plot(fig)

    def calculate(self, fig):
        '''Calculate the optimized limit load factor and plot geometry.
        '''
        try:
            print 'Optimized load factor: %f' % self.min_work_ratio
        except:
            print 'Optimization failed. Check input.'
        self.plate.plot(fig)
        return

    node_name = Str('Parametric study')

    tree_node_list = Property(depends_on='plate')
    @cached_property
    def _get_tree_node_list(self):
        return [self.plate]

    node_params_with_ref = Property(List(Instance(Parameter)), depends_on='node_params')
    def _get_node_params_with_ref(self):
        for i in range(len(self.node_params)):
            self.node_params[i].node_name = 'Parameter ' + str(i + 1)
            self.node_params[i].pstudyref = self
        return self.node_params

    plate_params_with_ref = Property(List(Instance(Parameter)), depends_on='plate_params')
    def _get_plate_params_with_ref(self):
        for i in range(len(self.plate_params)):
            self.plate_params[i].node_name = 'Parameter ' + str(i + 1)
            self.plate_params[i].pstudyref = self
        return self.plate_params

    param_nodes_with_ref = Property(List(Instance(ParamNode)), depends_on='param_nodes')
    def _get_param_nodes_with_ref(self):
        for i in range(len(self.param_nodes)):
            self.param_nodes[i].node_name = 'Node data ' + str(i + 1)
            self.param_nodes[i].pstudyref = self
        return self.param_nodes

    param_plate_with_ref = Property(List(Instance(ParamPlate)), depends_on='param_plate')
    def _get_param_plate_with_ref(self):
        for i in range(len(self.param_plate)):
            self.param_plate[i].node_name = 'Plate data ' + str(i + 1)
            self.param_plate[i].pstudyref = self
        return self.param_plate

    tree_view = View(HGroup(VGroup(
                     Group(Item('node_params_with_ref', editor=TableEditor(columns=[ObjectColumn(name='node_name', label='Name', editable=False),
                                                                       ObjectColumn(name='base_value', label='Default value'),
                                                                       ObjectColumn(name='minimum', label='Minimum'),
                                                                       ObjectColumn(name='maximum', label='Maximum'),
                                                                     ],
                                                             row_factory=Parameter,
                                                             show_toolbar=True,
                                                             deletable=True,
                                                             auto_size=False,
                                                             auto_add=True,
                                                            ),
                          show_label=False,
                          ), label='Node parameters:', springy=True),
                     Group(Item('param_nodes_with_ref', editor=TableEditor(columns=[ObjectColumn(name='node_name', label='Name', editable=False),
                                                                       ObjectColumn(name='node_no', label='Node Number'),
                                                                       ObjectColumn(name='trait_name', label='Unknown value name'),
                                                                       ObjectColumn(name='param_no', label='Parameter'),
                                                                       ObjectColumn(name='multiplier', label='Multiplier'),
                                                                       ObjectColumn(name='base_value', label='Default value'),
                                                                     ],
                                                             row_factory=ParamNode,
                                                             show_toolbar=True,
                                                             deletable=True,
                                                             auto_size=False,
                                                             auto_add=True,
                                                            ),
                          show_label=False,
                          ), label='Node optimization data:', springy=True)),
                            VGroup(
                            Group(Item('optimization_constrain_value', show_label=False), label='Optimization constrain value:', springy=True),
                            Group(Item('plate_params_with_ref', editor=TableEditor(columns=[ObjectColumn(name='node_name', label='Name', editable=False),
                                                                       ObjectColumn(name='base_value', label='Default value'),
                                                                       ObjectColumn(name='minimum', label='Minimum'),
                                                                       ObjectColumn(name='maximum', label='Maximum'),
                                                                       ObjectColumn(name='optimization_constrain_multiplier', label='Constrain multiplier'),
                                                                     ],
                                                             row_factory=Parameter,
                                                             show_toolbar=True,
                                                             deletable=True,
                                                             auto_size=False,
                                                             auto_add=True,
                                                            ),
                          show_label=False,
                          ), label='Plate parameters:', springy=True),
                     Group(Item('param_plate_with_ref', editor=TableEditor(columns=[ObjectColumn(name='node_name', label='Name', editable=False),
                                                                       ObjectColumn(name='reinf_layout_name', label='Reinf. layout name'),
                                                                       ObjectColumn(name='trait_name', label='Unknown value name'),
                                                                       ObjectColumn(name='param_no', label='Parameter'),
                                                                       ObjectColumn(name='multiplier', label='Multiplier'),
                                                                       ObjectColumn(name='base_value', label='Default value'),
                                                                     ],
                                                             row_factory=ParamPlate,
                                                             show_toolbar=True,
                                                             deletable=True,
                                                             auto_size=False,
                                                             auto_add=True,
                                                            ),
                          show_label=False,
                          ), label='Plate optimization data:', springy=True),)
                     )
                     )
Esempio n. 8
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)
Esempio n. 9
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
Esempio n. 10
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
Esempio n. 11
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
Esempio n. 12
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}'))
Esempio n. 13
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
Esempio n. 14
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')
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}
Esempio n. 16
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