Skip to content

Boss Download Cutout Tutorial

Tim Gion edited this page Jun 22, 2016 · 2 revisions

Downloading Cutout Data

Assuming data was uploaded as described in the [Boss Uploading Cutout Data](https://github.com/jhuapl-boss/ndio/wiki/Boss Upload Cutout Tutorial) tutorial, this tutorial shows how that data can be pulled down to a client.

from ndio.remote.boss.remote import Remote
from ndio.ndresource.boss.resource import *
import numpy

rmt = Remote()

COLL_NAME = 'JHUAPL'
EXP_NAME = 'Mouse17'
CHAN_NAME = 'EM2'

chan = ChannelResource(CHAN_NAME, COLL_NAME, EXP_NAME)

# Ranges use the Python convention where the number after the : is the stop
# value.  Thus, x_rng specifies x values where: 0 <= x < 8.
x_rng = '0:8'
y_rng = '0:4'
z_rng = '0:5'

# Download the cutout from the channel.
data = rmt.cutout_get(chan, 0, x_rng, y_rng, z_rng)

# Alter the range to get a subsection of the original data.
sub_x = '2:4'
sub_y = '2:4'
sub_z = '2:4'

sub_data = rmt.cutout_get(chan, 0, sub_x, sub_y, sub_z)