From 638dcbb07d957a1e74b16e1187a6a6e887d82bea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Wed, 16 Dec 2020 17:57:53 +0200 Subject: [PATCH] task2_1b is now officially task2_1 --- III/Ovodas/task2_1.py | 13 +++++---- III/Ovodas/task2_1b.py | 62 ------------------------------------------ 2 files changed, 8 insertions(+), 67 deletions(-) delete mode 100755 III/Ovodas/task2_1b.py diff --git a/III/Ovodas/task2_1.py b/III/Ovodas/task2_1.py index f3d9d3e..9c0dea1 100755 --- a/III/Ovodas/task2_1.py +++ b/III/Ovodas/task2_1.py @@ -1,15 +1,16 @@ #!/usr/bin/python3 import csv -from math import degrees +from math import degrees, radians, tan, pi, log from shapely.geometry import LineString import matplotlib.pyplot as plt phi_p, phi_s, dphi = 13, 49, 6 -nphi = int((phi_s-phi_p)/dphi)+1 lambda_v, lambda_r, dlambda = 0, 24, 6 -nlambda = int((lambda_r-lambda_v)/dlambda)+1 M = 25e6 +phil = round((phi_p+phi_s)/2) +nphi = int((phi_s-phi_p)/dphi)+1 +nlambda = int((lambda_r-lambda_v)/dlambda)+1 # label orientations W, E, N, S = (-25, -5), (10, -5), (-5, 10), (-5, -20) @@ -18,12 +19,14 @@ krasovskio = {} with open("krasovskio.csv") as f: for row in csv.DictReader(f): krasovskio[float(row['phi'])] = row +betamm = float(krasovskio[phil]["r"]) * 1000 / M points = [] for i in range(nphi): phid = phi_p + i*dphi - betamm = float(krasovskio[phid]["r"]) * 1000 / M - xmm = betamm * float(krasovskio[phid]["lgU"]) + phi = radians(phid) + U = tan(pi/4 + phi/2) + xmm = betamm * log(U) on_y = [] for j in range(nlambda): lambdad = lambda_v + j*dlambda diff --git a/III/Ovodas/task2_1b.py b/III/Ovodas/task2_1b.py deleted file mode 100755 index 9c0dea1..0000000 --- a/III/Ovodas/task2_1b.py +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/python3 - -import csv -from math import degrees, radians, tan, pi, log -from shapely.geometry import LineString -import matplotlib.pyplot as plt - -phi_p, phi_s, dphi = 13, 49, 6 -lambda_v, lambda_r, dlambda = 0, 24, 6 -M = 25e6 -phil = round((phi_p+phi_s)/2) -nphi = int((phi_s-phi_p)/dphi)+1 -nlambda = int((lambda_r-lambda_v)/dlambda)+1 - -# label orientations -W, E, N, S = (-25, -5), (10, -5), (-5, 10), (-5, -20) - -krasovskio = {} -with open("krasovskio.csv") as f: - for row in csv.DictReader(f): - krasovskio[float(row['phi'])] = row -betamm = float(krasovskio[phil]["r"]) * 1000 / M - -points = [] -for i in range(nphi): - phid = phi_p + i*dphi - phi = radians(phid) - U = tan(pi/4 + phi/2) - xmm = betamm * log(U) - on_y = [] - for j in range(nlambda): - lambdad = lambda_v + j*dlambda - ymm = betamm * lambdad / degrees(1) - on_y.append((ymm, xmm)) - points.append(on_y) - -fig, ax = plt.subplots() -ax.set_aspect('equal') -ax.axis("off") - - -def annotate(ax, nr, point, heading): - text = "{}°".format(nr) - ax.annotate(text, point, textcoords="offset points", xytext=heading) - - -# abscises -for i in range(nphi): - row = [points[i][j] for j in range(nlambda)] - ax.plot(*(LineString(row).xy), color="xkcd:black", linewidth=.5) - annotate(ax, phi_p+i*dphi, row[0], W) - annotate(ax, phi_p+i*dphi, row[-1], E) - -# ordinates -for i in range(nlambda): - col = [points[j][i] for j in range(nphi)] - ax.plot(*(LineString(col).xy), color="xkcd:black", linewidth=.5) - annotate(ax, lambda_v+i*dlambda, col[0], S) - annotate(ax, lambda_v+i*dlambda, col[-1], N) - -if __name__ == '__main__': - plt.show()