Ejemplo n.º 1
0
def do(board):

    dev = surf.Surf()
    print 'identify:'
    dev.identify()
    print 'path:', dev.path
    dev.labc.run_mode(0)
    dev.labc.testpattern_mode(0)
    dev.labc.reset_fifo()
    dev.labc.reset_ramp()
    dev.labc.dll(15)  #disable DLL
    time.sleep(1)

    dev.i2c.default_config()
    dev.clock(dev.internalClock)

    dev.labc.default()  #send default values to LAB registers
    dev.set_phase(2)
    dev.labc.automatch_phab(15)

    if not surf_cal.check_board(board, dev.dna()):
        print 'adding board to calibration json file..'
        surf_cal.add_board(board, dev.dna())
    else:
        print 'cal file entry already exists for board: ', board


#
#    if surf_cal.read_vadjn(dev.dna()) == None:
#        print 'scanning for Vadjn..'
#        vadjn = []
#        for i in range(12):
#            vadjn.append(dev.labc.autotune_vadjn(i))
#
#        surf_cal.save_vadjn(dev.dna(), vadjn)
#

    if surf_cal.read_vadjp(dev.dna()) == None:
        print 'scanning for Vadjp..'
        vadjp = []
        for i in range(12):
            vadjp.append(dev.labc.autotune_vadjp(i))

        surf_cal.save_vadjp(dev.dna(), vadjp)

    ##turn on the DLL
    time.sleep(1)
    dev.labc.dll(15, mode=True)
    ##show the board status
    dev.status()

    return dev
Ejemplo n.º 2
0
 def __init__(self):
     self.dev = surf.Surf()
     self.pedestals = np.zeros(((lab4d_storage_cells, surf_channels)),
                               dtype=np.int)
     self.lab_lut = np.zeros((2**LAB_ADC_BITS, 12), dtype=float)
Ejemplo n.º 3
0
    def run(self):
        self.game.display.blit(self.background, (0, 0))

        self.pressed = self.game.get_pressed()

        # shadow text
        name = self.font.render(self.UNIVERSITIES[self.index], 0,
                                (153, 132, 0))
        text_rect = name.get_rect(
            center=(pygame.display.Info().current_w / 2 + 5,
                    pygame.display.Info().current_h / 2 + 5))
        self.game.display.blit(name, text_rect)

        # main text
        name = self.font.render(self.UNIVERSITIES[self.index], 0,
                                (255, 255, 0))
        text_rect = name.get_rect(center=(pygame.display.Info().current_w / 2,
                                          pygame.display.Info().current_h / 2))
        self.game.display.blit(name, text_rect)

        if self.pressed[0] and not self.bounce and not self.ready:
            self.bounce = True
            self.bounce_time = pygame.time.get_ticks()
            self.index -= 1

        if self.pressed[1] and not self.bounce and not self.ready:
            self.bounce = True
            self.bounce_time = pygame.time.get_ticks()
            self.index += 1

        if self.pressed[3] and not self.ready:
            self.ready = True
            self.ready_time = pygame.time.get_ticks()

        elif not self.pressed[3]:
            self.ready = False

        self.index = self.index % len(self.UNIVERSITIES)

        if pygame.time.get_ticks() - self.bounce_time > 1000:
            self.bounce = False

        if self.ready:
            remaining = 5 - int(
                (pygame.time.get_ticks() - self.ready_time) / 1000.0)

            if remaining <= -1:
                self.game.university = self.UNIVERSITIES[self.index]
                if pygame.key.get_pressed(
                )[pygame.K_KP_PERIOD] and pygame.key.get_pressed(
                )[pygame.K_KP1] and pygame.key.get_pressed()[pygame.K_KP3]:
                    self.game.titi = True
                    self.game.university = 'TITI'
                self.game.state = surf.Surf(self.game)
                return

            pygame.draw.rect(
                self.game.display, (0, 255, 0),
                (pygame.display.Info().current_w / 2 - 500 / 2,
                 pygame.display.Info().current_h / 2 - 200 / 2, 500, 200))

            name = self.font.render("READY " + str(remaining), 0, (0, 0, 0))
            text_rect = name.get_rect(
                center=(pygame.display.Info().current_w / 2,
                        pygame.display.Info().current_h / 2))
            self.game.display.blit(name, text_rect)
Ejemplo n.º 4
0
codon_colour = {
    "M": "r",
    "V": "b",
}

with os.scandir(basepath) as entries:
    for entry in entries:
        try:
            assert (entry.is_file())
            files.append(entry.name)
        except:
            print(entry.name, " is apparently a problem file.")
    for file in files:
        print(file)

f68 = sf.Surf("F-68", 1800, 8350, 80)
f127 = sf.Surf("F-127", 3600, 12600, 70)
f38 = sf.Surf("F-38", 900, 5000, 80)
f108 = sf.Surf("F-108", 3000, 14000, 80)
p84 = sf.Surf("P-84", 2250, 3750, 80)

##plotting strip plots
exp5 = [f127, files[20], [0, 0.0001, 0.0005, 0.001, 0.0011, 0.1]]
exp6 = [f68, files[21], [0, 0.0001, 0.0005, 0.001, 0.0011, 0.1]]
exp7 = [
    f127, files[22], [0, 0.000033, 0.000066, 0.0001, 0.00016, 0.00033, 0.0005]
]
exp8 = [f68, files[23], [0, 0.0001, 0.0005, 0.001, 0.0011, 0.1]]

e = plotsurf.PlotSurf(
    f68,
Ejemplo n.º 5
0
ex9.get_mastermixes()
##print(ex10)
##ex10.get_mastermixes()

##set up datfram for adding data
df_blank = ex9.getPlate()
##obtain and analyse data
df_data = rd.RTQuICData_feat(files[24], numCycles = 200).get_df()
##print(df_data)
##join above two dataframas
df_labelled_data = pd.concat([df_blank, df_data], axis = 1)
##plot the data

params = ["Lag Time"]

surfs = sf.Surf("F-108", 3000, 14000, 80), sf.Surf("P-84", 2250, 3750, 80)
for surf in surfs:
    df_surf = df_labelled_data[df_labelled_data["Add"] == surf.get_name()]
    groups = df_surf.groupby("Seed")
    for param in params:
        for name, group in groups:
            x_, y_  = group["Conc"], group[param]
            print(x_)
            print(type(surf.get_mw()))
            print(type(x_))
            plt.scatter(x = x_.astype(float),y = y_, label = name)
            plt.title("Effect of "+ surf.get_name()+ \
    " on RTQuIC "+param)
            plt.xlabel("Conc %")            
            plt.xscale("log")
            plt.xlim(0.00001,0.001)