I’m trying to use Reactive to cyclically fetch data from an outer source. I 
want to have the value of some Signal update from this outer source, and 
once it’s updated, I want it to go and update itself again, and so on. Here 
are the details:

I connect to a spectrometer with Andreas Poehlmann’s python module 
<https://github.com/ap--/python-seabreeze>:

using PyCall, Reactive
@pyimport seabreeze
seabreeze.use("pyseabreeze")
@pyimport seabreeze.spectrometers as sb
devices = sb.list_devices()
S = sb.Spectrometer(devices[1])

I then can retrieve intensities, Vector{Float64}, from that spectrometer (S) 
with S[:intensities]().
So the idea is that there will be some variable that will continuously be 
updated from the spectrometer. I can’t pull intensities from the 
spectrometer while it’s sending the previous intensities (so I can’t call 
S[:intensities]() before S[:intensities]() is done). The time it takes for 
S[:intensities]() to finish depends on (among other things) the 
spectrometer’s integration time (kind of like exposure time for a camera). 

I can’t stick it all in a while loop because I want to interact with Julia 
after starting this cyclic update.
I’m running into errors when I try to @spawn it on another worker (maybe 
because S is some PyCall pointer?).

So I thought something like this might work:

s = Input(1)

sample = lift(_ -> S[:intensities](), s)
again = lift(_ -> push!(s, -value(s)), sample)
push!(s, -value(s))

But this doesn’t work. 

Anyone has some cool suggestions on how to set it up…?
​

Reply via email to