Browse Source

Savety update (Rauschen scales safer)

Ein paar restriktionen für die Rauschen scale widgets eingebaut (Untere, Obere Rauschgrenzen) so dass die digitale Bandpass Funktion hintendran keine Fehler mehr geben kann. Das sollte die GUI robuster machen.
master
seyffejn 4 years ago
parent
commit
7fed3e630e

+ 62
- 65
TinnitusAnalyse/.idea/workspace.xml View File

@@ -2,10 +2,8 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="5b3f2136-e422-4072-84be-e86e40fa2d55" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/DigitalFilterTest.py" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/SoundGenerator.py" beforeDir="false" afterPath="$PROJECT_DIR$/SoundGenerator.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/TinnitusAnalyse_GUI.py" beforeDir="false" afterPath="$PROJECT_DIR$/TinnitusAnalyse_GUI.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/TinnitusDaten.csv" beforeDir="false" afterPath="$PROJECT_DIR$/TinnitusDaten.csv" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
@@ -18,8 +16,8 @@
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/TinnitusAnalyse_GUI.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="312">
<caret line="13" column="67" lean-forward="true" selection-start-line="13" selection-start-column="67" selection-end-line="13" selection-end-column="67" />
<state relative-caret-position="162">
<caret line="150" lean-forward="true" selection-start-line="150" selection-end-line="150" />
<folding>
<element signature="e#0#117#0" expanded="true" />
</folding>
@@ -27,11 +25,29 @@
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python35/Lib/site-packages/scipy/signal/filter_design.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="534">
<caret line="2211" column="41" lean-forward="true" selection-start-line="2211" selection-start-column="41" selection-end-line="2211" selection-end-column="41" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python35/Lib/tkinter/__init__.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="17034">
<caret line="1004" column="30" selection-start-line="1004" selection-start-column="30" selection-end-line="1004" selection-end-column="30" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/SoundGenerator.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="424">
<caret line="123" column="21" lean-forward="true" selection-start-line="123" selection-start-column="21" selection-end-line="123" selection-end-column="21" />
<state relative-caret-position="1044">
<caret line="139" column="42" selection-start-line="139" selection-start-column="42" selection-end-line="139" selection-end-column="42" />
<folding>
<element signature="e#0#11#0" expanded="true" />
</folding>
@@ -39,6 +55,15 @@
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python35/Lib/site-packages/sounddevice.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="24106">
<caret line="1423" column="8" selection-start-line="1423" selection-start-column="8" selection-end-line="1423" selection-end-column="8" />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FileTemplateManagerImpl">
@@ -259,13 +284,14 @@
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="2576" height="1416" extended-state="6" />
<editor active="true" />
<layout>
<window_info content_ui="combo" id="Project" order="0" weight="0.18479118" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info id="Favorites" order="2" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" />
<window_info anchor="bottom" id="Run" order="2" weight="0.2548714" />
<window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.24707717" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.3990647" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
@@ -279,20 +305,20 @@
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
</layout>
<layout-to-restore>
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.18479118" />
<window_info content_ui="combo" id="Project" order="0" weight="0.18479118" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info id="Favorites" order="2" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" />
<window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.30553392" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
<window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.2548714" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.3990647" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="bottom" id="Version Control" order="7" />
<window_info anchor="bottom" id="Terminal" order="8" />
<window_info anchor="bottom" id="Terminal" order="8" weight="0.32969603" />
<window_info anchor="bottom" id="Event Log" order="9" side_tool="true" />
<window_info anchor="bottom" id="Python Console" order="10" />
<window_info anchor="bottom" id="Python Console" order="10" weight="0.32969603" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
@@ -306,23 +332,7 @@
<entry file="file://$PROJECT_DIR$/DigitalFilter1.py" />
<entry file="file://$PROJECT_DIR$/Noise Experiment.py" />
<entry file="file://$PROJECT_DIR$/DigitalFilter.py" />
<entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python35/Lib/tkinter/__init__.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="26435">
<caret line="1557" selection-start-line="1557" selection-end-line="1557" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/../../../DigitalFilter.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="493">
<caret line="32" lean-forward="true" selection-start-line="32" selection-end-line="32" />
<folding>
<element signature="e#0#47#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/../../../DigitalFilter.py" />
<entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python35/Lib/site-packages/matplotlib/axes/_base.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="3349">
@@ -337,64 +347,51 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/DigitalFilterTest2.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="620">
<caret line="20" lean-forward="true" selection-start-line="20" selection-end-line="20" />
<folding>
<element signature="e#1#25#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Scipy_Erklärung.py">
<entry file="file://$PROJECT_DIR$/DigitalFilterTest2.py" />
<entry file="file://$PROJECT_DIR$/Scipy_Erklärung.py" />
<entry file="file://$PROJECT_DIR$/DigitalFilterTest.py" />
<entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python35/Lib/wave.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="644">
<caret line="36" column="21" lean-forward="true" selection-start-line="36" selection-start-column="21" selection-end-line="36" selection-end-column="21" />
<folding>
<element signature="e#0#24#0" expanded="true" />
</folding>
<state relative-caret-position="353">
<caret line="454" column="35" lean-forward="true" selection-start-line="454" selection-start-column="35" selection-end-line="454" selection-end-column="35" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/DigitalFilterTest.py">
<entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python35/Lib/tkinter/__init__.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="320">
<caret line="16" column="26" lean-forward="true" selection-start-line="16" selection-start-column="26" selection-end-line="16" selection-end-column="26" />
<folding>
<element signature="e#0#47#0" expanded="true" />
</folding>
<state relative-caret-position="17034">
<caret line="1004" column="30" selection-start-line="1004" selection-start-column="30" selection-end-line="1004" selection-end-column="30" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/SoundGenerator.py">
<entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python35/Lib/site-packages/sounddevice.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="424">
<caret line="123" column="21" lean-forward="true" selection-start-line="123" selection-start-column="21" selection-end-line="123" selection-end-column="21" />
<folding>
<element signature="e#0#11#0" expanded="true" />
</folding>
<state relative-caret-position="24106">
<caret line="1423" column="8" selection-start-line="1423" selection-start-column="8" selection-end-line="1423" selection-end-column="8" />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python35/Lib/site-packages/scipy/signal/filter_design.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="463">
<caret line="2354" column="31" lean-forward="true" selection-start-line="2354" selection-start-column="31" selection-end-line="2354" selection-end-column="31" />
<state relative-caret-position="534">
<caret line="2211" column="41" lean-forward="true" selection-start-line="2211" selection-start-column="41" selection-end-line="2211" selection-end-column="41" />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python35/Lib/wave.py">
<entry file="file://$PROJECT_DIR$/SoundGenerator.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="353">
<caret line="454" column="35" lean-forward="true" selection-start-line="454" selection-start-column="35" selection-end-line="454" selection-end-column="35" />
<state relative-caret-position="1044">
<caret line="139" column="42" selection-start-line="139" selection-start-column="42" selection-end-line="139" selection-end-column="42" />
<folding>
<element signature="e#0#11#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/TinnitusAnalyse_GUI.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="312">
<caret line="13" column="67" lean-forward="true" selection-start-line="13" selection-start-column="67" selection-end-line="13" selection-end-column="67" />
<state relative-caret-position="162">
<caret line="150" lean-forward="true" selection-start-line="150" selection-end-line="150" />
<folding>
<element signature="e#0#117#0" expanded="true" />
</folding>

+ 33
- 16
TinnitusAnalyse/TinnitusAnalyse_GUI.py View File

@@ -29,15 +29,23 @@ def links_scale_rauschen_lautstärke_change(self):


def links_scale_untere_grenzfrequenz_change(self):
og = float(linksScaleObereGrenzfrequenz.get() * 1000) # kHz -> Hz
ug = float(linksScaleUntereGrenzfrequenz.get() * 1000) # kHz -> Hz
tinnitus.linksRauschenUntereGrenzfrequenz = ug
sound.play()
if og <= ug: # wenn obere Grenzfreq. kleiner als untere Grenzfreq. ist -> macht keinen Sinn deswegen verbieten
linksScaleUntereGrenzfrequenz.set(linksScaleObereGrenzfrequenz.get() - 0.01)
else:
tinnitus.linksRauschenUntereGrenzfrequenz = ug
sound.play()


def links_scale_obere_grenzfrequenz_change(self):
og = float(linksScaleObereGrenzfrequenz.get()*1000) # kHz -> Hz
tinnitus.linksRauschenObereGrenzfrequenz = og
sound.play()
ug = float(linksScaleUntereGrenzfrequenz.get() * 1000) # kHz -> Hz
if og <= ug: # wenn obere Grenzfreq. kleiner als untere Grenzfreq. ist -> macht keinen Sinn deswegen verbieten
linksScaleObereGrenzfrequenz.set(linksScaleUntereGrenzfrequenz.get() + 0.01)
else:
tinnitus.linksRauschenObereGrenzfrequenz = og
sound.play()


"""----------Funktionen rechts----------"""
@@ -62,15 +70,23 @@ def rechts_scale_rauschen_lautstärke_change(self):


def rechts_scale_untere_grenzfrequenz_change(self):
og = float(rechtsScaleObereGrenzfrequenz.get() * 1000) # kHz -> Hz
ug = float(rechtsScaleUntereGrenzfrequenz.get() * 1000) # kHz -> Hz
tinnitus.rechtsRauschenUntereGrenzfrequenz = ug
sound.play()
if ug >= og: # wenn obere Grenzfreq. kleiner als untere Grenzfreq. ist -> macht keinen Sinn deswegen verbieten
rechtsScaleUntereGrenzfrequenz.set(rechtsScaleObereGrenzfrequenz.get()-0.01)
else:
tinnitus.rechtsRauschenUntereGrenzfrequenz = ug
sound.play()


def rechts_scale_obere_grenzfrequenz_change(self):
og = float(rechtsScaleObereGrenzfrequenz.get()*1000) # kHz -> Hz
tinnitus.rechtsRauschenObereGrenzfrequenz = og
sound.play()
ug = float(rechtsScaleUntereGrenzfrequenz.get() * 1000) # kHz -> Hz
if og <= ug: # wenn obere Grenzfreq. kleiner als untere Grenzfreq. ist -> macht keinen Sinn deswegen verbieten
rechtsScaleObereGrenzfrequenz.set(rechtsScaleUntereGrenzfrequenz.get()+0.01)
else:
tinnitus.rechtsRauschenObereGrenzfrequenz = og
sound.play()


"""--------------Funktionen unten------------------"""
@@ -133,7 +149,7 @@ def unten_button_stop_press():
sound.stop()


def feedback(text, fontcolor = "black", backgroundcolor = "lightsteelblue"):
def feedback(text, fontcolor="black", backgroundcolor="lightsteelblue"):
""" This is a helper function. You can give it a string text and it will display it in the feedback frame (bottom
right of the GUI) in the text widget. The parameter color is also a string and defines the font color. Same with
background. Honestly this function is way too complicated, but Tkinter has no nicer/easier builtin way of doing the
@@ -206,17 +222,17 @@ linksScaleRauschenLautstärke.grid(column=1, row=3, sticky=(W+E))
# Obere Grenzfrequenz
linksLabelObereGrenzfrequenz = Label(linkerFrame, text="Obere Grenzfrequenz [kHz]", anchor="w")
linksLabelObereGrenzfrequenz.grid(column=0, row=4, sticky=W)
linksScaleObereGrenzfrequenz = Scale(linkerFrame, from_=0, to=20, orient=HORIZONTAL, length=600, resolution=-1.0,
linksScaleObereGrenzfrequenz = Scale(linkerFrame, from_=0.02, to=20, orient=HORIZONTAL, length=600, resolution=-1.0,
command=links_scale_obere_grenzfrequenz_change)
linksScaleObereGrenzfrequenz.grid(column=1, row=4, sticky=(W+E))
linksScaleObereGrenzfrequenz.set(20.00)
# Untere Grenzfrequenz
linksLabelUntereGrenzfrequenz = Label(linkerFrame, text="Untere Grenzfrequenz [kHz]", anchor="w")
linksLabelUntereGrenzfrequenz.grid(column=0, row=5, sticky=(W+E))
linksScaleUntereGrenzfrequenz = Scale(linkerFrame, from_=0, to=20, orient=HORIZONTAL, length=600, resolution=-1.0,
linksScaleUntereGrenzfrequenz = Scale(linkerFrame, from_=0.01, to=20, orient=HORIZONTAL, length=600, resolution=-1.0,
command=links_scale_untere_grenzfrequenz_change)
linksScaleUntereGrenzfrequenz.grid(column=1, row=5, sticky=(W+E))
linksScaleUntereGrenzfrequenz.set(0.01)
"""----------------------------------------------RECHTER FRAME-------------------------------------------------------"""
rechterFrame = LabelFrame(root, text="Rechtes Ohr", font="bold")
rechterFrame.grid(column=1, row=0, sticky=(N+E+W+S))
@@ -256,16 +272,17 @@ rechtsScaleRauschenLautstärke.grid(column=1, row=3, sticky=(W+E))
# Obere Grenzfrequenz
rechtsLabelObereGrenzfrequenz = Label(rechterFrame, text="Obere Grenzfrequenz [kHz]", anchor="w")
rechtsLabelObereGrenzfrequenz.grid(column=0, row=4, sticky=W)
rechtsScaleObereGrenzfrequenz = Scale(rechterFrame, from_=0, to=20, orient=HORIZONTAL, length=600, resolution=-1.0,
rechtsScaleObereGrenzfrequenz = Scale(rechterFrame, from_=0.02, to=20, orient=HORIZONTAL, length=600, resolution=-1.0,
command=rechts_scale_obere_grenzfrequenz_change)
rechtsScaleObereGrenzfrequenz.grid(column=1, row=4, sticky=(W+E))
rechtsScaleObereGrenzfrequenz.set(20.00)
# Untere Grenzfrequenz
rechtsLabelUntereGrenzfrequenz = Label(rechterFrame, text="Untere Grenzfrequenz [kHz]", anchor="w")
rechtsLabelUntereGrenzfrequenz.grid(column=0, row=5, sticky=(W+E))
rechtsScaleUntereGrenzfrequenz = Scale(rechterFrame, from_=0, to=20, orient=HORIZONTAL, length=600, resolution=-1.0,
rechtsScaleUntereGrenzfrequenz = Scale(rechterFrame, from_=0.01, to=20, orient=HORIZONTAL, length=600, resolution=-1.0,
command=rechts_scale_untere_grenzfrequenz_change)
rechtsScaleUntereGrenzfrequenz.grid(column=1, row=5, sticky=(W+E))
rechtsScaleUntereGrenzfrequenz.set(0.01)

"""------------------------------------------------ UNTERER LINKER FRAME---------------------------------------------"""
untererFrame = LabelFrame(root, text="Generelles", border=10)

BIN
TinnitusAnalyse/__pycache__/SoundGenerator.cpython-35.pyc View File


Loading…
Cancel
Save