def resume(): """ Serves Resume page """ #TO DO: Replace with SQLlite experience = [] experience.append( Exp("dolby.png", "Dolby Laboratories, Inc.", "Software Engineer", [ "When I joined Dolby, the company was still trying to break into the VR market. I joined a brilliant team \ of software engineers aiming to adapt existing Dolby technologies for a VR environment. To do so, I initially \ tasked with streamlining the audio rendering portion of the the audio SDK. This required to me to develop a \ system to match the rotational axes of the the device, like an Oculus or GearVR, to our internal axes then map \ the changes in head position between axis systems to adjust audio according to head positioning. After finishing \ the task, I was responsible for making sure that my work had cross-platform functionality.", "After redesigning the audio rendering SDK, I was lucky enough to be given the opportunity to work on the \ complementary decoder library. I was told that Dolby was built off Hollywood and that all movies and soundtracks \ prior to 1994 were all encoded using an older standard of compression. Thus, I was given the chance to find \ a means of implementing backwards compatibility for legacy content, which I accomplished by establishing \ virtual audio sources set at home theatre locations and accounting for audio change according to a given \ surround sound set up." ], ["C++", "C", "C#", "Java", "Android NDK"])) experience.append( Exp("ulukau.png", "Ulukau: The Hawaiian Electronic Library", "Software Engineer", [ "Ulukau is the principle attempt at preserving Hawaiian culture digitally for all generations to come. \ The resources collected range from historical land deads to genealogy to children's story books written in \ Hawaiian. As a student at University of Hawaii, I wanted to use the skills I've learned to give back to the \ community that so graciously accepted me. When I learned that Ulukau was making the transition from Oahu to \ the Big Island, I reached out to see if there was anyway I could be a part of the process.", "Fortune smiled upon me as I reached out. They were looking for a Front End Software Engineer to revamp \ their appearance and provide a means of easily updating and maintaining the project after I finished since it was \ cost-prohibitive to hire a web administrator. Thus, my partner and I hopped on board to work out the major \ issues like Section 508 compliance before setting up routine back ups and redesigning the entire website \ from the ground up." ], ["PHP", "HTML", "CSS", "JavaScript", "JQuery", "MySQL"])) experience.append( Exp("uhh.png", "University of Hawaii at Hilo", "Electrical Engineer, Intern", [ "In Hawaii, energy costs are typically 6 times more expensive than on the mainland. A lot of Hawaiians choose \ to live off the grid, so the energy grid infrastructure is not as developed as it could be. To address the issue, \ Cornell University set up a joint task force of sorts to investigate leading causes of energy inefficiency. This \ included measuring phantom loads, which occurs when electricity is drawn when devices are turned off but plugged into \ an outlet, and finding infrastructure conflicts causing increased demand on energy, such as single paned windows or \ shutters that do not close. After combing through the electrical systems on campus, we mapped energy usage by building \ and identified that 20% of the energy was being wasted. After learning about the severity of the problem, the \ chancellor decided that she would have to look into budgeting for architectural and electrical upgrades throughout \ campus." ], [])) return render_template('resume.html', pageHeader="Resume", exp=experience)
def __init__(self, rootdir): self.filemap = {} for k in CreateHg38.LISTFILES: self.filemap[k] = {} self.filemap[k + "_all"] = {} # for each assay for listfile in CreateHg38.LISTFILES: # load each exp accession from the existing list # for each, append only the first rep to one list and all reps to the other with open(os.path.join(rootdir, listfile), "r") as f: for line in f: p = line.strip().split('\t') try: e = Exp.fromJsonFile(p[0]) peaks, signal = CreateHg38._process(e) k = p[4] if len(p) >= 5 else p[2] self.filemap[listfile][(k, e.encodeID)] = (peaks[1].fileID, signal[1].fileID) self.filemap[listfile + "_all"][(k, e.encodeID)] = [(peaks[x].fileID, signal[x].fileID) for x, _ in signal.iteritems()] except: print("00_create_hg38$CreateHg38::__init__: could not process %s; skipping" % p[0]) # if DNase, write all reps to Hotspot-List.txt if listfile == "dnase-list.txt": CreateHg38._writehotspots(self.filemap[listfile + "_all"], "/data/projects/cREs/hg38/Hotspot-List.txt") print("wrote /data/projects/cREs/hg38/Hotspot-List.txt") # write first reps to list file CreateHg38._writelist(self.filemap[listfile], "/data/projects/cREs/hg38/%s" % listfile) print("wrote /data/projects/cREs/hg38/%s" % listfile)
def __init__(self, assembly, assay, toks): self.assembly = assembly self.assay = assay self.expID = toks[0] self.fileID = toks[1] self.cellTypeName = toks[2] exp = Exp.fromJsonFile(self.expID) self.tissue = DetermineTissue.TranslateTissue(assembly, exp) self.biosample_term_name = exp.biosample_term_name self.biosample_summary = exp.jsondata.get("biosample_summary", self.biosample_term_name) self.biosample_type = exp.jsondata["biosample_type"] if isinstance(self.biosample_type, list): if len(self.biosample_type) > 1: printt("multiple items for biosample_type:", self.biosample_type) self.biosample_type = self.biosample_type[0] if "mm10" == self.assembly: bs = self.biosample_summary bs = bs.replace("C57BL/6 ", "") matches = re.findall(r"\ (\((.*) days\))", bs) #printt(bs, matches, len(matches)) if matches and 1 == len(matches): bs = bs.replace(matches[0][0], "e" + matches[0][1]) bs = bs.replace("postnatal e", "p").replace("embryo e", "e") #printt("new bs", bs) self.biosample_summary = bs out = self.output().encode('ascii', 'ignore').decode('ascii')
def main(): expID = 'ENCSR000BCA' #ENCSR000SKS' #ENCSR000BCE' #'ENCSR000AEC' if 1: mw = MetadataWS(host="http://192.168.1.46:9008/metadata") exp = mw.exps([expID])[0] else: exp = Exp.fromJsonFile(expID) files = bigWigFilters("hg19", exp) print("found", len(files)) for f in files: print(f, f.bio_rep)
def __init__(self,ConfigFile): """Initialize a Job.""" # Initialize Experiment specific stuff in base class # -------------------------------------------------- Exp.__init__(self,ConfigFile) # Job specific parameters (will raise exception if not present) # ------------------------------------------------------------- self.nSegs = self.cf.nSegs self.recyclables = self.cf.recyclables # File list self.JobDelTime = self.cf.DelTime # Bring over resource files # ------------------------- self.getResources() # Bring over recyclables to runing ExpExecDir # ---------------------------------- -------- self.getRecyclables()
def main(img_path): trials = 20 framerate = 1/60.0 width = 1920 height = 1200 w = width/4 #img_path = '/Users/sb/neuro_comp/db/num_exp' pinfo = get_pinfo() kwargs = get_protocol(img_path,['png','jpg'],trials) exp = Exp(**kwargs) win = visual.Window(screen=1,fullscr=True) clock = core.Clock() for i in range(trials): exp._run_one_trial(win,i,img_path,w,framerate,clock) exp_file = open('filename.obj','w') pickle.dump(exp,exp_file) pylab.plot(win.frameIntervals) pylab.show()
def __init__(self, path): self.tads = {} self.exps = {} with gzip.open(path, "r") as f: for line in f: p = line.strip().split('\t') acc = p[3].split("-")[0] if acc not in self.exps: self.exps[acc] = Exp.fromJsonFile(acc).biosample_term_name self.tads[acc] = {} if p[0] not in self.tads[acc]: self.tads[acc][p[0]] = [] self.tads[acc][p[0]].append([int(p[1]), int(p[2])])
def loadExps(self): printt("loading exps...") with open( os.path.join(os.path.dirname(__file__), "hg38-Hotspot-List.txt")) as f: lines = [line.rstrip().split() for line in f] self.exps = [] for idx, line in enumerate(lines): expID = line[0] exp = Exp.fromJsonFile(expID) t = DetermineTissue.TranslateTissue("hg19", exp).strip() if not t: raise Exception("missing " + expID) self.exps.append((expID, exp, t, line[2])) printt("loaded", len(self.exps))
class TestTemplate(unittest.TestCase): def setUp(self): self.input = np.array(0.5) self.exp = Exp() def test_call(self): square_1 = Square() square_2 = Square() x = Variable(self.input) a = square_1(x) b = self.exp(a) y = square_2(b) self.assertEqual(0.25, a.data) self.assertEqual(1.2840254166877414, b.data) self.assertEqual(1.648721270700128, y.data) def test_forward(self): y = self.exp.forward(self.input) self.assertEqual(1.6487212707001282, y)
def _parse(self): fnp = os.path.join(self.d, "list.txt") with open(fnp) as f: header = f.readline().rstrip('\n').split('\t') ctToExpIDsRows = [ line.rstrip('\n').split('\t') for line in f if line ] allExps = {} for ctToExpIDs in ctToExpIDsRows: ct = ctToExpIDs[0] allExps[ct] = {} for idx, expID in enumerate(ctToExpIDs[1:]): allExps[ct][header[idx + 1]] = Exp.fromJsonFile( expID) # , True) if 0: for ct, exps in allExps.iteritems(): print(ct, exps["DNase"], exps["H3K4me3"], exps["H3K27ac"], exps["CTCF"]) return allExps
def processRow(self, row, outF, lookup): expID = row[0] fileID = row[1] replicate = row[2] exp = Exp.fromJsonFile(expID) j = exp.getExpJson() organ = self._organ(exp, j, lookup) cellCompartment = self._cellCompartment(exp, j) ageTitle = self._ageTitle(exp, j) signalFiles = self._signalFiles(exp, replicate) a = [ expID, fileID, exp.biosample_term_name, organ, cellCompartment, exp.target, exp.lab, exp.assay_term_name, exp.biosample_type, exp.biosample_term_name, exp.biosample_summary, ageTitle, j["assay_title"], str(replicate), json.dumps(signalFiles) ] # print(a) outF.write('\t'.join(a) + '\n')
def makeJobs(self): m = MetadataWS(Datasets.byAssembly(self.assembly)) allExps = [(m.chipseq_tfs_useful(), "tf"), (m.chipseq_histones_useful(), "histone")] allExpsIndiv = [] for exps, etype in allExps: printt("found", len(exps), etype) exps = [Exp.fromJsonFile(e.encodeID) for e in exps] exps = filter(lambda e: "ERROR" not in e.jsondata["audit"], exps) printt("found", len(exps), etype, "after removing ERROR audit exps") for exp in exps: allExpsIndiv.append((exp, etype)) random.shuffle(allExpsIndiv) total = len(allExpsIndiv) i = 0 jobs = [] for exp, etype in allExpsIndiv: i += 1 try: bed = exp.getUsefulPeakFile(self.assembly) if not bed: printt("missing", exp) jobs.append({ "exp": exp, # this is an Exp "bed": bed, # this is an ExpFile "i": i, "total": total, "assembly": self.assembly, "etype": etype }) except Exception, e: printt(str(e)) printt("bad exp:", exp)
def setUp(self): self.input = np.array(0.5) self.exp = Exp()
def f(x): A = Square() B = Exp() C = Square() return C(B(A(x)))
### attacking selection unitsInRange = [] attackUnitIndex = 0 font = pygame.font.Font('freesansbold.ttf', 52) ## custom class instances myMainMenu = MainMenu() myBattleForcast = BattleForcast(gameWidth) mainCursor = Cursor(tileSize, mapWidth, mapHeight, gameWidth, gameHeight) myCombatUI = CombatUI(0, gameHeight - 385) myUnitInfo = UnitInfo() myMapUnitUI = MapUnitUI(gameWidth, gameHeight) myExp = Exp() myLevelUp = LevelUp(gameWidth, gameHeight) ## creating units protag = Unit(3, 3, tileSize) protag.inventory.addItem(Bow()) protag.attack = 7 protag.defense = 6 protag.speed = 5 protag.skill = 7 protag.luck = 8 Jagen = Unit(3, 5, tileSize) Jagen.inventory.addItem(Sword()) Jagen.inventory.addItem(Javelin()) Jagen.inventory.addItem(HealingItem())
import json from pathlib import Path from tqdm import tqdm from exp import Exp def save_result(file_path, data): with open(file_path, 'w') as fp: json.dump(data, fp) input_data_path = Path("/home/ntao/project/data/train.csv") output_data_path = Path("/home/ntao/project/data/result.csv") model_dir = "/home/ntao/project/data/models/" exp = Exp(data_file_name=input_data_path, eval_result_file_name=output_data_path, model_dir=model_dir, n_dim=10, epochs=100, batch_size=512, gpus=[2, 3, 4, 5]) exp.run()