Skip to content

Instantly share code, notes, and snippets.

@thomasaarholt
Created September 23, 2018 06:11
Show Gist options
  • Save thomasaarholt/9ce38698ef6cc47ae3899f63adff7506 to your computer and use it in GitHub Desktop.
Save thomasaarholt/9ce38698ef6cc47ae3899f63adff7506 to your computer and use it in GitHub Desktop.
Error message after pulling hyperspy upstream into @ZanettaPM's background branch
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-4-825396d5c1d6> in <module>()
----> 1 m.plot()
c:\users\me\documents\github\hyperspy\hyperspy\models\model1d.py in plot(self, plot_components, **kwargs)
668 # Add the line to the figure
669 _plot.signal_plot.add_line(l2)
--> 670 l2.plot()
671 _plot.signal_plot.events.closed.connect(self._close_plot, [])
672
c:\users\me\documents\github\hyperspy\hyperspy\drawing\signal1d.py in plot(self, data, data_function_kwargs, norm)
308 self.data_function_kwargs = data_function_kwargs
309 self.norm = norm
--> 310 data = self._get_data()
311 if self.line is not None:
312 self.line.remove()
c:\users\me\documents\github\hyperspy\hyperspy\drawing\signal1d.py in _get_data(self, real_part)
345 else:
346 ydata = self.data_function(axes_manager=self.axes_manager,
--> 347 **self.data_function_kwargs).real
348 return ydata
349
c:\users\me\documents\github\hyperspy\hyperspy\models\model1d.py in _model2plot(self, axes_manager, out_of_range2nans)
631 self.axes_manager = axes_manager
632 self.fetch_stored_values()
--> 633 s = self.__call__(non_convolved=False, onlyactive=True)
634 if old_axes_manager is not None:
635 self.axes_manager = old_axes_manager
c:\users\me\documents\github\hyperspy\hyperspy\models\model1d.py in __call__(self, non_convolved, onlyactive, component_list)
408 sum_ = np.zeros(len(axis))
409 for component in component_list:
--> 410 sum_ += component.function(axis)
411 to_return = sum_
412
c:\users\me\documents\github\hyperspy\hyperspy\_components\physical_background.py in function(self, x)
279 Cthickness=self.coating_thickness.value
280
--> 281 Mu=Mucoef(self.model,self.quanti.value)
282 Mu=np.array(Mu,dtype=float)
283 #Mu=Mu[self.model.channel_switches]
c:\users\me\documents\github\hyperspy\hyperspy\_components\physical_background.py in Mucoef(model, quanti)
145 t=t[model.channel_switches]
146 u=t[0::5]
--> 147 Ac=mass_absorption_mixture(elements=model._signal.metadata.Sample.elements ,weight_percent=weight, energies=u)
148 b=t
149 Ac=np.interp(b,u,Ac) # Interpolation allows to gain some time
c:\users\me\documents\github\hyperspy\hyperspy\misc\material.py in _mass_absorption_mixture(weight_percent, elements, energies)
354 Scattering Tables (version 2.1).
355 """
--> 356 if len(elements) != len(weight_percent):
357 raise ValueError(
358 "Elements and weight_fraction should have the same length")
TypeError: object of type 'float' has no len()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment