gelles-brandeis / tapqir

Bayesian analysis of co-localization single-molecule microscopy image data.
Apache License 2.0
4 stars 0 forks source link

dwell time - post analysis #371

Closed jc-brandeis closed 2 years ago

jc-brandeis commented 2 years ago

errors associated with running dwell-time post analysis

Dwell-time analysis ...
Saved off-rate parameters for channel 0 in koff0.csv file
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
File ~/anaconda3/envs/tapqir-env/lib/python3.8/site-packages/matplotlib/texmanager.py:233, in TexManager._run_checked_subprocess(self, command, tex, cwd)
    232 try:
--> 233     report = subprocess.check_output(
    234         command, cwd=cwd if cwd is not None else self.texcache,
    235         stderr=subprocess.STDOUT)
    236 except FileNotFoundError as exc:

File ~/anaconda3/envs/tapqir-env/lib/python3.8/subprocess.py:415, in check_output(timeout, *popenargs, **kwargs)
    413     kwargs['input'] = empty
--> 415 return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
    416            **kwargs).stdout

File ~/anaconda3/envs/tapqir-env/lib/python3.8/subprocess.py:493, in run(input, capture_output, timeout, check, *popenargs, **kwargs)
    491     kwargs['stderr'] = PIPE
--> 493 with Popen(*popenargs, **kwargs) as process:
    494     try:

File ~/anaconda3/envs/tapqir-env/lib/python3.8/subprocess.py:858, in Popen.__init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text)
    855             self.stderr = io.TextIOWrapper(self.stderr,
    856                     encoding=encoding, errors=errors)
--> 858     self._execute_child(args, executable, preexec_fn, close_fds,
    859                         pass_fds, cwd, env,
    860                         startupinfo, creationflags, shell,
    861                         p2cread, p2cwrite,
    862                         c2pread, c2pwrite,
    863                         errread, errwrite,
    864                         restore_signals, start_new_session)
    865 except:
    866     # Cleanup if the child failed starting.

File ~/anaconda3/envs/tapqir-env/lib/python3.8/subprocess.py:1704, in Popen._execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session)
   1703         err_msg = os.strerror(errno_num)
-> 1704     raise child_exception_type(errno_num, err_msg, err_filename)
   1705 raise child_exception_type(err_msg)

FileNotFoundError: [Errno 2] No such file or directory: 'latex'

The above exception was the direct cause of the following exception:

RuntimeError                              Traceback (most recent call last)
File ~/anaconda3/envs/tapqir-env/lib/python3.8/site-packages/tapqir/gui.py:1292, in dtCmd(b, layout, out)
   1290 with out:
   1291     logger.info("Dwell-time analysis ...")
-> 1292     dwelltime(**layout.kwargs)
   1293     logger.info("Dwell-time analysis: Done")
   1294 out.clear_output(wait=True)

File ~/anaconda3/envs/tapqir-env/lib/python3.8/site-packages/tapqir/main.py:1169, in dwelltime(model, K)
   1166 ax.set_title(f"Bound dwell times channel {c}")
   1167 # ax.set_ylim(1e-4, 1e-1)
   1168 # plt.yscale("log")
-> 1169 plt.savefig(cd / f"bound_dwell_times{c}.png", dpi=600)
   1170 logger.info(
   1171     f"Saved bound dwell-time histograms for channel {c} in bound_dwell_times{c}.png file"
   1172 )
   1174 unbound_dt = unbound_dwell_times(intervals)

File ~/anaconda3/envs/tapqir-env/lib/python3.8/site-packages/matplotlib/pyplot.py:979, in savefig(*args, **kwargs)
    976 @_copy_docstring_and_deprecators(Figure.savefig)
    977 def savefig(*args, **kwargs):
    978     fig = gcf()
--> 979     res = fig.savefig(*args, **kwargs)
    980     fig.canvas.draw_idle()   # need this if 'transparent=True' to reset colors
    981     return res

File ~/anaconda3/envs/tapqir-env/lib/python3.8/site-packages/matplotlib/figure.py:3046, in Figure.savefig(self, fname, transparent, **kwargs)
   3042     for ax in self.axes:
   3043         stack.enter_context(
   3044             ax.patch._cm_set(facecolor='none', edgecolor='none'))
-> 3046 self.canvas.print_figure(fname, **kwargs)

File ~/anaconda3/envs/tapqir-env/lib/python3.8/site-packages/matplotlib/backend_bases.py:2319, in FigureCanvasBase.print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, bbox_inches, pad_inches, bbox_extra_artists, backend, **kwargs)
   2315 try:
   2316     # _get_renderer may change the figure dpi (as vector formats
   2317     # force the figure dpi to 72), so we need to set it again here.
   2318     with cbook._setattr_cm(self.figure, dpi=dpi):
-> 2319         result = print_method(
   2320             filename,
   2321             facecolor=facecolor,
   2322             edgecolor=edgecolor,
   2323             orientation=orientation,
   2324             bbox_inches_restore=_bbox_inches_restore,
   2325             **kwargs)
   2326 finally:
   2327     if bbox_inches and restore_bbox:

File ~/anaconda3/envs/tapqir-env/lib/python3.8/site-packages/matplotlib/backend_bases.py:1648, in _check_savefig_extra_args.<locals>.wrapper(*args, **kwargs)
   1640     _api.warn_deprecated(
   1641         '3.3', name=name, removal='3.6',
   1642         message='%(name)s() got unexpected keyword argument "'
   1643                 + arg + '" which is no longer supported as of '
   1644                 '%(since)s and will become an error '
   1645                 '%(removal)s')
   1646     kwargs.pop(arg)
-> 1648 return func(*args, **kwargs)

File ~/anaconda3/envs/tapqir-env/lib/python3.8/site-packages/matplotlib/_api/deprecation.py:415, in delete_parameter.<locals>.wrapper(*inner_args, **inner_kwargs)
    405     deprecation_addendum = (
    406         f"If any parameter follows {name!r}, they should be passed as "
    407         f"keyword, not positionally.")
    408     warn_deprecated(
    409         since,
    410         name=repr(name),
   (...)
    413                  else deprecation_addendum,
    414         **kwargs)
--> 415 return func(*inner_args, **inner_kwargs)

File ~/anaconda3/envs/tapqir-env/lib/python3.8/site-packages/matplotlib/backends/backend_agg.py:540, in FigureCanvasAgg.print_png(self, filename_or_obj, metadata, pil_kwargs, *args)
    490 @_check_savefig_extra_args
    491 @_api.delete_parameter("3.5", "args")
    492 def print_png(self, filename_or_obj, *args,
    493               metadata=None, pil_kwargs=None):
    494     """
    495     Write the figure to a PNG file.
    496 
   (...)
    538         *metadata*, including the default 'Software' key.
    539     """
--> 540     FigureCanvasAgg.draw(self)
    541     mpl.image.imsave(
    542         filename_or_obj, self.buffer_rgba(), format="png", origin="upper",
    543         dpi=self.figure.dpi, metadata=metadata, pil_kwargs=pil_kwargs)

File ~/anaconda3/envs/tapqir-env/lib/python3.8/site-packages/matplotlib/backends/backend_agg.py:436, in FigureCanvasAgg.draw(self)
    432 # Acquire a lock on the shared font cache.
    433 with RendererAgg.lock, \
    434      (self.toolbar._wait_cursor_for_draw_cm() if self.toolbar
    435       else nullcontext()):
--> 436     self.figure.draw(self.renderer)
    437     # A GUI class may be need to update a window using this draw, so
    438     # don't forget to call the superclass.
    439     super().draw()

File ~/anaconda3/envs/tapqir-env/lib/python3.8/site-packages/matplotlib/artist.py:73, in _finalize_rasterization.<locals>.draw_wrapper(artist, renderer, *args, **kwargs)
     71 @wraps(draw)
     72 def draw_wrapper(artist, renderer, *args, **kwargs):
---> 73     result = draw(artist, renderer, *args, **kwargs)
     74     if renderer._rasterizing:
     75         renderer.stop_rasterizing()

File ~/anaconda3/envs/tapqir-env/lib/python3.8/site-packages/matplotlib/artist.py:50, in allow_rasterization.<locals>.draw_wrapper(artist, renderer)
     47     if artist.get_agg_filter() is not None:
     48         renderer.start_filter()
---> 50     return draw(artist, renderer)
     51 finally:
     52     if artist.get_agg_filter() is not None:

File ~/anaconda3/envs/tapqir-env/lib/python3.8/site-packages/matplotlib/figure.py:2837, in Figure.draw(self, renderer)
   2834         # ValueError can occur when resizing a window.
   2836 self.patch.draw(renderer)
-> 2837 mimage._draw_list_compositing_images(
   2838     renderer, self, artists, self.suppressComposite)
   2840 for sfig in self.subfigs:
   2841     sfig.draw(renderer)

File ~/anaconda3/envs/tapqir-env/lib/python3.8/site-packages/matplotlib/image.py:132, in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
    130 if not_composite or not has_images:
    131     for a in artists:
--> 132         a.draw(renderer)
    133 else:
    134     # Composite any adjacent images together
    135     image_group = []

File ~/anaconda3/envs/tapqir-env/lib/python3.8/site-packages/matplotlib/artist.py:50, in allow_rasterization.<locals>.draw_wrapper(artist, renderer)
     47     if artist.get_agg_filter() is not None:
     48         renderer.start_filter()
---> 50     return draw(artist, renderer)
     51 finally:
     52     if artist.get_agg_filter() is not None:

File ~/anaconda3/envs/tapqir-env/lib/python3.8/site-packages/matplotlib/axes/_base.py:3055, in _AxesBase.draw(self, renderer)
   3052     for spine in self.spines.values():
   3053         artists.remove(spine)
-> 3055 self._update_title_position(renderer)
   3057 if not self.axison:
   3058     for _axis in self._get_axis_list():

File ~/anaconda3/envs/tapqir-env/lib/python3.8/site-packages/matplotlib/axes/_base.py:3005, in _AxesBase._update_title_position(self, renderer)
   3003     _log.debug('top of Axes not in the figure, so title not moved')
   3004     return
-> 3005 if title.get_window_extent(renderer).ymin < top:
   3006     _, y = self.transAxes.inverted().transform((0, top))
   3007     title.set_position((x, y))

File ~/anaconda3/envs/tapqir-env/lib/python3.8/site-packages/matplotlib/text.py:910, in Text.get_window_extent(self, renderer, dpi)
    907     raise RuntimeError('Cannot get window extent w/o renderer')
    909 with cbook._setattr_cm(self.figure, dpi=dpi):
--> 910     bbox, info, descent = self._get_layout(self._renderer)
    911     x, y = self.get_unitless_position()
    912     x, y = self.get_transform().transform((x, y))

File ~/anaconda3/envs/tapqir-env/lib/python3.8/site-packages/matplotlib/text.py:309, in Text._get_layout(self, renderer)
    306 ys = []
    308 # Full vertical extent of font, including ascenders and descenders:
--> 309 _, lp_h, lp_d = renderer.get_text_width_height_descent(
    310     "lp", self._fontproperties,
    311     ismath="TeX" if self.get_usetex() else False)
    312 min_dy = (lp_h - lp_d) * self._linespacing
    314 for i, line in enumerate(lines):

File ~/anaconda3/envs/tapqir-env/lib/python3.8/site-packages/matplotlib/backends/backend_agg.py:259, in RendererAgg.get_text_width_height_descent(self, s, prop, ismath)
    257     texmanager = self.get_texmanager()
    258     fontsize = prop.get_size_in_points()
--> 259     w, h, d = texmanager.get_text_width_height_descent(
    260         s, fontsize, renderer=self)
    261     return w, h, d
    263 if ismath:

File ~/anaconda3/envs/tapqir-env/lib/python3.8/site-packages/matplotlib/texmanager.py:335, in TexManager.get_text_width_height_descent(self, tex, fontsize, renderer)
    333 if tex.strip() == '':
    334     return 0, 0, 0
--> 335 dvifile = self.make_dvi(tex, fontsize)
    336 dpi_fraction = renderer.points_to_pixels(1.) if renderer else 1
    337 with dviread.Dvi(dvifile, 72 * dpi_fraction) as dvi:

File ~/anaconda3/envs/tapqir-env/lib/python3.8/site-packages/matplotlib/texmanager.py:271, in TexManager.make_dvi(self, tex, fontsize)
    262     # Generate the dvi in a temporary directory to avoid race
    263     # conditions e.g. if multiple processes try to process the same tex
    264     # string at the same time.  Having tmpdir be a subdirectory of the
   (...)
    268     # the absolute path may contain characters (e.g. ~) that TeX does
    269     # not support.)
    270     with TemporaryDirectory(dir=Path(dvifile).parent) as tmpdir:
--> 271         self._run_checked_subprocess(
    272             ["latex", "-interaction=nonstopmode", "--halt-on-error",
    273              f"../{texfile.name}"], tex, cwd=tmpdir)
    274         (Path(tmpdir) / Path(dvifile).name).replace(dvifile)
    275 return dvifile

File ~/anaconda3/envs/tapqir-env/lib/python3.8/site-packages/matplotlib/texmanager.py:237, in TexManager._run_checked_subprocess(self, command, tex, cwd)
    233     report = subprocess.check_output(
    234         command, cwd=cwd if cwd is not None else self.texcache,
    235         stderr=subprocess.STDOUT)
    236 except FileNotFoundError as exc:
--> 237     raise RuntimeError(
    238         'Failed to process string with tex because {} could not be '
    239         'found'.format(command[0])) from exc
    240 except subprocess.CalledProcessError as exc:
    241     raise RuntimeError(
    242         '{prog} was not able to process the following string:\n'
    243         '{tex!r}\n\n'
   (...)
    247             tex=tex.encode('unicode_escape'),
    248             exc=exc.output.decode('utf-8'))) from exc

RuntimeError: Failed to process string with tex because latex could not be found
ordabayevy commented 2 years ago

Which Tapqir version is this? This bug should have been fixed in versions 1.1.7 or later (PR #368 )

jc-brandeis commented 2 years ago

It runs on version 1.1.8. The errors were from v1.1.6.