Skip to content

Can't store intensities array in a variable [Value Error: could not broadcast input array from shape (64,) into shape (4097,)] #293

Description

@IsaacMcMillan

I managed to get a USB 650 to generate wavelengths and intensities, but only if I use a print statement.
when I try to store the intensities it gives me this error:

Value Error: could not broadcast input array from shape (64,) into shape (4097,)

This is what I used for my example code, the first part was grabbed from issue #47 as it seems to actually work:

import usb.core
import seabreeze
if usb.core.find(idVendor=0x2457, idProduct=0x1014):
    # If we find a connected USB650
    seabreeze.use("pyseabreeze")
else:
    seabreeze.use("cseabreeze")

import seabreeze.spectrometers as sb

spec = sb.Spectrometer.from_first_available()

spec.integration_time_micros(10000)

intensities = spec.intensities()
wavelengths = spec.wavelengths()

spec.close()

If I just use:

print(spec.wavelengths())
print(spec.intensities())

I don't get the above mentioned error and it prints the intensities. I can get it to print the whole array if I convert it to a list in the print statement. It doesn't have a problem assigning the wavelengths to a variable, but it does the intensities.

any attempt to grab the intensities outside a print statement gives me an error. Sometimes it does store them in a variable, but it still errors out.

For some context, I have a motorized microscope, and I want to grab the intensities of each wavelength every few millimeters, so that I can make a topographical map of the intensity of a certain wavelength over the surface of a microscope slide.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions