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 matplotlib.pyplot as plt | |
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg | |
import tkinter as tk | |
# Sample data: dictionary mapping names to image paths | |
image_data = { | |
'Image 1': 'image1.jpg', | |
'Image 2': 'image2.jpg', | |
'Image 3': 'image3.jpg' | |
} |
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
$ equery g --depth=5 jupyter | |
* Searching for jupyter ... | |
* dependency graph for dev-python/jupyter-1.0.0-r4 | |
`-- dev-python/jupyter-1.0.0-r4 amd64 | |
`-- dev-python/jupyter-core-5.4.0 (>=dev-python/jupyter-core-4.2.0) amd64 [python_targets_python3_10(-)? python_targets_python3_11(-)? python_targets_python3_12(-)?] | |
`-- dev-python/platformdirs-3.11.0 (>=dev-python/platformdirs-2.5) amd64 [python_targets_python3_10(-)? python_targets_python3_11(-)? python_targets_python3_12(-)?] | |
`-- dev-python/pypy3-7.3.13 (dev-python/pypy3) amd64 | |
`-- dev-python/pypy3_10-7.3.13_p1 (=dev-python/pypy3_10-7.3.13*) amd64 [gdbm? ncurses? sqlite? tk?] | |
`-- dev-python/pypy3_10-exe-7.3.13 (>=dev-python/pypy3_10-exe-7.3.13) amd64 [bzip2(+) ncurses?] |
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
\s*TopologyList\[(.*)\]\[(\s*Topology\[(\d+)\]\[(\s*Propagator\[(Incoming|Outgoing|Internal)\]\[(\s*Vertex\[(\d+)\]\[(\d+)\]\s*),(\s*Vertex\[(\d+)\]\[(\d+)\]\s*),(\s*Field\[(\d+)\]\s*)\]\s*),?(\s*Propagator\[(Incoming|Outgoing|Internal)\]\[(\s*Vertex\[(\d+)\]\[(\d+)\]\s*),(\s*Vertex\[(\d+)\]\[(\d+)\]\s*),(\s*Field\[(\d+)\]\s*)\]\s*)?,?(\s*Propagator\[(Incoming|Outgoing|Internal)\]\[(\s*Vertex\[(\d+)\]\[(\d+)\]\s*),(\s*Vertex\[(\d+)\]\[(\d+)\]\s*),(\s*Field\[(\d+)\]\s*)\]\s*)?,?(\s*Propagator\[(Incoming|Outgoing|Internal)\]\[(\s*Vertex\[(\d+)\]\[(\d+)\]\s*),(\s*Vertex\[(\d+)\]\[(\d+)\]\s*),(\s*Field\[(\d+)\]\s*)\]\s*)?,?(\s*Propagator\[(Incoming|Outgoing|Internal)\]\[(\s*Vertex\[(\d+)\]\[(\d+)\]\s*),(\s*Vertex\[(\d+)\]\[(\d+)\]\s*),(\s*Field\[(\d+)\]\s*)\]\s*)?,?(\s*Propagator\[(Incoming|Outgoing|Internal)\]\[(\s*Vertex\[(\d+)\]\[(\d+)\]\s*),(\s*Vertex\[(\d+)\]\[(\d+)\]\s*),(\s*Field\[(\d+)\]\s*)\]\s*)?,?(\s*Propagator\[(Incoming|Outgoing|Internal)\]\[(\s*Vertex\[(\d+)\]\[(\d+)\]\s*),(\s*Vertex\[(\d+)\]\[(\d+) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 | |
import sys | |
def recursive_for_replace(data): | |
if "xsec_pb" in data and "unc_pb" in data: | |
data["unc_pb"] = data["unc_pb"] * data["xsec_pb"] | |
return | |
for k in data: | |
recursive_for_replace(data[k]) |
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 | |
import sys | |
def myhook(pairs): | |
d = {} | |
for k, v in pairs: | |
if k not in d: | |
d[k] = v | |
else: | |
d[k] = {**d[k],**v} |
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
sed -i "s/static_cast<long double>//g" *.cc *.h | |
sed -i "s/long double/double/g" *.cc *.h | |
sed -i "s/\([0-9]*\.[0-9]*\)L/\1/g" *.cc *.h | |
sed -i "s/\([0-9][0-9]*\.[0-9]*\)L/\1/g" *.cc *.h | |
sed -i "s/\([0-9][0-9]*\.[0-9][0-9]*\)L/\1/g" *.cc *.h |
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 multiprocessing import Process,Queue | |
import time | |
def queued(q,f,*args,**kwargs): | |
q.put(f(*args,**kwargs)) | |
def res(a): | |
return next(a) | |
def gen(f,*args,**kwargs): | |
q = Queue() | |
p = Process(target=queued,args=(q,f,*args),kwargs=kwargs) | |
yield p.start() |
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 scipy.odr import * | |
def fit_curve(datax,datay,function,p0=None,yerr=None,xerr=None): | |
model = Model(lambda p,x : function(x,*p)) | |
realdata = RealData(datax,datay,sx=xerr,sy=yerr) | |
odr = ODR(realdata,model,beta0=p0) | |
out = odr.run() | |
return unp.uarray(out.beta,out.sd_beta) |