bcych / BiCEP_GUI

GUI for using the BiCEP method (Cych et al, 2021) on paleointensity data.
5 stars 3 forks source link

bunch of runtime errors with stalled processing #5

Closed ltauxe closed 2 years ago

ltauxe commented 2 years ago

running on KEN data set (ben-yosef et al., 2009) on site s20006a: [and this runs fine on the old jupyterhub version]

RuntimeError Traceback (most recent call last) ~/Dropbox/LevyFestchrift/BiCEP_functions.py in save_figures(a) 1836 objdict={'Specimen Plot':fig,'Site Plot':fig_2} 1837 value={'Specimen Plot':specimen_wid.value,'Site Plot':site_wid.value} -> 1838 objdict[figchoice.value].savefig(value[figchoice.value]+'_BiCEP_fit.'+figformats.value) 1839 1840

~/opt/anaconda3/envs/BiCEP/lib/python3.7/site-packages/matplotlib/figure.py in savefig(self, fname, transparent, kwargs) 2178 self.patch.set_visible(frameon) 2179 -> 2180 self.canvas.print_figure(fname, kwargs) 2181 2182 if frameon:

~/opt/anaconda3/envs/BiCEP/lib/python3.7/site-packages/matplotlib/backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, bbox_inches, kwargs) 2089 orientation=orientation, 2090 bbox_inches_restore=_bbox_inches_restore, -> 2091 kwargs) 2092 finally: 2093 if bbox_inches and restore_bbox:

~/opt/anaconda3/envs/BiCEP/lib/python3.7/site-packages/matplotlib/backends/backend_pdf.py in print_pdf(self, filename, dpi, bbox_inches_restore, metadata, **kwargs) 2501 RendererPdf(file, dpi, height, width), 2502 bbox_inches_restore=bbox_inches_restore) -> 2503 self.figure.draw(renderer) 2504 renderer.finalize() 2505 if not isinstance(filename, PdfPages):

~/opt/anaconda3/envs/BiCEP/lib/python3.7/site-packages/matplotlib/artist.py in draw_wrapper(artist, renderer, *args, *kwargs) 36 renderer.start_filter() 37 ---> 38 return draw(artist, renderer, args, **kwargs) 39 finally: 40 if artist.get_agg_filter() is not None:

~/opt/anaconda3/envs/BiCEP/lib/python3.7/site-packages/matplotlib/figure.py in draw(self, renderer) 1707 self.patch.draw(renderer) 1708 mimage._draw_list_compositing_images( -> 1709 renderer, self, artists, self.suppressComposite) 1710 1711 renderer.close_group('figure')

~/opt/anaconda3/envs/BiCEP/lib/python3.7/site-packages/matplotlib/image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite) 133 if not_composite or not has_images: 134 for a in artists: --> 135 a.draw(renderer) 136 else: 137 # Composite any adjacent images together

~/opt/anaconda3/envs/BiCEP/lib/python3.7/site-packages/matplotlib/artist.py in draw_wrapper(artist, renderer, *args, *kwargs) 36 renderer.start_filter() 37 ---> 38 return draw(artist, renderer, args, **kwargs) 39 finally: 40 if artist.get_agg_filter() is not None:

~/opt/anaconda3/envs/BiCEP/lib/python3.7/site-packages/matplotlib/axes/_base.py in draw(self, renderer, inframe) 2645 renderer.stop_rasterizing() 2646 -> 2647 mimage._draw_list_compositing_images(renderer, self, artists) 2648 2649 renderer.close_group('axes')

~/opt/anaconda3/envs/BiCEP/lib/python3.7/site-packages/matplotlib/image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite) 133 if not_composite or not has_images: 134 for a in artists: --> 135 a.draw(renderer) 136 else: 137 # Composite any adjacent images together

~/opt/anaconda3/envs/BiCEP/lib/python3.7/site-packages/matplotlib/artist.py in draw_wrapper(artist, renderer, *args, *kwargs) 36 renderer.start_filter() 37 ---> 38 return draw(artist, renderer, args, **kwargs) 39 finally: 40 if artist.get_agg_filter() is not None:

~/opt/anaconda3/envs/BiCEP/lib/python3.7/site-packages/matplotlib/axis.py in draw(self, renderer, *args, **kwargs) 1203 ticks_to_draw = self._update_ticks() 1204 ticklabelBoxes, ticklabelBoxes2 = self._get_tick_bboxes(ticks_to_draw, -> 1205 renderer) 1206 1207 for tick in ticks_to_draw:

~/opt/anaconda3/envs/BiCEP/lib/python3.7/site-packages/matplotlib/axis.py in _get_tick_bboxes(self, ticks, renderer) 1148 """Return lists of bboxes for ticks' label1's and label2's.""" 1149 return ([tick.label1.get_window_extent(renderer) -> 1150 for tick in ticks if tick.label1.get_visible()], 1151 [tick.label2.get_window_extent(renderer) 1152 for tick in ticks if tick.label2.get_visible()])

~/opt/anaconda3/envs/BiCEP/lib/python3.7/site-packages/matplotlib/axis.py in (.0) 1148 """Return lists of bboxes for ticks' label1's and label2's.""" 1149 return ([tick.label1.get_window_extent(renderer) -> 1150 for tick in ticks if tick.label1.get_visible()], 1151 [tick.label2.get_window_extent(renderer) 1152 for tick in ticks if tick.label2.get_visible()])

~/opt/anaconda3/envs/BiCEP/lib/python3.7/site-packages/matplotlib/text.py in get_window_extent(self, renderer, dpi) 888 raise RuntimeError('Cannot get window extent w/o renderer') 889 --> 890 bbox, info, descent = self._get_layout(self._renderer) 891 x, y = self.get_unitless_position() 892 x, y = self.get_transform().transform_point((x, y))

~/opt/anaconda3/envs/BiCEP/lib/python3.7/site-packages/matplotlib/text.py in _getlayout(self, renderer) 289 , lp_h, lp_d = renderer.get_text_width_height_descent( 290 "lp", self._fontproperties, --> 291 ismath="TeX" if self.get_usetex() else False) 292 min_dy = (lp_h - lp_d) * self._linespacing 293

~/opt/anaconda3/envs/BiCEP/lib/python3.7/site-packages/matplotlib/backends/_backend_pdf_ps.py in get_text_width_height_descent(self, s, prop, ismath) 60 else: 61 font = self._get_font_ttf(prop) ---> 62 font.set_text(s, 0.0, flags=ft2font.LOAD_NO_HINTING) 63 w, h = font.get_width_height() 64 d = font.get_descent()

RuntimeError: In set_text: could not load glyph


RuntimeError Traceback (most recent call last) ~/Dropbox/LevyFestchrift/BiCEP_functions.py in save_figures(a) 1836 objdict={'Specimen Plot':fig,'Site Plot':fig_2} 1837 value={'Specimen Plot':specimen_wid.value,'Site Plot':site_wid.value} -> 1838 objdict[figchoice.value].savefig(value[figchoice.value]+'_BiCEP_fit.'+figformats.value) 1839 1840

~/opt/anaconda3/envs/BiCEP/lib/python3.7/site-packages/matplotlib/figure.py in savefig(self, fname, transparent, kwargs) 2178 self.patch.set_visible(frameon) 2179 -> 2180 self.canvas.print_figure(fname, kwargs) 2181 2182 if frameon:

~/opt/anaconda3/envs/BiCEP/lib/python3.7/site-packages/matplotlib/backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, bbox_inches, kwargs) 2089 orientation=orientation, 2090 bbox_inches_restore=_bbox_inches_restore, -> 2091 kwargs) 2092 finally: 2093 if bbox_inches and restore_bbox:

~/opt/anaconda3/envs/BiCEP/lib/python3.7/site-packages/matplotlib/backends/backend_pdf.py in print_pdf(self, filename, dpi, bbox_inches_restore, metadata, **kwargs) 2501 RendererPdf(file, dpi, height, width), 2502 bbox_inches_restore=bbox_inches_restore) -> 2503 self.figure.draw(renderer) 2504 renderer.finalize() 2505 if not isinstance(filename, PdfPages):

~/opt/anaconda3/envs/BiCEP/lib/python3.7/site-packages/matplotlib/artist.py in draw_wrapper(artist, renderer, *args, *kwargs) 36 renderer.start_filter() 37 ---> 38 return draw(artist, renderer, args, **kwargs) 39 finally: 40 if artist.get_agg_filter() is not None:

~/opt/anaconda3/envs/BiCEP/lib/python3.7/site-packages/matplotlib/figure.py in draw(self, renderer) 1707 self.patch.draw(renderer) 1708 mimage._draw_list_compositing_images( -> 1709 renderer, self, artists, self.suppressComposite) 1710 1711 renderer.close_group('figure')

~/opt/anaconda3/envs/BiCEP/lib/python3.7/site-packages/matplotlib/image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite) 133 if not_composite or not has_images: 134 for a in artists: --> 135 a.draw(renderer) 136 else: 137 # Composite any adjacent images together

~/opt/anaconda3/envs/BiCEP/lib/python3.7/site-packages/matplotlib/artist.py in draw_wrapper(artist, renderer, *args, *kwargs) 36 renderer.start_filter() 37 ---> 38 return draw(artist, renderer, args, **kwargs) 39 finally: 40 if artist.get_agg_filter() is not None:

~/opt/anaconda3/envs/BiCEP/lib/python3.7/site-packages/matplotlib/axes/_base.py in draw(self, renderer, inframe) 2645 renderer.stop_rasterizing() 2646 -> 2647 mimage._draw_list_compositing_images(renderer, self, artists) 2648 2649 renderer.close_group('axes')

~/opt/anaconda3/envs/BiCEP/lib/python3.7/site-packages/matplotlib/image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite) 133 if not_composite or not has_images: 134 for a in artists: --> 135 a.draw(renderer) 136 else: 137 # Composite any adjacent images together

~/opt/anaconda3/envs/BiCEP/lib/python3.7/site-packages/matplotlib/artist.py in draw_wrapper(artist, renderer, *args, *kwargs) 36 renderer.start_filter() 37 ---> 38 return draw(artist, renderer, args, **kwargs) 39 finally: 40 if artist.get_agg_filter() is not None:

~/opt/anaconda3/envs/BiCEP/lib/python3.7/site-packages/matplotlib/axis.py in draw(self, renderer, *args, **kwargs) 1203 ticks_to_draw = self._update_ticks() 1204 ticklabelBoxes, ticklabelBoxes2 = self._get_tick_bboxes(ticks_to_draw, -> 1205 renderer) 1206 1207 for tick in ticks_to_draw:

~/opt/anaconda3/envs/BiCEP/lib/python3.7/site-packages/matplotlib/axis.py in _get_tick_bboxes(self, ticks, renderer) 1148 """Return lists of bboxes for ticks' label1's and label2's.""" 1149 return ([tick.label1.get_window_extent(renderer) -> 1150 for tick in ticks if tick.label1.get_visible()], 1151 [tick.label2.get_window_extent(renderer) 1152 for tick in ticks if tick.label2.get_visible()])

~/opt/anaconda3/envs/BiCEP/lib/python3.7/site-packages/matplotlib/axis.py in (.0) 1148 """Return lists of bboxes for ticks' label1's and label2's.""" 1149 return ([tick.label1.get_window_extent(renderer) -> 1150 for tick in ticks if tick.label1.get_visible()], 1151 [tick.label2.get_window_extent(renderer) 1152 for tick in ticks if tick.label2.get_visible()])

~/opt/anaconda3/envs/BiCEP/lib/python3.7/site-packages/matplotlib/text.py in get_window_extent(self, renderer, dpi) 888 raise RuntimeError('Cannot get window extent w/o renderer') 889 --> 890 bbox, info, descent = self._get_layout(self._renderer) 891 x, y = self.get_unitless_position() 892 x, y = self.get_transform().transform_point((x, y))

~/opt/anaconda3/envs/BiCEP/lib/python3.7/site-packages/matplotlib/text.py in _getlayout(self, renderer) 289 , lp_h, lp_d = renderer.get_text_width_height_descent( 290 "lp", self._fontproperties, --> 291 ismath="TeX" if self.get_usetex() else False) 292 min_dy = (lp_h - lp_d) * self._linespacing 293

~/opt/anaconda3/envs/BiCEP/lib/python3.7/site-packages/matplotlib/backends/_backend_pdf_ps.py in get_text_width_height_descent(self, s, prop, ismath) 60 else: 61 font = self._get_font_ttf(prop) ---> 62 font.set_text(s, 0.0, flags=ft2font.LOAD_NO_HINTING) 63 w, h = font.get_width_height() 64 d = font.get_descent()

RuntimeError: In set_text: could not load glyph


ValueError Traceback (most recent call last) ~/Dropbox/LevyFestchrift/BiCEP_functions.py in get_site_dist(a) 1686 model=model_circle_fast 1687 -> 1688 thellierData[site_wid.value].BiCEP_fit(model=model,n_samples=n_samples_wid.value) 1689 fit=thellierData[site_wid.value].fit 1690 display_sampler_diags(fit)

~/Dropbox/LevyFestchrift/BiCEP_functions.py in BiCEP_fit(self, n_samples, priorstd, model, **kwargs) 390 for specimen in self.specimens.values(): 391 if specimen.active==True: --> 392 specimen.save_changes() 393 minPTRM,minNRM,PTRMmax,k,phi,dist_to_edge,sigma,PTRMS,NRMS=specimen.BiCEP_prep() 394 NRM0=specimen.NRM0

~/Dropbox/LevyFestchrift/BiCEP_functions.py in save_changes(self) 696 redo=self.parentCollection.parentData.redo 697 if self.name in redo[0].unique(): --> 698 redo.at[redo[0]==self.name,1]=self.lowerTemp 699 redo.at[redo[0]==self.name,2]=self.upperTemp 700 else:

~/opt/anaconda3/envs/BiCEP/lib/python3.7/site-packages/pandas/core/indexing.py in setitem(self, key, value) 2279 # GH#33041 fall back to .loc 2280 if not isinstance(key, tuple) or not all(is_scalar(x) for x in key): -> 2281 raise ValueError("Invalid call for scalar access (setting)!") 2282 2283 self.obj.loc[key] = value

ValueError: Invalid call for scalar access (setting)!

bcych commented 2 years ago

I've encountered this bug before. I believe it's something to do with accessing data in the redo file. I'll have a look at what exactly is going on but this should be fixable by moving or deleting your redo file.

bcych commented 2 years ago

The other runtime errors shouldn't terminate the program, but look like they're related to matplotlib_base. Upgrading to the most recent version of matplotlib-base fixes these errors getting spewed, but for some reason it also draws the plots in the wrong place (below the entire GUI). This is an option if you want to avoid these errors.

bcych commented 2 years ago

I couldn't reproduce this error using the same dataset you are using, this site ran for me. I suspect it's a bug with the redo file from:

~/Dropbox/LevyFestchrift/BiCEP_functions.py in save_changes(self) 696 redo=self.parentCollection.parentData.redo 697 if self.name in redo[0].unique(): --> 698 redo.at[redo[0]==self.name,1]=self.lowerTemp 699 redo.at[redo[0]==self.name,2]=self.upperTemp 700 else:

~/opt/anaconda3/envs/BiCEP/lib/python3.7/site-packages/pandas/core/indexing.py in setitem(self, key, value) 2279 # GH#33041 fall back to .loc 2280 if not isinstance(key, tuple) or not all(is_scalar(x) for x in key): -> 2281 raise ValueError("Invalid call for scalar access (setting)!") 2282 2283 self.obj.loc[key] = value

Please try the following:

Try opening the GUI and running again, check if this error appears before or after the site level fit has been run. If the error persists: Try changing the ".at" in lines 698 and 699 of BiCEP_functions.py to a ".loc". If this fixes the problem I'll change that in the github version.

bcych commented 2 years ago

The fix suggested in the comment above worked for this problem and has been fixed in the latest commit. As this is the relevant fatal error, I'm closing this now. If you experience the other runtime errors again (likely not fatal again), these are a separate problem, please open a new issue.