I'm using PyCall to retrieve a vector of floats from an external
spectrometer (a gizmo that measures light intensities per wavelength). I
have it all set up in scheduled tasks with channels as the containers for
the intensities and the python module I'm using is from [Andreas
Poehlmann](https://github.com/ap--/python-seabreeze) (see below for code).
One important piece of information is the integration time (similar to the
shutter speed in a camera): after I set the integration time the
spectrometer start sampling the spectra at that frequency. When I try to
retrieve the intensities it will spit them out only when one cycle ends.
This means that when I try to run the function that retrieves the
intensities it can take anything from 0 to integration-time seconds.
Here's the weird thing:
When I run my code the REPL becomes non-responsive for integration-time
seconds, so if I try to type some text, the letters get typed in only one
letter at an integration-time (note that CPU usage is less than 3%)... But,
if I replace the function that retrieves the intensities with some mock
function that `sleep`s for a random amount of time and returns a (equally
long) vector of random floats, the REPL jitter is gone..!
I've stipped down my code to the following but the above described behavior
is still happening:
```Julia
using PyCall
@pyimport seabreeze
seabreeze.use("pyseabreeze")
@pyimport seabreeze.spectrometers as sb
devices = sb.list_devices()
S = sb.Spectrometer(devices[1])
S[:integration_time_micros](300000)
c0 = Channel{Array{Float64,1}}(1)
function fetchI()
while true
y = S[:intensities]()
put!(c0,y)
end
end
function plotit()
while true
take!(c0)
end
end
@schedule fetchI()
@schedule plotit()
```
and if I replace the 11th line (`y = S[:intensities]()` in `fetchI()`) with
`y = mockfunction()`, where:
```julia
function mockfunction()
sleep(rand()*IT*1e-6)
return rand(2048)
end
```
then the REPL becomes responsive again.
Other than understanding what is going on here, I'd love to know how to get
my snappy REPL back...