Skip to content

Instantly share code, notes, and snippets.

@casperlehmann
Last active July 4, 2021 15:46
Show Gist options
  • Save casperlehmann/b98afe08aa21a438a630dad7cbb6830c to your computer and use it in GitHub Desktop.
Save casperlehmann/b98afe08aa21a438a630dad7cbb6830c to your computer and use it in GitHub Desktop.
16:9
vs Dell P2715Q (Egmont) 27" 100% 16:9 (100:100) | 59x33cm 100x 100% | 2009cm2 100% | 3840x2160px 100x100% | 3600kr (100%) :: Display port | 100%
vs Macbook Dashou 13" 48% 16:9 (100:100) | 28x16cm 48x 48% | 465cm2 23% | 2560x1600px 66x 74% | 12000kr (333%) :: | 48%
vs Dell P2721Q (Mauro) 27" 100% 16:9 (100:100) | 59x33cm 100x 100% | 2009cm2 100% | 3840x2160px 100x100% | 3699kr (102%) :: usb-c | 100%
21:9
vs Samsung C34H890WG 34" 125% 21:9 (131:100) | 79x34cm 132x 101% | 2700cm2 134% | 3440x1440px 89x 66% | 4190kr (116%) :: usb-c | 132%
vs Samsung C34J791 34" 125% 21:9 (131:100) | 79x34cm 132x 101% | 2700cm2 134% | 3440x1440px 89x 66% | 5799kr (161%) :: DP/HDMI/USB-C | 132%
vs Samsung C34G55T 34" 125% 21:9 (131:100) | 79x34cm 132x 101% | 2700cm2 134% | 3440x1440px 89x 66% | 3999kr (111%) :: HDMI/DP | 132%
vs Samsung C34J791WTU 34" 125% 21:9 (131:100) | 79x34cm 132x 101% | 2700cm2 134% | 3440x1440px 89x 66% | 6822kr (189%) :: 2xTB, HDMI, DP | 132%
vs Samsung C34J791 34" 125% 21:9 (131:100) | 79x34cm 132x 101% | 2700cm2 134% | 3440x1440px 89x 66% | 5299kr (147%) :: 2xTB, HDMI, DP | 132%
vs LG UltraGear 38GN950 38" 140% 21:9 (131:100) | 88x38cm 148x 113% | 3373cm2 167% | 3840x1600px 100x 74% | 12869kr (357%) :: 2xHDMI/DP | 148%
32:9
vs Philips 498P9/00 49" 181% 32:9 (200:100) | 119x33cm 200x 100% | 4037cm2 200% | 5120x1440px 133x 66% | 6995kr (194%) :: hdmi/dp | 200%
vs Samsung C49J890 49" 181% 32:9 (200:100) | 119x33cm 200x 100% | 4037cm2 200% | 3840x1080px 100x 50% | 6990kr (194%) :: 2xHDMI/DP/USB-C | 200%
vs Samsung Odyssey G9 49" 181% 32:9 (200:100) | 119x33cm 200x 100% | 4037cm2 200% | 5120x1440px 133x 66% | 8999kr (249%) :: HDMI/2xDP | 200%
vs Samsung LC49RG90SSUXEN 49" 181% 32:9 (200:100) | 119x33cm 200x 100% | 4037cm2 200% | 5120x1440px 133x 66% | 7390kr (205%) :: HDMI/2xDP | 200%
vs LG 49WL95C-W 49" 181% 32:9 (200:100) | 119x33cm 200x 100% | 4037cm2 200% | 5120x1440px 133x 66% | 10990kr (305%) :: HDMI/DP/USB-C | 200%
vs Samsung C49HG90D 49" 181% 32:9 (200:100) | 119x33cm 200x 100% | 4037cm2 200% | 3840x1080px 100x 50% | 4999kr (138%) :: HDMI, SPAR 1690 | 200%
import math
from typing import List, NamedTuple
class Screen:
cm_per_inch = 2.54
def __init__(self, name: str, diagonal_inches: int, aspect: str, resolution: str, price: int, notes: str, url: str) -> None:
if isinstance(aspect, str):
aspect_x, aspect_y = [int(_.strip().replace('.', ''))
for _ in aspect.split(':')]
elif isinstance(aspect, tuple):
aspect_x, aspect_y = aspect
else:
raise TypeError('Aspect wrong type')
if isinstance(resolution, str):
resolution_x, resolution_y = [
int(_.strip().replace('.', '')) for _ in resolution.split('x')]
elif isinstance(resolution, tuple):
resolution_x, resolution_y = resolution
else:
raise TypeError('Resolution wrong type')
self.name = name
self.price = price
self.notes = notes
self.url = url
self.diagonal_inches = diagonal_inches
self.aspect_x, self.aspect_y = (aspect_x, aspect_y)
assert round(diagonal_inches, 2) == round(math.sqrt(self.width**2 + self.height**2)/self.cm_per_inch, 2), str(
diagonal_inches) + ' == ' + str(math.sqrt(self.width**2 + self.height**2)/self.cm_per_inch)
self.resolution_x, self.resolution_y = (resolution_x, resolution_y)
def __repr__(self) -> str:
return (
f'{self.name:<20} {self.diagonal_inches:>2}" {self.aspect_ratio:>5} {self.size}cm {self.resolution}px {self.price:>4}kr :: {self.notes}'
)
@property
def resolution(self):
return f'{self.resolution_x}x{self.resolution_y}'
@property
def aspect_ratio(self):
return f'{self.aspect_x}:{self.aspect_y}'
@property
def diagonal_cm(self):
return self.cm_per_inch * self.diagonal_inches
@property
def unit(self):
return self.diagonal_cm / math.sqrt(self.aspect_x**2 + self.aspect_y**2)
@property
def width(self):
return self.aspect_x * self.unit
@property
def height(self):
return self.aspect_y * self.unit
@property
def size(self):
return f'{int(self.width)}x{int(self.height)}'
@property
def area(self):
return int(self.width * self.height)
def __truediv__(self, other):
compare = Screen(
name=f'vs',
diagonal_inches=int(self.diagonal_inches /
other.diagonal_inches * 100),
aspect=(int(self.aspect_x / other.aspect_x * 100),
int(self.aspect_y / other.aspect_y * 100)),
resolution=(int(self.resolution_x / other.resolution_x * 100),
int(self.resolution_y / other.resolution_y * 100)),
price=int(self.price / other.price * 100),
notes=self.notes,
url=self.url
)
compare_diagonal = int(self.diagonal_inches /
other.diagonal_inches * 100)
compare_aspect_ratio = f'{int(self.aspect_x / other.aspect_x * 100)}:{int(self.aspect_y / other.aspect_y * 100)}'
compare_width = int(self.width / other.width * 100)
compare_height = int(self.height / other.height * 100)
compare_area = int(self.area / other.area * 100)
compare_resolution_x = int(
self.resolution_x / other.resolution_x * 100)
compare_resolution_y = int(
self.resolution_y / other.resolution_y * 100)
factor = int((self.width / self.aspect_y) /
(other.width / other.aspect_y) * 100)
print(
f'vs {self.name:<22} {self.diagonal_inches:>3}" {compare_diagonal:>3}% {self.aspect_ratio:>5} ({compare_aspect_ratio:>5})'
f' | {self.size:>6}cm {compare_width:>4}x{compare_height:>4}%'
f' | {self.area:>4}cm2 {compare_area:>3}%'
f' | {self.resolution:>7}px {compare_resolution_x:>3}x{compare_resolution_y:>3}%'
f' | {self.price:>5}kr ({compare.price:>3}%) :: {self.notes:<16}'
f' | {factor:>3}%'
)
data = [
Screen('Dell P2715Q (Egmont)', 27, '16:9', '3840x2160', 3600, 'Display port',
'https://www.proshop.dk/Skaerm/Dell-27-Skaerm-P2715Q-Sort-6-ms/2469728'),
Screen('Macbook Dashou', 13, '16:9', '2560x1600', 12000, '', ''),
Screen('Dell P2721Q (Mauro)', 27, '16:9', '3840x2160', 3699, 'usb-c',
'https://www.dustinhome.dk/product/5011203396/p2721q-27-4k-uhd-ips-169-usb-c?ssel=false&gclid=CjwKCAjwz_WGBhA1EiwAUAxIcRasAOhFKFWXyYRzaI60byIEsQhl15IiV5TWIakW1f6Em0gOeWauZBoCVzwQAvD_BwE'),
Screen('Samsung C34H890WG', 34, '21:9', '3.440 x 1.440', 4190, 'usb-c',
'https://www.dustinhome.dk/product/5011227880/c34h890wg-34-wqhd-va-219'),
Screen('Samsung C34J791', 34, '21:9', '3440x1440', 5799, 'DP/HDMI/USB-C',
'https://www.komplett.dk/product/1090438/hardware/skaerme/skaerme/samsung-34-led-curved-c34j791?q=samsung%2034#'),
Screen('Samsung C34G55T', 34, '21:9', '3440x1440', 3999, 'HDMI/DP',
'https://www.komplett.dk/product/1167954/gaming/spiludstyr/gamingskaerme/samsung-34-curved-gamingskaerm-c34g55t#'),
Screen('Samsung C34J791WTU', 34, '21:9', '3440 x 1440', 6822, '2xTB, HDMI, DP',
'https://www.computersalg.dk/i/4710740/samsung-c34j791wtu-cj79-series-led-sk%C3%A6rm-kurvet-34-34-til-at-se-3440-x-1440-ultra-wqhd-va-300-cd-m-3000-1-4-ms-2xthunderbolt?sq=4710740%20SAMSUNG%20LC34J791WTU'),
Screen('Samsung C34J791', 34, '21:9', '3440x1440', 5299, '2xTB, HDMI, DP',
'https://www.elgiganten.dk/product/gaming/gaming-pc-skarme/15882/samsung-curved-c34j791-34-skarm-solvhvid?gclid=CjwKCAjwrPCGBhALEiwAUl9X06V4HVZ-xyNg-d7kaWcT4rUnFf2Bxz29hQVLPsAa4aX1cV-Nzv_eJBoC5x0QAvD_BwE&gclsrc=aw.ds'),
Screen('LG UltraGear 38GN950', 38, '21:9', '3840x1600', 12869, '2xHDMI/DP',
'https://www.komplett.dk/product/1167588/gaming/spiludstyr/gamingskaerme/lg-38-curved-gamingskaerm-ultragear-38gn950#'),
Screen('Philips 498P9/00', 49, '32:9', '5120x1440', 6995, 'hdmi/dp',
'https://www.komplett.dk/product/1164054/hardware/skaerme/skaerme/philips-49-curved-skaerm-498p900#'),
Screen('Samsung C49J890', 49, '32:9', '3840x1080', 6990, '2xHDMI/DP/USB-C',
'https://www.komplett.dk/product/1012648/hardware/skaerme/skaerme/samsung-49-led-c49j890#'),
Screen('Samsung Odyssey G9', 49, '32:9', '5120x1440', 8999, 'HDMI/2xDP',
'https://www.komplett.dk/product/1154595/gaming/spiludstyr/gamingskaerme/samsung-49-curved-gamingskaerm-odyssey-g9'),
Screen('Samsung LC49RG90SSUXEN', 49, '32:9', '5120x1440', 7390, 'HDMI/2xDP',
'https://www.komplett.dk/product/1119314/hardware/skaerme/skaerme/samsung-49-led-lc49rg90ssuxen'),
Screen('LG 49WL95C-W', 49, '32:9', '5120x1440', 10990, 'HDMI/DP/USB-C',
'https://www.komplett.dk/product/1172326/hardware/skaerme/skaerme/lg-49-skaerm-49wl95c-w?channable=0095b769640031313732333236a5&gclid=CjwKCAjwrPCGBhALEiwAUl9X0wXdJsP3fE7x_JMbrV9uls7TgIYFORIO9vFO-sLZPKOl28ouhO9qoxoCkUcQAvD_BwE&gclsrc=aw.ds#'),
Screen('Samsung C49HG90D', 49, '32:9', '3840 x 1080', 4999, 'HDMI, SPAR 1690',
'https://www.elgiganten.dk/product/gaming/gaming-pc-skarme/LC49HG90DMUXE/samsung-curved-c49hg90d-49-skarm-sort?gclid=CjwKCAjwz_WGBhA1EiwAUAxIcWYp59TcMvP0XaJPnXwZ4GTPsYACb77KD5UADtePzmetXZ8obSGgLxoC9H0QAvD_BwE&gclsrc=aw.ds')
]
for i, screen in enumerate(data):
if i == 0 or (0 < i and data[i-1].aspect_ratio != data[i].aspect_ratio):
print(screen.aspect_ratio)
# print(screen)
screen / data[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment