sot / xija

Thermal modeling framework for Chandra X-ray Observatory
https://sot.github.io/xija
BSD 3-Clause "New" or "Revised" License
9 stars 5 forks source link

Fix random crashes using xija_gui_fit on Linux, change limit names for annotation, use CxoTime #108

Closed jzuhone closed 3 years ago

jzuhone commented 3 years ago

Description

This PR resolves an issue where xija_gui_fit would seemingly randomly crash on Linux when manipulating plots. The exact reason is unknown, because I could never seem to produce a traceback of any kind, but many of the plot objects (such as Figure and Axes were being re-created every time the data itself needed an update due to a new model fit, etc. This PR implements the changing of the data on the plot itself (for several plot types) instead of re-creating the plot objects with every update, which appears to fix the problem.

This PR also does the following:

Testing

Fixes issue #105.

jzuhone commented 3 years ago

I don't see crashes anymore, but I want @Gregg140 to confirm.

Gregg140 commented 3 years ago

The good news is that I could not make it crash.

I detected a couple of issues in my tests:

1) When I clicked on "Show Limits" for both the main data v time plot and the histogram I never saw the limit lines. Example:

Histo_show_lim

2) After doing some fitting, I asked for the histogram to be re-drawn and I got the following picture.

Pad_Plus_y

The issue is that on the right hand plot I can't tell if the data continues higher than ~13 or it I'm seeing the precise top of the data. A little padding would be good so that I'm sure I'm seeing the top of the histogram.

Example of tests performed:

xija_gui_fit dpa_model_spec.json --days 365 --stop 2021:079:00:00:00.00 &

1) Delete dpa0 solar heat plot

2) Add 1dpamzt resid_time plot

3) Clicked on show limits - Limits did not appear on the model v data plot

4) Click Histogram

5) Histogram plot: Show limits

 **- Limits did not appear on left hand plot**

6) Mask FMT1

7) Mask Radzones

8) Redraw Histo

9) Histo limits off

10) Mask FMT1 off

11) Mask Radzones off

12) fit tau, ampl, bias

13) Mask FMT1, radzones, show limits

14) Unmask FMT!, radzones, show limits

15) Redraw

16) Annotate line

17) Click on main plot to change annotation values

18) Redraw histo

19) Close histo

20) Open histo

21) Redraw histo

22) add resid_data plot

23) Fit P's

24) Redraw Histo

 **Need to pad the +y axis**
jzuhone commented 3 years ago

@Gregg140 this should be fixed now.

Gregg140 commented 3 years ago

Crashed when running through the tests I listed. But I winnowed it down to this:

1) fit tau, ampl, bias

2) Click on histogram

Traceback (most recent call last): File "/data/acis/ska_pkg/xija/xija/gui_fit/app.py", line 932, in make_histogram self.hist_window = HistogramWindow(self.model, self.hist_msids) File "/data/acis/ska_pkg/xija/xija/gui_fit/plots.py", line 275, in init self.make_plots() File "/data/acis/ska_pkg/xija/xija/gui_fit/plots.py", line 336, in make_plots self.update_plots() File "/data/acis/ska_pkg/xija/xija/gui_fit/plots.py", line 416, in update_plots self.ax2.set_ylim(0.0, hist.max()+1) File "/data/acis/miniconda3/envs/ska-dev/lib/python3.8/site-packages/matplotlib/axes/_base.py", line 3578, in set_ylim top = self._validate_converted_limits(top, self.convert_yunits) File "/data/acis/miniconda3/envs/ska-dev/lib/python3.8/site-packages/matplotlib/axes/_base.py", line 3101, in _validate_converted_limits raise ValueError("Axis limits cannot be NaN or Inf") ValueError: Axis limits cannot be NaN or Inf

jzuhone commented 3 years ago

Thanks for catching that--fixed now.

jzuhone commented 3 years ago

@taldcroft I added your suggestions also.

jzuhone commented 3 years ago

@taldcroft this is ready to go.