Skip to main content

A small package for sending and receiving data to and from the CTAC VizLab.

Project description

vizlab-data-transfer

Run Python tests Coverage Status

This package enables easy transferring of data to and from the VizLab!

How to set up

To use this package, we need a proper connection to Carnegie's local network. You can do this in a couple ways:

  • By using a Carnegie-managed device connected to the CarnegieEmployees network
  • By logging in with your Carnegie VPN

You'll need to set the VizLab local IP and appropriate port number - look to internal Carnegie resources for these:

from vizlab_data_transfer import vizlab

# set network state
vizlab.set_ip(IP)
vizlab.set_port(PORT)

# get network state
print(vizlab.get_ip())
print(vizlab.get_port())

These values are stored internally by the package and persist between sessions, so set them once and you're good to go!

How to use

This package is designed to be as straightforward as possible. To send Python data to the system, use the vizlab.send() method:

from vizlab_data_transfer import vizlab

vizlab.send(data) # give a single dataset
vizlab.send([table, fig1, fig2]) # or a list of them...

You can also use optional arguments to send additional details about your data:

from vizlab_data_transfer import vizlab

vizlab.send([positions, lum], object_name = "stellarstream-results", data_names = ["xyz_pos", "luminosity"]) # provide additional data details

vizlab.send(radii, object_name = "stellarstream-results", data_names = "disk_radii") # give the same object name to append data to an existing object in the system

Currently we support a variety of Python objects:

  • numpy ndarrays and recarrays
  • astropy FITS Table and ImageHDU objects
  • matplotlib figures
  • pandas dataframes
  • Pillow images

Special notice must be taken for heteregeneous data sources (FITS tables, pandas dataframes, numpy recarrays) and specifying data names and units. You give a name for the table (the column names are already included in the data itself) and units for each column individually:

# recarray names/units example
vizlab.send(three_col_recarray, data_names=["table"], data_units = ["m", "s", "J"])

Feel free to leave an issue on this repository if there's a Python object you'd like support for!

Likewise, to receive data back from the system use vizlab.receive():

from vizlab_data_transfer import vizlab

# NOTE: VizLab must be in 'receive' state before this is run so server is ready to meet this request
data = vizlab.receive() 

Currently only numeric data of type np.float32 can be returned.

Please consult the examples folder for more detailed use-cases!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vizlab_data_transfer-0.2.2.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vizlab_data_transfer-0.2.2-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file vizlab_data_transfer-0.2.2.tar.gz.

File metadata

  • Download URL: vizlab_data_transfer-0.2.2.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for vizlab_data_transfer-0.2.2.tar.gz
Algorithm Hash digest
SHA256 3a9c47b3cf8ea41e8b752efaf0feadc8b8335f6869a3a8fe498379e7b16633ae
MD5 8c35ac232aaddcb69d680f5d380197f9
BLAKE2b-256 f8e4a6daf462979bd8379bbc50d162312e146b816f569de28170a725a8d90a24

See more details on using hashes here.

Provenance

The following attestation bundles were made for vizlab_data_transfer-0.2.2.tar.gz:

Publisher: publish-package.yaml on carnegie/vizlab-data-transfer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vizlab_data_transfer-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for vizlab_data_transfer-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 49b44a3d15c1f461486d6df59c5f37ee3a74f9556f0c059285229350384f6784
MD5 9f66d3e8b93c5a3f2417603cd93d66d9
BLAKE2b-256 4ef2dc60fb65353324f29c96beb9f8c66f4451cc592b425c1bc84090adb40431

See more details on using hashes here.

Provenance

The following attestation bundles were made for vizlab_data_transfer-0.2.2-py3-none-any.whl:

Publisher: publish-package.yaml on carnegie/vizlab-data-transfer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page