Clean analyze_fft_ellipses.py

This commit is contained in:
Benjamin Loison 2024-05-22 19:53:20 +02:00
parent ffd71ce5b8
commit 80ac1f1bf3
Signed by: Benjamin_Loison
SSH Key Fingerprint: SHA256:BtnEgYTlHdOg1u+RmYcDE0mnfz1rhv5dSbQ2gyxW8B8

View File

@ -11,30 +11,47 @@ class Axis(Enum):
# TODO: with right color
# TODO: precising somehow low or high
# TODO: limit axis based on these values
INTERESTING_VALUES_OF_AXES = {
Axis.ABSCISSA: [0, 30, 60, 84],
Axis.ORDINATE: [0, 25, 40, 55],
Axis.ABSCISSA: [0, 30, 60, 84, 108, 132, 160, 179],
Axis.ORDINATE: [0, 25, 40, 55, 70, 85, 100, 117],
}
for axisName, axisProfile in zip(Axis, [secondImage[height // 2, width // 2:], secondImage[height // 2:, width // 2]]):
halfHeight = height // 2
halfWidth = width // 2
PROFILES_OF_AXES = {
Axis.ABSCISSA: secondImage[halfHeight , halfWidth:],
Axis.ORDINATE: secondImage[halfHeight:, halfWidth ],
}
colorsOfAxes = {}
for axis in Axis:
plt.title('Axis Fourier transform profile')
plt.xlabel('Fourier transform axis')
plt.ylabel('Fourier transform logarithmic intensity')
height, width = secondImage.shape
plt.plot(axisProfile, label = axisName)
axisProfile = PROFILES_OF_AXES[axis]
colorsOfAxes[axis] = plt.plot(axisProfile, label = axis)[0].get_color()
'''
for axis in Axis:
for interestingValueOfAxis in INTERESTING_VALUES_OF_AXES[axis]:
match axis:
case Axis.ABSCISSA:
plt.vlines(interestingValueOfAxis)
#case Axis.ORDINATE:
'''
for interestingValueOfAxisIndex, interestingValueOfAxis in enumerate(INTERESTING_VALUES_OF_AXES[axis]):
plt.axvline(interestingValueOfAxis, color = colorsOfAxes[axis], alpha = 0.3, linestyle = ':' if interestingValueOfAxisIndex % 2 == 0 else '--', label = 'Test')
#allInterestingValuesOfAxes = list(set(itertools.chain(*INTERESTING_VALUES_OF_AXES.values())))
def flattenDictValues(dict_):
return itertools.chain(*dict_.values())
allInterestingValuesOfAxes = list(set(flattenDictValues(INTERESTING_VALUES_OF_AXES)))
plt.xticks(list(plt.xticks()[0]) + allInterestingValuesOfAxes)
allInterestingValuesOfAxesMin = min(allInterestingValuesOfAxes)
allInterestingValuesOfAxesMax = max(allInterestingValuesOfAxes)
plt.xlim(allInterestingValuesOfAxesMin, allInterestingValuesOfAxesMax)
INTERESTING_PROFILES_OF_AXES = {axis: PROFILES_OF_AXES[axis][allInterestingValuesOfAxesMin:allInterestingValuesOfAxesMax + 1] for axis in Axis}
allInterestingIntensitiesOfAxes = list(flattenDictValues(INTERESTING_PROFILES_OF_AXES))
allInterestingIntensitiesOfAxesMin = min(allInterestingIntensitiesOfAxes)
allInterestingIntensitiesOfAxesMax = max(allInterestingIntensitiesOfAxes)
plt.ylim(allInterestingIntensitiesOfAxesMin, allInterestingIntensitiesOfAxesMax)
plt.legend()
plt.show()