linked streams across dynamic maps
up vote
0
down vote
favorite
I have a set of hyperspectral data, a grid of X,Y,Energy where each point is a full spectrum. From those spectra I can create image stacks e.g. image stack 1= sum of counts from channel 600-650 across the grid, image stack 2 = 700-750 etc.
I would like to be able to display the image stacks and when a user clicks on a pixel or adjusts the kdim slider show the full spectrum at that X,Y, Energy point.
At the moment I can show a single image stack and update the spectrum on a click or when changing kdim using the proof of principle code example below.
That's already pretty good but if I increases the number of images (nimages variable in the code) and try and create multiple SingleTap streams I get an error due to the multiple clash on the ['x', 'y'] parameters. I looked at the link_inputs in the "responding to events" section but that operates on a clone and I've tried and failed to set it up across dynamic maps. Could someome provide an example or point me in the right direction on how to do this ?
import holoviews as hv
import numpy as np
hv.extension('bokeh')
def image_extract(energy=0):
# create a random image as a substitute for looking up the
# real data
return hv.Image(np.random.rand(10,10))
def extract_curve(x=0,y=0,energy=0):
# create a random curve as a substitute for looking up
# the real data
x=np.arange(1000)
return hv.Curve((x,np.random.rand(1000)),"Counts","channels")
# number of images
nimages = 1
dmap_list=
pointer_list=
for i in range(nimages):
img_dmap = hv.DynamicMap(image_extract, kdims=['energy']).redim.range(energy=(0,90))
pointer = hv.streams.SingleTap(x=0,y=0, source=img_dmap,subscribers=,transient=False)
pointer_list.append(pointer)
pointer_dmap = hv.DynamicMap(lambda x,y: hv.Points([(x, y)]), streams=[pointer])
img =img_dmap*pointer_dmap
dmap_list.append(img)
dmap_list.append(hv.DynamicMap(extract_curve,kdims=['energy'],streams=pointer_list).redim.range(energy=(0,90)))
layout = hv.Layout(tuple(dmap_list)).cols(2)
layout
holoviews
add a comment |
up vote
0
down vote
favorite
I have a set of hyperspectral data, a grid of X,Y,Energy where each point is a full spectrum. From those spectra I can create image stacks e.g. image stack 1= sum of counts from channel 600-650 across the grid, image stack 2 = 700-750 etc.
I would like to be able to display the image stacks and when a user clicks on a pixel or adjusts the kdim slider show the full spectrum at that X,Y, Energy point.
At the moment I can show a single image stack and update the spectrum on a click or when changing kdim using the proof of principle code example below.
That's already pretty good but if I increases the number of images (nimages variable in the code) and try and create multiple SingleTap streams I get an error due to the multiple clash on the ['x', 'y'] parameters. I looked at the link_inputs in the "responding to events" section but that operates on a clone and I've tried and failed to set it up across dynamic maps. Could someome provide an example or point me in the right direction on how to do this ?
import holoviews as hv
import numpy as np
hv.extension('bokeh')
def image_extract(energy=0):
# create a random image as a substitute for looking up the
# real data
return hv.Image(np.random.rand(10,10))
def extract_curve(x=0,y=0,energy=0):
# create a random curve as a substitute for looking up
# the real data
x=np.arange(1000)
return hv.Curve((x,np.random.rand(1000)),"Counts","channels")
# number of images
nimages = 1
dmap_list=
pointer_list=
for i in range(nimages):
img_dmap = hv.DynamicMap(image_extract, kdims=['energy']).redim.range(energy=(0,90))
pointer = hv.streams.SingleTap(x=0,y=0, source=img_dmap,subscribers=,transient=False)
pointer_list.append(pointer)
pointer_dmap = hv.DynamicMap(lambda x,y: hv.Points([(x, y)]), streams=[pointer])
img =img_dmap*pointer_dmap
dmap_list.append(img)
dmap_list.append(hv.DynamicMap(extract_curve,kdims=['energy'],streams=pointer_list).redim.range(energy=(0,90)))
layout = hv.Layout(tuple(dmap_list)).cols(2)
layout
holoviews
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a set of hyperspectral data, a grid of X,Y,Energy where each point is a full spectrum. From those spectra I can create image stacks e.g. image stack 1= sum of counts from channel 600-650 across the grid, image stack 2 = 700-750 etc.
I would like to be able to display the image stacks and when a user clicks on a pixel or adjusts the kdim slider show the full spectrum at that X,Y, Energy point.
At the moment I can show a single image stack and update the spectrum on a click or when changing kdim using the proof of principle code example below.
That's already pretty good but if I increases the number of images (nimages variable in the code) and try and create multiple SingleTap streams I get an error due to the multiple clash on the ['x', 'y'] parameters. I looked at the link_inputs in the "responding to events" section but that operates on a clone and I've tried and failed to set it up across dynamic maps. Could someome provide an example or point me in the right direction on how to do this ?
import holoviews as hv
import numpy as np
hv.extension('bokeh')
def image_extract(energy=0):
# create a random image as a substitute for looking up the
# real data
return hv.Image(np.random.rand(10,10))
def extract_curve(x=0,y=0,energy=0):
# create a random curve as a substitute for looking up
# the real data
x=np.arange(1000)
return hv.Curve((x,np.random.rand(1000)),"Counts","channels")
# number of images
nimages = 1
dmap_list=
pointer_list=
for i in range(nimages):
img_dmap = hv.DynamicMap(image_extract, kdims=['energy']).redim.range(energy=(0,90))
pointer = hv.streams.SingleTap(x=0,y=0, source=img_dmap,subscribers=,transient=False)
pointer_list.append(pointer)
pointer_dmap = hv.DynamicMap(lambda x,y: hv.Points([(x, y)]), streams=[pointer])
img =img_dmap*pointer_dmap
dmap_list.append(img)
dmap_list.append(hv.DynamicMap(extract_curve,kdims=['energy'],streams=pointer_list).redim.range(energy=(0,90)))
layout = hv.Layout(tuple(dmap_list)).cols(2)
layout
holoviews
I have a set of hyperspectral data, a grid of X,Y,Energy where each point is a full spectrum. From those spectra I can create image stacks e.g. image stack 1= sum of counts from channel 600-650 across the grid, image stack 2 = 700-750 etc.
I would like to be able to display the image stacks and when a user clicks on a pixel or adjusts the kdim slider show the full spectrum at that X,Y, Energy point.
At the moment I can show a single image stack and update the spectrum on a click or when changing kdim using the proof of principle code example below.
That's already pretty good but if I increases the number of images (nimages variable in the code) and try and create multiple SingleTap streams I get an error due to the multiple clash on the ['x', 'y'] parameters. I looked at the link_inputs in the "responding to events" section but that operates on a clone and I've tried and failed to set it up across dynamic maps. Could someome provide an example or point me in the right direction on how to do this ?
import holoviews as hv
import numpy as np
hv.extension('bokeh')
def image_extract(energy=0):
# create a random image as a substitute for looking up the
# real data
return hv.Image(np.random.rand(10,10))
def extract_curve(x=0,y=0,energy=0):
# create a random curve as a substitute for looking up
# the real data
x=np.arange(1000)
return hv.Curve((x,np.random.rand(1000)),"Counts","channels")
# number of images
nimages = 1
dmap_list=
pointer_list=
for i in range(nimages):
img_dmap = hv.DynamicMap(image_extract, kdims=['energy']).redim.range(energy=(0,90))
pointer = hv.streams.SingleTap(x=0,y=0, source=img_dmap,subscribers=,transient=False)
pointer_list.append(pointer)
pointer_dmap = hv.DynamicMap(lambda x,y: hv.Points([(x, y)]), streams=[pointer])
img =img_dmap*pointer_dmap
dmap_list.append(img)
dmap_list.append(hv.DynamicMap(extract_curve,kdims=['energy'],streams=pointer_list).redim.range(energy=(0,90)))
layout = hv.Layout(tuple(dmap_list)).cols(2)
layout
holoviews
holoviews
asked Nov 21 at 16:36
pdq
11
11
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
It uses hover rather than clicking, but it sounds like you want to do what's in http://datashader.org/topics/landsat.html :
tap = hv.streams.PointerXY(source=true_color)
spectrum_curve = hv.DynamicMap(spectrum, streams=[tap]).redim.range(Luminance=(0, 30000))
tiles * regrid(true_color) + spectrum_curve
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
It uses hover rather than clicking, but it sounds like you want to do what's in http://datashader.org/topics/landsat.html :
tap = hv.streams.PointerXY(source=true_color)
spectrum_curve = hv.DynamicMap(spectrum, streams=[tap]).redim.range(Luminance=(0, 30000))
tiles * regrid(true_color) + spectrum_curve
add a comment |
up vote
0
down vote
It uses hover rather than clicking, but it sounds like you want to do what's in http://datashader.org/topics/landsat.html :
tap = hv.streams.PointerXY(source=true_color)
spectrum_curve = hv.DynamicMap(spectrum, streams=[tap]).redim.range(Luminance=(0, 30000))
tiles * regrid(true_color) + spectrum_curve
add a comment |
up vote
0
down vote
up vote
0
down vote
It uses hover rather than clicking, but it sounds like you want to do what's in http://datashader.org/topics/landsat.html :
tap = hv.streams.PointerXY(source=true_color)
spectrum_curve = hv.DynamicMap(spectrum, streams=[tap]).redim.range(Luminance=(0, 30000))
tiles * regrid(true_color) + spectrum_curve
It uses hover rather than clicking, but it sounds like you want to do what's in http://datashader.org/topics/landsat.html :
tap = hv.streams.PointerXY(source=true_color)
spectrum_curve = hv.DynamicMap(spectrum, streams=[tap]).redim.range(Luminance=(0, 30000))
tiles * regrid(true_color) + spectrum_curve
answered Nov 29 at 6:54
James A. Bednar
62625
62625
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53416670%2flinked-streams-across-dynamic-maps%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown