geoscixyz / geosci-labs

collection of notebook-apps for concepts in applied geophysics
https://geosci.xyz
MIT License
50 stars 35 forks source link

DC_Layer_Cylinder_2_5D #70

Open lheagy opened 11 months ago

lheagy commented 11 months ago

There seems to be something we are sensitive to with the location of the M, N electrodes in the 2.5D app

Using the setup in this image image

I get the following error

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
File ~/opt/miniconda3/envs/geosci/lib/python3.10/site-packages/ipywidgets/widgets/interaction.py:239, in interactive.update(self, *args)
    237     value = widget.get_interact_value()
    238     self.kwargs[widget._kwarg] = value
--> 239 self.result = self.f(**self.kwargs)
    240 show_inline_matplotlib_plots()
    241 if self.auto_display and self.result is not None:

File ~/git/geosci/geosci-labs/geoscilabs/dcip/DCWidgetResLayer2_5D.py:474, in PLOT(survey, A, B, M, N, zcLayer, dzLayer, xc, zc, r, rhohalf, rholayer, rhoTarget, Field, Type, Scale)
    471     ax[0].annotate("%2.1e" % (VM), xy=xytextM, xytext=xytextM, fontsize=labelsize)
    473 else:
--> 474     ax[0].plot(M, VM, "o", color="k")
    475     ax[0].plot(N, VN, "o", color="k")
    477     xytextM = (M + 0.5, max(min(VM, ylim.max()), ylim.min()) + 10)

File ~/opt/miniconda3/envs/geosci/lib/python3.10/site-packages/matplotlib/axes/_axes.py:1605, in Axes.plot(self, scalex, scaley, data, *args, **kwargs)
   1363 """
   1364 Plot y versus x as lines and/or markers.
   1365 
   (...)
   1602 (``'green'``) or hex strings (``'#008000'``).
   1603 """
   1604 kwargs = cbook.normalize_kwargs(kwargs, mlines.Line2D)
-> 1605 lines = [*self._get_lines(*args, data=data, **kwargs)]
   1606 for line in lines:
   1607     self.add_line(line)

File ~/opt/miniconda3/envs/geosci/lib/python3.10/site-packages/matplotlib/axes/_base.py:315, in _process_plot_var_args.__call__(self, data, *args, **kwargs)
    313     this += args[0],
    314     args = args[1:]
--> 315 yield from self._plot_args(this, kwargs)

File ~/opt/miniconda3/envs/geosci/lib/python3.10/site-packages/matplotlib/axes/_base.py:501, in _process_plot_var_args._plot_args(self, tup, kwargs, return_kwargs)
    498     self.axes.yaxis.update_units(y)
    500 if x.shape[0] != y.shape[0]:
--> 501     raise ValueError(f"x and y must have same first dimension, but "
    502                      f"have shapes {x.shape} and {y.shape}")
    503 if x.ndim > 2 or y.ndim > 2:
    504     raise ValueError(f"x and y can be no greater than 2D, but have "
    505                      f"shapes {x.shape} and {y.shape}")

ValueError: x and y must have same first dimension, but have shapes (1,) and (0, 1)