Skip to content

Instantly share code, notes, and snippets.

View polarities's full-sized avatar
🎯
Focusing

Jordy Lee polarities

🎯
Focusing
  • RWTH Aachen
  • Germany
View GitHub Profile
import matplotlib as mpl
multiplier = 1.4
mpl.rcParams.update({
"figure.subplot.left": 0.177,
"figure.subplot.right": 0.946,
"figure.subplot.bottom": 0.156,
"figure.subplot.top": 0.965,
"figure.facecolor": 'white',
from IPython.display import HTML, display
def colorpreview(color):
display(HTML(f"<b style=color:{color}>{color}</b>"))
def ascii2color(string:str):
string = string.lower()
color = tuple(ord(string[i]) if i < len(string) else 0 for i, v in enumerate(range(3)))
return '#%02x%02x%02x' % color
@polarities
polarities / weight_normalization.py
Created January 21, 2023 14:50
Weight expression
def to_gram(weight, unit:str):
if unit[-1].lower() == 't':
weight *= 1000000 * scale_factor(unit)
unit = 'g'
else:
weight *= scale_factor(unit)
unit = 'g'
return weight, unit