Generate All Graphs Correctly
This commit is contained in:
parent
b1e53552fb
commit
8a2c7aca4f
19
main.py
19
main.py
@ -144,7 +144,7 @@ if __name__ == '__main__':
|
||||
for aoa in tqdm(raw_data["AoA"], position=1):
|
||||
sheet = raw_data["data"][f"{aoa} AoA"]
|
||||
|
||||
aoa_data[aoa] = make_pressure_graph(sheet, aoa, raw_data["rpm"], raw_data["airSpeed"], True)
|
||||
aoa_data[aoa] = make_pressure_graph(sheet, aoa, raw_data["rpm"], raw_data["airSpeed"], False)
|
||||
|
||||
data[raw_data["rpm"]] = aoa_data
|
||||
|
||||
@ -162,6 +162,11 @@ if __name__ == '__main__':
|
||||
|
||||
colour_cycle = uqccf()
|
||||
for aoa, c in zip(aoa_data, colour_cycle):
|
||||
|
||||
#print(c["color"], c["color"].hex_lighten(1.4), c["color"].rgb(), c["color"].lighten(1.4))
|
||||
#print(c["color"].hex_lighten(1), c["color"])
|
||||
#exit()
|
||||
|
||||
this_data = aoa_data[aoa]
|
||||
pressure = this_data[0]
|
||||
|
||||
@ -178,8 +183,8 @@ if __name__ == '__main__':
|
||||
|
||||
#{"x": [PITOT_PLACEMENT[9], PITOT_PLACEMENT[18]], "y": [pressure.iloc[9], pressure.iloc[18]], "colour": c["color"]},
|
||||
|
||||
{"x": [PITOT_PLACEMENT[9], pN[0]], "y": [pressure.iloc[9], pN[1]], "colour": c["color"].lighten(0.4)},
|
||||
{"x": [PITOT_PLACEMENT[9], pN[0]], "y": [pressure.iloc[18], pN[1]], "colour": c["color"].lighten(0.4)},
|
||||
{"x": [PITOT_PLACEMENT[9], pN[0]], "y": [pressure.iloc[9], pN[1]], "colour": c["color"], "args":{"alpha":0.3}},
|
||||
{"x": [PITOT_PLACEMENT[9], pN[0]], "y": [pressure.iloc[18], pN[1]], "colour": c["color"], "args":{"alpha":0.3}},
|
||||
|
||||
{"x":PITOT_PLACEMENT, "y":pressure, "label":f"α = {int(aoa):d}°", "type":"scatter", "colour": c["color"], "args":{"zorder":2}},
|
||||
)
|
||||
@ -189,7 +194,7 @@ if __name__ == '__main__':
|
||||
if raw_data["rpm"] == 508:
|
||||
graph['xLim'] = (
|
||||
min(PITOT_PLACEMENT) - 5,
|
||||
max(PITOT_PLACEMENT) + 20
|
||||
max(PITOT_PLACEMENT) + 25
|
||||
)
|
||||
graph["figSize"] = (8, 6)
|
||||
|
||||
@ -216,10 +221,10 @@ if __name__ == '__main__':
|
||||
{"x": [PITOT_PLACEMENT[0], PITOT_PLACEMENT[10]], "y": [pressure.iloc[0], pressure.iloc[10]], "colour": c["color"]},
|
||||
#{"x": [PITOT_PLACEMENT[9], PITOT_PLACEMENT[18]], "y": [pressure.iloc[9], pressure.iloc[18]], "colour": c["color"]},
|
||||
|
||||
{"x": [PITOT_PLACEMENT[9], pN[0]], "y": [pressure.iloc[9], pN[1]], "colour": c["color"].lighten(0.4)},
|
||||
{"x": [PITOT_PLACEMENT[9], pN[0]], "y": [pressure.iloc[18], pN[1]], "colour": c["color"].lighten(0.4)},
|
||||
{"x": [PITOT_PLACEMENT[9], pN[0]], "y": [pressure.iloc[9], pN[1]], "colour": c["color"], "args":{"alpha":0.3}},
|
||||
{"x": [PITOT_PLACEMENT[9], pN[0]], "y": [pressure.iloc[18], pN[1]], "colour": c["color"], "args":{"alpha":0.3}},
|
||||
|
||||
{"x":PITOT_PLACEMENT, "y":pressure, "label":f"α = {int(aoa):d}°", "type":"scatter", "colour": c["color"]},
|
||||
{"x":PITOT_PLACEMENT, "y":pressure, "label":f"α = {int(aoa):d}°", "type":"scatter", "colour": c["color"], "args":{"zorder":2}},
|
||||
)
|
||||
for plt in plts:
|
||||
graph["plots"].append(plt)
|
||||
|
@ -43,7 +43,8 @@ UQ_COLOURS_DICT = {
|
||||
class ColourValue(str):
|
||||
def __new__(self, name, value):
|
||||
self.name = name
|
||||
self.value = colors.to_hex(value, True)
|
||||
self._orig_value = value
|
||||
self.value = colors.to_hex(self._orig_value, True)
|
||||
|
||||
return super().__new__(self, self.value)
|
||||
|
||||
@ -57,7 +58,7 @@ class ColourValue(str):
|
||||
return colors.to_rgba(self.value, alpha)
|
||||
|
||||
def rgb(self) -> tuple[float, float, float]:
|
||||
return colors.to_rgb(self.value)
|
||||
return colors.to_rgb(self._orig_value)
|
||||
|
||||
def hex(self) -> str:
|
||||
return self.value
|
||||
@ -72,6 +73,9 @@ class ColourValue(str):
|
||||
hls = self.hls()
|
||||
|
||||
return colorsys.hls_to_rgb(hls[0], max(0, min(1, amount * hls[1])), hls[2])
|
||||
|
||||
def hex_lighten(self, amount=0.5) -> str:
|
||||
return colors.to_hex(self.lighten(amount), True)
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user