From 122468f63eb0a3f1462d627f69f2f70e157d0340 Mon Sep 17 00:00:00 2001 From: Riccardo Bertossa Date: Wed, 23 Feb 2022 20:02:39 +0100 Subject: [PATCH] fixed 57 --- .../example_cepstrum_doublecomp_NaCl.ipynb | 4 +- sportran_gui/assets/languages.json | 4 ++ sportran_gui/interfaces/headerSelector.py | 4 +- sportran_gui/interfaces/otherVariables.py | 64 +++++++++++-------- 4 files changed, 47 insertions(+), 29 deletions(-) diff --git a/examples/example_cepstrum_doublecomp_NaCl.ipynb b/examples/example_cepstrum_doublecomp_NaCl.ipynb index e4ac469..d4a7de2 100644 --- a/examples/example_cepstrum_doublecomp_NaCl.ipynb +++ b/examples/example_cepstrum_doublecomp_NaCl.ipynb @@ -9463,7 +9463,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "Python 3", "language": "python", "name": "python3" }, @@ -9477,7 +9477,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.10" + "version": "3.8.5" }, "widgets": { "state": {}, diff --git a/sportran_gui/assets/languages.json b/sportran_gui/assets/languages.json index 7d65593..7207c28 100644 --- a/sportran_gui/assets/languages.json +++ b/sportran_gui/assets/languages.json @@ -93,6 +93,8 @@ "fw_low": "Filter width can't be less than 0", "fw_void": "Filter width can't be void", "automatic_T": "The temperature will be automatically calculated", + "automatic_V": "The volume will be automatically calculated", + "automatic_DT": "The DT_FS will be automatically calculated", "back_reset": "Go back?", "back_reset_t": "Save changes?\nIf reopen the same file\nthe values that you chosed will not be deleted!", "fs_loaded": "F* loaded from input file ({})", @@ -191,6 +193,8 @@ "fw_low": "La larghezza del filtro non può essere negativa", "fw_void": "Il campo \"larghezza del filtro\" non può essere vuoto", "automatic_T": "La temperatura verrà calcolata automaticamente", + "automatic_V": "Il volume verrà calcolato automaticamente", + "automatic_DT": "Il timestep verrà calcolato automaticamente", "back_reset": "Andare indietro?", "back_reset_t": "Salvo le modifiche?\nSe si riapre lo stesso file\ni valori scelti non saranno cancellati!", "fs_loaded": "F* caricato dal file di input ({})" diff --git a/sportran_gui/interfaces/headerSelector.py b/sportran_gui/interfaces/headerSelector.py index e0b61b4..72605c8 100644 --- a/sportran_gui/interfaces/headerSelector.py +++ b/sportran_gui/interfaces/headerSelector.py @@ -97,8 +97,8 @@ def next(self): if cu.Data.options[1] in description: #energy current if description.count(cu.Data.options[1]) == 1: if description.count(cu.Data.options[3]) <= 1: #temperature - if description.count(cu.Data.options[4]) <= 1: - if description.count(cu.Data.options[5]) <= 1: + if description.count(cu.Data.options[4]) <= 1: #volume + if description.count(cu.Data.options[5]) <= 1: #DT cu.data.keys = keys cu.data.description = description cu.Data.loaded = True diff --git a/sportran_gui/interfaces/otherVariables.py b/sportran_gui/interfaces/otherVariables.py index d2b6f70..f5df41a 100644 --- a/sportran_gui/interfaces/otherVariables.py +++ b/sportran_gui/interfaces/otherVariables.py @@ -167,31 +167,45 @@ def update(self): self.DT_FS_entry.config(state=NORMAL) self.volume_entry.config(state=NORMAL) - if cu.data.inputformat == 'dict': - if True: #not cu.Data.loaded: - if cu.Data.options[3] in cu.data.description: - self.temp_advertise.config(text=LANGUAGES[settings.LANGUAGE]['automatic_T'], fg='red') - temp = cu.data.jdata[cu.data.keys[cu.data.description.index(cu.Data.options[3])]] - if type(temp) == float: - cu.data.temperature = temp - else: - cu.data.temperature = temp.mean() - cu.data.temperature_std = temp.std() - self.temperature_entry.config(state=DISABLED) - if cu.Data.options[4] in cu.data.description: - self.volume_advertise.config(text='The volume will be automatically calculated', fg='red') - vol = cu.data.jdata[cu.data.keys[cu.data.description.index(cu.Data.options[4])]] - if type(vol) == float: - cu.data.volume = vol - else: - cu.data.volume = vol.mean() - self.volume_entry.config(state=DISABLED) - if cu.Data.options[5] in cu.data.description: - self.DT_FS_advertise.config(text='The DT_FS will be automatically calculated', fg='red') - cu.data.DT_FS = cu.data.jdata[cu.data.keys[cu.data.description.index(cu.Data.options[5])]] - self.DT_FS_entry.config(state=DISABLED) - - self.update_data() + if cu.Data.options[3] in cu.data.description: + self.temp_advertise.config(text=LANGUAGES[settings.LANGUAGE]['automatic_T'], fg='red') + if cu.data.inputformat == 'dict': #only for dict I have the data here + temp = cu.data.jdata[cu.data.keys[cu.data.description.index(cu.Data.options[3])]] + if type(temp) == float: + cu.data.temperature = temp + else: + cu.data.temperature = temp.mean() + cu.data.temperature_std = temp.std() + self.temperature_entry.config(state=DISABLED) + else: + self.temperature_entry.config(state=NORMAL) + self.temp_advertise.config(text='') + if cu.Data.options[4] in cu.data.description: + self.volume_advertise.config(text=LANGUAGES[settings.LANGUAGE]['automatic_V'], fg='red') + if cu.data.inputformat == 'dict': #only for dict I have the data here + vol = cu.data.jdata[cu.data.keys[cu.data.description.index(cu.Data.options[4])]] + if type(vol) == float: + cu.data.volume = vol + else: + cu.data.volume = vol.mean() + else: + raise RuntimeError('NOT IMPLEMENTED') + self.volume_entry.config(state=DISABLED) + else: + self.volume_advertise.config(text='') + self.volume_entry.config(state=NORMAL) + if cu.Data.options[5] in cu.data.description: + self.DT_FS_advertise.config(text=LANGUAGES[settings.LANGUAGE]['automatic_DT'], fg='red') + if cu.data.inputformat == 'dict': #only for dict I have the data here + cu.data.DT_FS = cu.data.jdata[cu.data.keys[cu.data.description.index(cu.Data.options[5])]] + else: + raise RuntimeError('NOT IMPLEMENTED') + self.DT_FS_entry.config(state=DISABLED) + else: + self.DT_FS_advertise.config(text='') + self.DT_FS_entry.config(state=NORMAL) + + self.update_data() self.main_frame.viewPort.columnconfigure(0, weight=1) self.main_frame.viewPort.rowconfigure(0, weight=1)