Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ds.compute_noise(n_lags=100000) fails #257

Open
joefowler opened this issue Oct 17, 2023 · 2 comments
Open

ds.compute_noise(n_lags=100000) fails #257

joefowler opened this issue Oct 17, 2023 · 2 comments
Labels
bug Something isn't working major
Milestone

Comments

@joefowler
Copy link
Member

Original report by Galen O'Neil (Bitbucket: oneilg, GitHub: oneilg).


ds.compute_noise(n_lags=100000) fails

I’m guessing it hasn’t been used to tested for a long time. We want to plot noise spectra from true bq pixels which have short records written but have very low f componenets.

with the below message

File ~/analysis/may-2023-am241/3_explore_and_make_off.py:57
     55 ds.summarize_data(use_cython=True)
     56 for ds in data:
---> 57     ds.compute_noise(n_lags=100000)
     58     ds.plot_noise()
     59 data.avg_pulses_auto_masks()

File ~/qsp/src/mass/mass/core/channel.py:1614, in MicrocalDataSet.compute_noise(self, max_excursion, n_lags, forceNew)
   1612     n_lags = self.noise_records.nSamples
   1613 if forceNew or all(self.noise_autocorr[:] == 0):
-> 1614     self.noise_records.compute_power_spectrum_reshape(
   1615         max_excursion=max_excursion, seg_length=n_lags)
   1616     self.noise_records.compute_autocorrelation(
   1617         n_lags=n_lags, plot=False, max_excursion=max_excursion)
   1619     self.noise_autocorr[:] = self.noise_records.autocorrelation[:len(
   1620         self.noise_autocorr[:])]

File ~/qsp/src/mass/mass/core/channel.py:201, in NoiseRecords.compute_power_spectrum_reshape(self, window, seg_length, max_excursion)
    199 psd = spectrum.spectrum()
    200 if self.hdf5_group is not None:
--> 201     self.noise_psd[:] = psd
    202     self.noise_psd.attrs["delta_f"] = freq[1] - freq[0]
    203 else:

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

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

File ~/qsp/lib/python3.8/site-packages/h5py/_hl/dataset.py:997, in Dataset.__setitem__(self, args, val)
    994     mshape = val.shape
    996 # Perform the write, with broadcasting
--> 997 mspace = h5s.create_simple(selection.expand_shape(mshape))
    998 for fspace in selection.broadcast(mshape):
    999     self.id.write(mspace, fspace, val, mtype, dxpl=self._dxpl)

File ~/qsp/lib/python3.8/site-packages/h5py/_hl/selections.py:264, in SimpleSelection.expand_shape(self, source_shape)
    262             eshape.append(t)
    263         else:
--> 264             raise TypeError("Can't broadcast %s -> %s" % (source_shape, self.array_shape))  # array shape
    266 if any([n > 1 for n in remaining_src_dims]):
    267     # All dimensions from target_shape should either have been popped
    268     # to match the selection shape, or be 1.
    269     raise TypeError("Can't broadcast %s -> %s" % (source_shape, self.array_shape))  # array shape

TypeError: Can't broadcast (50001,) -> (401,)

@joefowler
Copy link
Member Author

Original comment by Galen O'Neil (Bitbucket: oneilg, GitHub: oneilg).


This part assumes n_lags==nSamples which is not consistent with taking n_lags as an argument.

https://bitbucket.org/joe_fowler/mass/src/b69e77f828b4dbc7340337e967a2892496aff740/mass/core/channel.py#lines-97

@joefowler
Copy link
Member Author

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


You said this is being fixed in some branch. Is that complete?

I want to tag a new release 0.8.1, but first we should wrap up any issues that are easy to close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working major
Projects
None yet
Development

No branches or pull requests

1 participant