usnistgov / mass

Microcalorimeter pulse-analysis software
MIT License
6 stars 0 forks source link

Cannot use `TESGroup.plot_noise_autocorrelation()` #221

Closed joefowler closed 2 years ago

joefowler commented 2 years ago

Original report by Joseph Fowler (Bitbucket: joe_fowler, ).


In [508]: data.plot_noise_autocorrelation()
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Input In [508], in <cell line: 1>()
----> 1 data.plot_noise_autocorrelation()

File ~/Software/mass/mass/core/channel_group.py:1097, in TESGroup.plot_noise_autocorrelation(self, axis, channels, cmap, legend)
   1095     ds = self.channel[channum]
   1096     noise = ds.noise_records
-> 1097     noise.plot_autocorrelation(axis=axis, label='Chan %d' % channum,
   1098                                color=cmap(float(ds_num) / len(channels)))
   1099 plt.xlabel("Time lag (ms)")
   1100 if legend:

File ~/Software/mass/mass/core/channel.py:448, in NoiseRecords.plot_autocorrelation(self, axis, color, label)
    446     axis = plt.subplot(111)
    447 t = self.timebase * 1e3 * np.arange(len(self.autocorrelation))
--> 448 axis.plot(t, self.autocorrelation, label=label, color=color)
    449 axis.plot([0], [self.autocorrelation[0]], 'o', color=color)
    450 axis.set_xlabel("Lag (ms)")

File /opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/matplotlib/axes/_axes.py:1632, in Axes.plot(self, scalex, scaley, data, *args, **kwargs)
   1390 """
   1391 Plot y versus x as lines and/or markers.
   1392 
   (...)
   1629 (``'green'``) or hex strings (``'#008000'``).
   1630 """
   1631 kwargs = cbook.normalize_kwargs(kwargs, mlines.Line2D)
-> 1632 lines = [*self._get_lines(*args, data=data, **kwargs)]
   1633 for line in lines:
   1634     self.add_line(line)

File /opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/matplotlib/axes/_base.py:312, in _process_plot_var_args.__call__(self, data, *args, **kwargs)
    310     this += args[0],
    311     args = args[1:]
--> 312 yield from self._plot_args(this, kwargs)

File /opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/matplotlib/axes/_base.py:506, in _process_plot_var_args._plot_args(self, tup, kwargs, return_kwargs)
    504     x = x[:, np.newaxis]
    505 if y.ndim == 1:
--> 506     y = y[:, np.newaxis]
    508 if self.command == 'plot':
    509     make_artist = self._makeline

File h5py/_objects.pyx:54, in h5py._objects.with_phil.wrapper()

File h5py/_objects.pyx:55, in h5py._objects.with_phil.wrapper()

File /opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/h5py/_hl/dataset.py:710, in Dataset.__getitem__(self, args, new_dtype)
    708 if self._fast_read_ok and (new_dtype is None):
    709     try:
--> 710         return self._fast_reader.read(args)
    711     except TypeError:
    712         pass  # Fall back to Python read pathway below

File h5py/_selector.pyx:351, in h5py._selector.Reader.read()

File h5py/_selector.pyx:107, in h5py._selector.Selector.apply_args()

ValueError: 2 indexing arguments for 1 dimensions

joefowler commented 2 years ago

Original comment by Joseph Fowler (Bitbucket: joe_fowler, ).


Fix autocorrelation plot bug

Fixes #221.

joefowler commented 1 year ago

Original comment by Joseph Fowler (Bitbucket: joe_fowler, ).


Removing milestone: v0.7 (automated comment)