This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from numpy import array as np_array | |
from sklearn.metrics import confusion_matrix | |
from torch import Tensor as pytorch_tensor | |
def ensure_array(obj): | |
if isinstance(obj, pytorch_tensor): | |
return obj.numpy() | |
return np_array(obj) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from collections import defaultdict | |
from pathlib import Path | |
def load_from_json(path): | |
with open(path, "r") as infile: | |
return json.load(infile) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/solver.py b/solver.py | |
index 7d65766..57ab586 100644 | |
--- a/solver.py | |
+++ b/solver.py | |
@@ -179,7 +179,7 @@ class Solver(object): | |
if self.global_iter%self.display_step == 0: | |
pbar.write('[{}] recon_loss:{:.3f} total_kld:{:.3f} mean_kld:{:.3f}'.format( | |
- self.global_iter, recon_loss.data[0], total_kld.data[0], mean_kld.data[0])) | |
+ self.global_iter, recon_loss.item(), total_kld.item(), mean_kld.item())) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import time | |
def timeit(func): | |
def wrap(*args, **kwargs): | |
start = time.time() | |
func_returned_value = func(*args, **kwargs) | |
end = time.time() | |
print "Function {} returned in {} secs".format(func.__name__, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Python test code for airflow investigations | |
""" | |
from airflow import DAG | |
from airflow.operators import PythonOperator | |
from datetime import datetime, timedelta | |
from modules import print_date, boto_workout, spark_test | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Published+January+29%2C+2016++New+York+Post%0AFacebook241+Twitter0%09Email+Print%0A%0ADec.+3%2C+2016%3A+San+Francisco+49ers+Derek+Loville+prances+into+the+end+zone+for+a+touchdown+in+the+fourth+quarter+against+the+Buffalo+Bills+in+San+Francisco.+%28AP+Photo%2FLacy+Atkins%29%0AA+former+Denver+Broncos+running+back+who+won+a+pair+of+Super+Bowls+with+the+team+has+been+busted+in+an+international+drug+trafficking%2C+sports+gambling+and+money+laundering+ring+that+included+threats+to+debtors+like+showing+them+beheading+videos%2C+authorities+said.%0A%0ADerek+Loville%2C+47 | |
banal+ca+o+zi+de+duminic%C4%83+%28cum+%29+cum+ar+putea++s%C4%83+nu+explodeze+ca+o+grenad%C4%83+m%C4%83car+un+dram++de+fericire+sub+pielea+asta+bolnav%C4%83+de+contradic%C8%9Bii+c%C3%A2nd+ating+coapsa++conturului+t%C4%83u+parc%C4%83+sculptat++dintr-un+s%C3%A2mbure+de+piersic%C4%83+at%C3%A2t+de+coapt%C4%83+at%C3%A2t+de+parfumat%C4%83+++++cum+ar+putea++s%C4%83+nu+alunece++toat%C4%83+carnea+mea+++pe+panta+mir%C4%83rii+++c%C3%A2nd++%C3%AEmi+escaladezi+s% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Published+January+29%2C+2016++New+York+Post%0AFacebook241+Twitter0%09Email+Print%0A%0ADec.+3%2C+2016%3A+San+Francisco+49ers+Derek+Loville+prances+into+the+end+zone+for+a+touchdown+in+the+fourth+quarter+against+the+Buffalo+Bills+in+San+Francisco.+%28AP+Photo%2FLacy+Atkins%29%0AA+former+Denver+Broncos+running+back+who+won+a+pair+of+Super+Bowls+with+the+team+has+been+busted+in+an+international+drug+trafficking%2C+sports+gambling+and+money+laundering+ring+that+included+threats+to+debtors+like+showing+them+beheading+videos%2C+authorities+said.%0A%0ADerek+Loville%2C+47 | |
banal+ca+o+zi+de+duminic%C4%83+%28cum+%29+cum+ar+putea++s%C4%83+nu+explodeze+ca+o+grenad%C4%83+m%C4%83car+un+dram++de+fericire+sub+pielea+asta+bolnav%C4%83+de+contradic%C8%9Bii+c%C3%A2nd+ating+coapsa++conturului+t%C4%83u+parc%C4%83+sculptat++dintr-un+s%C3%A2mbure+de+piersic%C4%83+at%C3%A2t+de+coapt%C4%83+at%C3%A2t+de+parfumat%C4%83+++++cum+ar+putea++s%C4%83+nu+alunece++toat%C4%83+carnea+mea+++pe+panta+mir%C4%83rii+++c%C3%A2nd++%C3%AEmi+escaladezi+s% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
index 4633fbc..9957ca7 100644 | |
--- a/data2012dev/take_qcdkiller_hcalDeadEcal.py | |
+++ b/data2012dev/take_qcdkiller_hcalDeadEcal.py | |
@@ -1,5 +1,21 @@ | |
+import math as ma | |
from inputData import data, quadSum, fb | |
+def newSystMag(oldmag = None, ttw = None, zinv = None): | |
+ # get abs errs | |
+ ttwsyst = float(oldmag * ttw) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/test.py b/test.py | |
index edcc1d8..daf7009 100755 | |
--- a/test.py | |
+++ b/test.py | |
@@ -192,7 +192,10 @@ def signalArgs(whiteList=[], options=None): | |
from signals.t2cc_2012dev import dm10_250 | |
signal = dm10_250 | |
- kargs = {"signalToTest": None, | |
+ # from signals.t2tt_2012dev import m200_0 , m400_25, m600_0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
double get_jet_weight(double isr_pt){ | |
// function to calculate an individual ISR jet's weight | |
double qcut = 44.; | |
if(isr_pt<qcut){ | |
return (1. + (2.63e-5)*(isr_pt-qcut) + (1.2e-4)*pow((isr_pt-qcut), 2)); | |
} | |
else if(isr_pt == qcut){ | |
return 1.; |
NewerOlder