You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, our team has been using jwst to produce a transiting exoplanet data reduction pipeline, and we've encountered an error (see below) when we set rc('text', usetex=True) for matplotlib plotting and jwst logging is used.
The error occurs because when this setting is enabled, the log is passed a bytes like object at some point. The solution we've identified is to add:
if type(msg)==bytes:
msg = msg.decode()
immediately prior to Line 158 in the log_config.py file. I opted not to submit this as a pull request as I thought you'd want to look at things on your end first, hopefully that's okay! Let me know if you need any more information from us.
Generating x1dints figure
Traceback (most recent call last):
File "/Users/acarter/Documents/TRANSITS/EUREKA/TESTING_TAYLOR/run_eureka.py", line 12, in <module>
s2_meta = s2.run_eurekaS2(eventlabel)
File "/Users/acarter/anaconda3/envs/eureka_tjb/lib/python3.9/site-packages/eureka/S2_calibrations/s2_calibrate.py", line 164, in run_eurekaS2
File "/Users/acarter/anaconda3/envs/eureka_tjb/lib/python3.9/site-packages/matplotlib/pyplot.py", line 966, in savefig
res = fig.savefig(*args, **kwargs)
File "/Users/acarter/anaconda3/envs/eureka_tjb/lib/python3.9/site-packages/matplotlib/figure.py", line 3015, in savefig
self.canvas.print_figure(fname, **kwargs)
File "/Users/acarter/anaconda3/envs/eureka_tjb/lib/python3.9/site-packages/matplotlib/backend_bases.py", line 2230, in print_figure
self.figure.draw(renderer)
File "/Users/acarter/anaconda3/envs/eureka_tjb/lib/python3.9/site-packages/matplotlib/artist.py", line 74, in draw_wrapper
result = draw(artist, renderer, *args, **kwargs)
File "/Users/acarter/anaconda3/envs/eureka_tjb/lib/python3.9/site-packages/matplotlib/artist.py", line 51, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "/Users/acarter/anaconda3/envs/eureka_tjb/lib/python3.9/site-packages/matplotlib/figure.py", line 2790, in draw
mimage._draw_list_compositing_images(
File "/Users/acarter/anaconda3/envs/eureka_tjb/lib/python3.9/site-packages/matplotlib/image.py", line 132, in _draw_list_compositing_images
a.draw(renderer)
File "/Users/acarter/anaconda3/envs/eureka_tjb/lib/python3.9/site-packages/matplotlib/artist.py", line 51, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "/Users/acarter/anaconda3/envs/eureka_tjb/lib/python3.9/site-packages/matplotlib/_api/deprecation.py", line 431, in wrapper
return func(*inner_args, **inner_kwargs)
File "/Users/acarter/anaconda3/envs/eureka_tjb/lib/python3.9/site-packages/matplotlib/axes/_base.py", line 2881, in draw
self._update_title_position(renderer)
File "/Users/acarter/anaconda3/envs/eureka_tjb/lib/python3.9/site-packages/matplotlib/axes/_base.py", line 2822, in _update_title_position
if title.get_window_extent(renderer).ymin < top:
File "/Users/acarter/anaconda3/envs/eureka_tjb/lib/python3.9/site-packages/matplotlib/text.py", line 903, in get_window_extent
bbox, info, descent = self._get_layout(self._renderer)
File "/Users/acarter/anaconda3/envs/eureka_tjb/lib/python3.9/site-packages/matplotlib/text.py", line 306, in _get_layout
_, lp_h, lp_d = renderer.get_text_width_height_descent(
File "/Users/acarter/anaconda3/envs/eureka_tjb/lib/python3.9/site-packages/matplotlib/backends/backend_agg.py", line 229, in get_text_width_height_descent
w, h, d = texmanager.get_text_width_height_descent(
File "/Users/acarter/anaconda3/envs/eureka_tjb/lib/python3.9/site-packages/matplotlib/texmanager.py", line 399, in get_text_width_height_descent
dvifile = self.make_dvi(tex, fontsize)
File "/Users/acarter/anaconda3/envs/eureka_tjb/lib/python3.9/site-packages/matplotlib/texmanager.py", line 291, in make_dvi
self._run_checked_subprocess(
File "/Users/acarter/anaconda3/envs/eureka_tjb/lib/python3.9/site-packages/matplotlib/texmanager.py", line 268, in _run_checked_subprocess
_log.debug(report)
File "/Users/acarter/anaconda3/envs/eureka_tjb/lib/python3.9/site-packages/jwst/associations/lib/log_config.py", line 158, in log
for line in msg.split('\n'):
TypeError: a bytes-like object is required, not 'str'
The text was updated successfully, but these errors were encountered:
In regards to kevin218/Eureka#42 (comment), I'm not intimately familiar with what changes associations makes to logging, but this change seems to be innocuous enough. I'll run a PR through the regression tests to see if it breaks anything
I attempted to replicate this by: installing latex, modifying matplotlib rc as mentioned, generating a plot and creating jwst.stpipe.Step, which triggers the line which required modification. However I am unable to produce the mentioned error.
@zacharyburnett suggested approach sounds good to me. Any help in generating a minimal reproducer would be appreciated.
Hi, our team has been using
jwst
to produce a transiting exoplanet data reduction pipeline, and we've encountered an error (see below) when we setrc('text', usetex=True)
for matplotlib plotting andjwst
logging is used.The error occurs because when this setting is enabled, the log is passed a bytes like object at some point. The solution we've identified is to add:
immediately prior to Line 158 in the
log_config.py
file. I opted not to submit this as a pull request as I thought you'd want to look at things on your end first, hopefully that's okay! Let me know if you need any more information from us.The text was updated successfully, but these errors were encountered: