neutrons / PyRS

Reduction and visualization software for Stress Residual (HB2B)
https://neutrons-pyrs.readthedocs.io/en/latest/index.html
GNU General Public License v3.0
6 stars 7 forks source link

[BUG] Crash - Strain/Stress GUI #698

Closed jefrbunn closed 4 years ago

jefrbunn commented 4 years ago

The GUI crashes when I try and export a CSV from the GUI containing multiple files per direction

To recreate:

Open Strain/Stress GUI Select 3D files found: HB2B/IPTS-22091/shared/Fit Data

e11: AxialDirection_1.h5, AxialDirection_2.h5, AxialDirection_3.h5 e22: TransverseDirection.h5 e33: NormalDirection_1.h5, NormalDirection_2.h5

d0=1.0833 E:200 v=0.3

click "Export Grid Information" save file

Crash happens,

traceback:

Traceback (most recent call last):
  File "/SNS/software/PyRS/build/lib/pyrs/interface/strainstressviewer/strain_stress_view.py", line 339, in save_CSV
    self._parent.controller.write_stress_to_csv(filename)
  File "/SNS/software/PyRS/build/lib/pyrs/interface/strainstressviewer/controller.py", line 57, in write_stress_to_csv
    self._model.write_stress_to_csv(filename)
  File "/SNS/software/PyRS/build/lib/pyrs/interface/strainstressviewer/model.py", line 159, in write_stress_to_csv
    stress_csv.write_summary_csv()
  File "/SNS/software/PyRS/build/lib/pyrs/core/summary_generator_stress.py", line 223, in write_summary_csv
    self._write_csv_header(handle)
  File "/SNS/software/PyRS/build/lib/pyrs/core/summary_generator_stress.py", line 98, in _write_csv_header
    run_number = filename[filename.index('HB2B_') + 5: filename.index('.h5')]
ValueError: substring not found
rosswhitfield commented 4 years ago

I have created #700 to address the issue with the csv writer while I will work on making the GUI not crash when this happens and provide some useful error messages.